Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

The advection equation and hyperbolic system (2)

Reconstruction
the Lax-Wendroff scheme
Finite volume method & conservative scheme
Numerical flux limiters

Numerical Fluid
analysis Mechanics

CFD

Computer
Science

1
The inverse problem: Reconstruction of a field from discrete representation

Piecewise constant functions

Piecewise linear functions


p j = U nj + σ nj x − x j
( )
n
σ = slope
j

Assume a= 1>0
n
U nj+1 − U nj−1
Central scheme σ = j
2Δx
n n
U −U
j j−1
Upwind σ nj =
Δx
U nj+1 − U nj
Downwind σ nj =
Δx
Demonstration of the REA (reconstruction, evolution, averaging) procedure
∂U ∂U
Consider +a = 0 ⇒ The exact solution U n+1 x ≡ U n x − aΔt ( ) ( )
∂t ∂x

Step 1: Piecewise linear functions


p j = U nj + σ nj x − x j
( )
Step 2: Exact evolution plus cell averaging
x j −Δx / 2+aΔt x j +Δx / 2
1 ⎡U n + σ n x − x 1
⇒ U n+1
j
= ∫ ⎣ j−1 j−1( j−1
− aΔt ⎤⎦ dx +) ∫ ⎡U n + σ n x − x − aΔt ⎤ dx
⎣ j (
j j )⎦
Δx x j −Δx / 2 Δx x j −Δx / 2+aΔt

1 aΔt ⎡ n n
⎛ Δx ⎞⎤ 1 Δx ⎡ n n
⎛ Δx ⎞⎤
= ∫ ⎢U j−1 + σ j−1 ⎜ x' + x j − − x j−1 − aΔt ⎟⎥ dx' + ∫ ⎢U j + σ j ⎜ x − − aΔt ⎟⎥ dx
Δx 0 ⎣ ⎝ 2 ⎠⎦ Δx aΔt ⎣ ⎝ 2 ⎠⎦

=
aΔt ⎡ n n
⎛ aΔt
⎢U j−1 + σ j−1 ⎜ + xj −
Δx ⎞⎤
− x j−1 − aΔt ⎟⎥ +
Δx − aΔt ⎡ n( ⎛
n Δx + aΔt
⎢U j + σ j ⎜
)−
Δx ⎞⎤
− aΔt ⎟⎥
Δx ⎣ ⎝ 2 2 ⎠⎦ Δx ⎣ ⎝ 2 2 ⎠⎦
aΔt ⎡ n 1 ⎤
Δx − aΔt σ nj−1 ⎥ +
(
Δx − aΔt ⎡ n aΔt n ⎤ )
=
Δx ⎣
⎢U j−1 +
2
( ⎦
) Δx
⎢U j −
⎣ 2
σ j⎥
⎦ - Second-order linear
aΔt ⎡ n
U j − U nj−1 ⎤⎦ −
aΔt reconstruction leads to a
= U nj − ⎣ Δx − aΔt σ nj − σ nj−1
( )( )
Δx 2Δx second-order accurate
U nj+1 − U nj
Step 3: Now if I select the downwind slope σ j = n
Δx
, then scheme
aΔt ⎡ n n ⎤ aΔt
⎛U n − U n U n − U n ⎞ - But the Lax-Wendroff
n+1
U j =U j −n
U j − U j−1 ⎦ − Δx − aΔt ⎜ j+1 ( j
− j) j−1 ⎟
Δx ⎣ 2Δx ⎜

Δx Δx ⎟

scheme produces
aΔt ⎡ n n ⎤ 1 ⎛ aΔt ⎞
2 oscillations, so the choice
=U nj − U
2Δx ⎣ j+1
− U j−1 ⎦
+ ⎜
2 ⎝ Δx ⎠
n n n
(
⎟ U j+1 − 2U j + U j−1 ) of downwind slope is not
This is exactly the Lax-Wendroff scheme. good.
The stability condition for the Lax-Wendroff scheme
The Lax-Wendroff scheme
U n+1 − U nj ⎡U n − U n ⎤ ⎛ n n n ⎞
j ⎢ j+1 j−1 ⎥ a 2 Δt ⎜ U j+1 − 2U j + U j−1 ⎟
+a =
Δt ⎢

2Δx ⎥

2 ⎜
⎝ Δx 2 ⎟

