Professional Documents
Culture Documents
The Advection Equation and Hyperbolic System (1) Introduction: 1D Linear Advection
The Advection Equation and Hyperbolic System (1) Introduction: 1D Linear Advection
Numerical Fluid
analysis Mechanics
CFD
Computer
Science
1
The advection or wave equation and flux limiters
Let us consider the simple problem
∂u ∂u
+a = 0 with a = constant
∂t ∂x
− ∞ ≤ x ≤ +∞, t ≥ 0
A subset of the wave equation
I .C. u( x,t = 0) = F!"x #
( ) ∂2 u 2 ∂2 u
−a =0
∂t 2 ∂x 2
The analytical solution is
u( x,t ) = F!"x -#at,
( − 0%&
)
The initial condition determines the solution at later times
Hyperbolic PDE
!" !- "
*ℎ, -."& - " = %" → + =0
!# !&
5& !- "
/,-01, #ℎ, 2ℎ%3%2#,304#02 .01, = =%
5# !"
)"
=(
)$
→ " = "& + ( ⋅ $
4
Euler explicit methods
Differential equation
∂u ∂u
+a = 0 with a > 0
∂t ∂x
!"#$% − !"# * # #
+ !" − !",% =0
Δ( Δ+
Apply the Taylor expansions
1 # Δ( 2 Δ( 4 Δ( 6
!" + Δ( ⋅ !1 + ⋅ !11 + ⋅ !111 + ⋅ !1111 + 8 Δ( 9 − !"#
Δ( 2 6 24
* # # Δ+ 2 Δ+ 4 Δ+ 6
+ !" − !" − Δ+ ⋅ !: + ⋅ !:: − ⋅ !::: + ⋅ !:::: + 8 Δ+ 9 =0
Δ+ 2 6 24
→ !1 + *!:
Δ( Δ+ Δ( 2 Δ+ 2 Δ( 4 Δ+ 4
=− ⋅ !11 + * ⋅ !:: − ⋅ !111 − * ⋅ !::: − ⋅ !1111 + * ⋅ !::::
2 2 6 6 24 24
6
+ 8 Δ+ + 8 Δ( 6
The upwind scheme: Converting R.H.S. to spatial derivatives
→ "# + %"&
. .
Δ* Δ- Δ* Δ- Δ* 0 Δ- 0
=− ⋅ "## + % ⋅ "&& − ⋅ "### − % ⋅ "&&& − ⋅ "#### + % ⋅ "&&&& + 2 Δ- 3
2 2 6 6 24 24
+ 2 Δ* 3
Δ* Δ- Δ* . Δ- .
→ "## + %"&# =− ⋅ "### + % ⋅ "&&# − ⋅ "#### − % ⋅ "&&&# + 2 Δ- 0 + 2 Δ* 0
2 2 6 6
.
Δ* Δ- Δ* Δ- .
→ −%"#& − %. "&& =% ⋅ "##& − %. ⋅ "&&& + % ⋅ "###& + %. ⋅ "&&&& + 2 Δ- 0 + 2 Δ* 0
2 2 6 6
→ "##
.
Δ* Δ- .
Δ* . Δ- .
= % "&& + ⋅ −"### + %"##& + ⋅ %"&&# − % ⋅ "&&& + ⋅ %"###& − "#### +
2 2 6 6
⋅ −%"&&&# + %. ⋅ "&&&& + 2 Δ- 0 + 2 Δ* 0
Δ* Δ-
→ "### = %. "&&# + ⋅ −"#### + %"###& + ⋅ %"&&## − %. ⋅ "&&&# + 2 Δ- . + 2 Δ* .
2 2
Δ* Δ-
→ "##& = %. "&&& + ⋅ −"###& + %"##&& + ⋅ %"&&&# − %. ⋅ "&&&& + 2 Δ- . + 2 Δ* .
2 2
Δ* Δ-
→ "&&# = −%"&&& − ⋅ "&&## + % ⋅ "&&&& + 2 Δ- . + 2 Δ* .
2 2
→ "&&&# = −%"&&&& + 2 Δ- + 2 Δ*
→ "&&## = −%"&&&# + 2 Δ- + 2 Δ* = %. "&&&& + 2 Δ- + 2 Δ*
→ "&### = %. "&&&# + 2 Δ- + 2 Δ* = −%0 "&&&& + 2 Δ- + 2 Δ*
→ "#### = %. "&&## + 2 Δ- + 2 Δ* = %3 "&&&& + 2 Δ- + 2 Δ*
Converting R.H.S. to spatial derivatives fully
→ "##
Δ* Δ* 5 Δ1
= %&"'' + 2%,"''' + %- ⋅ "'''' − %, "''''
2 2 2
Δ1 Δ* Δ1 Δ* & Δ1 &
+ −2%&"''' − %, ⋅ "'''' + %& ⋅ "'''' − %-"'''' + ⋅ %&"''''
2 2 2 3 3
, , & &
+ 3 Δ1 , Δ* , Δx Δt, Δt Δ1
Δ* 3 Δ1
→ "### = −%,"''' + %- ⋅ "'''' + %, "'''' + 3 Δ1 &, Δ* &, Δ1Δ*
2 2
Δ* Δ1
→ "''# = −%"''' − %& ⋅ "'''' + % ⋅ "'''' + 3 Δ1 &, Δ* &, Δ1Δ*
2 2
→ "'''# = −%"'''' + 3 Δ1 + 3 Δ*
→ "''## = %&"'''' + 3 Δ1 + 3 Δ*
→ "'### = −%,"'''' + 3 Δ1 + 3 Δ*
→ "#### = %-"'''' + 3 Δ1 + 3 Δ*
The upwind scheme – The modified equation
!" + $!%
$Δ( $Δ, $ Δ( - $Δ, $Δ, -
= 1− ! − 1−3 +2 !%%%
2 Δ( %% 6 Δ( Δ(
Δ( 0 $Δ, $Δ, - $Δ, 0
+$ 1−7 + 12 −2 !%%%%
24 Δ( Δ( Δ(
Namely,
-
$Δ( $Δ, $ Δ( - $Δ, $Δ,
3= 1− , 4=− 1−3 +2 ,
2 Δ( 6 Δ( Δ(
- 0
$ Δ( 0 $Δ, $Δ, $Δ,
5= 1−7 + 12 −2
24 Δ( Δ( Δ(
The upwind scheme: Final result - Known as the modified equation
,
#Δ% #Δ) # Δ% , #Δ) #Δ)
!= 1− , +=− 1−3 +2 ,
2 Δ% 6 Δ% Δ%
# Δ% 1 #Δ) #Δ) , #Δ) 1
0= 1−7 + 12 −2
24 Δ% Δ% Δ%
Numerical (artificial)
viscosity (diffusivity)
von Neumann stability analysis of the upwind scheme
It can be written as
*Δ( #
!"#$% = !"# − #
!" − !"+% = !"# − 1 !"# − !"+%
#
Δ,
Namely,
11
The upwind scheme: Physical interpretations of the added terms (1)
Exact Solution
ut + aux = 0
For the initial condition: ( )
u x,t = 0 = A0 exp ikx ( )
The exact solution is uE ( x,t ) = A0 exp ⎡⎣ik ( x − at )⎤⎦ = A0 exp ⎡⎣i ( kx − kat )⎤⎦
Discussion:
(1) The amplitude stays as A0 , namely, σ E = 0;
(2) The phase angle is changed by φ E = −kaΔt, for each time step
2
Numerical solution (
exp σ N Δt = ) (1− C + C cos β ) + C 2 sin 2 β
u n+1 − u nj u nj − u nj−1 ⎛ −C sin β ⎞
j
+a =0 φ N = tan −1 ⎜ ⎟
Δt Δx ⎝ 1− C + C cos β ⎠
uN ( ) { ( )}
x,Δt = 1− C ⎡⎣1− exp −ikΔx ⎤⎦ ⋅ A0 exp ikx ( ) aΔt
C≡ , β = kΔx
Δx
( )
≡ exp σ N Δt + iφ N ⋅ A0 exp ikx ( )
Growth rate σ N , and change in phase φ N in one time step
The upwind scheme: Physical interpretations of the added terms (2)
Assume β = kΔx is small
2
(
exp σ N Δt =) (
1− C + C cos β ) + C 2 sin 2 β
2
⎡ ⎛ 2 ⎞⎤
β ⎥ Taylor expansions
= ⎢1− C + C ⎜⎜1−
⎢⎣
⎟ + C 2β 2 + O β 3
2 ⎟⎠⎥⎦ ( )
⎝ β2 β4
cos β = 1− + + ...
2 24
( )
= 1− C β 2 + C 2 β 2 + O β 4
β3
1 sin β = β − + ...
=1− C (1− C ) β + O ( β )
2 4 6
2 1 1
1− x = 1− x − x 2 + ...
2 8
1 1 aΔt ⎛ aΔt ⎞ 2 2 exp ( x ) = 1+ x + ...
σ N Δt ≈ − C (1− C ) β 2 = − ⎜1− ⎟ k ( Δx )
2 2 Δx ⎝ Δx ⎠
aΔx ⎛ aΔt ⎞ 2
=− ⎜1− ⎟ k Δt
2 ⎝ Δx ⎠ Conclusions:
(1) The amplitude growth rate is proportional
aΔx ⎛ aΔt ⎞ 2 2 to the numerical viscosity
σN = − ⎜1− ⎟ k = −ν N k
2 ⎝ Δx ⎠ (2) Positive numerical viscosity corresponds to
negative amplitude growth rate
The upwind scheme: Physical interpretations of the added terms (3)
⎛ −C sin β ⎞
φ N = tan −1 ⎜ ⎟
⎝ 1− C + C cos β ⎠
⎛ ⎛ β3 ⎞ ⎞
⎜
⎜
−C ⎜⎜ β −
⎝ 6 ⎠
( )
⎟⎟ + O β 5 ⎟
⎟
= tan −1 ⎜ ⎟
⎛ 2 4⎞
⎜ 1− C + C ⎜1− β + β ⎟ + O β 6 ⎟
⎜
⎝
⎜
⎝ 2 24 ⎟⎠ ( )⎟
⎠
⎧
⎪⎡ ⎛ ⎤⎡ ⎤⎫ Taylor expansions
β3 ⎞ ⎛β2 ⎞ ⎪
= tan −1 ⎨⎢−C ⎜⎜ β −
6 ⎟ ( )
⎟ + O β 5 ⎥⎢1+ C ⎜
⎜ 2
⎟+O β4
⎟ ( )
⎥⎬
1
⎩⎣⎢
⎪ ⎝ ⎠ ⎦⎥⎣⎢ ⎝ ⎠ ⎥⎦⎪
⎭ = 1+ x + x 2 + ...
⎧ ⎛ β3 ⎞ ⎫ 1− x
−1 ⎪ 5 ⎪
= tan ⎨−C β + C ⎜
⎪
⎩
⎜
⎝ 6 ⎠
⎟ (1− 3C ) + O β ⎬
⎟ ( )
⎪
⎭
−1
tan x = x −
x3
+ ...
⎛ β3 ⎞ 3
C 3β 3
= −C β + C ⎜⎜
⎝ 6 ⎠
⎟ (1− 3C ) +
⎟ 3 ( )
+ O β5
⎛ β3 ⎞
= −C β + C ⎜⎜
⎝ 6 ⎠
( )
⎟ 1− 3C + 2C 2 + O β 5
⎟ ( )
2
( )
a Δx
= −akΔt +
6 (1− 3C + 2C ) k Δt + O (β )
2 3 5
2
( )
a Δx
= φE +
6 (1− 3C + 2C ) k Δt + O (β )
2 3 5
Summary of physical interpretations of the added terms
2 ⎡
aΔx ⎛ aΔt ⎞ a Δx ( ) aΔt ⎛ aΔt ⎞2 ⎤
ut + aux ≈
2 ⎝
⎜1−
Δx ⎠
⎟ uxx −
6
⎢1− 3
⎢ Δx
+ 2⎜
⎝ Δx ⎠ ⎥⎦
3 3
( 2 2
⎟ ⎥ uxxx + O Δt ,Δx ,ΔtΔx ,Δt Δx )
⎣
2
( )
a Δx
σN =−
aΔx ⎛ aΔt ⎞ 2
⎜1− ⎟ k = −ν N k
2
φE − φN = −
6 (1− 3C + 2C ) k Δt + O (β )
2 3 5
2 ⎝ Δx ⎠
Numerical viscosity
Wave phase error
à Negative growth rate
à Reduce (dissipate) wave amplitude à known as the numerical dispersion
Alternative ways of looking at analytical solutions
Original equation:
!" !"
+% =0
!# !&
Initial condition:
" &, # = 0 = *+ cos /&
The analytical solution is:
" &, # = *+ cos / & − %#
Then
? = −1/ 2 + 5/ 6 , @ = −3/ 4
Finally,
" &, # = *+ =&> −1/ 2 # + 5/ 6 # cos / & − %# − 3/ 4 #
(Magnitude) dissipation error (Phase) dispersion error
Summary
We use 1D advection equation to explain many important concepts of CFD:
Von Neumann stability analysis
truncation error à physical accuracy
Numerical (artificial) viscosity / diffusivity
aΔt
CFL (Courant–Friedrichs–Lewy) number C≡
Δx
Upwind , downwind
Evolution of a wave: amplitude and phase angle
Numerical dissipation error
Numerical dispersion error
Many Taylor expansions