From ee5e3748a25cfae2774e6b15a8e081134aace77d Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Fri, 3 Jan 2025 14:43:08 -0700 Subject: [PATCH] also add sanity check for rhomax vs rhomin --- singularity-eos/eos/eos_base.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/singularity-eos/eos/eos_base.hpp b/singularity-eos/eos/eos_base.hpp index 64cd955eb2..950a5d1e63 100644 --- a/singularity-eos/eos/eos_base.hpp +++ b/singularity-eos/eos/eos_base.hpp @@ -863,9 +863,12 @@ class EosBase { constexpr Real DEFAULT_RHO_GUESS = 12; CRTP copy = *(static_cast(this)); + // P(rho) not monotone. When relevant, bound rhopmin. Real rhomin = std::max(copy.RhoPmin(temp), copy.MinimumDensity()); Real rhomax = copy.MaximumDensity(); + PORTABLE_REQUIRE(rhomax > rhomin, "max bound > min bound"); + auto PofRT = [&](const Real r) { return copy.PressureFromDensityTemperature(r, temp, lambda); };