aΔt
C≡
Δx

The growth factor


1+ C 2 cos kΔx − 1 − iC sin kΔx ≤ 1
( ( ) ) ( )
2
⎡1+ C cos kΔx − 1 ⎤
2
+ C 2 sin 2 kΔx ≤ 1
⇒ ⎣ ( ( ) )⎦ ( )
⇒ (1− C 2
) ( ) (
+ C 4 + 2C 2 − 2C 4 cos kΔx + C 4 − C 2 cos 2 kΔx ≤ 1
( ) ) ( )
⇒ (
If cos kΔx = 1, ) OK 1≤1
2
⇒ (
If cos kΔx = −1, ) (1− 2C 2 ) ≤1

⇒ ( )
− 1 ≤ 1− 2C 2 ≤ 1

⇒ (2C 2
)≤2
⇒ C ≤1
aΔt
⇒ ≤1
Δx
Question: What is the numerical diffusivity of the Lax-Wendroff scheme?

∂U ∂U
PDE: +a = 0 ⇒ The exact soln U n+1 x ≡ U n x − aΔt ⇒ zero viscosity
( ) ( )
∂t ∂x

The Lax-Wendroff scheme


U n+1 − U nj ⎡U n − U n ⎤ 2 ⎛ U n − 2U n + U n ⎞
j j+1 j−1 a Δt ⎜ j+1 j j−1 ⎟
+ a⎢ ⎥=
Δt ⎢ 2Δx ⎥ 2 ⎜ 2 ⎟
⎣ ⎦ ⎝ Δx ⎠
1 ⎡ Δt 2 Δt 3 Δt 4 ⎤ a ⎡ Δx 3 ⎤
LHS= ⎢ΔtU t +
Δt ⎢⎣ 2
U tt +
6
U ttt +
24 ( )
U tttt + O Δt 5 ⎥ + ⎢2ΔxU x + 2
⎥⎦ 2Δx ⎢⎣ 6 ( )
U xxx + O Δx 5 ⎥
⎦⎥
Δt Δt 2 Δt 3 aΔx 2
= U t + aU x +
2
U tt +
6
U ttt +
24
U tttt +
6 (
U xxx + O Δx 4 ,Δt 4 )
2
a Δt ⎛ Δx 2
Δx 4 ⎞
RHS =
2Δx 2 ⎝
⎜ 2 2 U xx + 2 24 U xxxx + O Δx ⎟
⎜ ( ) 6


⎛ a 2 Δt Δx 2 a 2 Δt ⎞
= ⎜⎜
⎝ 2
U xx +
24 ( )
U xxxx + O Δx 4 ⎟⎟

Δt 2 Δt 2 Δt 3 aΔx 2 Δx 2 a 2 Δt
⇒ U t + aU x =
2 (
a U xx − U tt −
6) U ttt −
24
U tttt −
6
U xxx +
24 (
U xxxx + O Δx 4 ,Δt 4 )
Converting all error terms to spatial derivative (1)

Δt 2 Δt 2 Δt 3 aΔx 2 Δx 2 a 2 Δt
U t + aU x =
2 (
a U xx − U tt −
6 )
U ttt −
24
U tttt −
6
U xxx +
24 ( )
U xxxx + O Δx 4 ,Δt 4
2 3 2
Δt 2 Δt Δt aΔx Δx 2 a 2 Δt
⇒ U tt + aU xt =
2 (
a U xxt − U ttt −
6 )
U tttt −
24
U ttttt −
6
U xxxt +
24 ( )
U xxxxt + O Δx 4 ,Δt 4
2 3
Δt Δt Δt a Δx 2
2
Δx 2 a 3Δt
⇒ −aU tx − a 2U xx =
2 (
−a 3U xxx + aU ttx + a
6 ) U tttx + a
24
U ttttx +
6
U xxxx −
24 ( )
U xxxxx + O Δx 4 ,Δt 4
2 2
Δt 2 Δt aΔx
⇒ U tt = a 2U xx +
2 (
a U xxt − U ttt − a 3U xxx + aU ttx + ) 6
(
aU tttx − U tttt + ) (
6
) (
−U xxxt + aU xxxx + O Δx 3 ,Δx 2 Δt,Δt 3 )
Δt
⇒ U ttt = a 2U xxt +
2 ( )
a 2U xxtt − U tttt − a 3U xxxt + aU tttx + O Δx 2 ,Δt 2( )
Δt 2
⇒ U ttx = a 2U xxx +
2 ( )
a U xxxt − U tttx − a 3U xxxx + aU ttxx + O Δx 2 ,Δt 2 ( )
Δt 2
⇒ U xxt = −aU xxx +
2 ( )
a U xxxx − U ttxx + O Δx 2 ,Δt 2 ( )
(
⇒ U tttt = a 4U xxtt + O Δx 2 ,Δt )
(
⇒ U tttx = −a 3U xxxx + O Δx 2 ,Δt )
⇒ U xxtt = a 2U xxxx + O ( Δx ,Δt ) 2

