Skip to content

Physical models ​

FLUME solves hyperbolic conservation laws of compressible, inviscid flow in the form

∂q∂t+∑d=13∂Fd(q)∂xd=S(q),

with q the conservative state, Fd the flux along direction d and S a source, present only in the GLM damping of the MHD model. Four models are implemented; the model fixes the state width nv and selects, on the host, the compute kernels compiled for that width (no branching on the model inside a kernel).

Model[physics] physical_model[mhd] divergence_controlqnv
Compressible Eulereuler—(ρ,ρu,ρv,ρw,E)5
Ideal MHD with mixed GLM cleaningmhd-idealglm(ρ,ρu,ρv,ρw,E,Bx,By,Bz,ψ)9
Ideal MHD with EGLM cleaning (E includes ψ2/2)mhd-idealeglmas GLM9
Ideal MHD without divergence controlmhd-idealnonethe first 8 of the above8

All models use a calorically perfect ideal gas and are inviscid by default. Viscosity, heat conduction and Ohmic resistivity are milestone M4 (#65), each given as a coefficient or as its number (input): with a viscosity or a conductivity each model is its compressible Navier–Stokes form, and mhd-ideal with a resistivity is resistive MHD (Ohm's law E=−u×B+ηJ; numerics).

Thermodynamics ​

The gas is defined by the specific heats at constant pressure and volume, [physics] cp, cv (J/(kg K)), or by their ratio alone, [physics] gamma, with the gas constant then 1 (code units):

γ=cpcv,R=cp−cv,p=ρRT,a=γpρ.

Air, the value of most inputs, is cp = 1040.004, cv = 742.86 (γ=1.4). The MHD verification problems use γ=5/3 or 2 (Brio–Wu). R enters only the temperature: the fluxes, eigensystems and Riemann solvers take γ alone.

Compressible Euler ​

∂∂t(ρρuE)+∇⋅(ρuρu⊗u+pI(E+p)u)=0,E=pγ−1+12ρ|u|2.

The flux along direction d (normal n=ed, normal velocity un=u⋅n) is Fd=ρun(1,u,H)+p(0,n,0) with the total specific enthalpy H=(E+p)/ρ.

Eigensystem ​

The characteristic decomposition used by the WENO schemes is written once for every direction: the tangents are taken cyclically, t1=emod(d,3)+1, t2=emod(d+1,3)+1, so a problem rotated from x to y or z runs the same arithmetic on permuted data. With b2=(γ−1)/a2 and b1=b2|u|2/2 the right (rk) and left (lk) eigenvectors are

kλkrklk
1un−a(1, u−an, H−aun)12(b1+un/a, −b2u−n/a, b2)
2un(1, u, |u|2/2)(1−b1, b2u, −b2)
3un(0, t1, u⋅t1)(−u⋅t1, t1, 0)
4un(0, t2, u⋅t2)(−u⋅t2, t2, 0)
5un+a(1, u+an, H+aun)12(b1−un/a, −b2u+n/a, b2)

evaluated at the Roe average of the two cells adjacent to the face (ρ-weighted velocity and enthalpy, a~2=(γ−1)(H~−|u~|2/2)). The unit test test_flume_euler_library checks LR=I, the homogeneity identity LF(q)=ΛLq and the rotation invariance on 10 000 random states in each direction.

Ideal MHD ​

In code units the magnetic permeability is absorbed into the field, B=BSI/μ0, so the magnetic pressure is |B|2/2 and the fluid variables keep the units of the input (units and scaling):

∂ρ∂t+∇⋅(ρu)=0,∂(ρu)∂t+∇⋅[ρu⊗u+pTI−B⊗B]=0,pT=p+12|B|2,∂E∂t+∇⋅[(E+pT)u−(u⋅B)B]=0,E=pγ−1+12ρ|u|2+12|B|2,∂B∂t+∇⋅(u⊗B−B⊗u)=0,∇⋅B=0.

The flux of Bj along n is unBj−Bnuj, so the Bn component of the flux vanishes identically: without a divergence-control term the normal field is transported only through the transverse fluxes. Every input field (region states, boundary states) is in code units: a field in Tesla must be divided by μ0, a Gaussian one by 4π, by the user.

Wave speeds. Along n the system has seven waves: un±cf (fast), un±cA (Alfvén), un±cs (slow) and un (entropy), with b2=|B|2/ρ, bn2=Bn2/ρ, cA=|bn| and

cf,s2=12(a2+b2±(a2+b2)2−4a2bn2).

FLUME evaluates the discriminant as (a2−b2)2+4a2bt2 (bt2=b2−bn2), a sum of non-negative terms that cannot become negative through round-off when B is aligned with n.

Eigensystem. The 7×7 core is the Roe–Balsara-normalised eigensystem of Stone et al. (2008, ApJS 178, appendix B), evaluated at the arithmetic average of the two face states (a physical state, so the Roe-matrix factors are X=0, Y=1), with Bn as a parameter. The degenerate states are handled explicitly: a vanishing transverse field (|Bt|≤10−12max(|B|,ρa)) and the triple umbilic (cf2−cs2≤10−12cf2). Every three-term sum (|u|2, |B|2, u⋅B) is summed in increasing order of its terms, so the result does not depend on the order of the components and rotated problems stay bitwise equal. The unit test test_flume_mhd_library checks the eigensystem, including the degenerate states.

Divergence control: mixed GLM ​

The induction equation preserves ∇⋅B=0 analytically but not discretely, and a divergence error acts as a spurious force parallel to B. With divergence_control = glm FLUME uses the mixed hyperbolic–parabolic cleaning of Dedner et al. (2002): a ninth variable ψ is coupled to the induction equation,

∂B∂t+∇⋅(u⊗B−B⊗u)+∇ψ=0,∂ψ∂t+ch2∇⋅B=−ch2cp2ψ,

so the Bn flux becomes ψ and the ψ flux ch2Bn: along each direction the pair (Bn,ψ) is a linear system with speeds ∓ch, decoupled from the seven MHD waves. The divergence error travels away at the constant cleaning speed ch and is damped at the rate

ch2cp2=αchL,

with glm_alpha =α and glm_damping_length =L (a length, or min-cell for the minimum cell spacing of the realm, as Mignone & Tzeferacos 2010; with runtime regridding the spacing of the finest level allowed, so that the damping rate does not change with the grid). ψ is not part of the energy (mixed GLM); the damping source is applied to ψ only. ch (glm_ch) is constant and uniform, and it bounds the time step (below). glm_ch_check warns or stops when the fastest wave |un|+cf outruns it. Keep ch just above that speed. Where the discrete div B is not small, as on the sheared flanks of magnetised Rayleigh–Taylor, the discretised cleaning amplifies small asymmetries at a rate that grows with ch. The cleaned equations themselves have no such mode (verification, #83).

The (Bn,ψ) system of one direction is solved exactly at a face by the Riemann solvers of weno-riemann (Dedner et al. 2002, eq. 42):

B~n=12(Bn,L+Bn,R)−ψR−ψL2ch,ψ~=12(ψL+ψR)−ch2(Bn,R−Bn,L).

divergence_control = none drops ψ (nv=8). It is a diagnostic variant: in multi-dimensional runs the divergence error grows unchecked (the magnetised vortex reaches a negative pressure), so production runs use glm.

Divergence control: EGLM ​

In the mixed GLM ψ changes Bn without appearing in the energy, so the change of magnetic energy is taken from the thermal pressure; at very low plasma β this makes the first-order update of high-order stage states inadmissible (the Balsara–Spicer blast fails, issue #47). divergence_control = eglm selects the ideal GLM-MHD of Derigs et al. (2018, eqs. 3.16–3.18), with ψ in field units and part of the energy:

E=pγ−1+ρ|u|22+|B|22+ψ22,

the Bn flux chψ, the ψ flux chBn, the energy flux augmented by chψBn, and the nonconservative sources

−(∇⋅B)(0, B, u⋅B, u, 0)−(u⋅∇ψ)(0, 0, ψ, 0, 1)

in the order (ρ,ρu,E,B,ψ). ∇⋅B and ∇ψ are centred differences of order 2S, the WENO order (second-order sources drop the Alfvén wave to order 2.26). The damping −α(ch/L)ψ uses the GLM keys and acts on ψ only, so the removed cleaning energy becomes heat. Density is conserved exactly; momentum, energy and B up to the O(∇⋅B) sources. In the flux splitting the (Bn,ψ) block has eigenvectors r=(1,∓1) at speeds ∓ch and the energy couples it to the core (r(E)=∓ψ, lk(ψ)=−ψlk(E)), so with ψ=0 the arithmetic of the core is that of GLM. With weno-riemann the (Bn,ψ) subsystem is solved exactly at the face in field units, B~n=12(BnL+BnR)−12(ψR−ψL), ψ~=12(ψL+ψR)−12(BnR−BnL); the Riemann solver sees the MHD states (energy without ψ2/2), and the energy flux gains chψ~B~n plus the cleaning energy carried by the mass flux, Fρψ~2/(2ρup) (a passive scalar, upwind density). Both schemes run EGLM.

Positivity floors ​

[mhd] rho_floor, p_floor (both ≥0; 0 disables) clip density and pressure after each stage, before the ghost exchange, and count the floored cells (global counters in the log). With the floors disabled, a non-positive state stops the run. Independently, every step checks the state for non-finite values and stops the run naming the first one.

External gravity ​

A constant gravitational acceleration g ([gravity], input; milestone M7, #73) adds sources to both models, with the potential Φ=−g⋅x:

∂t(ρu)+⋯=ρg,∂tE+⋯=ρu⋅g,so that∂t(E+ρΦ)+∇⋅((E+pT+ρΦ)u−…)=0.
  • Momentum: ρig at the cell centre.
  • Energy: from the scheme's own mass fluxes Fρ, never from ρu at the centre (Mikami et al. 2008, Mullen et al. 2021): ∑dgd(−Fi−3/2ρ+13Fi−1/2ρ+13Fi+1/2ρ−Fi+3/2ρ)/24. A face's weights sum to one over the cells it touches, so ∑(E+ρΦ)V changes only by boundary fluxes, to round-off; the fourth-order weights make the source the cell value of ρug to fourth order (the face form 12(Fi−1/2+Fi+1/2) is second order on a finite-difference scheme, whose fluxes are point values of the primitive function of ρu). At a reflecting wall the invariant is W, the sum plus an O(Δx2) term of the wall rows (verification). It takes one more ghost layer, ngc >= S + 1.
  • Positivity limiter: the backbone carries the time-centred energy ρg⋅(u+gΔt/2), which leaves its internal energy unchanged, and the high-order excess of the source is limited with the fluxes.
  • Time step: no bound of its own; the regime |g|Δt2/(CFLh) is printed at the first step.
  • Boundary: hydrostatic faces continue the isothermal equilibrium of the boundary cell into the ghosts.
  • Well-balanced mode ([gravity] equilibrium = atmosphere): the residual of the initial atmosphere at rest, computed with the run's own operator once per grid, is subtracted from every residual (the deviation method of Edelmann et al. 2021, §4.3). The atmosphere is then an exact discrete steady state, and the scheme evolves the deviation from it; without it a stratified atmosphere at rest drives a stationary flow of the truncation error's size (verification).
  • Through a cell potential ([gravity] potential = linear, M8-P1, #81): the same field as the cell potential Φi=−g⋅xi, applied by the path self-gravity uses. The face gravity is −(Φi+1−Φi)/Δx, the cell gravity the mean of its two faces; the momentum gains ρi times the cell gravity, the energy 12∑d(gd,i+1/2Fi+1/2ρ+gd,i−1/2Fi−1/2ρ). That is the face form, second order, and ∑(E+ρΦ)V is conserved without a wall term. The hydrostatic ghosts take the potential drop, and the limiter the face and cell gravity. A test of that path (SV-1); refused with the well-balanced mode.

The equilibria FLUME builds are the isothermal-atmosphere, polytropic-atmosphere and rayleigh-taylor initial conditions (initial conditions).

Self-gravity ​

[gravity] self_gravity (#81, M8-P3) adds the gravity of the gas itself:

∇2Φ=4πG(ρ−ρ¯),∂t(ρu)+=−ρ∇Φ,∂tE+=−ρu⋅∇Φ,

with the mean density removed on a periodic domain (the Jeans swindle), or Φ→0 at infinity with isolated boundaries (poisson_bc = isolated, M8-P4). The discretisation is that of Mullen et al. (2021): Φ solves LhΦ=4πG(ρ−ρ¯) (periodic) or LhΦ=4πGρ (isolated) with the 7-point Laplacian (5-point in 2-D, periodic only), and enters through the potential path above (face gravity, cell gravity, the energy from the face mass fluxes).

What is conserved, and why. The solvers are linear and symmetric, Φ=4πGKρ with K=KT (VK symmetric on AMR, below): the periodic one inverts Lh on the zero-mean modes, the isolated one convolves with an even kernel. Summed over the cells, the energy source is ∑iΦi(∇⋅Fρ)iV=−∑Φρ˙V, and W˙=12ddt(ρTKρ)=ΦTρ˙ because K is symmetric: the semi-discrete scheme conserves E+W, W=12∑ρΦV, exactly (with periodic boundaries or closed walls, where no mass flux crosses the boundary). The momentum source −∑ρg¯V vanishes because the centred difference of an even, translation-invariant kernel is antisymmetric. Neither needs the discrete Poisson equation to hold at round-off (the isolated residual is about 10−11); the symmetry is what counts. That holds exactly for the FFT solvers, which are fixed linear maps. The multigrid solver on AMR stops at a tolerance, so its K is symmetric, and E+W exact, only to that tolerance: the defect measured in situ is 1.7⋅10−11 at a tolerance of 10−12 (SV-13), the point Mullen et al. make (round-off conservation needs a round-off Poisson solution). The Runge–Kutta integration (one solve per stage, nothing time-averaged) leaves a drift of its own order in Δt; the positivity limiter's gravity energy correction (M7-G1) breaks the exchange wherever it acts.

The coupling is second order in space whatever the WENO order. A linear Jeans mode obeys ω2=c2k2−4πGρ0: a wavelength shorter than the Jeans length λJ=cπ/(Gρ0) oscillates, a longer one grows; an n = 1 polytrope star is an isolated equilibrium (verification).

On AMR grids (M8-P5b; isolated boundaries: #87, below), Lh is the composite Laplacian of the leaves. Across a 2:1 face it carries the mimetic mean flux: every fine face f of a coarse cell C carries 23w(Φ¯f−ΦC), where Φ¯f is the mean of the face's fine cells and w is the fine face area over the fine spacing, and C receives the sum of these fluxes. The operator is symmetric in the volume-weighted form, so Φ=4πGKρ with VK symmetric, and it is consistent (exact for linear Φ face by face). SV-9 explains why the simpler couplings fail one property or the other.

Both sides of the seam see the same face gravity, −(Φ¯f−ΦC)/(1.5h), which is first order there. The energy sources, however, need the two-point work. For E+W to telescope, the seam's sources must sum to ∑fAfFfρ(ΦC−Φf) (with the sign of the mass flux), and the two kernels give ∑fAfFfρ(ΦC−Φ¯f) instead. The difference, ∑fAfFfρ(Φ¯f−Φf), is small (∑f(Φ¯f−Φf)=0) but not zero.

It rides on the reflux. Every stage adds to the flux register's energy entry:

  • the coarse side: its own seam source, taken back;
  • the fine side: the exact two-point work less the fine cell's own source.

The end-of-step correction then gives the coarse cell exactly the missing work. The semi-discrete E+W is exact again, the fine cells keep the consistent gravity, and the coarse cell next to the seam takes an O(h) local error.

The fully discrete exchange is first order in Δt, not of the Runge–Kutta order. The reflux corrects the coarse cells only at the end of the step, so its stages advance them with their own seam fluxes, an O(Δt) inconsistency per step. Measured on the collapsing Jeans mode (SV-10):

  • with the seam work: 9⋅10−8, 3⋅10−8, 1.4⋅10−8 at CFL 0.4, 0.2, 0.1;
  • without it: 10−5 at every CFL, a spatial leak.

[numerics] reflux_cadence = stage (P5c) restores the Runge–Kutta order: every stage corrects the coarse cells' residual from that stage's fluxes, and the drift falls at third order in Δt (3.5⋅10−8, 4.3⋅10−9, 5.4⋅10−10).

Under runtime AMR (P5c) every regrid sets the solver up on the new grid and solves Φ from the regridded state. The regrid conserves ρ, ρu and E, but W=12∑ρΦV is the grid's own discrete energy: a regrid that changes the grid changes W by a truncation-sized amount, and E+W jumps (SV-11). The jump is not a leak of the scheme between regrids, which stays exact. Making the regrid itself conserve E+W would need a correction of E at each regrid, which is not done.

Isolated boundaries on AMR (#87) use a symmetric form of James's method. With A the composite operator with zero ghosts at the domain faces and B the map of ghost values onto the boundary rows, the zero-ghost solve Φ0=A−14πGVρ, extended by zero, satisfies the infinite operator with a screening charge s=BTΦ0 on the ghost cells. The free-space ghost values are g=−Gs, G the lattice Green's function from ghost cell to ghost cell (a zero-padded FFT of the coarsest grid widened by the ghost layer), and the second solve is Φ=A−1(4πGVρ−Bg):

K=A−1+A−1BGBTA−1,

symmetric because A and G are, so the E+W exchange above stays exact. On a uniform grid it is the discrete free-space solution of the FFT solver; on AMR it is second order (G ignores the refinement inside the domain, a truncation-order error). The textbook James method, with the screening charge on the boundary surface and the potential at the ghost centres, is not symmetric. G is the coarse lattice's only if every leaf on the domain boundary is at the coarsest level: anything else is fatal, at start and at the regrid that would refine a boundary block (an isolated problem keeps its mass away from the boundary, where refinement is not needed). Each Poisson solve costs two composite solves and one FFT of the coarsest grid (SV-13, SV-14).

Units and scaling ​

The equations above carry no dimensionless number. Take three references, a density ρ0, a length L0 and a velocity u0, and derive the others:

QuantityReference
timet0=L0/u0
pressure, energy densityp0=ρ0u02
magnetic field (BSI/μ0)B0=u0ρ0
GLM speed chu0
ψ, mixed GLMB0u0
ψ, EGLMB0
temperatureu02/R (R∗=1)

Dividing every variable by its reference, every term of the Euler and MHD systems, the GLM and EGLM terms and the GLM damping αch/L included, picks up the same factor, which cancels: the equations in the scaled variables are the same equations (Goedbloed & Poedts 2004, section 4.1.2). A run in SI, in cgs or in units of order 1 is the same run. PLUTO, Athena++, MPI-AMRVAC, BATS-R-US, FLASH and RAMSES solve the same μ0-absorbed form and treat units as a conversion.

What the invariance does not remove:

  • The parameters move into the data. The Mach number, the Alfvén Mach number and the plasma β live in the initial and boundary states; one reference speed can set only one of the flow, sound and Alfvén speeds to 1.
  • The temperature needs R, and later a reference temperature, once conduction, cooling or a temperature-dependent resistivity exist.
  • Gravity is not free: an external field brings gL0/u02=1/Fr2 ([gravity], milestone M7, #73, above), self-gravity Gρ0L02/u02 (M8, #81); the dissipative terms of M4 bring the Reynolds, Prandtl, magnetic Reynolds and Lundquist numbers, each accepted in place of its coefficient (input).
  • The discrete scheme must be scale-free too. FLUME's is, apart from the classic WENO weights: their absolute ε stops the limiting at small magnitudes (numerics). With [weno] weights = si a run whose input is scaled by powers of two (lengths, velocities, density) equals the base run bit for bit (the scaling oracle, NV-4); the admissibility floor of the positivity limiter and the immersed-boundary cut spacing are relative.

FLUME uses the invariance in two ways. An input in physical units can carry a [reference] section: the values are divided by their references once, on the loaded file, and the solver runs on numbers of order 1, whatever the weights; output_units = dimensional writes the results back in the input units. Or the input runs as it is with weights = si. On Sod at an interstellar density both match the code-units run to 10−13, where the classic weights without the layer stop limiting (NV-6).

Time-step bound ​

The time step is the minimum over the realm of

Δt=CFLmaxcells∑d|ud|+cdΔxd,

with cd=a (Euler) or the fast speed along d (MHD), null directions excluded ([time] CFL). With GLM the cleaning waves add the bound Δt≤CFL/(chmax∑d1/Δxd). With dissipative terms each cell sum gains the diffusive part 2ν∑d1/Δxd2 (numerics).

Derived output fields ​

With [IO] save_auxiliary_fields = .true. the checkpoints also hold u,v,w,p,H,a; MHD adds the total pressure pt =pT, the plasma beta beta, the field magnitude bmag and the discrete divergence divb. Their exact definitions are on the input reference page.

References ​

  • Dedner A. et al. (2002), Hyperbolic divergence cleaning for the MHD equations, J. Comput. Phys. 175, 645–673.
  • Edelmann P. V. F. et al. (2021), Well-balanced treatment of gravity in astrophysical fluid dynamics simulations at low Mach numbers, Astron. Astrophys. 652, A53, doi:10.1051/0004-6361/202140653.
  • Goedbloed J. P., Poedts S. (2004), Principles of Magnetohydrodynamics, Cambridge University Press.
  • Derigs D. et al. (2018), Ideal GLM-MHD: about the entropy consistent nine-wave magnetic field divergence diminishing ideal MHD equations, J. Comput. Phys. 364, 420–467.
  • Mignone A., Tzeferacos P. (2010), A second-order unsplit Godunov scheme for cell-centered MHD: the CTU-GLM scheme, J. Comput. Phys. 229, 2117–2138.
  • Mikami H., Sato Y., Matsumoto T., Hanawa T. (2008), Astrophys. J. 683, 357, doi:10.1086/589759.
  • Mullen P. D., Hanawa T., Gammie C. F. (2021), An extension of the Athena++ framework for fully conservative self-gravitating hydrodynamics, Astrophys. J. Suppl. 252, 30, doi:10.3847/1538-4365/abcfbd.
  • Stone J. M. et al. (2008), Athena: a new code for astrophysical MHD, ApJS 178, 137–177.
  • Toro E. F. (2009), Riemann Solvers and Numerical Methods for Fluid Dynamics, 3rd ed., Springer.