Compressible source terms#

Implementation#

Various source terms are included in the compressible equation set. Their implementation is solver-dependent.

compressible#

For the compressible solver, source terms are included in the compressible equations via a predictor-corrector formulation. Starting with the conserved state, Un, we do the update as:

Un+1,=UnΔt[F(U)]n+1/2+ΔtS(Un)Un+1=Un+1,+Δt2(S(Un+1,)S(Un))

This time-centers the sources, making the update second-order accurate.

compressible_rk, compressible_fv4, compressible_sdc#

These solvers all use a method-of-lines type discretization, so at each temporal node / stage, s, that the update is needed, we compute it as:

Ut|s=F(Us)+S(Us)

and the method’s time-integration strategy ensures that it achieves the correct order of accuracy.

Gravity#

All solvers include the ability to adds a constant gravitational source, set by the parameter compressible.grav.

For the compressible solver, the corrector update is done by first updating the momentum, and then using the new momentum to get the final total energy. This makes it appear as if it were an implicit-in-time update.

Sponge#

A sponge is a damping term in the velocity meant to drive the velocity to zero in regions that are not interesting. This is often used with outflow / zero-gradient boundary conditions in atmospheric calculations for the region above the atmosphere (see the convection problem for an example).

The sponge is enabled by setting sponge.do_sponge=1.

The momentum equation in this case appears as:

(ρU)t+(ρUU)+p=ρgfdampτdampρU

where

  • fdamp is in [0,1] and indicates where the sponge is active. This is specified in terms of density and takes the form:

    fdamp={0ρ>ρbegin12(1cos(πρρbeginρfullρbegin))ρbegin>ρ>ρfull1ρ<ρfull

    where ρbegin is the density where the sponge turns on (set by sponge.sponge_rho_begin) and ρfull is the density where the sponge is fully enabled (set by sponge.sponge_rho_begin), with ρbegin>ρfull.

  • τdamp is the timescale for the sponge to act (typically this should be a few to 10 timesteps). This is set by sponge.sponge_timescale.

Problem-dependent source#

A problem-dependent source can be added to the conserved equations. This is provided by a function source_terms in the problem’s module, with the form:

source_terms(myg, U, ivars, rp)

This is evaluated using the appropriate conserved state, U, and expected to return a vector S(U). See the convection problem for an example (as a heating term).