You are on page 1of 53

Rony Keppens & Jon Sundqvist

Computational Methods for


Astrophysical Applications
–Hands-on simulating with MPI-AMRVAC–

October 28, 2020

Springer Nature
Contents

6 The Euler equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


6.1 On the energy law in gas dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
6.2 The Euler equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
6.3 1D compressible gas dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
6.3.1 Characteristic equations and Riemann invariants∗∗ . . . . . . . . . 4
6.3.2 Hyperbolicity of the Euler equations . . . . . . . . . . . . . . . . . . . . 6
6.3.3 Relating characteristic, primitive and conservative forms∗∗ . . 7
6.3.4 Euler system and Rankine-Hugoniot . . . . . . . . . . . . . . . . . . . . 9
6.3.5 The Riemann problem for Euler . . . . . . . . . . . . . . . . . . . . . . . . 11
6.3.6 Assignment: design your own 1D Riemann solver for Euler . 13
6.4 Numerical tests with TVDLF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.4.1 1D Riemann problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.4.2 2D Riemann problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.5 Sound waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.5.1 Linear sound wave theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.5.2 TVDLF and driven sound waves . . . . . . . . . . . . . . . . . . . . . . . 29
6.6 Approximate Riemann solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.6.1 The Godunov scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.6.2 Roe scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.6.3 HLL and HLLC approximate Riemann solvers . . . . . . . . . . . . 34
6.7 Roe’s approximate Riemann solver∗∗ . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.8 1D transonic flow: de Laval nozzle∗∗ . . . . . . . . . . . . . . . . . . . . . . . . . . 42
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

v
Chapter 6
The Euler equations

Abstract This chapter discusses the nonlinear Euler equations, expressing mass,
momentum and energy conservation. We discuss the various equivalent forms for
writing the 1D Euler system, involving a density, velocity and pressure. We stress
the hyperbolic nature of the PDEs, discussing their characteristic speeds, and how
these return in the solution of the Riemann problem, where two constant states are in
contact. The Rankine-Hugoniot relations govern shocks and contact discontinuities,
leading to the shock relations. The TVDLF method is used for simulating Riemann
problems numerically, and critically discussed, also in its application to simulating
linear and nonlinear sound waves. Modern solvers, like HLL, HLLC and the Roe
approximate Riemann solver are explained as well, and contrasted against the TVDLF
results.

6.1 On the energy law in gas dynamics

In the previous chapters, the isothermal/polytropic hydro Eqns. (??), augmented with
a central gravitational field in Eqns. (??), did not really incorporate a consideration
of an energy balance, although the flows they describe can be quantified in terms
of their kinetic energy density ρv 2 /2, the thermal energy in the gas ∝ T, and
their gravitational potential energy. The isothermal hydro set implicitly assumes
conditions such that the gas temperature T ∝ p/ρ remains at a fixed value throughout.
This is e.g. the case in the surroundings of hot stars, which irradiate and photoionize
their surroundings and hence keep all the surrounding gas at a temperature above
about 10000 K, the ionization temperature of hydrogen1. This assumption in effect
adopts an unspecified source (or sink) for internal energy, such that the total energy
is not conserved. An astrophysical scenario where this happens is around young O
or B type stars, which emit copious amounts of UV radiation and are surrounded by

1 In fact, the surrounding medium is then a plasma (a mixture of charged ions and electrons), rather
than a gas.

1
2 6 Euler equations

their Strömgren sphere: a roughly spherical region whithin which neutral hydrogen
(H I) is converted to H II (i.e. the electron is stripped away from the hydrogen
atoms). An example is the Rosette Nebula, which has a large H II region, that is
shown in a combined X-ray and optical view in Fig. 6.1. This nebula is situated
at 5000 lightyears, and contains thousands of massive O-stars that blow an ionized
bubble in their surroundings.

Fig. 6.1 The Rosette Nebula, where many hot massive stars in effect cause an almost isothermal
region at about 10000 K. From http://chandra.harvard.edu/photo/2010/rosette/.

If we instead wish to consider energy conservation, on an equal footing with mass


and momentum conservation, it is necessary to introduce a total energy density,
computed from
ρv 2 p
e= + . (6.1)
2
|{z} γ−1
|{z}
kinetic thermal energy

This energy density has a thermal part ei ≡ p/(γ − 1) containing the gas pressure
denoted by p, and the ratio of specific heats γ = cp /cv entering as a parameter.
These specific heats cp and cv are generally defined as follows. We first re-express
the thermal energy in terms of a specific (i.e. per unit mass) internal energy eis such
that
ρeis = ei = p/(γ − 1) . (6.2)
6.2 The Euler equations 3

For an ideal gas, a temperature can be computed from p = R ρT with gas constant
R. Also, an ideal gas has its specific internal energy depending on temperature only
eis (T ). The specific heat at constant volume is then by definition

deis
cv = . (6.3)
dT
Hence, eis = cv T for the ideal gas case. For defining the specific heat at constant
pressure cp , the specific enthalpy
ei + p
h s = eis + p/ρ = (6.4)
ρ
is introduced. Then one defines
dh s
cp = . (6.5)
dT
For an ideal gas, we find cp − cv = R. Generally, their ratio

α dof + 2
γ = cp /cv = , (6.6)
α dof
where α dof is an integer quantifying the total number of degrees of freedom over
which internal energy can be distributed. Molecules composing the gas can have
translational, rotational, or vibrational degrees of freedom. For a monoatomic gas
(like a hydrogen gas) in 3D, only the three translational degrees of freedom exist so
α dof = 3 and γ = 5/3.

6.2 The Euler equations

The governing set of PDEs for compressible gas dynamics are the so-called Eu-
ler equations, expressing conservation in terms density ρ(x, t), momentum density
m(x, t) = ρv, and total energy density e(x, t) according to

∂t ρ + ∇ · (vρ) = Sρ ,
∂t m + ∇ · (vρv + pI) = Sm ,
∂t e + ∇ · (ve + vp) = Se , (6.7)

where the energy density is given by Eq. (6.1), and where source or sink terms
are collected on the right side. These could represent external gravitational effects
(where Sm = ρg and Se = ρv · g, respectively). They could also be sources for
mass, momentum and energy as corresponding to (otherwise unresolved) stellar
outflows entering the computational domain with a prescribed mass loss rate and
terminal velocity. They may even represent terms that introduce PDEs of a mixed-
type character, when e.g. heat conduction or another diffusion-type term (e.g. due to
4 6 Euler equations

viscosity or radiation) appears in the momentum and energy budget. The system (6.7)
without source terms governs the dynamics of an inviscid gas, which conserves mass,
momentum and energy. Depending on the dimensionality and assumed symmetry,
we may have 3, 4 or 5 equations to solve. These range from a pure 1D case where
3 equations remain, governing ρ(x, t), m x (x, t) and e(x, t), through 1.5D (including
my (x, t)), 1.75D (including also mz (x, t)), 2D, 2.5D or 3D realizations. As a closure
relation we will always adopt an ideal gas relation p ∝ ρT making the internal energy
density ei = p/(γ − 1).
In the present chapter, we will handle ideal Euler flows only, i.e. focus exclusively
on the left-hand-side of the Eqns. (6.7). As we will see, these represent a hyperbolic
set of non-linear conservation laws, and allow for shock-dominated dynamics, en-
riched by various gas dynamical instabilities. Before handling their applications in
multi-dimensional settings, we first restrict attention to the 1D case.

6.3 1D compressible gas dynamics

The governing conservation laws (6.7) of a compressible gas in 1D (without source


terms and where v = v êx ) reduce to


 ∂t ρ + ∂x ( ρ v) =0
 ∂t m + ∂x (m v + p) = 0 .

(6.8)
 ∂ e + ∂ (e v + p v) = 0

 t x

They express mass, momentum m = ρv, and total energy conservation, and we can
hence introduce the vector of conserved quantities

ρ
U = *. m +/ . (6.9)
,e-

6.3.1 Characteristic equations and Riemann invariants∗∗

Many different formulations for the PDE system (6.8) exist, and collectively, they
reveal various aspects of interest to compressible gas dynamics. E.g., one may also
consider the vector of so-called primitive variables, usually taken as

ρ
V = *. v +/ . (6.10)
,p-
The 1D Euler system written in terms of these variables is not in conservation form,
and is given by
6.3 1D compressible gas dynamics 5

ρ v ρ 0 ρ
∂t *. v +/ + .. 0 v ρ1 // ∂x *. v +/ = 0 . (6.11)
* +

, p - , 0 γp v - , p -

Exercise
6.1 Show the mathematical equivalence of Eqns. (6.11) with Eqns. (6.8),
assuming that all occuring variables are smooth, i.e. have well behaved partial
derivatives.

Another state variable one may want to use is the ‘entropy’ S = pρ−γ (actually,
the entropy is cv ln S + const but we will refer to S as entropy). From the 1D Euler
system, which neglects viscosity, thermal conduction, and heat addition - and is
hence considering adiabatic processes only, one can deduce

∂t S + v∂x S = 0 , (6.12)

so that the flow is isentropic: the entropy of a gas parcel is merely advected with the
flow velocity. Note that Eq. (6.12) is also not in conservation form since generally
v(x, t). It does express that in the (x, t) plane, the entropy is constant along curves
dt = v. Using equation (6.12), along these curves dt = v we can deduce the
dx dx

so-called characteristic equation

dp − cs2 dρ = 0 , (6.13)

where dp = (∂t p) dt + (∂x p) dx and cs2 = γp/ρ. The velocity


s
∂p
cs = (6.14)
∂ ρ |S

is the sound speed, where the partial derivative is taken at constant entropy. The
flow speed v will be shown to correspond to one of the characteristic speeds for
the Euler system, and equation (6.12) identifies S as a Riemann invariant along the
characteristic curves dx
dt = v.
From the system (6.11) exploiting primitive variables V, one can deduce
1
∂t v + (v ± cs ) ∂x v ± √ (∂t p + (v ± cs )∂x p) = 0. (6.15)
γpρ

γp
q
Using cs = ρ and under constant entropy S = pρ−γ , we then find

2cs 2cs
! !
∂t v ± + (v ± cs ) ∂x v ± = 0. (6.16)
γ−1 γ−1
6 6 Euler equations

This implies that in the (x, t) plane, along curves where dx dt = v − cs , we have the
2cs 2cs
Riemann invariant v − γ−1 . Similarly, for curves dx
dt = v + cs , the invariant is v + γ−1 .
In analogy with the characteristic equation (6.13), the Euler system can hence be
reformulated in three characteristic equations, namely

