Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyro/compressible/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ grav = 0.0 ; gravitational acceleration (in y-direction)

riemann = HLLC ; HLLC or CGF

small_dens = -1.e200 ; minimum allowed density
small_eint = -1.e200 ; minimum allowed specific internal energy

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
8 changes: 8 additions & 0 deletions pyro/compressible/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ def evolve(self):
timestep dt.
"""

self.clean_state(self.cc_data.data)

tm_evolve = self.tc.timer("evolve")
tm_evolve.begin()

Expand Down Expand Up @@ -437,6 +439,12 @@ def evolve(self):

tm_evolve.end()

def clean_state(self, U):
"""enforce minimum density and eint on the conserved state U"""

U.v(n=self.ivars.idens)[:, :] = np.maximum(U.v(n=self.ivars.idens),
self.rp.get_param("compressible.small_dens"))

def dovis(self):
"""
Do runtime visualization.
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_fv4/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ grav = 0.0 ; gravitational acceleration (in y-direction)

riemann = CGF

small_dens = -1.e200 ; minimum allowed density

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible_fv4/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def substep(self, myd):
compute the advective source term for the given state
"""

self.clean_state(myd.data)

myg = myd.grid

# compute the source terms -- we need to do this first
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_rk/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ riemann = HLLC ; HLLC or CGF

well_balanced = 0 ; use a well-balanced scheme to keep the model in hydrostatic equilibrium

small_dens = -1.e200 ; minimum allowed density

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible_rk/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def substep(self, myd):
conservative state defined as part of myd
"""

self.clean_state(myd.data)

myg = myd.grid

# source terms -- note: this dt is the entire dt, not the
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_sdc/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ grav = 0.0 ; gravitational acceleration (in y-direction)

riemann = CGF

small_dens = -1.e200 ; minimum allowed density

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
Loading