A robust numerical scheme for highly compressible magnetohydrodynamics: Nonlinear stability, implementation and tests
ABSTRACT The ideal MHD equations are a central model in astrophysics, and their
solution relies upon stable numerical schemes. We present an implementation of
a new method, which possesses excellent stability properties. Numerical tests
demonstrate that the theoretical stability properties are valid in practice
with negligible compromises to accuracy. The result is a highly robust scheme
with state-of-the-art efficiency. The scheme's robustness is due to entropy
stability, positivity and properly discretised Powell terms. The implementation
takes the form of a modification of the MHD module in the FLASH code, an
adaptive mesh refinement code. We compare the new scheme with the standard
FLASH implementation for MHD. Results show comparable accuracy to standard
FLASH with the Roe solver, but highly improved efficiency and stability,
particularly for high Mach number flows and low plasma beta. The tests include
1D shock tubes, 2D instabilities and highly supersonic, 3D turbulence. We
consider turbulent flows with RMS sonic Mach numbers up to 10, typical of gas
flows in the interstellar medium. We investigate both strong initial magnetic
fields and magnetic field amplification by the turbulent dynamo from extremely
high plasma beta. The energy spectra show a reasonable decrease in dissipation
with grid refinement, and at a resolution of 512^3 grid cells we identify a
narrow inertial range with the expected power-law scaling. The turbulent dynamo
exhibits exponential growth of magnetic pressure, with the growth rate twice as
high from solenoidal forcing than from compressive forcing. Two versions of the
new scheme are presented, using relaxation-based 3-wave and 5-wave approximate
Riemann solvers, respectively. The 5-wave solver is more accurate in some
cases, and its computational cost is close to the 3-wave solver.
A ROBUST NUMERICAL SCHEME FOR HIGHLY COMPRESSIBLE
MAGNETOHYDRODYNAMICS: NONLINEAR STABILITY, IMPLEMENTATION AND
K. WAAGAN, C. FEDERRATH, AND C. KLINGENBERG
Abstract. The ideal MHD equations are a central model in astrophysics, and their solution relies upon
stable numerical schemes. We present an implementation of a new method, which possesses excellent stability
properties. Numerical tests demonstrate that the theoretical stability properties are valid in practice with
negligible compromises to accuracy. The result is a highly robust scheme with state-of-the-art efficiency.
The scheme’s robustness is due to entropy stability, positivity and properly discretised Powell terms. The
implementation takes the form of a modification of the MHD module in the FLASH code, an adaptive mesh
refinement code. We compare the new scheme with the standard FLASH implementation for MHD. Results
show comparable accuracy to standard FLASH with the Roe solver, but highly improved efficiency and
stability, particularly for high Mach number flows and low plasma β. The tests include 1D shock tubes,
2D instabilities and highly supersonic, 3D turbulence. We consider turbulent flows with RMS sonic Mach
numbers up to 10, typical of gas flows in the interstellar medium. We investigate both strong initial magnetic
fields and magnetic field amplification by the turbulent dynamo from extremely high plasma β. The energy
spectra show a reasonable decrease in dissipation with grid refinement, and at a resolution of 5123grid cells
we identify a narrow inertial range with the expected power-law scaling. The turbulent dynamo exhibits
exponential growth of magnetic pressure, with the growth rate twice as high from solenoidal forcing than
from compressive forcing. Two versions of the new scheme are presented, using relaxation-based 3-wave and
5-wave approximate Riemann solvers, respectively. The 5-wave solver is more accurate in some cases, and
its computational cost is close to the 3-wave solver.
In order to model complex nonlinear astrophysical phenomena, numerical solutions of the equations of
ideal MHD are central. Examples include the dynamics of stellar atmospheres, star formation and accretion
discs. Magnetised gas flows in astrophysics are typically highly compressible, nonlinear and often supersonic.
Hence, obtaining stable numerical results in such regimes is extremely challenging if the numerical scheme
must also be both accurate and efficient. Here we present a new MHD solver that preserves stable, physical
solutions to the compressible MHD equations by construction, while at the same time showing improved
efficiency and comparable accuracy to standard schemes based on the very accurate, but less stable Roe
approximate Riemann solver .
Date: February 11, 2011.
K. Waagan would like to thank Dr. Michael Kn¨ olker at the High Altitude Observatory in Colorado for advice and support
with this work. K. Waagan is partially supported by NSF Grants DMS07-07949, DMS10-08397 and ONR Grant N000140910385.
C. Federrath is grateful for support from the Landesstiftung Baden-W¨ urttemberg via their program International Col-
laboration II under Grant P-LS-SPII/18, and has received funding from the European Research Council under the European
Community’s Seventh Framework Programme (FP7/2007-2013 Grant Agreement No. 247060). C. Federrath acknowledges com-
putational resources from the HLRB II project Grant pr32lo at the Leibniz Rechenzentrum Garching for running the turbulence
The FLASH code was developed in part by the DOE-supported Alliances Center for Astrophysical Thermonuclear FLASHes
(ASC) at the University of Chicago.
arXiv:1101.3007v3 [astro-ph.IM] 10 Feb 2011
We consider numerical solutions of the ideal MHD system (here written in conservation form, and in three
dimensions, letting I3denote the 3 × 3 identity matrix)
ρt+ ∇ · (ρu) = 0,
(ρu)t+ ∇ · (ρu ⊗ u + (p +1
Et+ ∇ · [(E + p +1
Bt+ ∇ · (B ⊗ u − u ⊗ B) = 0,
∇ · B = 0,
with the specific internal energy e, such that the total energy density is given by E = ρe+1
the pressure given by the equation of state p = p(ρ,e). The Cartesian components of the velocity are denoted
by u = (u,v,w). The system fits the generic form of a conservation law Ut+ ∇ · F(U) = 0, except for the
restriction on ∇ · B. However, if this restriction is satisfied at the initial time t = 0, it automatically holds
at later times t > 0 for the exact solution. Shock conditions are common in astrophysics, hence (1.1) should
be understood in a weak sense. The lack of regularity and large scale ranges in astrophysical flows make
it particularly challenging to devise numerically stable schemes. Recent developments in nonlinear stability
analysis have made such schemes possible, however. The central stability notions are entropy stability and
positivity of mass density ρ and internal energy ρe. This paper presents an implementation of the robust
positive second order scheme from , which uses the entropy stable approximate Riemann solvers of [4, 5].
Several codes are available for high-performance compressible MHD simulations. We mention Athena ,
AstroBEAR , Chombo , Enzo , FLASH , Nirvana , Pluto , RAMSES  and VAC
. The positive scheme of  has so far been unavailable in such codes. We have implemented it as an
alternative MHD module in the FLASH code.
We focus here on a comparison with the original FLASH code. Benchmark tests in one and two spatial
dimensions are presented. Transition to unstable turbulence-like flow is particularly emphasised. Additional
tests of the algorithms may be found in [5, 35] and . As an example application we consider turbulence in
molecular clouds, which is characterised by high Mach numbers and the presence of magnetic fields. Before
presenting the results, we give a review of the numerical schemes and their theoretical properties.
2|B|2)I3− B ⊗ B) = 0,
2|B|2)u − (B · u)B] = 0,
2. Numerical schemes
In this section we give a quick summary of the numerical techniques used, and their justification. Consider
first a system of conservation laws in one spatial dimension (we consider the x-dimension) Ut+ F(U)x= 0.
The numerical schemes we will use are of the finite volume type
where Uiare averages over intervals (or ’cells’) of length h indexed by i at a given time t, and the operator
S∆tupdates the cell averages to time t + ∆t. The numerical fluxes F are evaluated at the cell interfaces,
hence U is conserved and we call the scheme conservative.
2.1. First order accuracy in one space dimension. First order accurate schemes can be given by
Typically, F(·,·) is given by an approximate Riemann solver [3, 67, 41]. The following are considered here:
The Roe solver and the HLLE (Harten, Lax, van Leer and Einfeldt) solver as implemented in FLASH,
and the multi-wave HLL-type solvers of [4, 5] (named HLL3R and HLL5R, or HLLxR). Other HLL-type
solvers are given in [27, 50, 26, 42, 44, 25] among others. The numerical flux should be consistent (i.e.
F(U,U) = F(U)), and satisfy appropriate stability criteria. For gas and plasma dynamical systems a strong
and physically meaningful stability criterion is implied by the second law of thermodynamics, which reads
in one dimension:
(2.3)(ρs)t+ (ρus)x≥ 0,
s being the specific entropy of the system. This inequality holds, by definition, for an exact Riemann solver,
and should also hold for an approximate Riemann solver. The HLLxR solvers were proved in [4, 5] to satisfy
(2.3), and consequently the resulting conservative scheme satisfies a discrete version of (2.3). We refer to an
approximate Riemann solver satisfying (2.3) as being entropy stable. For the Roe and HLLE solvers there
are no rigorous proofs of entropy stability. For HLLE this appears not to be a problem, while Roe solvers
yield non-physical shocks at sonic points. Therefore, Roe solvers are typically equipped with a so-called
entropy-fix, which adds extra dissipation at sonic points. The Roe solver also tends to produce negative
mass density values, while HLLE and HLLxR provably preserve positive mass density. Positivity of mass
density and entropy stability imply that the internal energy remain positive. The positivity of density and
internal energy ensures that the hyperbolicity of the equations does not break down (in which case the
numerical schemes no longer make sense), and implies that the computed conserved quantities are stable in
L1. Entropy stability and positivity are referred to as nonlinear stability conditions since they apply
directly to nonlinear systems. The ’R’ in HLLxR comes from the derivation of the solvers from a relaxation
approximation to the MHD equations, hence they are referred to as relaxation solvers. The underlying
relaxation approximation has formally been found to be entropy dissipative through a Chapman-Enskog
analysis . The corresponding relaxation solver for hydrodynamics , was tested in an astrophysical
turbulence setting in .
Approximate Riemann solvers tend to vary in accuracy according to the level of detail they take into
account. Typically, some wave modes are better resolved than others. For the solvers considered here, the
HLLE solver can only optimally resolve the fast waves, while the Roe solver can, in principle, resolve all
isolated waves as well as the exact solver. The relaxation solvers lie somewhere in between: The HLL3R can
optimally resolve material contacts and tangential discontinuities at vanishing Alfv´ en speed, and the HLL5R
additionally resolves velocity shears at vanishing Alfv´ en speed. Hence HLL5R is a true generalisation of the
HLLC solver for the Euler equations. These differences in resolution most prominently appear when the
wave modes in question are close to stationary, i.e. much slower than h/∆t.
2.2. Second order accuracy in one space dimension. In order to obtain second-order accuracy, some
interpolation, i.e. reconstruction of the states from cell averages, has to be employed. We consider here
the conservative MUSCL-Hancock scheme, introduced in  (see also ). We refer to  for the non-
conservative case. Let W denote the primitive state variables (ρ,u,B,p). Away from discontinuities the
equations can be rewritten as Wt+A(W)Wx= 0 for a matrix A(W). The MUSCL-Hancock algorithm goes
(1) Reconstruction: evaluate discrete differences DWi. For oscillation control, we use the MC-limiter
(monotonised central limiter), so for each component of Wiwe take
(2) Prediction step: evaluate
(2.4)DWi= σimin2|Wi+1− Wi|,1
2|Wi+1− Wi−1|,2|Wi− Wi−1|
Wi+1− Wi> 0, Wi− Wi−1> 0
Wi+1− Wi< 0, Wi− Wi−1< 0
(3) Evaluate the cell edge values
(4) Use the cell edge values as input to the numerical flux in the conservative scheme,
where U denotes the conserved state variables.
Using primitive variables as the basis for reconstructing the states was recommended for example in .
It ensures that material contact discontinuities are reproduced exactly (and also shear waves at vanishing
Alfv´ en speed). Alternatively, one can use that the primitive form Wt+ A(W)Wx= 0 may be diagonalised
with Wi= XiRi. The matrix Xiis given by the eigenvectors Xj
may then be evaluated using the relation DWi= XiDRi, given gradients DRi, and we get
where λ is the diagonal matrix having the eigenvalues λjas entries. The original FLASH code uses the
characteristic variable-based reconstruction, while we use the primitive variables with the relaxation solvers.
The limiter (2.4) forces the scheme to behave like the first order scheme near a discontinuity, hence
ensuring that the entropy dissipation of the approximate Riemann solver kicks in. Even so, it turns out to
be important to ensure the positivity of mass density and internal energy. In , a limiting procedure was
presented such that the MUSCL-Hancock scheme is positive for any positive approximate Riemann solver.
It consists of a modification that applies to any piecewise linear reconstruction of the W or R -variables.
This limiter (more specifically the ’W-reconstruction’ of ) is used with the relaxation solvers.
j = 1,2,...,d
iof A(Wi). The reconstructed gradients
2DRi) = Wi−∆t
2.3. Multidimensionality. Clearly our scheme is based on the treatment of one-dimensional Riemann
problems. Multidimensional Riemann problems are much too complicated to be used as a basis of schemes,
so various means have been suggested to derive multidimensional schemes from one-dimensional schemes.
We only consider Cartesian grids here, where one can rely on dimensional splitting. This method consists
of first solving the system ignoring the y and z- derivatives, then ignoring the x- and z-derivatives etc. The
splitting adds an error, and in order to maintain second order accuracy, the order of the directions must be
reversed between each time step (Strang splitting). Unsplit methods have been developed to eliminate this
error completely (e.g. in [39, 38]). We limit our discussion to the split scheme, and focus on issues specific
to the multidimensional MHD equations. Note however that these issues, as well as the proposed solutions,
are not specific to split schemes.
Due to considering the directions separately, we have to make sense of one-dimensional problems where the
longitudinal magnetic field component is non-constant, in other words we can no longer assume ∇ · B = 0
initially. In order to handle the resulting more general one-dimensional problems, we use the following
approach of , consisting of modifying the evolution equation for B to
Bt+ ∇ · (B ⊗ u − u ⊗ B) − u∇ · B = 0.
Equation (2.11) implies that
(2.12)(∇ · B)t+ ∇ · (u∇ · B) = 0,
consequently ∇ · B remains zero analytically, and numerical errors in ∇ · B are transported by the flow.
In the original FLASH code, the momentum and energy equations were also modified, which is what was
actually recommended in . We found it sufficient for stability in  and  to only include the Powell
term for the induction equation.
The one-dimensional Powell system is only conservative when (Bn) is constant, so the schemes must take
In the original FLASH code, the source contributions from the cell edges are ignored, and the Powell source
term is simply evaluated by a central discretisation. In  and , we found that it was essential for
stability, both practically and theoretically, to discretise the Powell term in a proper upwind manner. This
was carried out in  for the first order scheme by extending the relaxation system to the Powell system, see
also . The second order extension can be found in , and numerical tests demonstrating the importance
of including a properly discretised Powell source are in [25, 35] and .
We include divergence cleaning in the form of the parabolic cleaning method of ; see also . We
use it as already implemented in FLASH. It has the advantage of not expanding the numerical stencil of the
scheme. FLASH also has the non-local projection method of  implemented, which could in principle be used
i+1) − Fr(U+
Powell term discretisation
Table 1. Summary of the schemes.
also with the new schemes. An alternative to using (2.11) is the staggered mesh (or constrained transport)
approach (reviewed in ), which in one dimension essentially means evaluating Bn at the cell interface
instead of as a cell average. The numerical stability results we rely on (entropy stability and positivity)
are not available for staggered methods, but staggered schemes have the advantage of guaranteeing that
∇·B = 0 to approximation order in smooth regions. Note that all approximate Riemann solvers we consider
may also be used as components of staggered methods.
2.4. Isothermal gas. As a simple model of cooling (e.g., due to radiation), it is common to assume that
the gas temperature is constant. This means that p = c2
practical way to implement isothermality consists of (i) solving the full equations for ideal gas with a γ
close to 1 within each time step, and (ii) projecting to the isothermal state between each time step. We
use γ = 1.00001. This projection method is preferred due its simplicity, accuracy, and generalisability. By
generalisability we mean that the projection to p = c2
sρ is easily replaced with more elaborate cooling models.
The projection method requires robust underlying numerics, since the full energy equation has to be solved
sρ, where the constant csis the sound speed. A
2.5. The schemes. The changes made to the original FLASH code in order to implement the new scheme
are as described above. The time step size is chosen from the maximum wave speed of the previous time step
and the maximum of
ρover all cell averages (csdenoting sound speed). We use a CFL-number of 0.8
throughout, unless otherwise noted. We used version 2.5 of FLASH, but it is straightforward to implement
the new scheme in other finite volume codes.
For numerical testing, we compare the new schemes HLL3R and HLL5R with the basic FLASH schemes
for MHD. FLASH offers both a Roe and an HLLE approximate Riemann solver. The relevant schemes are
summarised in Table 1. All schemes are finite volume schemes of MUSCL-Hancock type, with differences in
the (approximate) Riemann solver, reconstruction method and Powell terms as described above. The names
of the schemes are taken from the Riemann solvers for simplicity, although other algorithmic differences may
also be important. To distinguish the schemes from the Riemann solvers, we use the ‘sans serif’ font to
indicate the scheme and normal font type for the Riemann solvers (see Tab. 1). The thermodynamics are
either adiabatic with an ideal gas equation of state or isothermal.
3. Numerical studies 1D
In one spatial dimension, the differences between the schemes are given mainly by the accuracy of the
approximate Riemann solver and the stability properties of both the approximate Riemann solver and the
3.1. Brio-Wu shock tube. We first consider initial shock tube data from  that have become a standard
test case. It contains a variety of numerically challenging wave types occurring in MHD flows, in particular
a fast rarefaction, a compound wave, a material contact, and a slow shock. The initial data are given by
U = Ulfor x < 0.5, and U = Urfor x > 0.5, with γ = 5/3 and
ρl= 1,ul= 0,Bl= (0.75,1,0),pl= 1
ρr= 0.125,ur= 0,Br= (0.75,−1,0),pr= 0.1.
Figure 3.1 shows small differences between HLL3R and FLASH-Roe on this standard test with FLASH-Roe
slightly sharper on the compound wave. FLASH-HLLE is similar to HLL3R, except that the material contact
was more smeared out than in HLL3R (see Fig. 3.2). We conclude that all the schemes perform reasonably