Numerical Methods for Hyperbolic Conservation LawsLecture 2
Wen Shen
Department of Mathematics, Penn State UniversityEmail: [email protected]
Oxford, Spring, 2018
Lecture Notes online: http://personal.psu.edu/wxs27/NotesNumCons/
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 1 / 47
Godunov’s method of kth order
General approach, from tn to tn+1: Given {Qni }, compute {Qn+1
i }.
1 Construct piecewise polynomial function (of degree k − 1) from cell averages{Qn
i };2 Solve the conservation law exactly on [tn, tn+1];
3 Construct new cell averages {Qn+1i }.
Conservative form:
Qn+1i = Qn
i −∆t
∆x[Fi+ 1
2− Fi− 1
2]
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 2 / 47
First order Godunov: piecewise constant approximation
qt + f (q)x = 0, f (q) = Aq
Need to solve a Riemann problem at each cell boundary xi .
Observations:• Solution of Riemann problem is constant along cell boundary, i.e., ξ = 0.
• Flux f (q) is constant along ξ = 0;
• Need to find solution of Riemann problem only along ξ = 0.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 3 / 47
Upwind method
qt + f (q)x = 0, f (q) = Aq
• If λp ≥ 0 for all p, the Riemann problem solution with (ql , qr ) alongξ = x/t = 0 is ql .
⇒ F(Qi−1,Qi ) = Qi−1 ⇒ Qn+1i = Qn
i −∆t
∆x[f (Qi )− f (Qi−1)]
• If λp ≤ 0 for all p, the Riemann problem solution with (ql , qr ) alongξ = x/t = 0 is qr .
⇒ F(Qi−1,Qi ) = Qi , ⇒ Qn+1i = Qn
i −∆t
∆x[f (Qi+1)− f (Qi )]
CFL condition: ν ≤ 1
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 4 / 47
In general, denote byQ↓
i− 12
=q↓(Qni−1,Q
ni )
the value of q of the solution of Riemann problem along ξ = 0.
Numerical flux:
Fi− 12
=1
∆t
∫ tn+1
tn
f (q↓(Qni−1,Q
ni ))dt = f (Q↓
i− 12
)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 5 / 47
Wave propagation form
Qi − Qi−1 =m∑
p=1
αp,i− 12rp
=m∑
p=1
Wp,i− 12
Example: m = 3, λ1 < 0 < λ2 < λ3
Observation:• Positive velocity waves enter at xi− 1
2(left)
• Negative velocity waves enter at xi+ 12
(right)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 6 / 47
The effect on cell average at tn+1:Consider W2,i− 1
2= α2,i− 1
2r2, with speed λ2 > 0
cell average is changes by
−λ2∆t · W2,i− 1
2
∆x
Then
for W3,i− 12
: −λ3∆t · W3,i− 1
2
∆x
and
for W1,i+ 12
: −λ1∆t · W1,i+ 1
2
∆x
(note that λ1 < 0, so −λ1 > 0)
Add up:
Qn+1i = Qn
i −∆t
∆x
[λ1W1,i+ 1
2+ λ2W2,i− 1
2+ λ3W3,i− 1
2
]
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 7 / 47
Using the notation
(λp)+= max{λp, 0}, (λp)−= min{λp, 0} ∀p
Suppose that Riemann problem solution consists of m waves Wp with speed λp:
Qn+1i = Qn
i −∆t
∆x
[m∑
p=1
(λp)+Wp,i− 12
+m∑
p=1
(λp)−Wp,i+ 12
]
= Qni −
∆t
∆x
[A+∆Qi− 1
2+A−∆Qi+ 1
2
]= Qn
i −∆t
∆x[(net-effect of positive waves) + (net-effect of negative waves)]
(definitions coming next...)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 8 / 47
qt + Aqx = 0, Wp = αprp with speed λp
Define
Λ+=diag((λ1)+, (λ2)+, · · · , (λm)+), Λ−=diag((λ1)−, (λ2)−, · · · , (λm)−)
andA+=RΛ+R−1, A−=RΛ−R−1
Note
A+ + A− = RΛ+R−1 + RΛ−R−1 = R(Λ− + Λ−)R−1 = RΛR−1 = A
⇒ splitting of A into positive and negative speed propagation
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 9 / 47
Let ∆Qi− 12
= Qi − Qi−1.
Then
A+∆Qi− 12
= RΛ+[R−1(Qi − Qi−1)
]= RΛ+αi− 1
2=
m∑p=1
(λp)+αp,i− 12rp
Similarly
A−∆Qi− 12
= RΛ−[R−1(Qi − Qi−1)
]= RΛ−αi− 1
2=
m∑p=1
(λp)−αp,i− 12rp
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 10 / 47
Relate to numerical flux
Riemann solution along x = xi− 12:
Q↓i− 1
2
= q↓(Qi−1,Qi ) = Qi−1 +∑
p:λp<0
Wp,i− 12
Then
F ni− 1
2= f (Q↓
i− 12
) = AQi−1 +∑
p:λp<0
AWp,i− 12
= AQi−1 +∑
p:λp<0
λpWp,i− 12
= AQi−1 +m∑
p=1
(λp)−Wp,i− 12
= f (Qi−1) + A−∆Qi− 12
so
F ni+ 1
2= AQi +
m∑p=1
(λp)−Wp,i+ 12
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 11 / 47
Alternatively,
Q↓i− 1
2
= Qi −∑
p:λp>0
Wp,i− 12
we get
F ni− 1
2= AQi −
∑p:λp>0
(λp)+Wp,i− 12
= f (Qi−1)− A+∆Qi− 12
then
Qn+1i = Qn
i −∆t
∆x
[F ni+ 1
2− F n
i− 12
]= Qn
i −∆t
∆x
[m∑
p=1
(λp)−Wp,i+ 12
+m∑
p=1
(λp)+Wp,i− 12
]
Can be extended to non-linear problems.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 12 / 47
CLAWPACK Software
– developed by Randall LeVeque and his group
– written in Fortran
– for both linear and nonlinear problems
– for both scalar equation and systems
– finite volume methods, first order and high resolutions
– both 1D and several space dimensions (2D and 3D)
– public domain
Download at:
http://www.amath.washington.edu/~claw
Read Chapter 5 in the textbook.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 13 / 47
Discrete Fourier analysis
– A quick way to check stability.
Recall a naive method for qt + uqx = 0:
Qn+1j − Qn
j
∆t+ u
Qnj+1 − Qn
j−1
2∆x= 0, F n
j− 12
=u
2(Qj−1 + Qj)
Fourier mode:Qn
j = (λ)ne ik(j∆x), λ ∈ C
We haveQn+1
j = λQnj , Qn
j±1 = e±i∆xkQnj
Plug inλ− 1
∆t+ u
e i∆xk − e−i∆xk
2∆x= 0
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 14 / 47
λ = λ(k) = 1− u∆t
∆x· 1
2
[e i∆xk − e−i∆xk
]= 1− u
∆t
∆xi sin(k∆x)
– wave dispersion relation
Stability requirement: |λ(k)| ≤ 1 for all k
But here:|λ(k)| > 1 for all mesh ratios ∆t/∆x and almost all modes.
⇒ always unstable.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 15 / 47
Upwind scheme
qt + uqx = 0 (u > 0), Qn+1j = Qn
j −∆t
∆xu[Qn
j − Qnj−1
]Plug in the Fourier modes and simplify:
λ(k) = 1− u∆t
∆x
[1− e−ik∆x
]= 1− ν + ν [cos(k∆x)− i sin(k∆x)]
|λ(k)|2 = (1− ν + ν cos k∆x)2 + ν2 sin2(k∆x)
= (1− ν)2 + 2(1− ν)ν cos k∆x + ν2 cos2(k∆x) + ν2 sin2(k∆x)
= (1− ν)2 + 2(1− ν)ν cos k∆x + ν2
= 1− 2ν(1− ν)(1− cos k∆x)
= 1− 4ν(1− ν) sin2(k∆x/2)
⇒ stability condition: |λ(k)|2 ≤ 1 if 0 ≤ 1− ν ≤ 1. (same as CFL condition)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 16 / 47
Lax-Wendroff scheme
• approximate q at the mid-point in time, i.e. tn+ 12
= tn + 12 ∆t
• evaluate flux also at that point
⇒ a second order method in both x and t
numerical flux: F ni− 1
2
= f (Qn+ 1
2
i− 12
) where
Qn+ 1
2
i− 12
=1
2(Qn
i−1 + Qni )− ∆t/2
∆x
[f (Qn
i )− f (Qni−1)
](Lax-F)
stencil CFL condition: |ν| ≤ 1
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 17 / 47
For scalar case: qt + uqx = 0, let ν = u∆t/∆x
f (Qn+ 1
2
i− 12
) =u
2(Qn
i−1 + Qni )− u
2ν(Qn
i − Qni−1)
Plug in
Qn+1i = Qn
i − ν[f (Q
n+ 12
i+ 12
)− f (Qn+ 1
2
i− 12
)]
= · · ·
=1
2ν(1 + ν)Qn
i−1 + (1− ν2)Qni −
1
2ν(1− ν)Qn
i+1
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 18 / 47
Discrete Fourier analysis: dispersion relation:
λ(k) =1
2ν(1 + ν)e−ik∆x + (1− ν2)− 1
2ν(1− ν)e ik∆x
= · · ·= 1− iν sin k∆x − 2ν2 sin2(k∆x/2)
then|λ(k)|2 =
∣∣1− 4ν2(1− ν2) sin4(k∆x/2)∣∣
Stability condition:|λ(k)|2 ≤ 1 if ν2 ≤ 1, i.e., |ν| ≤ 1.
(same as CFL condition)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 19 / 47
Accurary (formal)
Taylor series expansion at (x , tn):
q(x , tn+1) = q(x , tn) + ∆t · qt(x , tn) +1
2(∆t)2qtt(x , tn) + · · ·
Usingqt = −Aqx , qtt = −Aqxt = −A(−Aqx)x = A2qxx
then
q(x , tn+1) = q(x , tn)−∆t · Aqx(x , tn) +1
2(∆t)2A2qxx(x , tn) + · · ·
Compare with Lax-Wendroff:
Qn+1i = Qn
i −∆tAQn
i+1 − Qni−1
2∆x+
1
2(∆t)2A2 (Qn
i−1 − 2Qni + Qn
i+1)
(∆x)2
⇒ second order method for smooth solutions
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 20 / 47
numerical flux for Lax-Wendroff can be written as
F ni− 1
2=
1
2A(Qn
i−1 + Qni )− 1
2
∆t
∆xA2(Qn
i − Qni−1)
(unstable numerical flux) + (diffusion, stabilizing flux)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 21 / 47
The Beam-Warming method
For qt + uqx = 0 (with u > 0) or qt + Aqx = 0 (with λi > 0).
Use one-sided (upwind) finite difference of second order:
qx(xi , tn) =1
2∆x[3q(xi , tn)− 4q(xi−1, tn) + q(xi−2, tn)] +O(∆x2)
qxx(xi , tn) =1
∆x2[q(xi , tn)− 2q(xi−1, tn) + q(xi−2, tn)] +O(∆x2)
We have
Qn+1i = Qn
i −∆t
2∆xA[3Qn
i − 4Qni−1 + Qn
i−2
]+
1
2(∆t/∆x)2A2
[Qn
i − 2Qni−1 + Qn
i−2
]
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 22 / 47
Numerical flux for Beam-Warming can be written:
F ni− 1
2= AQn
i−1 +1
2A(1− ∆t
∆xA)(Qn
i−1 − Qni−2)
(upwind) + (high order corrections)
Comment: Not advantageous with one sided finite differences.
Discrete Fourier analysis: leave as an exercise ***
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 23 / 47
Numerical simulations
Example: qt + qx = 0 with periodic boundary condition, and ν = ∆t/∆x = 0.8
Upwind method:
Excessive dissipation, correct phase position, no oscillations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 24 / 47
Lax-Wendroff method:
Sharper capturing of the smooth pulse, phase error, oscillation behind jumps.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 25 / 47
Beam-Warming method:
Sharper capturing of the smooth pulse, phase error, oscillation before jumps.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 26 / 47
summary of simulation results
High order method (LW)
(+) High accuracy in smooth region
(-) Oscillation around singularities – dispersive
(-) Phase error, incorrect wave position
Low order method (Upwind)
(-) Low accuracy even in smooth region
(+) No oscillations around singularities (monotone)
(+) No phase shift, correct wave position
Idea: Combine them!
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 27 / 47
Combining the two methods
Compare the numerical fluxes:
Upwind : Fi− 12
= A−Qni + A+Qn
i−1
LW : Fi− 12
= (A−Qni + A+Qn
i−1) +1
2|A| (I − ∆t
∆x|A|) · (Qn
i − Qni−1)
= (Upwind flux) + (high order correction term)
where|A| = R |Λ|R−1 = A+ − A−, where |Λ| = diag(|λp|)
Limiter:Change the magnitude of the correction term, depending on the solution.•: in smooth region, use the correction term•: around singularities, remove the correction term
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 28 / 47
This is more complicated for systems.
Solution is superposition of waves of several families.
At a point, some family is smooth, and some can have a jump.
⇒ one can construct limiters based on each family (in the solution of Riemannproblem)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 29 / 47
General setting:
Assume that we have two methods, a lower and a higher order, with numericalfluxes FL(Qi−1,Qi ) and FH(Qi−1,Qi ).
Flux Limiter
F ni− 1
2= FL(Qn
i−1,Qni ) + Φn
i− 12
[FH(Qn
i−1,Qni )−FL(Qn
i−1,Qni )]
If Φni− 1
2
= 0, then F ni− 1
2
= FL(Qni−1,Q
ni );
If Φni− 1
2
= 1, then F ni− 1
2
= FH(Qni−1,Q
ni ).
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 30 / 47
The REA algorithm with piecewise linear reconstruction
From cell average Qni , construct a piecewise linear (affine) function
qn(x , tn) = Qni + σn
i (x − xi ), for xi− 12≤ x ≤ xi+ 1
2
where
xi =1
2(xi− 1
2+ xi+ 1
2), center of Ci
and σni : slope of qn in cell Ci . (TBD)
Then, in each cell, we have (regardless of σni )
qn(xi , tn) = Qni
Solve the equations exactly on [tn, tn+1], and form new cell averages {Qn+1i }, and
repeat the process.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 31 / 47
Consider the scalar equation qt + uqx = 0, u > 0.
Solving it on [tn, tn+1], the solution at tn+1 is
qn(x , tn+1) = qn(x − u∆t, tn).
CFL condition: ν = u∆t/∆x ≤ 1
qn(x , tn+1)
qn(x , tn)
Qni−1
Qni
Qni+1
Qni−1
Qni
Ci
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 32 / 47
Take cell-average over Ci :
∆x · Qn+1i =
u∆t
2
[(Qn
i−1 +∆x
2σni−1) + (Qn
i−1 − (u∆t − ∆x
2)σn
i−1
]+
∆x − u∆t
2
[(Qn
i −∆x
2σni ) + (Qn
i − (u∆t − ∆x
2)σn
i )
]simplify
Qn+1i =
u∆t
∆x
[Qn
i−1 +1
2(∆x − u∆t)σn
i−1
]+ (1− u
∆t
∆x)
[Qn
i −1
2u∆tσn
i
]= ...
= Qni −
u∆t
∆x(Qn
i − Qni−1)− u∆t
2∆x(∆x − u∆t)(σn
i − σni−1)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 33 / 47
Choices of slopes σni
If we choose σni ≡ 0: ⇒ Godunov’s method (i.e., upwind)
3 other choices:
• Centered slope: σni =
Qni+1 − Qn
i−1
2∆x(Fromm’s method)
• Upwind slope: σni =
Qni − Qn
i−1
∆x(Beam-Warming)
• Downwind slope: σni =
Qni+1 − Qn
i
∆x(Lax-Wendroff)
⇒ Formally all are of 2nd order.
Fromm’s method:
Qn+1i = Qn
i −u∆t
4∆x
[Qn
i+1 + 3Qni − 5Qn
i−1 + Qni−2
]− u2∆t2
4∆x2
[Qn
i+1 − Qni − Qn
i−1 + Qni−2
]Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 34 / 47
Total variation: definitions
For discrete data {Qi}:TV(Q) =
∑i
|Qi − Qi−1|
For function q(x):
TV(q) = sup
N∑j=1
|q(yi )− q(yi−1)|
where the sup is taken over all subdivisions of the real line
−∞ = y0 < y1 < · · · < yN =∞, ∀N
or
TV (q) = lim supε→0
1
ε
∫ ∞−∞|q(x)− q(x − ε)| dx
If q(x) is differentiable:
TV (q) =
∫ ∞−∞|q′(x)| dx
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 35 / 47
TVD methods
Definition: A two-level method is called total variation diminishing (TVD) if
TV(Qn+1) ≤ TV(Qn)
Definition: A two-level method is called monotonicity-preserving if
Qni ≥ Qn
i+1, ∀i implies Qn+1i ≥ Qn+1
i+1 , ∀i
TVD implies monotonicity-preserving!
More observations:• For transport equation, in the exact solution, as t evolves, TV does not change
• The averaging operator does not increasing the TV!
So, if the reconstruction step is TVD, then the method is TVD.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 36 / 47
Slope-limiter methods:
min-mod limiter
σni = minmod
(Qn
i − Qni−1
∆x,Qn
i+1 − Qni
∆x
)where
minmod(a, b) =
a, if |a| < |b| and ab > 0
b, if |a| > |b| and ab > 0
0, if ab ≤ 0
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 37 / 47
Example of minmod limiter:
One can improve upon minmod limiter!
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 38 / 47
Superbee limiter (introduced by Roe)
σni = maxmod(σ
(1)i , σ
(2)i )
where
σ(1)i = minmod
(Qn
i+1 − Qni
∆x, 2
Qni − Qn
i−1
∆x
),
σ(2)i = minmod
(2Qn
i+1 − Qni
∆x,Qn
i − Qni−1
∆x
)and maxmod selects the argument with larger modulus.
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 39 / 47
Monotonized central-difference limiter (MC limiter):
(Propose by van Leer)
σni = minmod
(Qn
i+1 − Qni−1
2∆x, 2
Qni − Qn
i−1
∆x, 2
Qni+1 − Qn
i
∆x
)
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 40 / 47
Example:
Mostly TVD!
Problem of superbee: tends to steepen the slope even in smooth region.
MC limiter: does not steepen up smooth slopes – a good default choice.
These limiters make the method nonlinear (even though the equation is linear).
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 41 / 47
Numerical simulations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 42 / 47
Numerical simulations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 43 / 47
Numerical simulations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 44 / 47
Numerical simulations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 45 / 47
Numerical simulations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 46 / 47
Numerical simulations
Wen Shen (Penn State) Numerical Methods for Hyperbolic Conservation Laws Lecture 2Oxford, Spring, 2018 47 / 47