⇒ U xxxt = −aU xxxx + O ( Δx ,Δt ) 2


Converting all error terms to spatial derivative (2)
Δt 2 Δt 2 Δt 3 aΔx 2 Δx 2 a 2 Δt
U t + aU x =
2 (
a U xx − U tt −
6 )
U ttt −
24
U tttt −
6
U xxx +
24 (
U xxxx + O Δx 4 ,Δt 4 )
4 2 2 2
a Δt a Δx
⇒ U tt = a 2U xx −
3
U xxxx +
3 (
U xxxx + O Δx 3 ,Δx 2 Δt,Δt 3 )
(
⇒ U ttt = −a 3U xxx + O Δx 2 ,Δt 2 )
(
⇒ U ttx = a 2U xxx + O Δx 2 ,Δt 2 )
(
⇒ U xxt = −aU xxx + O Δx 2 ,Δt 2 )
⇒ U tttt = a 4U xxxx + O ( Δx ,Δt )
2

⇒ U tttx = −a 3U xxxx + O ( Δx ,Δt )2

⇒ U xxtt = a 2U xxxx + O ( Δx ,Δt )


2

⇒ U xxxt = −aU xxxx + O ( Δx ,Δt )2

Δt ⎛ 2 a 4 Δt 2 a 2 Δx 2 ⎞
U t + aU x = ⎜ a U xx − a 2U xx + U − U ⎟
2 ⎜⎝ 3 xxxx
3 xxxx ⎟

Δt 2 3 Δt 3 4 aΔx 2 Δx 2 a 2 Δt
+
6
a U xxx −
24
a U xxxx −
6
U xxx +
24 (
U xxxx + O Δx 3Δt,,Δx 2 Δt 2 ,Δx 4 ,Δt 4 )
⎡ 2 ⎤ ⎡ 2 ⎤
aΔx 2 ⎢ ⎛ aΔt ⎞ ⎥ aΔx 3 ⎛ aΔt ⎞⎢ ⎛ aΔt ⎞ ⎥
=− 1− ⎜
6 ⎢ ⎝ Δx ⎠ ⎥
⎟ U xxx − ⎜ ⎟ 1− ⎜ ⎟ U
8 ⎝ Δx ⎠⎢ ⎝ Δx ⎠ ⎥ xxxx (
+ O Δx 3Δt,,Δx 2 Δt 2 ,Δx 4 ,Δt 4 )
⎣ ⎦ ⎣ ⎦
Final result: the modified equation for the Lax-Wendroff scheme

⎡ 2⎤ ⎡ 2⎤
aΔx 2 ⎢ ⎛ aΔt ⎞ ⎥ aΔx 3 ⎛ aΔt ⎞⎢ ⎛ aΔt ⎞ ⎥
U t + aU x = −
6 ⎢
1− ⎜ ⎟ U xxx −
Δx ⎠ ⎥

8 ⎝ Δx ⎠
⎟ 1− ⎜
⎢ Δx ⎠ ⎥ ( 3 2 2 4
⎟ U xxxx + O Δx Δt,,Δx Δt ,Δx ,Δt
4
)
⎣ ⎝ ⎦ ⎣ ⎝ ⎦

Dispersion term hyper-viscous term

Conclusions:
(1) This result is identical to Equation (4.45) in the text
(2) The scheme is of second-order accuracy both in space and time!
(3) There is no numerical viscosity, but there is a numerical phase-dispersion error.
(4) There is a hyper-viscous term.
(5) It is conditionally stable.
Alternative ways of looking at analytical solutions
Original equation:
!" !"
+% =0
!# !&
Initial condition:
" &, # = 0 = *+ cos /&
The analytical solution is:
" &, # = *+ cos / & − %#