dp − ρcs dv = 0 along dx
dt = v − cs
dp − cs2 dρ = 0 along dx
dt =v . (6.17)
dp + ρcs dv = 0 along dx
dt = v + cs

These equations form the basis for simulating 1D Euler flow solutions in (x, t)-space,
using the so-called ‘method of characteristics’. This method considers the initial
value problem with a given ρ(x, t = 0), v(x, t = 0) and p(x, t = 0) as data to be traced
along the characteristics into the (x, t > 0) halfspace. In modern multidimensional
Euler solvers, these relations enter in more advanced, characteristic-based solvers,
which we will discuss in section 6.7.

6.3.2 Hyperbolicity of the Euler equations

The Euler system exploiting the conservative variables U from Eq. (6.9) can be
written as ∂t U + ∂x (F(U)) = 0 when we introduce the flux vector

m
*. m2 3−γ
F(U) = .. ρ 2 + (γ − 1)e /// .
+
(6.18)
em
γ − γ−1 m3
, ρ 2 ρ2 -
When we use the flux Jacobian matrix
0 1 0
∂F *. m2 γ−3 m
− γ) γ − 1 // ,
+
≡ FU = .. ρ2 2 ρ (3 (6.19)
∂U 3 2

γ) 32 m mγ
/
−γ ρ2 + (γ − 1) m
em
ρ3 ρ + (1 − ρ2 ρ -
,
we can write the system in quasilinear form as

Ut + FU Ux = 0. (6.20)

In analogy with the linear hyperbolic system discussed in Chapter ??, or with the
nonlinear isothermal hydro system analysed in section ??, we can compute the
eigenvalues and the right eigenvectors of the flux Jacobian matrix to find
γp
q
• eigenvalue λ 1 = mρ − ρ = v − cs with right eigenvector
6.3 1D compressible gas dynamics 7

1 1
r1 = .. v − cs = cs +/ , (6.21)
* +/ *
. v −
v2 cs2
/
s
, 2 + γ−1 − vcs - , h − vcs -
• eigenvalue λ 2 = m
ρ = v with right eigenvector

1
r2 = .. v /, (6.22)
* +/
v2
, 2 -
γp
q
• eigenvalue λ 3 = m
ρ + ρ = v + cs with right eigenvector

1 1
r3 = ..
* v + cs =
+/ *
. v + cs +/ . (6.23)
2 2 /
, 2 + γ−1 + vcs - , h + vcs -
v c s s

Because cs > 0, the three eigenvalues are always distinct and the Euler system
is strictly hyperbolic. We can therefore anticipate that, similar to a 3 × 3 linear
hyperbolic system, when two constant states are joined discontinuously to set up an
initial Riemann problem, up to three characteristic waves will emerge. Summarizing,
we find that the 1D Euler system has three physical speeds that matter, namely the
local gas velocity v, and those associated with sound waves that travel either forward
(v + cs ) or backward (v − cs ) with respect to this local speed. A dimensionless
measure of the local speed is then the local Mach number M = v/cs .

6.3.3 Relating characteristic, primitive and conservative forms∗∗

Now that we have analytic expressions for the eigenvalue/eigenvector pairs of the
flux Jacobian matrix, we can introduce the matrix R = (r1 | r2 | r3 ). These collect
the right eigenvectors in its columns. We could instead work out the left eigenvectors
lq of the matrix FU , normalized to be orthonormal to r p . The latter property means
that they are then given by the rows of the inverse matrix
1 γ−1
   
*. + 4
v
c s
2 + (γ − 1) v
c s
− 2 c s
1 + (γ − 1) v
c s 2 cs2 +/
γ−1 v 2
R =.
−1 . 1 − 2 c2 (γ − 1) c2
v
−(γ − 1) c12 // . (6.24)
s s s /
. v  1 γ−1
  
− 2 − (γ − 1) cs + 2 cs 1 − (γ − 1) cs
v v
, 4 cs 2 cs2 -
The eigenvalues λ p can also be deduced directly from the Euler system (6.11) written
in terms of the primitive variables V. Start by writing (6.11) as

Vt + W Vx = 0, (6.25)
8 6 Euler equations

and (6.20) as Ut + FU Ux = 0. Introducing the matrix R whose columns consist of


the right eigenvectors r p of FU and the diagonal matrix Λ from the eigenvalues λ p ,
we have by construction FU R = RΛ, as in the linear hyperbolic case. Defining the
matrix UV from dU = UV dV we conclude again that

FU = UV WUV−1 . (6.26)

It follows directly that W and FU have the same eigenvalues, and their right eigen-
vectors are related by R = UV−1 R, where R is the matrix with the right eigenvectors
R p of W as its columns. Similarly, left eigenvectors Lq of W correspond to the rows
of the matrix R−1 = R−1UV . These matrices are given by

1 1 1 0 − 2 ρcs 2c12 1 0 0
s
1
R = .. − ρs 0 ρs // and R−1 = ... 1 0 − cs2 // and UV = .. v ρ 0 // .
* c c +
* +/ * +
v2 1
2 2
, cs 0 cs - 0 + 2 ρcs 2c12 , 2 ρv γ−1 -
s
(6.27)
, -

There are direct relationships between the Riemann invariants, the characteristic
equations, and the left eigenvectors from either conservative R−1 or primitive R−1
formulations. Introducing the vector R i collecting the Riemann invariants
2 cs
v − γ−1
R = . S // ,
i
(6.28)
*. +
2 cs
, v + γ−1 -
the defining equations for the Riemann invariants (6.12,6.16) can be written as

R ti + ΛR xi = 0. (6.29)

This is equivalent to the characteristic equations (6.17) stating that

l p · dU = L p · dV dx=λ p dt = 0. (6.30)
   
dx=λ p dt

We can note further that


R ti ∝ R−1 Ut = R−1 Vt ,
(6.31)
R xi ∝ R−1 Ux = R−1 Vx .

Exercise
6.2 Instead of the 1D Euler system discussed here, consider the 1.5 dimen-
sional isentropic hydrodynamic system, where the velocity/momentum has
two components (vx , vy ) but where ∂y = 0. This system is given by


 ∂x ρ + ∂x (m x) =0
m2x

 ∂t (m x ) + ∂x ρ + p( ρ) = 0 .

(6.32)


 ∂ (m ) + ∂ m x my
 
=0


 t y x ρ
6.3 1D compressible gas dynamics 9

In the isentropic case, the pressure is given by p = cad ργ with constant ‘entropy’
cad and polytropic index γ. The 1.5 dimensionality reflects the fact that while
we consider two velocity components vx (x, t) and vy (x, t), a translational
invariance ∂y = 0 is assumed in the y direction so that the problem remains
essentially one-dimensional. Compute for this system the flux Jacobian, its
eigenvalues, and its left and right eigenvectors. Derive the governing equation
for the primitive variables V = ( ρ vx vy )T . Verify that the eigenvalues of
the matrix W appearing in this primitive formulation are identical to the
eigenvalues of the flux Jacobian. Compute the right eigenvectors R p and left
eigenvectors Lq for the W matrix. Check the relations between matrices R,
FU , W , R. Compute the Riemann invariants and find that for this system (as
long as γ , 1)
2 cs
vx − γ−1
R i = .. vy /, (6.33)
* +/
2 cs
, v x + γ−1 -
q
with cs = dp dρ . For the isothermal case for which γ = 1, what are the Riemann
invariants then?

6.3.4 Euler system and Rankine-Hugoniot

The Euler system allows for discontinuous solutions where a constant left state
Ul = ( ρl ml el )T is separated from a constant right state Ur = ( ρr mr er )T by specific
jumps in the conserved quantities at a location which travels at a ‘shock speed’ s. Such
a traveling discontinuity must still obey the discrete equivalent of the conservation
laws, expressed by the Rankine-Hugoniot relations F(Ul ) − F(Ur ) = s (Ul − Ur ),
hence


  2   2 ml − mr = s( ρl − ρr )
ml 3−γ mr 3−γ

 ρl 2 + (γ − 1)el − ρr 2 + (γ − 1)er = s(ml − mr )


(6.34)

3
γ−1 m3r
   
el ml γ−1 ml

γ er mr
γ = s(el − er ).



ρ l
− 2 2
ρl
− ρ r
− 2 2
ρr

Note that for a given right state Ur , this constitutes a system of 3 equations for 4
unknowns, namely s and Ul . In particular, a contact discontinuity which travels at the
fluid velocity s = v (corresponding to the characteristic speed λ 2 ) and only carries
an arbitrary jump in density ρl , ρr , while having constant velocity vl = vr = v
and constant pressure pl = pr = p, is a viable solution to the Rankine-Hugoniot
relations. This contact discontinuity is seen to have an entropy/temperature/density
jump, advected with the local fluid velocity. Hence, the numerical treatment of these
contact discontinuities in gas dynamic simulations already calls for a scheme which
10 6 Euler equations

appropriately deals with advection problems of discontinuous profiles. Note that this
contact discontinuity was not a solution to the Rankine-Hugoniot relations in the
isothermal/polytropic hydro set, because their pressure relates directly to density,
and a jump in density then corresponds to an unbalanced pressure force. For the full
Euler system, this new contact discontinuity ingredient enriches the solution to the
Riemann problem, as we will see.
Apart from the contact discontinuities, genuine shock solutions are also obtained
from the relations (6.34). We here denote the sound speed for the left and right state
with cl and cr , respectively. Analyzing these relations for the case of a stationary
shock where s = 0, we find ml = mr and

vl2 cl2 vr2 c2 γ+1 2


+ = + r = c . (6.35)
2 γ−1 2 γ − 1 2(γ − 1) s∗
The last equality is for the fiducial sonic point where v = cs∗ . The Prandtl-Meyer
2 = v v , expressing that a stationary shock separates a
relation follows then as cs∗ l r
super- from a subsonic state (w.r.t. cs∗ ). If we introduce the Mach number Ml = cvll ,
we find relations between the left and right primitive variables depending on Ml and
γ only. Indeed, we get

vl (γ + 1)Ml2
= ,
vr (γ − 1)Ml2 + 2
ρl (γ − 1)Ml2 + 2
= ,
ρr (γ + 1)Ml2
pl γ+1
= . (6.36)
pr 1 − γ + 2γ Ml2

The maximal compression ratio ρr /ρl for a very strong shock Ml → ∞ is then seen
to reach (γ + 1)/(γ − 1) = 4 for γ = 5/3.
For a moving shock, we use a Galilean transformation of the above relations, which
γ+1
leaves all thermodynamic quantities unchanged. Introducing α = γ−1 and P = pprl ,
the two parameters for a moving shock are P and the shock speed s (together with
γ and hence α). The relations for the primitive variables across the moving shock
(assuming vr − s , 0 thus excluding the contact discontinuity) are then
vl − s α+P ρr
= = , (6.37)
vr − s αP + 1 ρl

γ+1
" !#
pr
(s − vl ) 2 = cl2 1 + −1 . (6.38)
2γ pl
Note in particular that when the pressure ratio pr /pl is close to unity (weak shock), we
find that the shock speed will be s = vl ± cl , in correspondence with the characteristic
speeds λ 1 , λ 3 . Further discussions of these gas dynamic shock relations can be found
in many books, e.g. in [1] and [2].
6.3 1D compressible gas dynamics 11

6.3.5 The Riemann problem for Euler

As already encountered in the case of the scalar Burgers equation in chapter ??,
not all shock solutions obeying the Rankine-Hugoniot relations (6.34) are physically
admissable. We can analyze the possibility for continuously varying rarefaction
wave solutions where U(x, t) = U(x/t) ≡ U(ξ) as follows. From the quasilinear
form (6.20), we deduce that for such self-similar solutions,
dρ dρ
∂F *. ddξm +/ * dξ +
/= ξ ... ddξm /// . (6.39)
∂U . ddξe /
.
de
, dξ - , dξ -
We write this in shorthand notation as

FU U0 = ξU0 . (6.40)

This expression means that ξ must be an eigenvalue λ p of the flux Jacobian FU ,


and that U0 (with the prime indicating the derivative with respect to ξ) must be
proportional to the corresponding right eigenvector r p . Hence

ξ = λ p (U(ξ)) and U0 = α(ξ)r p (U(ξ)). (6.41)

Differentiating the first expression with respect to ξ we find

∂λ p dρ ∂λ p dm ∂λ p de  
1= + + = ∇U λ p · U 0 (6.42)
∂ ρ dξ ∂m dξ ∂e dξ

Using the correspondence between U0 and r p , the proportionality constant α(ξ) is


found from
1
α(ξ) =   . (6.43)
∇U λ p · r p
We determined the possible values λ p for the Euler system to be v ± cs and v, and
their right eigenvectors in (6.21,6.22,6.23). One can verify that the construction to
determine α(ξ) fails for λ 2 = v, since

(∇U λ 2 ) · r2 = 0. (6.44)

This indicates that the second characteristic wave family is ‘linearly degenerate’, and
only has the discontinuous ‘contact discontinuity’ solution. For the first and third
wave family, rarefaction solutions are possible.

Exercise
6.3 Consider again the 1.5 dimensional isentropic hydrodynamic system from
Exercise 6.2. Verify that a shear wave representing an arbitrary jump in the
tangential velocity component vy , but without change in density and normal
12 6 Euler equations

velocity vx is a valid solution to the Rankine-Hugoniot relations for this system


with ‘shock speed’ s = vx . Demonstrate further that the second characteristic
wave family related to this shear wave is linearly degenerate.

We now have all ingredients to appreciate the general solution to the Riemann
problem for the Euler system. Out of the contact point of the initial two constant
states Ul and Ur , normally three ‘wave’ signals will emerge separating four constant
states. The two emergent intermediate states Uml and Umr will be connected by
a contact discontinuity traveling at the speed v∗ which is identical for these two
states, as is the intermediate pressure p∗ . The remaining Rankine-Hugoniot relations
connecting the left state Ul with Uml = ( ρml ρml v∗ ρml v∗2 /2 + p∗ /(γ − 1))T via a
‘1-wave’ and Ur with Umr = ( ρmr ρmr v∗ ρmr v∗2 /2 + p∗ /(γ − 1))T via a ‘3-wave’
then mathematically constitute a system with six equations for the six unknowns,
namely (s1, ρml, v∗, p∗, s3, ρmr ) with the shock speeds s1 and s3 . Physically though,
not all shock solutions are allowed. An admissable shock will have the fluid increase
its entropy as the shock passes. Therefore, either one of the ‘1-wave’ or ‘3-wave’
signals can be a rarefaction wave instead. In case the ‘1-wave’ is a rarefaction fan,
we know from the discussion of the Riemann invariants that the entropy S as well
as the quantity v + 2cs /(γ − 1) will remain constant through the rarefaction, and
identical for Ul and Uml . When the ‘3-wave’ is a rarefaction, we conclude that the
entropy S and v − 2cs /(γ − 1) will be the same for Ur and Umr . Schematically,
the Riemann problem for the Euler system leads to the generic solution as sketched
in Fig. 6.2. This figure assumes the particular (but rather typical) case where the
solution consists of a rarefaction wave, a contact discontinuity and a genuine shock.

CD
t
1-rarefaction 2-shock
3-shock

Uml Umr

Ul Ur

x
Fig. 6.2 Schematic solution to the Riemann problem for the Euler system.

The schematic solution in Fig. (6.2) just shows one of the many possible configura-
tions, where the Riemann fan consists of a left-going rarefaction wave, a right-going
6.3 1D compressible gas dynamics 13

contact discontinuity, and a right-going shock. Since the left wave may be a shock,
a rarefaction wave, or be absent, the middle wave may be present or absent, and
the right wave can be a shock, rarefaction wave, or absent, we have in principle
3 × 2 × 3 = 18 different configurations that may result from initial Riemann data. The
sketched outcome in Fig. (6.2) can also be witnessed in actual laboratory setups, that
realize a ‘shock tube’ (see Fig. 6.3): two gases of different densities and pressures that
are initially at rest, and seperated by a membrane. When the membrane is disrupted,
the three wave signals can be identified clearly.

Fig. 6.3 A laboratory setup realizing a ‘shock tube’. From http://www.uni-


pc.gwdg.de/troe/k_luther/shocktube.htm.

6.3.6 Assignment: design your own 1D Riemann solver for Euler

The ‘exact’ solution to the Riemann problem for 1D hydro can be numerically
computed as follows (see also Toro [2], chapter 4). The pressure in the intermediate
region p∗ can be found as the zero of the function

f (p, Ul, Ur ) = f l (p, Ul ) + f r (p, Ur ) + vr − vl .

In this expression, we have


14 6 Euler equations

 " 2
# 12
if p > pk (shock)
 (γ+1)ρ k
(p − pk )


 (γ−1) p
p+ γ+1 k



f k (p, Uk ) = 


 "   γ−1 #
2ck

p 2γ
1 if p ≤ pk (rarefaction).




 γ−1 pk


The velocity in the middle region is then
vl + vr f r (p∗ ) − f l (p∗ )
v∗ = + .
2 2
This zero can be computed using a Newton-Raphson scheme on the function f (p),
with start value e.g. p0 = 0.5(pr + pl ) (better start values may exist, and may need
to be used to avoid the generation of negative pressure values!). Another way to find
the zero is to note that with pmin = min(pl, pr ) and pmax = max(pl, pr ) the signs of
f (pmin ) and f (pmax ) will determine which bracket to use for the zero p∗ : it lies in
[0, pmin ] when f (pmin ) > 0 and f (pmax ) > 0; it is ∈ [pmin, pmax ] when their signs
differ; and p∗ is in [pmax, +∞] when f (pmin ) < 0 and f (pmax ) < 0. These statements
can be made since f (p) can be shown to be a monotonous function of p. There is a
caveat: pressure positivity requires f (0) < 0 leading to
2cl 2cr
+ > vr − vl .
γ−1 γ−1
If this condition is not fulfilled, vacuum will be created (and this case needs special
treatment). Once the initial bracket for the zero is identified, a simple bisection
algorithm can be employed to zoom in on the root of f (p). As always, a root for
a nonlinear function is computed numerically to within a certain accuracy, hence
the quotation marks for denoting this as an ‘exact’ solution. As seen from the above
formula, whether we have a left shock or rarefaction ultimately depends on p∗ > pl
or p∗ < pl , respectively. Similarly, the character of the right nonlinear wave is
determined by which pressure is dominant: p∗ or pr .
With knowledge of Ul , Ur , p∗ and v∗ as well as the nature of the left and right
nonlinear wave, we can then fully compute the solution as function of x at any
time t. It will be a self-similar solution, essentially depending on x/t if the initial
discontinuity is placed at x = 0. For a shock, we need to determine its shock speed (s1
or s3 ), and the density across the shock. These follow both from Rankine Hugoniot,
and in essence use Eqns. (6.37)-(6.38). If we know the signal is a rarefaction, we can
use the knowledge of the generalized Riemann invariants across these continuous
waves to deduce the density (since entropy is constant) in the middle (left or right)
state. The rarefaction wave itself will
p have a tail and head position which are given
by vk ± ck and v∗ ± c∗ where c∗ = γp∗ /ρ∗ . The variation through the rarefaction is
then also found in function of x/t from the knowledge of the Riemann invariants on
the rays x/t = v ± c. In particular, for a left rarefaction one then finds:
6.4 Numerical tests with TVDLF 15
2
2 γ−1 
" # γ−1
x
ρ = ρl + vl − , (6.45)
γ + 1 (γ + 1)cl t
2 γ−1
" #
x
v= cl + vl + , (6.46)
γ+1 2 t

2 γ−1 
" # γ−1
x
p = pl + vl − . (6.47)
γ + 1 (γ + 1)cl t

Deduce these expressions, find the corresponding expressions for the variation
through a right rarefaction, and consecutively write a plotting program which shows
the variation of ρ, v, p and the 3 Riemann invariants R i at any point x in a (finite)
domain [x min, x max ] at any time t, for a Riemann problem with given left and right
state Ul and Ur seperated at the middle of the interval for t = 0. An extra input
parameter is the ratio of specific heats γ, and the number of points used in between
[x min, x max ] to produce the plots.

6.4 Numerical tests with TVDLF

The TVDLF method discussed in Section ?? can be used directly to solve numerically
the spatio-temporal evolution of initial 1D Riemann problems for Euler. The maximal
physical propagation speed to be used in the numerical flux expression given by
Eq. (??) is simply cmax =| v | +cs . Temporal second order accuracy can be obtained
by using a predictor-corrector approach in Eq. (??). Spatial second order accuracy,
together with ensuring the TVD property from section ??, is accomplished by using
the limited linear reconstruction strategy from Eq. (??), and the finite volume method
from section ?? is used throughout, such that we ensure the conservation properties
of the solution at the discrete level, which is important to obtain physically correct
shock speeds, as discussed in section ??. Note that many variations of this TVDLF
method may be exploited as well: we could use e.g. the three-step SSPRK(3,3)
method for the temporal advance, rather than the RK(2,2) predictor-corrector or PC
method, or we may use a different limiter in the linear reconstruction process to go
from cell center to cell edge values, other than the ‘minmod’ choice from Eq. (??).
One could even replace the factor | cmax | which averages the left and right state
before evaluating the maximal speed expression in the flux formula, with a maximum
obtained over of each state separately, i.e.

UL 1 + UR 1  
max * i+ 2 i+ 2 +/ | ⇒ max | cmax (U L ) |, | cmax (U R ) | .
|c i+ 12 i+ 21
(6.48)
2
.
, -
These many possibilities will lead to slightly different outcomes in the discrete
representation of our solution. Of course, our simulations always use fully explicit
time strategies, so we must obey the CFL condition that links our timestep with
16 6 Euler equations

the spatial resolution and the instantaneous solution variation, ensuring that the
numerical domain of dependence encompasses the physical domain of dependence
as illustrated in Fig. ??.

6.4.1 1D Riemann problems

Fig. 6.4 TVDLF solution for the Sod problem (6.49) at t = 0.15. Top panels show density ρ,
velocity v, and pressure p. Note how velocity and pressure remain constant through the contact
discontinuity. The bottom panels plot the Riemann invariants from equation (6.28). Note how the
second and third Riemann invariant stay constant through the leftward going rarefaction wave.

To demonstrate the typical outcome, we perform a series of Riemann problem


calculations for 1D Euler flows using the 2nd order accurate, conservative, TVDLF
discretization. We use 200 grid points on x ∈ [0, 1], typically place the t = 0
discontinuity at x = 0.5, and set the ratio of specific heats γ = 1.4, representing
a diatomic gas like O2 in air, where three translational and two rotational degrees
of freedom are taken into account, hence α dof = 5. Boundary conditions represent
open boundaries ∂x = 0, by continuous extrapolation of the solution into the two
ghost cells (on each side). Various tests that follow are taken as in Wesseling [1],
6.4 Numerical tests with TVDLF 17

Chapter 10. We refer to that handbook for exact solutions to the Riemann problems
considered below, but encourage the reader to use a self-coded Riemann solver to
generate the exact solutions, as described in the assignment from section 6.3.6.

Fig. 6.5 TVDLF solution for the Lax problem at t = 0.15. Top panels show density ρ, velocity v,
and pressure p. Note how velocity and pressure remain constant through the contact discontinuity.
The bottom panels plot the Riemann invariants from equation (6.28). Note how the second and
third Riemann invariant stay constant through the leftward going rarefaction wave.

The classical ‘Sod’ problem is a ‘shock tube problem’: the sudden removal of a
diaphragm separating 2 gases at rest. This Riemann problem takes

Vl = ( ρl, vl, pl )T = (1, 0, 1)T and Vr = (0.125, 0, 0.1)T (6.49)

Figure 6.4 shows the numerical solution2 at t = 0.15. We clearly identify a left-
ward traveling rarefaction wave, a rightward traveling contact discontinuity, and a
rightward traveling shock. Note how through the rarefaction wave the two Riemann
invariants S and v + 2cs /(γ − 1) remain constant, while v and p are constant across
the contact discontinuity. The shock is resolved over a few discrete cells, but the
contact discontinuity is spread over (too) many cells. Slight under/overshoot errors

2 See [1], Fig. 10.2 for the exact solution, where ENTROPY indicates ln S.
18 6 Euler equations

can be detected in some variables, which are influenced by the precise choice of the
limiters (‘minmod’ here).
Similar conclusions can be drawn from a test case from Lax, where two states in
relative motion are considered. Taking an initial rightwardly moving left state, with
Vl = ( ρl, vl, pl )T = (0.445, 0.698, 3.528)T and Vr = (0.5, 0, 0.571)T , the solution
at t = 0.15 is given in Figure 6.5, to be compared with [1], his Fig. 10.3.

Fig. 6.6 TVDLF solution for the Mach 3 problem (6.50) at t = 0.09. Top panels show density
ρ, velocity v, and pressure p. Note that velocity and pressure should remain constant through the
contact discontinuity. The bottom panels plot the local Mach number M = v/c, and the second and
third Riemann invariants from equation (6.28). Note how the second and third Riemann invariant
stay constant through the leftward going rarefaction wave, but clearly show overshoots at the contact
discontinuity.

Both the Sod and Lax test cases remain subsonic as M = v/c < 1. Supersonic
flows are considered in a Mach 3 test from Arora and Roe, with

Vl = ( ρl, vl, pl )T = (3.857, 0.92, 10.333)T and Vr = (1, 3.55, 1)T . (6.50)

The obtained solution at t = 0.09 in Figure 6.6 shows how the contact discontinuity
is rather poorly resolved, with pronounced overshoots in the Riemann invariants.
Note also that the most rightward signal is a shock which is spread over many grid
points. The exact solution is in [1], Fig. 10.4.
6.4 Numerical tests with TVDLF 19

Fig. 6.7 TVDLF solution for the supersonic shock tube problem at t = 0.1562. Top panels show
density ρ, velocity v, and pressure p. Note that velocity and pressure remain constant through the
contact discontinuity. The bottom panels plot the local Mach number M = v/c, and the second and
third Riemann invariants from equation (6.28). Note how the second and third Riemann invariant
stay constant through the leftward going rarefaction wave.

A somewhat better behavior is found for a supersonic shock tube problem taking
Vl = ( ρl, vl, pl )T = (8, 0, 8)T and Vr = (0.2, 0, 0.2)T . The solution at t = 0.1562
depicted in Figure 6.7 also contains a strong transonic rarefaction wave, and suffers
from much less spurious overshoots. [See [1], Fig. 10.8 for exact solution].
In all but the Mach 3 test, the shock was rather well captured numerically: only few
cells are needed to resolve that discontinuity (in contrast to the contact discontinuity).
The TVDLF scheme may behave rather diffusive for slowly moving weak shocks as
well. The solution at time t = 0.175 of a problem taking

Vl = ( ρl, vl, pl )T = (1, −1, 1)T and Vr = (0.9275, −1.0781, 0.9)T (6.51)

is given in Figure 6.8. Note how (too) many cells are needed to represent the slowly
rightward moving weak shock (at right). [See [1], Fig. 10.15 for exact solution].
The diffusion of a contact discontinuity by the TVDLF scheme is most obvious
when a stationary contact discontinuity, i.e. an exact solution to the Euler system, is
solved numerically. Setting Vl = ( ρl, vl, pl )T = (1, 0, 0.5)T and Vr = (0.6, 0, 0.5)T ,
20 6 Euler equations

Fig. 6.8 TVDLF solution for the slowly moving weak shock problem (6.51) at t = 0.175. Top
panels show density ρ, velocity v, and pressure p. The rightmost signal (at x ≈ 0.5) is a shock,
which is particularly smeared over many grid cells. The bottom panels plot the local Mach number
M = v/c, and the second and third Riemann invariants from equation (6.28).

the TVDLF result at times t = 0.1 and t = 1 is compared to the exact t = 0 solution in
Figure 6.9. As time progresses, increasingly (too) many cells are needed to represent
the contact discontinuity.
On the positive side, the TVDLF scheme does well for more continuous
(transonic) flows, and recognizes rarefaction waves. Indeed, when we start with
two states with the same entropy, as Vl = ( ρl, vl, pl )T = (1, −3, 10)T and
Vr = (0.87469, −2.46537, 8)T , where γ = 5/3, a single rarefaction wave emerges.
This problem is taken from Falle [3]. The solution shown in Figure 6.10 took 800
cells from [0, 800] and shows the velocity v at times t = 0 and t = 40 and t = 80.
The leftward rarefaction wave is nicely recovered numerically.
The outcome of a 1D Euler Riemann problem can occasionally contain two
rarefactions, or two shocks for both the ‘1-wave’ and the ‘3-wave’ signal. A rather
severe numerical test that leads to two strong rarefaction fans is set up by creating a
central evacuation as follows

Vl = ( ρl, vl, pl )T = (1, −2, 0.4)T and Vr = (1, 2, 0.4)T . (6.52)


6.4 Numerical tests with TVDLF 21

Fig. 6.9 TVDLF solution for a stationary contact discontinuity, at t = 0 (left) and t = 0.1 and
t = 1 (right). The exact solution should maintain the discontinuous density profile from t = 0 at
left.

Fig. 6.10 TVDLF solution for a rarefaction wave, seen in velocity v at t = 0, 40 and 80.

By taking the same left and right thermodynamic conditions, and artificially reversing
the velocity discontinuously, this test will lead to two rarefactions separated by a zero
velocity, near ‘vacuum’ state. [This is Test 2 in Toro [2], Chapter 10, p.329]. In fact,
when the initial separating velocities would be raised even higher, eventually a true
vacuum state would be formed. The rarefactions resulting from (6.52) go transonic,
and the numerical result for TVDLF is shown in Figure 6.11 at t = 0.15. Note that the
entropy quantifies the numerical error directly: it should remain constant throughout
but instead shows O(1) variation! Also, the other Riemann invariants clearly show
erroneous variations. The middle constant state should have zero velocity, and the
22 6 Euler equations

largest errors seem correlated with the position of the sonic point (where v = c) in
both rarefactions.

Fig. 6.11 TVDLF solution at t = 0.15 for a Riemann problem given by (6.52) leading to two
rarefaction waves. Top panels show density, velocity and pressure, bottom panels the three Riemann
invariants from (6.28). Note the error in the entropy - which should remain constant throughout -
and in both other Riemann invariants. The central region should remain at rest (v = 0) and contain
a near-vacuum state.

A Riemann problem that leads to the creation of two shocks is given by

Vl = ( ρl, vl, pl )T = (5.99924, 19.5975, 460.894)T


and
Vr = (5.99242, −6.19633, 46.0950)T . (6.53)

[This is Test 4 in Toro [2], Chapter 10, p.329]. The TVDLF result at t = 0.035 is
given in Figure 6.12. Both shocks are well captured, the left shock needing more grid
points due to its slow movement. The contact discontinuity is significantly smeared.
6.4 Numerical tests with TVDLF 23

Fig. 6.12 TVDLF solution at t = 0.035 for a Riemann problem given by (6.53) leading to two
shock waves separated by a contact discontinuity. Top panels show density, velocity and pressure,
bottom panels the three Riemann invariants from (6.28).

6.4.2 2D Riemann problems

In this section, we extend our TVDLF simulations to handle 2D Riemann problems.


The first example revisits the 1D Sod shock tube problem from Fig. 6.4, but this time
solves this 1D Riemann problem on a 2D polar grid. This illustrates the handling
of curvilinear orthogonal grids as discussed in the previous chapter ??, as well as
the use of π-periodic boundary conditions to handle the pole in our circular domain
as shown in Fig. ??. We solve the problem in (r, ϕ) polar coordinates and use
the corresponding polar vector components for the momentum representation. The
initial condition is taken from the classical Sod problem, where γ = 1.4 and the
1D Euler Riemann problem has static left and right states, with ( ρl, pl ) = (1, 1)
and ( ρr , pr ) = (0.125, 0.1) respectively. We take a circle of radius 2, and place the
discontinuity as a straight line at x = −0.5 (where x = r cos(ϕ)). The solution is
shown at t = 0.4, in Fig. 6.13. At that point, the rightward going shock has traveled
across the pole of the circular domain, demonstrating the correct handling of the
singular r = 0 boundary by the π-periodic boundary conditions.
24 6 Euler equations

Fig. 6.13 An essentially 1D shocktube test performed in polar coordinates on a circular domain.
At final time t = 0.4, we show the density in a grayscale view on the (r, ϕ) coordinate plane, and a
cut along the middle of the grid, clearly identifying the leftward rarefaction, contact discontinuity
and rightward shock. From [4].

The result shown in Fig. 6.13, shows a contour view on density in the (r, ϕ) plane
at the end of the run. At the far r = 2 boundary, we continuously extrapolate the
Cartesian x-component of momentum along the radial direction, as computed from
the polar vector components, while the y-component is set to zero. This reflects the
1D nature of the simulated shock tube. The horizontal cut at t = 0.4 shows that the
simulation correctly recovers the solution to this Riemann problem. Note that at the
time shown, the rightward going shock has already crossed the singular point r = 0
without distortion of the straight shock front.
In analogy to the 2D Riemann problems for the isothermal hydro set from Ta-
ble ?? in chapter ??, we perform selected test cases from [5] (A, B, C and D are
configurations 3, 6, 17 and 13 from that paper, respectively). The initial conditions
are given in table 6.1, in terms of the density, in-plane velocity components, and
pressure. The tests are run up to time t = 0.3, always adopt γ = 1.4, and we per-
form a 10242 uniform grid simulation that uses a predictor-corrector timestepping, a
TVDLF flux computation, and a minmod limited linear reconstruction. The density
is plotted at the endtime for the three cases in Fig. 6.14. At the end of this chapter, the
same tests are simulated at higher resolution, and with a more accurate combination
of schemes, and Fig. 6.14 can be contrasted directly with Fig. 6.22.
6.5 Sound waves 25

Fig. 6.14 2D Riemann problems, simulated at 10242 resolution, using a twostep TVDLF scheme
with minmod reconstruction. We show the density at time t = 0.3.

6.5 Sound waves

6.5.1 Linear sound wave theory

Closed form, analytic solutions to the Euler equations are difficult to obtain in general,
since they represent a set of nonlinear PDEs, allowing even discontinuous variations,
as in shocks and at contact discontinuities. However, as done in Chapter ?? for the
isothermal hydro set, we may linearize the PDEs, and only look for small deviations
about a static and uniform gas with pressure p = p0 , density ρ = ρ0 and zero
velocity v0 = 0. This means we write ρ(x, t) = ρ0 + ρ1 (x, t) where ρ1  ρ0 , and
then systematically throw away terms of second order in ρ1 , p1 , v1 .
This is easily done for the Euler equations written in terms of density ρ, velocity
v, and pressure p as
26 6 Euler equations

Table 6.1 Initial conditions for 2D hydro Riemann tests.


Case A ρ vx vy p
top left 0.5323 1.206 0 0.3
top right 1.5 0 0 1.5
bottom left 0.138 1.206 1.206 0.029
bottom right 0.5323 0 1.206 0.3
Case B ρ vx vy p
top left 2 0.75 0.5 1
top right 1 0.75 -0.5 1
bottom left 1 -0.75 0.5 1
bottom right 3.0 -0.75 -0.5 1
Case C ρ vx vy p
top left 2 0 -0.3 1
top right 1 0 -0.4 1
bottom left 1.0625 0 0.2145 0.4
bottom right 0.5197 0 -1.1259 0.4
Case D ρ vx vy p
top left 2 0 0.3 1
top right 1 0 -0.3 1
bottom left 1.0625 0 0.8145 0.4
bottom right 0.5313 0 0.4276 0.4

∂t ρ + ∇ · (vρ) = 0
ρ (∂t v + v · ∇v) + ∇p = 0
∂t p + v · ∇p + γp∇ · v = 0 ,

which become in linearized form

∂t ρ1 + ρ0 ∇ · v1 = 0
ρ0 ∂t v1 + ∇p1 = 0
∂t p1 + γp0 ∇ · v1 = 0 .

We can easily combine the (in general five) equations to one for v1 to get

∂ 2 v1
− c02 ∇∇ · v1 = 0 , (6.54)
∂t 2
where we introduced the squared sound speed for the uniform medium c02 = γp0 /ρ0 .
This is clearly a (hyperbolic) wave equation for sound waves, and in 1D where
v1 = v1x êx , it reduces to
∂ 2 v1x 2
2 ∂ v1x
− c0 = 0. (6.55)
∂t 2 ∂ x2
In 3D, as the uniform medium has no preferred direction, we can use a Fourier
representation in terms of plane waves where
X
v1 (x, t) = v̂k ei(k·x−ωt) . (6.56)
k
6.5 Sound waves 27

The wave equation then becomes algebraic since ∂t → −iω and ∇ → ik, and we
obtain
ω2 I − c02 kk · v̂k = 0 .
f g
(6.57)
For the uniform medium, we are free to choose the coordinates such that k = k êz ,
hence we get
(ω2 − k 2 c02 ) v̂z = 0 . (6.58)
This shows that nontrivial solutions must obey the dispersion relation

ω = ±kc0 , (6.59)

where the ± again indicates the right/left travelling sound waves. These linear sound
waves are compressible since ∇ · v1 , 0.

Fig. 6.15 Stationary (top left), subsonic (bottom left) versus sonic (top right) and su-
personic (bottom right) moving sound source, and its emitted sound wavefronts. From
https://commons.wikimedia.org/wiki/File:Explanation_of_Sonic_Motion.png.

From the dispersion relation, we can identify both the phase speed diagram, as
well as the group speed diagram. The phase diagram plots v ph = (ω/k)n for all
directions n = k/k at once, hence taking n = (cos ϑ, sin ϑ) for angles ϑ ∈ [0, 2π]. In
this hydrodynamic case, this obviously leads to a circle of radius c0 , since v ph = c0 n.
The group diagram plots instead ∂ω/∂k for all ϑ ∈ [0, 2π], and in essence gives
the solution to an initial value problem where a single location (the origin) acts as
a (spatio-temporally) localized point source. Now for the hydro equations, since the
dispersion relation sets ω2 = k 2 c02 and ∂k 2 /∂k = 2k we get
28 6 Euler equations

∂ω
vgr = = c0 n . (6.60)
∂k
This group diagram is thus the very same circle (sphere) as the phase diagram, and
the difference between phase and group diagrams seems irrelevant. This will not be
the case in general, as will become clear in magnetohydrodynamics.

Fig. 6.16 The Mach cone formation, illustrated above [from


https://commons.wikimedia.org/wiki/File:Transonico-en.svg], and
as witnessed for actual supersonic jet fighters [NASA image from
nasa.gov/centers/armstrong/features/supersonic-shockwave-interaction.html].

The group diagram does tell you how a sudden, localized pressure/density pertur-
bation leads to a spherically outgoing wavefront, and this is an experience familiar
from our everyday life. If a point source that continuously emits sound happens to be
traveling, the difference between subsonic and supersonic motion of a moving source
of sound is then appreciated from Fig. 6.15. This also leads to the familiar Doppler
6.6 Approximate Riemann solvers 29

effect. This schematic introduces the Mach cone (its opening angle is denoted by µ
on the figure), which is the sharply defined shock region bounding the envelope of
all emitted sound waves by a supersonically moving object. The same is illustrated
for the case of a jet plane, where it leads to the sonic boom effect. In Fig. 6.16, top
panels, this is done schematically once more, and constrasted to a real life situation:
the bottom panel is a NASA image of the many shocks induced by two supersonically
traveling jets.

6.5.2 TVDLF and driven sound waves

We can of couse easily perform numerical simulations that consider sound wave
propagation. In that context, we note that the diffusive nature of TVDLF makes this
scheme not optimally suited to study pure linear wave dynamics. The scheme is
instead designed to capture shock transitions fairly well.
To illustrate this statement, we simulate linear sound waves by implementing a
time dependent driver v = A sin (2πt/P) at x = 0 in the ghost cells of a 1D problem
setup. When we start from the uniform state where ρ(t = 0) = 1, v(t = 0) = 0,
p(t = 0) = 0.6 with γ = 5/3, taking A = 0.02 with P = 1 generates sound
waves (of amplitude 0.01) which travel a unit distance in unit time. Figure 6.17
compares TVDLF results at t = 4 for 100 versus 400 grid points on the domain
[0, 5]. Obviously, the wave ‘damping’ is purely numerical, and we conclude that a
high resolution (already in 1D) is needed to battle the numerical diffusion. This must
be kept in mind when detailed linear wave interactions are of interest.
On the other hand, repeating the simulation with an amplitude A = 0.2, the
nonlinear sound wave steepening and shock formation is well captured, as seen in
Figure 6.18. Note how 10 % variations already imply significant nonlinear effects,
such that the ability of shock-capturing schemes are really desirable. In summary,
besides some clear shortcomings, the TVDLF method is rather reliable and can be
used succesfully on many shock-dominated 1D and multi-dimensional problems.

6.6 Approximate Riemann solvers

So far, we emphasized that the 1D (or even multi-D) nonlinear Euler equations can
be solved numerically using the TVDLF scheme discussed in section ??, where we
presented it as a robust, general scheme applicable to any hyperbolic system, which
ensures the TVD property (at least for a nonlinear scalar PDE in 1D) and hence
behaves as a monotonicity-preserving scheme. In the finite volume approach for a
1D Cartesian grid with (possibly non-uniform) grid spacings ∆x i and cell-averages
Ūi , it is a conservative scheme since we discretize ∂t U + ∇ · F(U) = 0 as
1
∂t Ūi + Fi+1/2 − Fi−1/2 = 0 , (6.61)

∆x i
30 6 Euler equations

Fig. 6.17 TVDLF solution for linear sound waves at 100 versus 400 grid points.

Fig. 6.18 TVDLF solution for nonlinear sound wave driving at 400 grid points.

employing flux evaluations on cell-interfaces denoted by Fi±1/2 . We explained that


we can ensure a second-order accuracy when we e.g. employ a predictor-corrector
approach for temporal advance, and introduce a slope limited linear reconstruction to
L, R
go from cell center to (left and right) cell edge evaluations of Ui±1/2 . As usual for any
explicit scheme, the CFL condition links the maximal allowed ∆t with (the minimal)
∆x i , and the basic flux expression for TVDLF (also called local-Lax-Friedrichs or
6.6 Approximate Riemann solvers 31

Rusanov scheme) is

UL 1 + UR 1
1
  
 F(U 1 ) + F(U 1 )− | c ( i+ 2
max i+ 2
 
= L R R L
1  .
 
Fi+ 1 ) | U 1 − U 
2 2 
 i+ 2 i+ 2 2 i+ 2 i+ 2 

(6.62)
 
The cmax denotes the maximal physical propagation speed for the system at hand,
which for 1D HD makes cmax = |vx | + cs . The original Rusanov [6] variant was
only first order accurate, which simplifies the scheme dramatically. Such a first
order variant can use a forward Euler temporal discretization instead of a two-step
PC method, and does not need any (slope-limited) linear reconstruction, so it just
assigns U L = Ūi+1 while UR = Ūi . This makes the scheme even more diffusive than
TVDLF, but will otherwise remain conservative, monotonicity preserving, and the
solution will eventually converge to the correct weak solution, possibly containing
(smeared out representations of) discontinuities.

Exercise
6.4 Implement a first order variant of a 1D Euler solver using the TVDLF
scheme. You will need to think about the essential parts of an actual simulation
and how to organize them practically. These are:
• Choose a domain x ∈ [a, b] with real numbers a < b, and generate a
uniform grid with N cells of equal size ∆x. Already account for the fact
that you will use additional ‘ghost cells’ on either side, that will extend
beyond the [a, b] range, to easily handle boundary conditions. How many
ghost cells do you need for the first order TVDLF scheme?
• Allow a subroutine that initializes ρ(x, t = 0), v(x, t = 0) and p(x, t = 0),
but be aware that you will employ the conservative variables ρ, m, and e
for your computations. Allow for a user-set ratio of specific heats γ, which
should default to 5/3.
• The method itself will need to evaluate the physical fluxes F and the maximal
physical propagation speed cmax . This is the only part that actually depends
on the equations to solve, so it is best to isolate this in generic subroutines.
• The code should integrate the numerical solution up to a prechosen time
t end . You must repeatedly take a single timestep ∆t, and advance the solution
by one timestep. In that loop, you may want to allow for the possibility to
save the solution every (so many) timesteps, for later visualization. You
should also, at the beginning of each time step, ensure that the ∆t is in
accord with the instantaneous CFL condition over the entire interval. This
CFL condition again features the cmax speed, so try not to duplicate code.
• The boundary conditions must be imposed prior to every time step advance.
Just code up zero-gradient Neumann boundary conditions, which copies the
values of the closest interior grid cell into the ghost cell(s).
You can then compare the numerical results against the second order TVDLF
solutions for the Riemann problems discussed above. You can verify how your
32 6 Euler equations

solver behaves when increasing the resolution N. You can also use your exact
Riemann solver from the assignment in section 6.3.6, to compare and validate
the outcome.

The diffusive nature of the TVDLF scheme (which gets worse in a first order
variant) was already clear from our discussion of 1D Riemann problems, where it
unavoidably diffuses contact discontinuities, and may need excessive numbers of grid
cells to represent (slowly moving) shocks. The reason should be obvious: in reality,
both the first and second order variant of TVDLF encounter Riemann problems at
every cell edge, represented by the local Ui+1/2
L and Ui+1/2
R data. We know that the
actual solution to the Riemann problem will behave self-similar, where up to three
wave signals emerge, at every such cell interface. TVDLF does not really incorporate
any aspect of the Riemann problem outcome, and makes a correspondingly ‘poor’
approximation to the (time-averaged) flux across the cell faces, which we should
use. This is illustrated in Fig. 6.19, where a schematic outcome of the Riemann
problem in (x, t) space is contrasted with the TVDLF approximation. Fig. 6.19

CD t
t c max c max
1-rarefaction 2-shock
3-shock

Uml Umr

Ul Ur Ul Ur

x x

Fig. 6.19 The (x, t) view on the Riemann problem (left), and the TVDLF proxy (right).

suggests that TVDLF only knowns about the largest physical speed (could be either
left or right-going one) from the Riemann outcome, and subsequently employs a
flux that does not care about the possibly asymmetric orientation of the Riemann
fan with respect to the vertical time axis. In particular, TVDLF ignores that a real
flux as based on the Riemann problem solution should distinguish between various
cases illustrated in Fig. 6.20. The flux along the time axis must thus in reality be
based on the state that corresponds to this position, and this is hence purely the left
state in the top right panel, some intermediate state in the two left cases, or purely
the right state in the bottom right panel of Fig. 6.20. None of these considerations
is incorporated in the TVDLF approach. In what follows, we will discuss various
modern high resolution, shock-capturing schemes for Euler that in increasingly
sophisticated manner capitalize on the known solution of the (nonlinear) Riemann
problem.
6.6 Approximate Riemann solvers 33
t t

U ml U mr

Ul Ur
Ul U
r

x x
t t

Ul Ur Ur
Ul
x x

Fig. 6.20 The (x, t) view on the Riemann problem can show large left-right asymmetry, depending
on whether the flow condition is supersonic at left (top right), intermediate, or supersonic for the
right state (bottom right).

6.6.1 The Godunov scheme

As discussed in our assignment 6.3.6, for the 1D Euler problem, one can in principle
solve the Riemann problem exactly, at the expense of computing some nonlinear
iteration to determine the typical intermediate state pressure p∗ and velocity v∗ . This
solution specifies the entire self-similar structure of the Riemann fan, and hence we
can select the unique value that corresponds to the state at the original discontinuity,
to evaluate the flux. This idea was originally developed by Godunov, and is referred
to as the Godunov scheme. It would consider piecewise constant values throughout
the cells (no linear reconstruction), solve the Riemann problem encountered at every
cell interface exactly, use the corresponding flux based on the state along the vertical
time axis in the local Riemann fan, and repeat the process. Since one does not want
to allow for wave interactions within one grid cell, the instantaneous time step is
always restricted to ∆t < 2 max|λ|
∆x
, with λ the largest eigenvalue of the flux Jacobian
max
FU , i.e. our c , where the factor 2 ensures that the Riemann fans from the left
and the right edge of the cell do not overlap within the time step taken. This scheme
is also generally applicable to any system of hyperbolic PDEs, but then requires
the nontrivial handling of an exact nonlinear Riemann solver. Since the scheme
used piecewise constant values to go from cell center to edges, it is only first order
accurate.

6.6.2 Roe scheme

The Godunov scheme discussed above is 1st order accurate, and in general obtaining
the exact solution to the Riemann problem is complicated and needs a numerical
approximation due to its nonlinear nature. Roe’s approximate Riemann solver is then
34 6 Euler equations

based on the observation that one might as well solve the Riemann problem in some
approximate fashion, and in practice use a linearization of the underlying nonlinear
problem. This linearization then features naturally the Flux Jacobian matrix FU ,
evaluated in some suitably averaged state, leading to a computation of its eigenvalues
λ p and right eigenvectors r p . Once these are known, the numerical flux expression
in Roe’s scheme takes the form
1 1X
Fi+1/2 = (F(Ui ) + F(Ui+1 )) − | λ p | α p rp . (6.63)
2 2
This in practice replaces the real solution to the nonlinear Riemann problem, by an
exact solution to a linear Riemann problem, which as we discussed in section ??,
accounts for all characteristic waves and their orientation in the Riemann fan. This is
the basic idea of ‘upwinding’, as the sum in Eq. 6.63 accounts for all characteristic
speeds λ p and the wave directionality. Each wave carries an associated wave strengths
α p , which is to be specified for the system at hand. For the 1D Euler system, a detailed
discussion follows in section 6.7.

6.6.3 HLL and HLLC approximate Riemann solvers

Roe’s scheme may still need ‘fixes’, as it sometimes faces robustness issues which lead
to negative, unphysical pressures p. It in effect replaces the true Riemann problem
solution by one consisting of discontinuities only, which is an exact solution for the
linear system case as discussed in section ??. In the nonlinear case, we saw that either
left or rightgoing wave ingredients can also be continuous rarefaction waves. The
basic idea of the HLL (due to Harten, Lax and van Leer [7]) and HLLC solvers [8]
are to similarly replace the true Riemann fan by one involving discontinuities alone,
without and with allowance of the contact discontinuity, respectively. Some historic
overview is found in [9]. Schematically, they represent the solution of the Riemann
problem locally as in Fig. 6.21. The detailed formula for the fluxes are based on shock-

λ− HLL λ− HLLC
o
λ

Ul*
U* +
λ Ur* λ
+

Ul Ur Ul
Ur
x x

Fig. 6.21 HLL and HLLC local representations of the Riemann fan at every cell interface.

only solutions to the wave ingredients, in accord with Rankine-Hogoniot relations.


6.7 Roe’s approximate Riemann solver∗∗ 35

These scheme do distinguish according to the orientation of their Riemann fan with
respect to the vertical time axis, so one distinguishes three fluxes for HLL, or four
flux prescriptions for HLLC, in accord with the possibilities indicated in Fig. 6.20.
These schemes turn out to be more robust than the Roe method, and especially HLL,
which only needs a left and right-going extremal wave knowledge, can be easily
adopted to more complicated systems of nonlinear hyperbolic PDE character. Note
that for the 1D Euler system, the HLLC solver represents the actual 3-wave Riemann
fan with one left-going shock, one right-going shock, and an intermediate contact
disconituity: it has ‘restored the contact wave’ in the HLL solver. Of course, in
systems without an actual contact discontinuity, like the isothermal/polytropic hydro
set from chapters ??-??, only the HLL solver makes physical sense3.
The 2-wave approximation used in the HLL solver, involves a single intermediate
state U∗ which generalizes the Rankine Hugoniot relation to ensure

F(Ul ) − F(Ur ) = λ − (Ul − U∗ ) + λ + (U∗ − Ur ) , (6.64)

where λ − and λ + are both fastest wave speeds still retained in the Riemann fan
approximation. This method then switches the flux evaluation between F(Ul ) when
λ − ≥ 0, F(Ur ) when λ + ≤ 0, or a weighted flux expression

λ + F(Ul ) − λ − F(Ur ) + λ − λ + (Ur − Ul )


F∗ = , (6.65)
λ+ − λ−
for the case where the intermediate state should apply. Note that F∗ , F(U∗ ). In
practical application, this HLL method has proven to work very similarly to the
TVDLF method, demonstrating minor improvements over the latter. For contact
discontinuities, both methods introduce fairly large diffusion, but at the same time
the schemes are very robust and computationally simple. The HLLC performs better
on contact discontinuities, as it is designed to remedy this aspect in particular.
That the resolution employed, together with the choice of the flux scheme, time
stepping scheme and reconstruction procedure, all play a prominent role in the
details obtained, is illustrated in Fig. 6.22, which is to be contrasted with Fig. 6.14.
The same initial data given in Table 6.1 is now advanced using a SSPRK3 scheme,
an HLLC flux expression, and a more accurate reconstruction procedure, but also
allowing for an effective resolution (using AMR) of 40962 . Many more details due
to small-scale Kelvin-Helmholtz development are seen, as compared to the (lower
resolution) TVDLF results.

6.7 Roe’s approximate Riemann solver∗∗

In what follows, we describe the widely used Roe solver for 1D hydrodynamic
simulations in detail, adapting its discussion in Chapter 10 from Wesseling [1]. As
3 The HLLC can however also handle the intermediate, linearly degenerate shear wave, encountered
in exercise 6.3.
36 6 Euler equations

Fig. 6.22 2D Riemann problems, simulated using AMR at effective resolutions of 40962 , using
a SSPRK3 time stepping, an HLLC flux, and a high order reconstruction (cada3). The density is
shown.

a general procedure to numerically solve the 3 × 3 system ∂t U + ∂x (F(U)) = 0,


one considers again the local Riemann problem obtained from a left and right cell
interface value indicated as Ul and Ur . Instead of using the exact nonlinear solution,
Roe suggested to solve a linear Riemann problem instead, namely

∂t U + A∂x U = 0, A ∈ R3×3, (6.66)

where the constant matrix A = A (Ul, Ur ) must satisfy the conditions


• F(Ul ) − F(Ur ) = A(Ul, Ur ) (Ul − Ur ),
• A(Ul, Ur ) → FU (Ur ) as Ul → Ur ,
• A(Ul, Ur ) has only real eigenvalues,
• A(Ul, Ur ) has a complete system of eigenvectors.
6.7 Roe’s approximate Riemann solver∗∗ 37

These conditions ensure that the exact Riemann problem solution is obtained when
the initial states obey the Rankine-Hugoniot relations, i.e. are separated by a single
shock transition or contact discontinuity. Indeed, when (Ul, Ur ) are such that F(Ul )−
F(Ur ) = s (Ul − Ur ), the first condition ensures that Ul − Ur is an eigenvector of
A with eigenvalue equal to the shock speed s. The solution of the linear Riemann
problem merely maintains this jump at the physically correct shock speed. The
second condition ensures consistency with the original nonlinear equations. The last
two conditions guarantee solvability of the linear Riemann problem.
Provided such a Roe matrix A can be found – if there is one satisfying all Roe
conditions, it can be shown to be unique – the Roe scheme uses the numerical Roe
flux expression at the interface between cells i, i + 1 given by

Fi+1/2 (Ui, Ui+1 ) = Ai+1/2 (Ui, Ui+1 ) Û (0, Ui, Ui+1 ) . (6.67)

In the above expression (6.67), Û indicates the exact solution of the linear Riemann
problem.
Let us write the eigenvalues λ p and right eigenvectors r p of the local Roe matrix
Ai+1/2 (Ui, Ui+1 ), hence
Ai+1/2 r p = λ p r p . (6.68)
More explicit expressions for the Roe flux can then be obtained as follows. As
encountered in the discussion of the linear hyperbolicXsystem, one decomposes
X both
states in terms of the eigenvectors r p , writing Ui = β p r p and Ui+1 = γp rp .
The same decomposition of the difference Ui+1 − Ui then introduces coefficients α p
from X  X
Ui+1 − Ui = γp − βp rp ≡ α p rp . (6.69)
As found from the analytic solution (??) for the Riemann problem for the linear
hyperbolic system [note the change in notation α p → β p and β p → γ p ], the
solution along the (x, t) ray (x − x i+ 1 )/t = 0 is thus
2

X X
Û = βp rp + γp rp . (6.70)
0<λ p 0>λ p

Alternative expressions are


X X
Û = βp rp + (γ p − β p )r p
λ p <0
X (6.71)
= Ui + α p r p,
λ p <0

or similarly X X
Û = γp rp + ( β p − γ p )r p
λ p >0
X (6.72)
= Ui+1 − α p rp .
λ p >0

This is then combined to


38 6 Euler equations

Ui + Ui+1 1  X X 
 
Û = +  −  α p rp . (6.73)
2 2 λ <0 λ >0
 p p 
The Roe flux (6.67) then becomes

1 1  X X 
 
Fi+1/2 = Ai+1/2 Û = Ai+1/2 (Ui + Ui+1 ) +  −  α p Ai+1/2 r p . (6.74)
2 2 λ <0 λ >0

 p p 
As a result of the first Roe condition imposed on the matrix A, and due to the
fact that for the hydrodynamic system we find the (purely) mathematical equality
F(−U) = −F(U), the Roe flux is written as
1 1X
Fi+1/2 = (F(Ui ) + F(Ui+1 )) − | λ p | α p rp . (6.75)
2 2
The solver is then completely determined once the matrix Ai+1/2 that satisfies
the Roe conditions is constructed. For the Euler system, this starts by noting that in
terms of the components of the vector

ρ
√ +
Z = . ρv / ,
* (6.76)
√ s
, ρh -

using the specific enthalpy h s = e+pρ , all components of the vector of conserved
quantities U and of the flux vector F(U) can be written as quadratic functions alone.
One can verify easily that when writing Z = (z1, z2, z3 )T , we find

z1 z1 z1 z2
*. γ+1
U = .. z1 z2 and = + γ−1 z1 z3 // .
* +/ +
F 2γ z 2 z 2 γ
1 γ−1
/ .
, γ z1 z3 + 2γ z2 z2 - , z2 z3 -
It is then possible to compute matrices B and C which have elements linear in
z̄ = 12 (zi + zi+1 ) such that Ui+1 −Ui = B (Zi+1 − Zi ) and Fi+1 −Fi = C (Zi+1 − Zi ).
The matrix Ai+1/2 ≡ C B−1 then satisfies Ai+1/2 (Ui+1 − Ui ) = Fi+1 − Fi , which is
recognized as the first Roe condition.
This procedure leads to the introduction of the so-called Roe-averages for the
velocity and specific enthalpy as
√ √
ρi vi + ρi+1 vi+1
v̄ ≡ √ √ , (6.77)
ρi + ρi+1
√ √
ρi his + ρi+1 hi+1
s
h¯s ≡ √ √ . (6.78)
ρi + ρi+1
In terms of these averages, the matrix Ai+1/2 is found to be
6.7 Roe’s approximate Riemann solver∗∗ 39

0 1 0
γ−3 2
Ai+1/2 = .. γ) γ 1 // . (6.79)
* +
2 v̄ (3 − v̄ −
γ−1 3 2
, 2 v̄ − v̄ h̄ h̄ − (γ − 1) v̄ γ v̄ -
s s

By mere inspection, this matrix is seen to be identical to FU (Ū) from (6.19),


i.e. the flux Jacobian evaluated at the Roe average state Ū = ( ρ̄, m̄, ē)T ≡
g T
ρ̄, ρ̄v̄, ρ̄ h̄ s + (γ − 1) v̄ 2 /2 /γ . The Roe-average density is defined to be ρ̄ =
 f

ρi ρi+1 . Since we know that the flux Jacobian of the Euler system has real eigen-
values and a complete system of eigenvectors, this matrix clearly satisfies all other
Roe conditions as well.
All ingredients appearing in the Roe flux (6.75) are now known. From a given
left and right state, we compute the Roe average. The eigenvalues λ p in terms of the
Roe-average state are then known to be λ 1 = v̄ − c̄, λ 2 = v̄, λ 3 = v̄ + c̄, where the
2
sound speed for the Roe average state follows from c̄2 = (γ − 1) h̄ s − v̄2 . The right
eigenvectors are explicitly given by

1 1 1
r1 = *. v̄ − c̄ +/ r2 = .. v̄ / r3 = . v̄ + c̄ / . (6.80)
* +/ * +
v̄ 2
, h̄ + v̄ c̄ -
s s
, h̄ − v̄ c̄ - , 2 -
The ‘wave strength’ coefficients α p quantify the jumps in the conserved variables
and could be computed from the left eigenvectors lq of the Roe matrix as α p =
l p · (Ui+1 − Ui ). Alternatively, and for practical implementation purposes, one can
use the left eigenvectors L p of the primitive variable formulation to express the
α p directly in terms of jumps in the primitive variables Vi+1 − Vi as α p = l p ·
(Ui+1 − Ui ) = L p · (Vi+1 − Vi ). Writing ∆ρ ≡ ρi+1 − ρi we then find
1
α1 = (∆p − c̄ ρ̄∆v) ,
2c̄2
1
α2 = ∆ρ − 2 ∆p ,

1
α3 = 2 (∆p + c̄ ρ̄∆v) . (6.81)
2c̄
Note the direct correspondence with the characteristic equations (6.17).
As a final note on approximate Riemann solver based schemes, to ensure spatial
second order accuracy, the linear reconstruction and limiting procedures discussed
earlier could be applied directly on the jumps in the characteristic wave fields. This
is a frequently used alternative to reconstructing and limiting the conservative or
primitive variables.
We now directly compare numerical results for several of the 1D Riemann prob-
lems introduced earlier. We contrast the endresults for the 2nd order TVDLF scheme
with those obtained with a one-step, second order accurate scheme employing a
Roe solver. Starting with the classical Sod shock tube problem given by (6.49),
Figure 6.23 shows density, velocity and pressure at time t = 0.15 for TVDLF (top
40 6 Euler equations

Fig. 6.23 TVDLF (top) versus Roe based (bottom) solution for the Sod shock tube.

panels) versus the Roe-based scheme (bottom). It is seen that the Roe solver shows
a slight improvement in the resolution of the contact discontinuity. At the 200 grid
points used in the calculation, other differences are quite marginal.
The Mach 3 test case defined by (6.50) shows a rather striking result for the Roe
based method: Figure 6.24 shows how in contrast to the TVDLF scheme, the Roe
method erroneously ‘recognizes’ the initial discontinuity as a stationary solution!
This error is due to the presence of a transonic mach M = 1 point. [See also the
discussion in Wesseling [1], Chapter 10]. For the initial states (6.50), we saw that
the TVDLF method produced the physically correct transonic rarefaction associated
with the λ 1 wave family. The states are such that the eigenvalue computed in the Roe
scheme as λ 1 = v̄ − c̄ is (essentially) zero, and the wave strengths α p associated with
the 2nd and third wave family also (nearly) vanish α2 = α3 = 0. The Roe flux then
reduces to a central discretization as
1
Fi+1/2 = (F(Ui ) + F(Ui+1 ))
2
such that discontinuities are insufficiently smeared out. An entropy-violating (wrong!)
solution may then occur. The remedy to avoid this problem is known as a ‘sonic
entropy fix’, and it merely replaces the eigenvalues λ 1 and λ 3 in case they approach
6.7 Roe’s approximate Riemann solver∗∗ 41

Fig. 6.24 TVDLF (top) versus Roe based (bottom) solution for the Mach 3 test.

zero. Introducing a small fixed parameter , a sonic fix for the Roe scheme then
writes if | λ 1 |<  or | λ 3 |< 
2
1 * λp
λp → + + .
2,  -
This is thus only effective when transonic solutions | v |' c occur. Repeating the
Mach 3 test case with a sonic entropy fix, Figure 6.25 shows noticable improvements
for the Roe solver as compared to the TVDLF scheme. This is particularly true for
the contact discontinuity and rightward traveling shock part of the solution. In the
transonic rarefaction, the Roe result still shows a small ‘sonic glitch’. In fact, even
with the mentioned entropy fix, the Roe-based method failed to produce results for
the severe double transonic rarefaction test given by (6.52).
A clear improvement of the numerical solution from a Roe-solver based scheme
over the TVDLF results is found for the case of the slowly moving very weak shock
given by (6.51). The diffusive TVDLF scheme smeared out the rightward moving
shock over a large number of grid points. In Figure 6.26, the (bottom) Roe result
is seen to capture the shock with an acceptable low number of grid points. Finally,
another clear advantage of the Roe method is its capacity to recognize and maintain
42 6 Euler equations

Fig. 6.25 TVDLF (top) versus Roe based (bottom) solution with entropy fix for the Mach 3 test.

a static contact discontinuity as exact solution of the Euler system. The stationary
contact discontinuity depicted at t = 0, t = 0.1 and t = 1 in Figure 6.27 is not diffused
at all with the Roe scheme, showing a radical improvement from the TVDLF result.
In summary, it is clear that the Roe solver is mathematically more involved than
the TVDLF method, but by design incorporates more of the governing physics in its
flux computations. It needs an artificial entropy fix for transonic expansion fans, but
overall represents a contact discontinuity better, especially stationary ones which are
recognized as steady solutions. It is doing fine on slowly traveling weak shocks as
well. These conclusions are true for the 2nd order variants of the TVDLF and the
Roe-based TVD type schemes, both of which are heavily used in multi-dimensional
hydrodynamic simulations, together with the HLL and HLLC schemes.

6.8 1D transonic flow: de Laval nozzle∗∗

The 1D Euler equations for compressible gas dynamics can also be used to describe
flows constrained to move through a tube of varying-cross sectional area. This even
allows transonic flow patterns, in a similar way as described for the Parker solar
6.8 1D transonic flow: de Laval nozzle∗∗ 43

Fig. 6.26 TVDLF (top) versus Roe based (bottom) solution for the slowly moving weak shock test.

Fig. 6.27 TVDLF (top) versus Roe based (bottom) solution for a stationary contact discontinuity.
44 6 Euler equations

wind, when the variation in the tube cross-sectional area A(s) is of the converging-
diverging type. Here, s indicates the distance along the tube. Such converging-
diverging configurations are also called Laval nozzles. The governing equations
write as
1
∂t ρ + ∂s ( Aρv) = 0 ,
A
1 p dA
∂t m + ∂s ( A(mv + p)) = ,
A A ds
1
∂t e + ∂s ( Av(e + p)) = 0 , (6.82)
A
where the unknowns are the density ρ(s, t), momentum density m(s, t) ≡ ρv and
total energy density e(s, t) ≡ ρv 2 /2+ p/(γ −1), as before. The difference with the 1D
Euler equations from Eq. (6.8) is only by the geometric factors introduced through
the given cross-section variation A(s), and indeed the system reduces to Eq. (6.8)
when A = 1.
The system above is again formulated in its conserved variables, and one can
appreciate that the finite volume implementation from Eqns. (??)-(??) will handle
the momentum equation from (6.82) as
1   pi dA
∂t m̄i + Ai+ 1 (mv + p)i+ 1 − Ai− 1 (mv + p)i− 1 = |i , (6.83)
Vi 2 2 2 2 Ai ds
such that we need to be able to evaluate A(s) and its derivative dA/ds at cell centers
si to handle the geometric source term at right, while the fluxes need A(s) at cell
interfaces si± 1 and use the volumes Vi from
2

∆s i
Z si + 2
Vi = ∆s i
A(s) ds . (6.84)
si − 2

One can also formulate the equations in primitive variables, and these would write
the momentum equation as

ρ (∂t v + v∂s v) + ∂s p = 0 , (6.85)

while some equivalent forms of the energy equation for various thermodynamic
variables are
(γ − 1)T
∂t T + v∂s T + ∂s ( Av) = 0,
A
γei
∂t ei + v∂s ei + ∂s ( Av) = 0,
A
γp
∂t p + v∂s p + ∂s ( Av) = 0,
A
(γ − 1)eis
∂t eis + v∂s eis + ∂s ( Av) = 0. (6.86)
A
6.8 1D transonic flow: de Laval nozzle∗∗ 45

When we analyze the system (6.82) for steady-state solutions where ∂t = 0, we


find that the following relations must hold

Aρv = C1 ,
v2 p γ
+ = C2 , (6.87)
2 ργ−1
which express the constancy of the mass flux and energy along the path, where C1
and C2 are integration constants. The momentum equation can be manipulated to
yield
 dv v dA
M2 − 1

= , (6.88)
ds A ds
where we used the Mach number M = v/cs and the sound speed from cs2 = γp/ρ.
Eq. (6.88) demonstrates, similar to the Parker (iosthermal or polytropic) wind solu-
tion, that stationary transonic flows are possible, but the location of the sonic point
is necessarily at the throat of the nozzle where the derivative dA/ds vanishes. A
numerical solution where the A(s) = s2 + 1 on s ∈ [−2, 2] and further constant to
A = 5 elsewhere is shown in Fig. 6.28. The flow is subsonic throughout for the inlet
flow speed v = 0.1 where also ρ = 1 and p = 1/γ, but responds to the constriction
while keeping the constants (6.87). In Fig. 6.29, the inlet flow speed is raised to
v = 0.5, forcing the flow to go transonic at the throat, and inducing a shock transition
to subsonic flows further downstream.

Fig. 6.28 Laval nozzle flow problem with subsonic behavior.


46 6 Euler equations

Fig. 6.29 Laval nozzle flow problem with transonic behavior.

Exercise
6.5 Derive the equations (6.87)-(6.88) for steady nozzle flow problems. Use
MPI-AMRVAC to preproduce figures 6.28-6.29, and explore the role of the inlet
Mach number on the solution. Modify the setup to handle different nozzle
shapes A(s). Finally, simplify the nozzle flow problem to an isothermal/poly-
tropic relation p = cad ργ , without the energy equation. Show that you get
analogous equations to (6.87) (the energy one will be different for the isother-
mal case where γ = 1), and that they still obey Eq. (6.88). Use MPI-AMRVAC
to compare subsonic to transonic nozzle flows for the full Euler system on the
one hand, and for isothermal/polytropic setups on the other hand.
References 47

References

1. P. Wesseling, Principles of Computational Fluid Dynamics (Berlin Heidelberg, Springer-Verlag,


2001)
2. E. Toro, Riemann solvers and Numerical methods for Fluid dynamics. A practical introduction
(2nd Edition) (Berlin, Springer-Verlag, 1999)
3. S.A.E.G. Falle, ApJ Letters 577(2), L123 (2002). DOI 10.1086/344336
4. B. van der Holst, R. Keppens, Journal of Computational Physics 226(1), 925 (2007). DOI
10.1016/j.jcp.2007.05.007
5. P.D. Lax, X.D. Liu, SIAM J. Sci. Comput. 19(2), 319 (1998). DOI
10.1137/S1064827595291819. URL https://doi.org/10.1137/S1064827595291819
6. V. Rusanov, USSR Comp. Math. and Math. Phys. 1, 304 (1961)
7. A. Harten, P. Lax, B. van Leer, SIAM Rev. 25, 35 (1983)
8. E. Toro, Riemann solvers and Numerical methods for Fluid dynamics (Berlin, Springer-Verlag,
1997)
9. E.F. Toro, Shock Waves 29(8), 1065 (2019). DOI 10.1007/s00193-019-00912-4
Index

boundary conditions phase speed diagram, 27


π-periodic, 23 Prandtl-Meyer relation, 10
primitive variables, 4, 7
characteristic equation, 5
contact discontinuity, 9 Rankine-Hugoniot relations, 9
rarefaction wave, 11
entropy, 5 ratio of specific heats, 2
Euler equations, 3
Riemann fan, 12
Riemann invariants, 5, 8
flux Jacobian matrix, 6
Riemann problem
1D Euler, 12
Godunov scheme, 33
2D case, 23
group speed diagram, 27
Roe average, 38
Roe solver, 33, 35
HLL and HLLC, 34

Laval nozzle, 44 shock relations, 10


linearly degenerate wave, 11 shock tube, 13
sonic entropy fix, 40
Mach cone, 29 sound waves, 27
Mach number, 7 specific enthalpy, 3
maximal compression ratio, 10 specific internal energy, 2
method of characteristics, 6 Strömgren sphere, 2

49

You might also like