Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions singularity-eos/eos/eos_gruneisen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,12 @@ Gruneisen::MaxStableDensityAtTemperature(const Real temperature) const {
if (slope_at_ref_density < 0) {
// Something is very wrong in the construction of this EOS... just error out
using PortsOfCall::printf;
#ifndef NDEBUG
printf("ERROR: The pressure is decreasing as density increases at the reference\n"
" density, %.15g, for temperature, %.15g. Check that the reference\n"
" temperature is set correctly. This is an unstable state.",
_rho0, temperature);
#endif // NDEBUG
PORTABLE_ALWAYS_THROW_OR_ABORT("Input pressure is off EOS surface");
}

Expand Down Expand Up @@ -498,11 +500,13 @@ PORTABLE_INLINE_FUNCTION void Gruneisen::DensityEnergyFromPressureTemperature(
auto pres_max = PressureFromDensityTemperature(rho_upper, temp);
if (press > pres_max) {
// We're off the EOS surface
#ifndef NDEBUG
using PortsOfCall::printf;
printf("ERROR: Requested pressure, %.15g, exceeds maximum, %.15g, for \n"
" temperature, %.15g.\n"
" setting pressure to maximum allowed value.\n",
press, pres_max, temp);
#endif // NDEBUG
p_used = pres_max;
}
// Construct a reasonable guess for the density
Expand Down
6 changes: 6 additions & 0 deletions singularity-eos/eos/eos_helmholtz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,11 @@ PORTABLE_INLINE_FUNCTION Real Helmholtz::lTFromRhoSie_(const Real rho, const Rea
math_utils::pow10(electrons_.lTMax()), HELM_EOS_EPS, T, nullptr,
options_.VERBOSE, false);
if (status != RootFinding1D::Status::SUCCESS) {
#ifndef NDEBUG
if (options_.VERBOSE) {
printf("Newton-Raphson failed to converge, falling back to regula falsi\n");
}
#endif // NDEBUG
status = RootFinding1D::regula_falsi(
[&](Real T) {
Real p[NDERIV], e[NDERIV], s[NDERIV], etaele[NDERIV], nep[NDERIV];
Expand Down Expand Up @@ -944,15 +946,19 @@ PORTABLE_INLINE_FUNCTION Real Helmholtz::lTFromRhoSie_(const Real rho, const Rea
lT = std::log10(T);
// Make sure the result is within the table bounds
if (lT < electrons_.lTMin()) {
#ifndef NDEBUG
if (options_.VERBOSE) {
printf("Temperature below table limit, setting lT = lTMin. (lT = %f)\n", lT);
}
#endif // NDEBUG
lT = electrons_.lTMin();
}
if (lT > electrons_.lTMax()) {
#ifndef NDEBUG
if (options_.VERBOSE) {
printf("Temperature above table limit, setting lT = lTMax. (lT = %f)\n", lT);
}
#endif // NDEBUG
lT = electrons_.lTMax();
}
IndexerUtils::SafeGet<IndexableTypes::LogTemperature>(lambda, Lambda::lT, lT);
Expand Down
3 changes: 2 additions & 1 deletion singularity-eos/eos/eos_mgusup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ PORTABLE_INLINE_FUNCTION Real MGUsup::HugTemperatureFromDensity(Real rho) const
Real eta = 1.0 - robust::ratio(_rho0, rho);
Real f1 = 1.0 - _s * eta;
if (f1 <= 0.0) {
#ifndef NDEBUG
printf("f1, eta, rho, rho0, s = %.14e %.14e %.14e %.14e %.14e\n", f1, eta, rho, _rho0,
_s);
#endif // NDEBUG
PORTABLE_ALWAYS_THROW_OR_ABORT("MGUsup model parameters s and rho0 together with rho "
"give a negative argument for a logarithm.");
}
Expand Down Expand Up @@ -241,7 +243,6 @@ PORTABLE_INLINE_FUNCTION Real MGUsup::HugTemperatureFromDensity(Real rho) const
PORTABLE_WARN("Hugoniot Temperature not converged");
#endif // NDEBUG
}
// printf("sum=%e\n",sum);
temp = _T0 - pf * ((G0os - 3.0) + exp(-G0os) * (G0os * G0os - 4.0 * G0os + 2.0) *
(std::log(f1) + sum));
temp = temp * exp(_G0 * eta);
Expand Down
2 changes: 2 additions & 0 deletions singularity-eos/eos/get_sg_eos_functors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ struct init_functor {
any_bad_vals = any_bad_vals || error_utils::bad_value(spvol_v(i), "spvol");

if (any_bad_vals) {
#ifndef NDEBUG
using PortsOfCall::printf;
printf("### Bad Value Output state:\n");
printf(" ~~Bulk state~~\n");
Expand All @@ -148,6 +149,7 @@ struct init_functor {
printf(" %24.15g", frac_mass_v(i, m));
printf("\n");
}
#endif // NDEBUG
PORTABLE_ALWAYS_ABORT(
"Bad values INPUT to singularity-eos interface. See output for details");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ PORTABLE_INLINE_FUNCTION bool set_bracket(const T &f, Real &a, const Real guess,
}
}
// if we get here then we failed to bracket a root
#ifndef NDEBUG
if (verbose) {
printf("set_bracket failed to bound a root! %.14e %.14e %.14e %.14e %.14e %.14e\n", a,
guess, b, ya, yg, yb);
}
#endif // NDEBUG
return false;
}

Expand Down Expand Up @@ -175,9 +177,11 @@ PORTABLE_INLINE_FUNCTION Status regula_falsi(const T &f, const Real ytarget,
} else {
// ya, yg, and yb have the same sign
if (!set_bracket(func, a, guess, b, ya, yg, yb, verbose)) {
#ifndef NDEBUG
if (verbose) {
printf("regula_falsi failed! %.14e %.14e %.14e %.14e\n", ytarget, guess, a, b);
}
#endif // NDEBUG
return Status::FAIL;
}
}
Expand Down Expand Up @@ -222,10 +226,12 @@ PORTABLE_INLINE_FUNCTION Status regula_falsi(const T &f, const Real ytarget,
}
auto status = Status::SUCCESS;
if (iteration_count == max_iter) {
#ifndef NDEBUG
if (verbose) {
printf("root finding reached the maximum number of iterations. likely not "
"converged\n");
}
#endif // NDEBUG
status = Status::FAIL;
}
if (counts != nullptr) {
Expand Down Expand Up @@ -279,10 +285,12 @@ PORTABLE_INLINE_FUNCTION Status newton_raphson(const T &f, const Real ytarget,
// Per default, we fail if the root is out of bounds controlled by
// fail_on_bound_root.
if ((_x <= a && _xold <= a) || (_x >= b && _xold >= b)) {
#ifndef NDEBUG
if (verbose) {
printf("newton_raphson out of bounds! %.14e %.14e %.14e %.14e\n", ytarget, guess,
a, b);
}
#endif // NDEBUG
if (fail_on_bound_root) {
status = Status::FAIL;
}
Expand All @@ -291,10 +299,12 @@ PORTABLE_INLINE_FUNCTION Status newton_raphson(const T &f, const Real ytarget,
_x = std::max(std::min(_x, b), a);
}
if (iter >= max_iter) {
#ifndef NDEBUG
if (verbose) {
printf("root finding reached the maximum number of iterations. likely not "
"converged\n");
}
Comment on lines 303 to 306

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ones without arguments are maybe fine?

#endif // NDEBUG
status = Status::FAIL;
}

Expand Down
Loading