The modified equation:


7 7
!" !" !2" !4" % Δ& 7 %Δ# % Δ& 2 %Δ# %Δ#
+% =1 2+3 4, 1≡− 1− , 3≡− 1− ,
!# !& !& !& 6 Δ& 8 Δ& Δ&

Again, the same initial condition:


" &, # = 0 = *+ cos /&
The analytical solution can be written as:
" &, # = *+ ;&< =# cos / & − %# + >#
Then
=*+ ;&< =# cos / & − %# + ># − −/% + > *+ ;&< =# sin / & − %# + ># − %/*+ ;&< =# sin / & − %# + >#
= 1/ 2 *+ ;&< =# sin / & − %# + ># + 3/ 4 *+ ;&< =# cos / & − %# + >#
Therefore
= − 3/ 4 *+ ;&< =# cos / & − %# + ># + −> − 1/ 2 *+ ;&< =# sin / & − %# + ># = 0

Then
= = 3/ 4 , > = −1/ 2
Finally,
" &, # = *+ ;&< 3/ 7 # cos / & − %# − 1/ 2 #
(Magnitude) dissipation error (Phase) dispersion error
Conclusions
Original equation:
!" !"
+% =0
!# !&
Initial condition:
" &, # = 0 = *+ cos /&
The analytical solution is:
" &, # = *+ cos / & − %#

The modified equation:


7
!" !" ! 2" ! 4" % Δ& 7 %Δ#
+% = 1 2+3 4, 1≡− 1− ,
!# !& !& !& 6 Δ&
% Δ& 2 %Δ# %Δ# 7
3≡− 1− ,
8 Δ& Δ&

Again, the same initial condition:


" &, # = *+;&< 3/ 7# cos / & − %# − 1/ 2#
(Magnitude) dissipation error (Phase) dispersion error
Negative d means a stable scheme
Demonstration of the Lax-Wendroff scheme for a problem with a jump
Assume
⎧1, for j ≤ J
U nj = ⎨
⎩0, for j > J

adt
For the discussion, assume a = 1, Δx = 1, CFL = = 0.5
dx

⎧0, for j ≠ J
The downwind slopes: σ nj = ⎨
⎩−1, for j = J

Apply the Lax-Wendroff scheme, we have


aΔt ⎡ n 1 ⎛ aΔt ⎞
2 Oscillation is generated
n ⎤
U n+1
j
= U nj − U
2Δx ⎣ j+1
− U j−1 ⎦ + ⎜
2 ⎝ Δx ⎠ ( n n n
⎟ U j+1 − 2U j + U j−1 )
⎧1, for j ≤ J − 1

( )
⎪1− 0.25⎡⎣0 − 1⎤⎦ + 0.125 0 − 2 + 1 = 1.125, for j = J
=⎨
( )
⎪0 − 0.25⎡⎣0 − 1⎤⎦ + 0.125 0 − 0 + 1 = 0.375, for j = J + 1

⎩0, for j ≥ J + 2

Spurious oscillations à
Comp. Math.
&
Applications
Finite volume schemes
Jingmei Qiu

Outline
" Z ! #
1 d
Nonlinear u(x, t)dx + f (u(xj+ 12 , t)) f (u(xj 1 , t)) = 0.
equations x dt Ij
2

Conservative
schemes Then,
Monotone d 1 ˆ
!" !% ", # schemes ūj (t) + (fj+ 12 fˆj 12 ) = 0
+ =0 dt x
!# !' Nonlinear
TVD and with Z
TVB schemes 1
ūj (t) ⇡ u(x, t)dx.
Summary x Ij
Thus,
t ˆ
ūjn+1 (t) = ūjn (t) (f 1 fˆj 1 )
x j+ 2 2

with
fˆj 1
2
= fˆ(ūjn 1 , ūjn ),
being an approximation of the Riemann solution with left and right
states ūjn 1 , ūjn respectively.
12 15 / 79
Comp. Math.
&
Applications
Conservative scheme
Jingmei Qiu

Outline Definition (Conservative schemes)


