The Advection-Diffusion equation!: ∂u ∂t + u ∂u ∂x + v ∂u ∂y = − 1 ρ ∂P ∂x + µ ρ ∂ ∂x + ∂ ∂y ⎛ ⎝ ⎜ ⎞ ⎠ ⎟
The Advection-Diffusion equation!: ∂u ∂t + u ∂u ∂x + v ∂u ∂y = − 1 ρ ∂P ∂x + µ ρ ∂ ∂x + ∂ ∂y ⎛ ⎝ ⎜ ⎞ ⎠ ⎟
The Advection-Diffusion ∂u ∂u ∂u
+ u +v =−
1 ∂P µ ⎛⎜ ∂ 2 u ∂ 2 u ⎟⎞
+ +
∂t ∂x ∂y ρ ∂x ρ ⎝ ∂x 2 ∂y 2 ⎠
equation!
Hyperbolic part!
The Navier-Stokes equations contain three equation types
that have their own characteristic behavior!
∂u ∂v
+ =0 Depending on the governing parameters, one behavior can
∂x ∂y be dominant!
1D Advection/diffusion equation! ∂f ∂f ∂2 f
∂f ∂f ∂2 f +U = D 2
+U = D 2 ∂t ∂x ∂x
∂t ∂x ∂x
Forward in time/centered in space (FTCS)! FTCS! O(Δt,h 2 ) UΔt
≤1 &
DΔt 1
≤
f jn +1 − f jn f n − f j−1
n
f n − 2 f jn + f j−1
n 2D h2 2
+ U j +1 = D j +1
Δt 2h h 2
O(Δt,h ) UΔt DΔt
Upwind! + 2 2 ≤1
Stability limits! UL h h
UΔt DΔt 1 R=
≤1 & ≤
O(Δt 2 ,h 2 ) ⎛ UΔt ⎞ 2 ⎛ DΔt ⎞
2D h2 2 D
L-W! ⎜ ⎟ ≤ 2⎜ 2 ⎟ ≤ 1
2D h2 ⎝ h ⎠ ⎝ h ⎠
Δt = & Δt =
U 2D
C-N! O(Δt 2 ,h 2 ) Unconditionally stable!
Δt → 0 For high and low D!
∂f ∂2f
=D 2
0.9
U
∂x ∂x 0.8
RL=1! 0.7
U RL=5!
f =0 f =1
0.6
RL=10! 0.5
RL=20! 0.4
L
0.3
0.2
Exact solution!
0.1
exp( RL x / L) − 1 UL
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
f = RL =
exp( RL ) − 1 D
Computational Fluid Dynamics
Computational Fluid Dynamics
∂f ∂2 f
U =D 2
∂x ∂x
The Cell Reynolds Centered difference approximation!
Rearrange:!
( R − 2)q j +1 + 4q j − ( R + 2)q j −1 = 0
( R − 2) f j +1 + 4 f j − ( R + 2) f j −1 = 0 Divide by !q
j −1
Where:! R =
Uh ( R − 2)q2 + 4q1 − ( R + 2 ) = 0
D
⎛ 2 + R⎞
0
Solving for q gives two solutions:! f 0 = C1 + C2 = C1 + C2 = 0
⎝ 2 − R⎠
2+R
q1 = 1 and! q2 = ⎛ 2 + R⎞
N
2− R f N = C1 + C2 =1
⎝ 2 − R⎠
The general solution is:!
The final solution is:!
f j = C1 q1 + C2 q2
j j
⎛ 2 + R⎞
j
−1
⎝ ⎠
f j = 2 − R N +1
or!
⎛ 2 + R⎞
j
f j = C1 + C2 ⎛ 2 + R⎞
⎝ 2 − R⎠ −1
⎝ 2 − R⎠
Computational Fluid Dynamics
Computational Fluid Dynamics
⎝ ⎠ −1
f j = 2 − R N +1
⎛ 2 + R⎞
giving! −1
⎝ 2 − R⎠
q 2 − ( R + 2)q1 + ( R + 1) = 0 R=
Uh
Upwind! D
Solution! 1− (1+ R)
j
1− (1+ R)
j
fj =
fj = 1− (1+ R)
N
1− (1+ R)
N
Upwind! Upwind!
Exact! Exact!
Centered! Centered!
Upwind!
When centered differencing is used for the
Exact! advection/diffusion equation, oscillations may
Centered! appear when the Cell Reynolds number is
higher than 2. For upwinding, no oscillations
appear. In most cases the oscillations are
small and the cell Reynolds number is
frequently allowed to be higher than 2 with
relatively minor effects on the result.!
Uh
R= <2
D
Computational Fluid Dynamics
Computational Fluid Dynamics
2D example! Recell=3.2258!
∂f ∂f ∂f ⎛∂ 2 f ∂ 2 f ⎞
+U + V = D⎜ 2 + 2 ⎟ D=0.02!
∂t ∂x ∂y ⎝ ∂x ∂y ⎠ t=1.5088!
f =0
Flow! Computations
f =1 using centered
differences on a
32 by 32 grid!
f =0
Recell=6.4516! Recell=12.9032!
D=0.005!
D=0.01! t=1.5088!
t=1.5088!
D=0.02!
t=1.50!
1.5
Recell=3.2258!
1.5
Recell=6.6716! Stability in !
1
1
terms of Fluxes!
0.5
0.5
0
0
30
25 15
30
20 25 15
15 20 10
10 15 10
5 10 5
5 5
0 0
0 0
Computational Fluid Dynamics
Computational Fluid Dynamics
Stability in terms of fluxes! Stability in terms of fluxes!
Consider the following initial conditions:! U =1 Consider the following initial conditions:!
f j −1 f j f j +1
Δt Fj −1 / 2 = Uf jn−1 = U
1 = 1.5⋅ U = 1.5
h Fj +1 / 2 = Uf jn = 0
1
f j −1 fi fi+1
Fj +1 / 2 = Uf jn = 0
Fj −1 / 2 = Uf jn−1 = 1
Δt n
f jn+1 = fjn − (F − Fjn−1 / 2 ) = 0 − 1.5(0 −1) = 1.5
During one time step, U∆t of f flows into cell j, h j +1 / 2
increasing the average value of f by U∆t/h.!
Fj +1 / 2 = Uf jn = 0.75U
Fj −1 / 2 = Uf jn−1 = U Fj +1 / 2 = Uf jn = 1.5U Fj +1 / 2 = Uf jn = 2.25U
Fj −1 / 2 = Uf jn−1 = U
1 1
f j −1 f j f j +1 f j −1 f j f j +1
Δt n
f jn+1 = fjn − (F − Fjn−1 / 2 ) = 0 − 1.5(1.5 − 1) = 0.75
h j +1 / 2
Δt n Taking a third step will result in an even larger positive value,
f jn+1
+1 = fjn+1 − (F − Fjn+1/ 2 ) = 0 −1.5(0 −1.5) = 2.25
h j + 3/ 2 and so on until the compute encounters a NaN (Not a Number).!
∂x ⎠ i h
=
1
64h
{
[3 f i+1 + 6 f i − f i−1 ] − [3 f i + 6 f i−1 − f i− 2 ]
2 2
}
∂f 1 ∂f 2 ∂2 f
+ =D 2
∂t 2 ∂x ∂x
∂f 1 ∂f 2 ∂2 f
+ =D 2
∂t 2 ∂x ∂x 10 10
9
Centered!
9
8 8
7 QUICK! 7
6
Upwind! 6
5 5
4 4
Centered! 3 3
QUICK! 2 2
Upwind! 1 1
0 0
0 5 10 15 20 25 30 35 40 0 5 10 15 20 25 30 35 40
Re_cell=10! Re_cell=20!
Computational Fluid Dynamics
Computational Fluid Dynamics
Second order ENO scheme for the linear advection equation! Second order ENO!
∂f ∂f ⎧ a, ∂f 1 ∂f 2 ∂2 f
+u =0 ⎪ a < b + =D 2
∂t ∂x amin ( a,b ) = ⎨ ∂t 2 ∂x ∂x
Δt ⎪⎩ b, b ≤ a
h
(
f j* = f jn − u nj f jn+1/2 − f jn−1/2 ) 10
Re_cell=20!
f jn +1 = f jn −
Δt 1 n n
h 2
( ( ) (
u j f j +1/2 − f jn−1/2 + u *j f j*+1/2 − f j*−1/2 )) 9
8
Centered!
7 QUICK! ENO!
Upwind!
( ) (u + u ) > 0
6
⎧ f + 1 amin Δf + , Δf − , if 1 Upwind!
⎪ j 2
5
j j 2 j j +1
f j +1/2 =⎨ 4
⎩
(
+ −
⎪ f j − 2 amin Δf j +1 , Δf j +1 , if
1
) 1
2(u + u ) < 0
j j +1
3
1
+ −
Δf = f j +1 − f j
j Δf = f j − f j −1
j
0
0 5 10 15 20 25 30 35 40
∂f ∂f
+u =0
∂t ∂x
ENO!
Upwind!
Higher order!
in space!
Centered
Higher order finite difference approximations!
∂f ⎞ f j−2 − 8 f j−1 + 8 f j +1 − f j +2
⎟ = + O(h 4 )
The simplest approach is to use more points:! ∂x ⎠ j 12h
∂ 2 f ⎞ − f j−2 + 16 f j−1 − 30 f j + 16 f j +1 − f j +2
f(x-2h) f(x-h) f(x) f(x+h) f(x+2h) ! ⎟ = + O(h 4 )
∂x 2 ⎠ j 12h 2
h
h
Skewed
∂f ⎞ f j−2 − 6 f j−1 + 3 f j + 2 f j +1
⎟ = + O(h 3 )
∂x ⎠ j 6h
Computational Fluid Dynamics
Computational Fluid Dynamics
Compact Schemes!
By a Taylor series expansion the following forth order relations By a Taylor series expansion the following forth order relations
between the values of f and the derivatives of f can be derived! between the values of f and the derivatives of f can be derived!
∂ fi ∂ 2 fi Δx 2 ∂ f i
3
Δx 3 ∂ f i Δx 4
4
∂ fi ∂ 2 fi Δx 2 ∂ f i
3
Δx 3 ∂ f i Δx 4
4