From bc5f10eac206973cb4d53576f0d6dd690a9d9ba8 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Fri, 3 Jan 2025 12:35:15 -0700 Subject: [PATCH] tweak how to check this residual to work when P = 0 --- test/eos_unit_test_helpers.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/eos_unit_test_helpers.hpp b/test/eos_unit_test_helpers.hpp index de89e950e5..887c7cab8f 100644 --- a/test/eos_unit_test_helpers.hpp +++ b/test/eos_unit_test_helpers.hpp @@ -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()); @@ -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;