Nonlinear
quations A scheme is called a conservative scheme if it can be written in the form
Conservative
of
t ˆ
chemes ujn+1 = ujn (fj+ 1 fˆj 1 )
x 2 2
Monotone
chemes where fˆj± 1 are numerical fluxes. They are designed to locally depends on
2
Nonlinear the solution
TVD and
TVB schemes fˆj+ 1 = fˆ(u , u + 1 ).
2 j+ 12 j+ 2
ummary
The flux satisfies
• fˆ is Lipschitz continuous w.r.t. u and u + .
• fˆ(u, u) = u (consistency).

Remark
We say fˆ is Lipschitz continuous if there is a constant L 0(which may depend
on u) such that |fˆ(v , u) fˆ(u, u)|  L|v u|, 8v with |v u| is sufficiently small.
13
Comp. Math.
&
Applications
Examples: Lax-Friedrich scheme
Jingmei Qiu
The numerical flux is
Outline
1⇥ ⇤
Nonlinear fˆ = f (u ) + f (u + ) ↵(u + u ) , Here * + means the part of flux
2
with positive characteristic
quations

onservative
chemes where ↵ = max |f 0 (u)|.
u
speed, thus * + = * -.
Monotone
chemes
Ideas behind:
Nonlinear
TVD and
Here * . means the part of flux
TVB schemes
f (u) = f++f with negative characteristic
speed, thus * . = * -+
ummary
1 1
:= (f (u) + ↵u) + (f (u) ↵u),
2 2
upwind 1 1
= (f (u ) + ↵u ) + (f (u + ) ↵u + )
2 2
observing that
@f + @f
0,  0.
@u @u
Physical meaning
22 / 79 here:
The characteristic speed for each, in
!"# !"% discrete form, must remain the same sign.
Thus
!$%
≥ 0, !$#
≤0 à Preserve upwind locally!
14
For the special case of
! = #$ → & = # '! # > 0; & = −# '! # < 0

Then for # > 0 and constant reconstruction


1
!- 0 = #$4./0 5
+ #$4.5 − # $4./0
5
− #$4.5 = #$4.5 , !- 0 = #$4.80
5
./1 2 .81

5/0 5 Δ: 5 5
$4.5/0 − $4.5 1
$4. = $4. − #$4. − #$4.80 → + #$4.5 − #$4.80
5
= 0 !<= # > 0
Δ; Δ: Δ;

Likewise
$4.5/0 − $4.5 1 5
+ #$4./0 − #$4.5 = 0 !<= # < 0
Δ: Δ;

Thus, we derived the upwind scheme in this case.


15
The upwind scheme

Observations:

(1) No oscillation
(Monotone) à Good

(2) But too diffusive (the


thickness of the
interface becomes very
wide) à Bad

16
For the special case of
! = #$ → & = # '! # > 0; & = −# '! # < 0

Then for # > 0 and linear reconstruction with center slope


