Skip to content

Commit

Permalink
tweak how to check this residual to work when P = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Jan 3, 2025
1 parent 6dc8cae commit bc5f10e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/eos_unit_test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ CheckRhoSieFromPT(EOS eos, Real rho, Real T,
Real bmod = eos.BulkModulusFromDensityTemperature(rho, T, lambda);
Real P_test = eos.PressureFromDensityTemperature(rtest, T, lambda);
Real residual = P_test - P;
Real frac_residual = singularity::robust::ratio(residual, P);
Real frac_residual = std::min(singularity::robust::ratio(residual, P), residual);
bool results_good = (isClose(rho, rtest, 1e-8) && isClose(sie, etest, 1e-8))
// This is as good as it will get sometimes.
|| (std::abs(frac_residual) < 10 * singularity::robust::EPS());
Expand All @@ -169,7 +169,7 @@ CheckRhoSieFromPT(EOS eos, Real rho, Real T,
"\tsie = %.14e\n"
"\tP_test = %.14e\n"
"\tresidual = %.14e\n"
"\fracres = %.14e\n",
"\tfracres = %.14e\n",
rho, sie, P, T, rtest, etest, P_test, residual, frac_residual);
}
return results_good;
Expand Down

0 comments on commit bc5f10e

Please sign in to comment.