Skip to content

Commit

Permalink
add some asserts to the compressible solver (#312)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zingale authored Jan 9, 2025
1 parent 1289879 commit c1b0584
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyro/compressible/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c1b0584

Please sign in to comment.