$578 − $598 $57? − $5
-./ 0122 3: $ = $5 + <′ ; -./ 0122 3 + 1: $ = $578 + <′′
2Δ< 2Δ<
$578 − $598 $57? − $5
→ $9 57@.B = $5 + , $7 57@.B = $578 −
4 4
Then
1
!E57@.B = ! $9 + ! $7 − # $7 − $9
2
1 $578 − $598 $57? − $5 $57? − $5 $578 − $598
= # $5 + + # $578 − − # $578 − − $5 −
2 4 4 4 4
$578 − $598
= #$5 + #
4
$5 − $59?
!E59@.B = #$598 + #
4
Therefore, we have a scheme
ΔG $578 − $598 $5 − $59?
$5F78 = $5F − #$5 + # − #$598 − #
Δ< 4 4
#ΔG $578 − $ 5 − $ 598 + $ 59?
= $5F − $5 − $598 +
Δ< 4
Thus, the modified upwind scheme
F
F78 F
#ΔG F F
$578 − $5F − $598
F F
+ $59?
$5 = $5 − $ − $598 +
Δ< 5 4
17
Thus, the modified upwind scheme
# # # #
(Δ* !"$% − !" − !",% + !",.
!"#$% = !"# − !"# − !",%
#
+
Δ+ 4

Note:
#
!"$% − !"# − !",%
# #
+ !",.
4
#
1 4! # Δ+ 5 4 5 !
= 12Δ+ + − !"#
4 4+ " 3 4+ 5 "
# . # # #
4! 2Δ+ 4.! 2Δ+ 5
45! 2Δ+ 8
48!
+ !"# − 2Δ+ + − + + 9 Δ+ 5 2
4+ " 2! 4+ . "
3! 4+ 5 "
4! 4+ 8 "
. . # 5 5 # 8 8 #
Δ+ 4 ! Δ+ 4 ! Δ+ 4 !
= − + + 9 Δ+ ;
2 4+ . "
4 4+ 5 "
6 4+ 8 "
<=>
Amounts to adding a diffusion term with a viscosity of − , cancelling part of the
.
leading-order numerical viscosity in the original upwind scheme.

But, the true modified equation should be re-derived.


18
Flux Limiters - introduction
Used in high-resolution schemes to avoid spurious oscillations

Total variation diminishing (TVD) property


∂u ∂u ∂u
+a = 0, total variation TV = ∫ dx ~ ∑ ui+1 − ui
∂t ∂x ∂x i

( )
A numerical scheme is said total variation dimishing if TV u n+1 ≤ TV u n ( )
A desired property: If the initial field is non-oscillatory, then the solution should also be non-oscillatory
A scheme meets this property is called a monotone scheme
High-order scheme such as the second-order Lax-Wendroff scheme can produce oscillatory solution
This is because that the local piecewise linear reconsutrction violates TVD requirement.

Straightforward choices like central, upwind, downwind slopes do not satisfy the TVD requirement!

WE NEED A FLUX LIMITER!


The minmod slope limiter
A clever choice of the slope
p j = U nj + σ nj x − x j
( )
is
#U n − U n U n − U n &
σ = minmod %% j+1
n
j
j
, j j−1 (
(
$ Δx Δx '
where
)
( ( ) ( ) ( )
+ sign a1 min a1 , a2 , if sign a1 = sign a2
minmod a1 ,a2 = * ) ( )
,0, otherwise
+

- monotonicity is maintained
- TV is not increasing with time
- Exact scalar conservation

!" # = !" #%& = !" #%' = 1.0

+ - #%. = + - # + 01 = + - # + 02Δ1
, , ,
The SUPERBEE slope limiter
(
σ nj = maxmod σ Lj ,σ Rj )
where
# U n −U n U n −U n &
σ L
= minmod % 2 j j−1
, j+1 j (
j % Δx Δx (
$ '
#U n − U n U nj+1 − U nj &
j j−1
σ Rj = minmod %
%
,2 (
(
$ Δx Δx '
and
*
maxmod a1 ,a2 ( ) ( ) ( ) ( ) ( )
, sign a1 max a1 , a2 , if sign a1 = sign a2
≡+
-0, otherwise
,

Compare to the minmod limiter, the SUPERBEE limiter results in a steeper


slope (or sharp interface)
Still meet TVD
The SUPERBEE slope limiter - details
U nj − U nj−1 U nj+1 − U nj
s1 = , s2 =
Δx Δx

σ nj = maxmod σ Lj ,σ Rj ( )
where
σ Lj = minmod ( 2s1 ,s2 )
σ Rj = minmod ( s1 ,2s2 )
and
!
( ( ) ( )
# sign a1 max a1 , a2 , if sign a1 = sign a2
maxmod a1 ,a2 ≡ " ) ( ) ( )
#0, otherwise
$

(1) If s1 and s2 are of different signs, σ nj = 0

(2) if both s1 and s2 are positive, and s1 ≤ s2


s1 + s2
2a: if s1 = s2 , σ nj =
2
1
2b: if 0<s1 ≤ s , σ nj = 2s1
2 2
1
2c: if s2 < s1 ≤ s2 , σ nj = s2
2
The van-Leer slope limiter (the monotonized central limiter)

# U n −U n U n −U n U nj − U nj−1 &
n j+1 j j+1 j−1
σ = minmod %% 2
j
, ,2 (
(
$ Δx 2Δx Δx '
where
)
(
minmod a1 ,a2 ,a3 ) =*
( ) ( ) ( ) ( ) ( )
+ sign a1 min a1 , a2 , a3 , if sgn a1 = sgn a2 = sgn a3
,0,
+ otherwise

The van Leer limiter is about as accurate as the superbee limiter.


The van-Leer slope limiter: two different forms
Form 1:
# U n −U n U n −U n U n − U nj−1 & # s + s2 &
σ nj = minmod %% 2 j+1 j
, j+1 j−1
,2 j ( = σ n = minmod % 2s ,s = 1
( j 1 0
,2s2 (
$ Δx 2Δx Δx ' $ 2 '
where
)
( )
+ sign ( a1 ) min a1 , a2 , a3 , if sgn ( a1 ) = sgn ( a2 ) = sgn ( a3 )
minmod ( a1 ,a2 ,a3 ) = *
+0,
, otherwise

Form 2:
s s U nj+1 − U nj U nj − U nj−1
σ nj = -.sgn ( s1 ) + sgn ( s2 )/0 1 2 ,
s1 + s2
where s1 =
Δx
, s2 =
Δx
The two forms are
essentially similar, with
(1) Both give σ nj = 0, if s1 and s2 are of different signs Form 2 giving a
(2) if both s1 and s2 are positive, and s1 ≤ s2
smooth variation and
)s + s slightly smaller slope
+ 1 2
Form 1
n + 2
2a: if s1 = s2 , σ j = * magnitude (by at most
+ s1 + s2
+
, 2
Form 2
a factor of 0.75)
) 2s Form 1
+ 1
1 + 2s s 1
2b: if 0<s1 ≤ s2 , σ nj = * 1 2 = 2s1 ⋅ = 2s1 ⋅ -.1 → 0.75/0 Form 2, → 2s1 if s1 << s2
3 s
+ 1 + s s1
+
2
1+
, s2
)s + s
+ 1 2
Form 1
+ 2
1 n
2c: if s < s1 < s2 , σ j = * 2 - 2/
3 2 ( ) ( )
+ 2s1s2 = s1 + s2 − s2 − s1 = s1 + s2 41− s2 − s1 5 = s1 + s2 ⋅ -1 → 0.75/ Form 2
+s + s 2 2 4 25 . 0
, 1 2 (
2 s1 + s2 ) 4. (
s1 + s2 50 2
)
Compare SUPERBEE with van Leer form 1
(1) If s1 and s2 are of different signs, σ nj = 0

(2) if both s1 and s2 are positive, and s1 ≤ s2


s1 + s2
2a: if s1 = s2 , σ nj = superbee = van Leer form 1
2

1
2b : if 0<s1 ≤ s , σ nj = 2s1 van Leer Form 1=superbee
3 2

* s + s2 4s1 / s2 s + s2 $ 4'
, 2s1 = 1 ⋅ = 1 ⋅ &1 → ) , superbee
1 1 , 2 s1 / s2 + 1 2 % 3(
2b: if s2 <s1 ≤ s2 , σ nj = +
3 2 , s1 + s2
, , van Leer Form 1
- 2
* s + s2 2 s + s2 $ 4 '
, s2 = 1 ⋅ = 1 ⋅ & → 1) , superbee
1 , 2 s1 / s2 + 1 2 %3 (
2c: if s2 < s1 < s2 , σ nj = +
2 , s1 + s2
, , van Leer Form 1
- 2
Summary of order of numerical dissipation

Near regions where the gradient change quickly Near regions where the gradient change slowly
No limiter Superbee
Superbee No limiter
van Leer form 1 van Leer form 1
van Leer form 2 van Leer form 2
minmod minmod
zero slope zero slope

àThe last one is global first-order

Important: when a=0, must take the average of L+R


Some general statements
In general, the modified equation can be written as:
∞ ⎛ ∂2n u ∂2n+1u ⎞
ut + aux = ∑ ⎜⎜ B2n + B2n+1 ⎟

n=1 ⎝ ∂x 2n ∂x 2n+1 ⎠

l−1
(1) The necessary condition for numerical stability is (−1) B2l > 0
B2l is the lowest even derivative term
∞ n
(2) The relative phase error is φ E − φ N = −kΔt ∑ (−1) k 2n B2n+1
n=1

For the explicit upwind method:


aΔx ⎛ aΔt ⎞
B2 = ⎜1− ⎟ 1−1 aΔx ⎛ aΔt ⎞ aΔt
2 ⎝ Δx ⎠ (−1) ⎜1− ⎟>0 ⇒ <1
2
2 ⎝ Δx ⎠ Δx
⎡ ⎞2 ⎤
B3 = −
( )
a Δx ⎛
⎢1− 3 aΔt + 2 ⎜ aΔt ⎟ ⎥
6 ⎢ Δx ⎝ Δx ⎠ ⎥⎦

For the Lax-Wendroff method:


B2 = 0
⎡ 2⎤
aΔx 2 ⎢ ⎛ aΔt ⎞ ⎥
B3 = − 1− ⎜ ⎟
6 ⎢ ⎝ Δx ⎠ ⎥
⎣ ⎦
⎡ 2⎤ ⎧ ⎡ 2 ⎤⎫
aΔx 3 ⎛ aΔt ⎞⎢ ⎛ aΔt ⎞ ⎥ 2−1 ⎪ aΔx 3 ⎛ aΔt ⎞⎢ ⎛ aΔt ⎞ ⎥⎪ aΔt
B4 = − ⎜ ⎟ 1− ⎜ ⎟ ( )
−1 × ⎨− ⎜ ⎟ 1− ⎜
8 ⎝ Δx ⎠⎢ ⎝ Δx ⎠ ⎥⎪
⎟ ⎬>0 ⇒
Δx
<1
8 ⎝ Δx ⎠⎢ ⎝ Δx ⎠ ⎥ ⎪
⎩ ⎣ ⎦⎭
⎣ ⎦
A few other schemes (1)

The Lax Method

u n+1
j ( )
− u nj+1 + u nj−1 / 2
+a
u nj+1 − u nj−1
=0
Δt 2Δx

⎡ 2⎤

The truncation error:



O ⎢Δt,
Δx ( ) ⎥
Δt ⎥
⎢⎣ ⎥⎦

The modified equation is


2 ⎛ ⎛ 2⎞
ut + aux =
aΔx ⎛ Δx
⎜ −
aΔt ⎞
⎟ uxx +
a Δx ( ) ⎜1− ⎜ aΔt ⎞⎟ ⎟ u + ...
2 ⎝ aΔt Δx ⎠ 3 ⎜ ⎝ Δx ⎠ ⎟ xxx
⎝ ⎠
The stability condition is
aΔt
<1
Δx
A few other schemes (2)

The Euler implicit method with central differencing


u n+1
j
− u nj u n+1
j+1
− u n+1
j−1
+a =0
Δt 2Δx

⎡ 2⎤
The truncation error: O ⎢Δt, Δx

( ) ⎥⎦

The modified equation is


2 ⎛ 2⎞
ut + aux =
a 2 Δt
uxx −
a Δx ( ) ⎜1+ 2 ⎛⎜ aΔt ⎞⎟ ⎟ u + ...
xxx
2 6 ⎜ ⎝ Δx ⎠ ⎟⎠

It is unconditionally stable

Must solve a tridiagonal system ⎡⎣The Thomas algorithm⎤⎦


A few other schemes (3)

The MacCormack Method

The predictor sub-step


u*j − u nj u nj+1 − u nj
+a =0
Δt Δx
The corrector sub-step
u n+1
j (
− u*j + u nj / 2) +a
u*j − u*j−1
=0
Δt 2Δx

Essentially the same as the Lax-Wendroff scheme


A few other schemes (4)

The fourth-order Runge-Kutta method


u j+1 − u j−1
( )
ut = −aux ≡ R u = −a
2Δx

Sub-step 1:
Δt n
u( ) = u n +
1
R
2

Sub-step 2:
Δt (1)
u( ) = u n +
2 ⎡ 4 2⎤
R ( ) ,(Δx )
Truncation error = O ⎢ Δt
2 ⎣ ⎥⎦

Sub-step 3:
( 2)
u( ) = u n + Δt ⋅ R
3

Sub-step 4:
Δt ⎛ n (1) ( 2) (3) ⎞
u n+1 = u n + ⎜⎜ R + 2R + 2R + R ⎟⎟
6 ⎝ ⎠
Summary

• We consider one second-order algorithm for solving the 1D advection equation: The
Lax-Wendroff scheme
• We derived the modified equation for the Lax-Wendroff scheme, and interpreted the
leading-order error terms physically.
• We use the Lax-Wendroff scheme to demonstrate spurious oscillations
• We also introduce the finite-volume method for the 1D advection equation, the concept
of conservative scheme. An example of which is the Lax-Friedrich scheme. Some
examples are given.
• We then introduce the concept of flux limiter to remove oscillations à Total variation
diminishing
• Will the flux limiter affect the order of accuracy of a scheme?
• Many other schemes are available, each with merits and drawbacks

You might also like