Professional Documents
Culture Documents
6.1D Advection Part2
6.1D Advection Part2
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
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
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
⇒ ( )
− 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
Δ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
Δ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
)
⎣ ⎝ ⎦ ⎣ ⎝ ⎦
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 / & − %#
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 / & − %#
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
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
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
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
Δ: Δ;
Observations:
(1) No oscillation
(Monotone) à Good
16
For the special case of
! = #$ → & = # '! # > 0; & = −# '! # < 0
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.
( )
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!
- monotonicity is maintained
- TV is not increasing with time
- Exact scalar conservation
+ - #%. = + - # + 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
,
σ 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
$
# 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
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
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
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
u n+1
j ( )
− u nj+1 + u nj−1 / 2
+a
u nj+1 − u nj−1
=0
Δt 2Δx
⎡ 2⎤
⎡ 2⎤
The truncation error: O ⎢Δt, Δx
⎣
( ) ⎥⎦
It is unconditionally stable
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