Skip to content

Commit 4a074a6

Browse files
committed
add a sponge to the compressible solvers
for the CTU solver, the sponge update is implicit in time for the RK/SDC solvers, it is an explicit source this damps the velocity field over a timescale "sponge_timescale" The sponge is essentially the same as in Castro
1 parent 59e072d commit 4a074a6

File tree

7 files changed

+39
-2
lines changed

7 files changed

+39
-2
lines changed

pyro/compressible/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
__all__ = ["simulation"]
88

99
from .simulation import (Simulation, Variables, cons_to_prim,
10-
get_external_sources, prim_to_cons)
10+
get_external_sources, get_sponge_factor, prim_to_cons)

pyro/compressible/_defaults

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ grav = 0.0 ; gravitational acceleration (in y-direction)
2121

2222
riemann = HLLC ; HLLC or CGF
2323

24+
2425
[sponge]
2526
do_sponge = 0 ; do we include a sponge source term
2627

pyro/compressible_fv4/_defaults

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,12 @@ grav = 0.0 ; gravitational acceleration (in y-direction)
2424
riemann = CGF
2525

2626

27+
[sponge]
28+
do_sponge = 0 ; do we include a sponge source term
29+
30+
sponge_rho_begin = 1.e-2 ; density below which to begin the sponge
31+
sponge_rho_full = 1.e-3 ; density below which the sponge is fully enabled
32+
sponge_timescale = 1.e-2 ; the timescale over which the sponge should act
33+
34+
2735

pyro/compressible_fv4/simulation.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pyro.compressible_fv4.fluxes as flx
22
from pyro import compressible_rk
3-
from pyro.compressible import get_external_sources
3+
from pyro.compressible import get_external_sources, get_sponge_factor
44
from pyro.mesh import fv, integration
55

66

@@ -48,6 +48,13 @@ def substep(self, myd):
4848
(flux_x.v(n=n) - flux_x.ip(1, n=n))/myg.dx + \
4949
(flux_y.v(n=n) - flux_y.jp(1, n=n))/myg.dy + S.v(n=n)
5050

51+
# finally, add the sponge source, if desired
52+
if self.rp.get_param("sponge.do_sponge"):
53+
kappa_f = get_sponge_factor(myd.data, self.ivars, self.rp, myg)
54+
55+
k.v(n=self.ivars.ixmom)[:, :] -= kappa_f.v() * myd.data.v(n=self.ivars.ixmom)
56+
k.v(n=self.ivars.iymom)[:, :] -= kappa_f.v() * myd.data.v(n=self.ivars.iymom)
57+
5158
return k
5259

5360
def preevolve(self):

pyro/compressible_rk/_defaults

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ riemann = HLLC ; HLLC or CGF
2626
well_balanced = 0 ; use a well-balanced scheme to keep the model in hydrostatic equilibrium
2727

2828

29+
[sponge]
30+
do_sponge = 0 ; do we include a sponge source term
31+
32+
sponge_rho_begin = 1.e-2 ; density below which to begin the sponge
33+
sponge_rho_full = 1.e-3 ; density below which the sponge is fully enabled
34+
sponge_timescale = 1.e-2 ; the timescale over which the sponge should act

pyro/compressible_rk/simulation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ def substep(self, myd):
3333
(flux_x.v(n=n) - flux_x.ip(1, n=n))/myg.dx + \
3434
(flux_y.v(n=n) - flux_y.jp(1, n=n))/myg.dy + S.v(n=n)
3535

36+
# finally, add the sponge source, if desired
37+
if self.rp.get_param("sponge.do_sponge"):
38+
kappa_f = compressible.get_sponge_factor(myd.data, self.ivars, self.rp, myg)
39+
40+
k.v(n=self.ivars.ixmom)[:, :] -= kappa_f.v() * myd.data.v(n=self.ivars.ixmom)
41+
k.v(n=self.ivars.iymom)[:, :] -= kappa_f.v() * myd.data.v(n=self.ivars.iymom)
42+
3643
return k
3744

3845
def method_compute_timestep(self):

pyro/compressible_sdc/_defaults

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ temporal_method = RK4 ; integration method (see mesh/integration.py)
2222
grav = 0.0 ; gravitational acceleration (in y-direction)
2323

2424
riemann = CGF
25+
26+
27+
[sponge]
28+
do_sponge = 0 ; do we include a sponge source term
29+
30+
sponge_rho_begin = 1.e-2 ; density below which to begin the sponge
31+
sponge_rho_full = 1.e-3 ; density below which the sponge is fully enabled
32+
sponge_timescale = 1.e-2 ; the timescale over which the sponge should act

0 commit comments

Comments
 (0)