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

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

1D linear convection / advection equation


The characteristic lines

!" !" !" ! %"


+% =0 → + =0
!# !& !# !&

!" !- "
*ℎ, -."& - " = %" → + =0
!# !&

5& !- "
/,-01, #ℎ, 2ℎ%3%2#,304#02 .01, = =%
5# !"

Then the derivative along the characteristic line is

/" !" !" 5& !" !" !- " !" !- "


= + = + = + =0
/# !# !& 5# !# !& !" !# !&
The solution does not change along the characteristic lines

)"
=(
)$

→ " = "& + ( ⋅ $

! ", $ = !& " − ($ = !& "&

4
Euler explicit methods

Differential equation
∂u ∂u
+a = 0 with a > 0
∂t ∂x

Method 1 Method 2 Method 3


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

Downwind Upwind Central


Unconditionally Conditionally Unconditionally
unstable stable unstable
The stability condition
What is the numerical diffusivity? 0≤
aΔt
≤1
Δx
The upwind scheme: Truncation errors

!"#$% − !"# * # #
+ !" − !",% =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Δ*

Δ* Δ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!%% + 4!%%% + 5!%%%% + +6 Δ( 7, Δ( 0Δ,, Δ( -Δ, -, Δ(Δ, 0, Δ, 7

-
$Δ( $Δ, $ Δ( - $Δ, $Δ,
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 Δ% Δ% Δ%

45 + #46 = !466 + +4666 + 046666 + +7 Δ% 8, Δ% 1Δ), Δ% ,Δ) ,, Δ%Δ) 1, Δ) 8

Numerical hyper-viscous term


The numerical viscous
Physical interpretation?
term / numerical
dissipation
aΔx ⎛ aΔt ⎞
νN ≈ ⎜1− ⎟
2 ⎝ Δx ⎠

Numerical (artificial)
viscosity (diffusivity)
von Neumann stability analysis of the upwind scheme

!"#$% − !"# !"# − !"+%


#
+* = 0, *>0
Δ( Δ,

It can be written as
*Δ( #
!"#$% = !"# − #
!" − !"+% = !"# − 1 !"# − !"+%
#
Δ,

One time-step Von Neumann stability analysis

23( !"# = 453 678 , !"#$% = 4(Δ()3 678


Then
4 Δ( = 45 − 451 1 − 3 +67<8 = 1 − 1 1 − 3 +67<8 45

Namely,

!"#$% = 1 − 1 1 − 3 +67<8 453 678

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 )

The diffusion term Physical interpretation?

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 / & − %#

The modified equation:


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

Again, the same initial condition:


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

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

Deep physical interpretations


Positive numerical viscosity à negative growth factor
à better numerical stability
numerical instability à negative numerical viscosity [homework]

CFD: mathematics and physics go together

You might also like