Understanding of Numerical Oscillations in Terms of Modified Equation
Understanding of Numerical Oscillations in Terms of Modified Equation
Jiequan Li ()
1
H. S. Carslaw (1930): Introduction to the theory of Fourier’s series and
integrals.
Lax–Wendroff Method
∂u ∂u
+c = 0,
∂t ∂x
ν n ν2 n
ujn+1 = ujn − [uj+1 n
− uj−1 ] + [uj+1 − 2ujn + uj−1
n
], ν = cτ /h.
2 2
In this lecture, τ is the time step size and h is the grid spacing.
2
P. D. Lax, Gibbs phenomena, J. Sci. Comput., Vol. 28, Nos. 2/3 (2006),
445–449.
Local Oscillations in Lax–Friedrichs Solutions34
Numerical results for the advection equation ut + ux = 0, 50 grid
points are used, ν = 0.8
0.16 0.16
0.14 0.14
0.12 0.12
0.1 0.1
u
u
0.08 0.08
0.06 0.06
0.04 0.04
0.02 0.02
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x−axis x−axis
(c) uj0
= 1 for j = 25 and uj0 ≡ (d) uj0
= 1 for j = 25, 26, and
0 otherwise uj0 ≡ 0 otherwise
3
H.-Z. Tang and G. Warnecke, A note on (2K + 1)-point conservative
monotone schemes, M2AN Math. Model. Numer. Anal., 38(2004), 345–357.
4
M. Breuss, The correct use of the Lax-Friedrichs method, M2AN Math.
Model. Numer. Anal. 38(2004), 519–540.
L-F Solutions of Compressible Euler Equations5
ρt +(ρv )x = 0, (ρv )t +(ρv 2 +p)x = 0, (ρE )t +(v (ρE +p))x = 0.
T = 0.25, 100 grid points, CFL = 0.6.
Initial data: (ρ0j , uj0 , pj0 ) = (0.125, 0, 0.1) for j = 49, 50, 51, and
(ρ0j , uj0 , pj0 ) = (1, 0, 1) otherwise.
DENSITY PRESSURE
1 1
0.98 0.98
0.96
0.96
rho
0.94
p
0.94
0.92
0.92 0.9
0.9 0.88
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
X−AXIS X−AXIS
0.1
2.6
0.05
0 2.55
e
v
−0.05 2.5
−0.1
2.45
−0.15
−0.2 2.4
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
X−AXIS X−AXIS
5
J. L. Li, H. T. Tang, G. Warnecke and L. M. Zhang, local oscillations in
finite difference solutions of hyperbolic conservation laws, Math. Comp.,
(2009), Vol. 78, pp. 1997–2018.
Remarks
1. The Lax–Friedrichs scheme is first order accurate, has TVD
property and the maximum numerical viscosity in the class of
TVD schemes. The large dissipation SHOULD suppresses
local oscillations!!! This oscillatory phenomenon is very
counter–intuitive and misleading.6
6
Nevertheless, the oscillations are just local and do not contradict to
the TVD property because the latter is a global definition while the
oscillations are of local nature. The preservation of the TVD property is
due to the compensation by strong decrease in solution amplitude.
Purposes
n+1 1 n n
uM = (u + uM ), n ≥ 1.
2 M−2
7
It is well-known to result in instability. An easy remedy is to use
n+1 1 n n
uM = (u + uM )
2 M−1
Chequerboard Mode Solutions
• Generalized Lax–Friedrichs (GLF) scheme with initial datum
uj0 = (−1)j
ν n q n
ujn+1 = ujn − [uj−1 n
−uj+1 ]+ [uj+1 −2ujn +uj−1
n
], 0 < qmin ≤ q ≤ 1.
2 2
8
1. As f (u) is an even function, the solution is
ujn = (−1)j .
f (b) ′
if ujn = (−1)j+n b. Amplification factor: 1 − 2λ2 f (ξ).
b
f (b) ′
The amplitude of solution is amplified if |1 − 2λ2 f (ξ)| > 1.
b
8
Private communication with Huazhong Tang
• MacCormack scheme for ut + (u α )x = 0, 0 < α < 1
The initial data is uj0 = (−1)j . α = 13 , t = 1.19, CFL=0.9.
20
f=u**(1/3)
15
10
-5
-10
-15
-20
0 0.5 1 1.5 2
and
arg λ(k)
Ep (k) := − − 1 = O(ξ 2 ).
νξ
Common understanding: The numerical dissipation of monotone
schemes O(ξ) suppresses relative phase errors, while the dissipation
of L–W is too weaker O(ξ 2 ) and oscillations are triggered.
û(ξ) ∼ 1/|ξ|, as ξ → 0,
This implies that low frequency modes can cause oscillations in the
L-W solutions.
• High Frequency Modes ξ ≈ π.
Introduce ξ ′ = k ′ h ≈ 0 such that ξ = π + ξ ′
′ ′
ujn = λnk e ijξ = λnk e i (π+ξ )j = (−1)j+n λnk ′ e i ξ j .
The relative phase errors of high frequency modes O(1) are huge and are
difficult to be suppressed by the numerical dissipation.
Brief Summary for GLF
We distinguish low and high frequency Fourier modes ujn = λnk e ijξ ,
ξ = kh. They behave differently.
1. For the low frequency modes (ξ ≈ 0), the relative phase error
is of order O(ξ 2 ), and the amplitude error (dissipation)
becomes smaller as the parameter q decreases.
1.1 The order of amplitude error is O(ξ) for the monotone
schemes and thereby offsets the relative phase errors.
1.2 The order of amplitude error is O(ξ 2 ) for the LW scheme and
the relative phase errors cannot be offset. Hence oscillations
are observable.
2. For the high frequency modes (ξ ≈ π), the relative phase error
is of order O(1), the amplitude error becomes larger as the
parameter q is closer to 1/2.
In particular, as q = 1 (LF), the amplitude error vanishes and
there is no dissipation on the highest frequency mode. This
explains why oscillations in LF solutions are observable.
Application: Composite Scheme 9
u n+1 = LF ◦ (LW )m u n .
9
R. Liska and B. Wendroff, Composite schemes for conservation laws. SIAM
J. Numer. Anal. 35 (1998), no. 6, 2250õ 2271.
• Remark on Discrete Fourier Analysis
βs = αs , s = 1, · · · , K ;
(i ) βs = αs , s = 1, · · · , K ;
(ii ) βs = 0, s = K + 1, · · · , K + q − 1;
(iii ) |βK +p (h, τ )| ≤ Chq , C is constant.
Modified equation from discrete Fourier analysis (Classical!!!)
Write
λk = e i ω(k)τ
where ω(k) is the frequency. Expand ω(k) at k = 0,
∞ ∞
X ω (s) (0) 1 X [ln λ(0)](s) s
i ω(k) = i ks = k , ω(0) = 0.
s! τ s!
s=0 s=0
ln |λ(k0 )|
4.1 Numerical damping: ∂t ũ ∼ ũ. Such solution behaves
τ
ln |λ(k0 )|
ũ(t) ∼ ũ(0)e αt , α = .
τ
As α < 0 (⇐⇒ |λ| < 1), the solution decays exponentially.
As |λ| ≤ 1 + C τ (von Neumann stability condition), the
solution is bounded
|ũ| ≤ |ũ(0)|E C .
′′
4.2 Numerical diffusion: ∂t ũ ∼ ǫ∂ 2 ũ, ǫ = ω̃ 2(k0 ) . The solution
behaves
ũ(t) ∼ O(t −1/2 ),
if ǫ > 0. Note that:
(i) As k0 = 0, |λ(0)| = 1 is the scheme is consistent. Then the
numerical diffusion (viscosity) dominates the dissipation.
(ii) As k0 6= 0, generally speaking |λ(k0 )| < 1. Hence the
numerical damping dominates the dissipation.
Nonlinear Modified Equations
• Conservative Schemes
τ n
ujn+1 = ujn − [Fj+ 1 −F
n
j− 12
],
h 2
n
where numerical fluxes Fj+ n n
1 = F (uj−q , · · · , uj+p ) is consistent
2
with f (u)
F (u, · · · , u) = f (u).
The classical modified equation of monotone schemes is (Harten,
Hyman & Lax, CPAM, 1976),
Γ(ũ)
Dt ũ + G (ũ)x = −2 ũ + τ · (β(ũ, λ)ũx )x + τ · δ(ũ, λ)ũx2 + O(τ 2 ),
τ
10
K.W. Morton and D.F.Mayers, Numerical solution of partial differential
equations, 2nd edition, Cambridge University Press, 2005.
Numerical Damping Determines Dissipation!!!
Γ(ũ)
Dt ũ = −2 ũ.
τ
1. |ũ(t + τ, ·)| < |ũ(t, ·)| if 0 < Γ(ũ) < 1;
ujn+1 = H(uj−q
n n
, · · · , uj+p ) = ujn − λ[Fj+
n
1 −F
n
j− 1
],
2 2
where n
Fj+ = n
F (uj−q+1 ,··· n ).
, uj+p The monotonicity means that
1
2
∂H
(v−q , · · · , vℓ , · · · , vp ) ≥ 0,
∂vℓ
for all −q ≤ ℓ ≤ p.
Proposition. If the schemes are monotone, then there holds,
0 ≤ Γ(ũ) ≤ 1,
n
n
f (uj+1 ) + f (ujn ) Q n
Fj+1/2 = F (ujn , uj+1
n
)= − (u − ujn ),
2 2λ j+1
where 0 < Qmin ≤ Q ≤ 1. It is easy to calculate
Γ(ũ) = 1 + (−1)n+1 λ F ((−1)n ũ, (−1)n+1 ũ)
u n+1/2 = 1 (u n + u n ) − λ f (u n ) − f (u n ) .
j+1/2 j j+1 j+1 j
2 2
f (λf (ũ))
Γ(ũ) = 1 − λ .
ũ
◮ Even flux case, f (−u) = f (u).
Γ(ũ) = 1.
◮ General cases, f (u) = fodd (u) + feven (u).
ǫλ3 n
a (f n − fj n ) − 2ajn (fj+1 n n n
(fj n − fj−2
n
+ − fj−1 ) + aj−1 ) ,
12 j+1 j+2
As δ = ǫ = 0, back to L-W.
◮ Odd flux case.
0.5 0.4
odd odd
0.45 even even
0.35
0.4
0.3
0.35
0.25
0.3
0.25 0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
1.5 1.5
Lax−Fridrichs MacComack
1 1
0.5 0.5
0 0
−0.5 −0.5
−1 −1
−1.5 −1.5
3 4 5 6 7 3 4 5 6 7
1.5 1.5
Richtmyer ZA
1 1
0.5 0.5
0 0
−0.5 −0.5
−1 −1
−1.5 −1.5
3 4 5 6 7 3 4 5 6 7
0.5
1 Lax−Friedrichs MacCormack
0.5
0 0
−0.5
−1
−0.5
3 4 5 6 7 3 4 5 6 7
Richtmyer ZA
2 5
0 0
−2 −5
3 4 5 6 7 3 4 5 6 7
|u|
|u|
1 0.2
0.95 0.1
0.9 0
1 2 3 4 1 2 3 4
step step
20 200
Richtmyer ZA
log10|u| 15 150
log10|u|
10 100
5 50
0 0
1 2 3 4 1 2 3 4
step step