Skip to content

Commit

Permalink
Add debug NaNs to MinmodTci
Browse files Browse the repository at this point in the history
  • Loading branch information
fmahebert authored and prayush committed May 15, 2019
1 parent 7bbda7d commit 2fbdea5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Evolution/DiscontinuousGalerkin/SlopeLimiters/MinmodTci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <algorithm>
#include <array>
#include <cmath>
#include <limits>
#include <utility>

#include "DataStructures/DataVector.hpp" // IWYU pragma: keep
Expand All @@ -18,6 +19,7 @@
#include "Utilities/ConstantExpressions.hpp"
#include "Utilities/GenerateInstantiations.hpp"
#include "Utilities/Gsl.hpp"
#include "Utilities/MakeArray.hpp"

namespace SlopeLimiters {
namespace Minmod_detail {
Expand Down Expand Up @@ -146,6 +148,11 @@ bool troubled_cell_indicator(

if (not u_needs_limiting) {
// Skip the limiting step for this tensor component
#ifdef SPECTRE_DEBUG
*u_mean = std::numeric_limits<double>::signaling_NaN();
*u_limited_slopes =
make_array<VolumeDim>(std::numeric_limits<double>::signaling_NaN());
#endif // ifdef SPECTRE_DEBUG
return false;
}
} // end if LambdaPiN
Expand Down Expand Up @@ -185,6 +192,17 @@ bool troubled_cell_indicator(
}
}

#ifdef SPECTRE_DEBUG
// Guard against incorrect use of returned (by reference) slopes in a
// LambdaPiN limiter, by setting these to NaN when they should not be used.
if (minmod_type == SlopeLimiters::MinmodType::LambdaPiN and
not slopes_need_reducing) {
*u_mean = std::numeric_limits<double>::signaling_NaN();
*u_limited_slopes =
make_array<VolumeDim>(std::numeric_limits<double>::signaling_NaN());
}
#endif // ifdef SPECTRE_DEBUG

return slopes_need_reducing;
}

Expand Down

0 comments on commit 2fbdea5

Please sign in to comment.