From cf8f51322ad9eeeeb2069a8ddbb8dcd4ea0c1be5 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Thu, 9 Jan 2025 13:02:57 -0500 Subject: [PATCH] add some asserts to the compressible solver this catches negative density and internal energy if these become a problem, then the solution is to do a dual energy formulation or to introduce some floors. --- pyro/compressible/simulation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyro/compressible/simulation.py b/pyro/compressible/simulation.py index af152d319..993f10b8f 100644 --- a/pyro/compressible/simulation.py +++ b/pyro/compressible/simulation.py @@ -65,6 +65,9 @@ def cons_to_prim(U, gamma, ivars, myg): out=np.zeros_like(U[:, :, ivars.iener]), where=(U[:, :, ivars.idens] != 0.0)) + assert e.v().min() > 0.0 + assert q.v(n=ivars.irho).min() > 0.0 + q[:, :, ivars.ip] = eos.pres(gamma, q[:, :, ivars.irho], e) if ivars.naux > 0: