View
6
Download
0
Category
Preview:
Citation preview
Computational Fluid Dynamics
Numerical Methods for!Parabolic Equations!
Grétar Tryggvason!Spring 2011!
http://www.nd.edu/~gtryggva/CFD-Course/!Computational Fluid Dynamics
One-Dimensional Problems!• Explicit, implicit, Crank-Nicolson!• Accuracy, stability!• Various schemes!
Multi-Dimensional Problems!• Alternating Direction Implicit (ADI)!• Approximate Factorization of Crank-Nicolson!
Splitting!
Outline!
Solution Methods for Parabolic Equations!
Computational Fluid Dynamics
Numerical Methods for!One-Dimensional Heat
Equations!
Computational Fluid Dynamics
bxatxf
tf <<>
∂∂=
∂∂ ,0;
2
2
α
which is a parabolic equation requiring!
)()0,( 0 xfxf =
Consider the diffusion equation!
Initial Condition!
)(),();(),( ttbfttaf ba φφ == Boundary Condition!(Dirichlet)!
)(),();(),( ttbxftta
xf
ba ϕϕ =∂∂=
∂∂ Boundary Condition!
(Neumann)!
or!
and!
Computational Fluid Dynamics
Parabolic equations can be viewed as the limit of a hyperbolic equation with two characteristics as the signal speed goes to infinity!
Increasing signal speed!
x!
t!
Computational Fluid Dynamics
211
1 2h
ffftff n
jnj
nj
nj
nj −++ +−
=Δ−
α
Explicit: FTCS!
f jn+1 = f j
n +αΔth2
f j+1n − 2 f j
n + f j−1n( )
j-1 j j+1 n
n+1
Explicit Method: FTCS - 1!
∂ 2 f∂x2
⎞
⎠⎟ j
n
=f j+1
n − 2 f jn + f j−1
n
h2
∂ f∂t
⎞⎠⎟ j
n
=f j
n+1 − f jn
Δt
∂f∂t
⎛⎝⎜
⎞⎠⎟ j
n
= α ∂2 f∂x2
⎛
⎝⎜⎞
⎠⎟ j
n
Computational Fluid Dynamics
Modified Equation!
xxxxxxxxxx fhthtOfrhxf
tf ),,()61(
12422
2
2
2
ΔΔ+−=∂∂−
∂∂ αα
2htr Δ= αwhere!
- Accuracy ! ),( 2htO Δ
- No odd derivatives; dissipative!
Explicit Method: FTCS - 2!Computational Fluid Dynamics
Stability: von Neumann Analysis!
14112<Δ−<−
htα
210
2<Δ≤
htα
Fourier Condition!
ε n+1
ε n= 1− 4αΔt
h2sin2 k h
2G = 1− 4r sin2 (β / 2)⎡⎣ ⎤⎦
Explicit Method: FTCS - 3!
Computational Fluid Dynamics
Domain of Dependence for Explicit Scheme!
BC! BC!
x
t
Initial Data!
h
P Δt
Boundary effect is not !felt at P for many time !steps!
This may result in!unphysical solution behavior!
In the limit of Δt and Δx going to zero, the computational domain contains the physical domain of dependence since Δt ~ Δx2 for stability !
Explicit Method: FTCS - 4!Computational Fluid Dynamics
2
11
111
1 2h
ffftff n
jnj
nj
nj
nj
+−
+++
+ +−=
Δ−
α
Implicit Method: Backward Euler!
−rf j+1n+1 + 2r +1( ) f jn+1 − rf j−1n+1 = f j
n r = αΔt / h2( )
j-1 j j+1 n
n+1
Tri-diagonal matrix system!
Implicit Method - 1!
Computational Fluid Dynamics
- The + sign suggests that implicit method may be! less accurate than a carefully implemented explicit! method.!
Modified Equation!∂f∂t
−α ∂2 f∂x2
=αh2
12(1+ 6r) fxxxx +O(Δt
2 ,h2Δt,h4 ) fxxxxxx
Implicit Method - 2!
Amplification Factor (von Neumann analysis)!
G = 1+ 2r(1− cosβ)[ ]−1
Unconditionally stable!
Computational Fluid Dynamics
⎟⎟⎠
⎞⎜⎜⎝
⎛ +−+
+−=
Δ− −+
+−
+++
+
211
2
11
111
1 222 h
fffh
ffftff n
jnj
nj
nj
nj
nj
nj
nj α
Crank-Nicolson Method (1947)!
j-1 j j+1 n
n+1
Tri-diagonal matrix system!
−rf j+1n+1 + 2 r +1( ) f jn+1 − rf j−1n+1 = rf j+1n − 2 r −1( ) f jn + rf j−1n
Crank-Nicolson - 1!
Computational Fluid Dynamics
- Second-order accuracy!
Modified Equation!
xxxxxxxxxx fhtfhxf
tf
⎥⎦⎤
⎢⎣⎡ +Δ+=
∂∂−
∂∂ 423
2
2
2
3601
121
12αααα
Crank-Nicolson - 2!
Amplification Factor (von Neumann analysis)!
( )( )β
βcos11cos11
−+−−=
rrG
Unconditionally stable!
),( 22 htO Δ
Computational Fluid Dynamics
⎟⎟⎠
⎞⎜⎜⎝
⎛ +−−+
+−=
Δ− −+
+−
+++
+
211
2
11
111
1 2)1(
2h
fffh
ffftff n
jnj
nj
nj
nj
nj
nj
nj θθα
Generalization!
j-1 j j+1 n
n+1
⎪⎩
⎪⎨⎧
−=
NicolsonCrank1/2Implicit1
(FTCS)Explicit0θ
θ×( )θ−× 1
Combined Method A - 1!
Computational Fluid Dynamics
( )2
11
111
11 21
hfff
tff
tff n
jnj
nj
nj
nj
nj
nj
+−
+++
−+ +−=
Δ−
−Δ−
+ αθθ
Generalized Three-Time-Level Implicit Scheme:!! ! !Richtmyer and Morton (1967)!
j-1 j j+1
n
n+1
⎩⎨⎧
=implicitfully level-Three1/2
Implicit0θ
( )θ+× 1θ×
n-1
Combined Method B - 1!Computational Fluid Dynamics
Modified Equation:!
Combined Method B - 2!
+Δ+⎥⎦⎤
⎢⎣⎡ +Δ⎟
⎠⎞⎜
⎝⎛ −−=− )(
1221 2
22 tOfhtff xxxxxxt
ααθα
Special Cases:!
),(21 22 htO Δ⇒=θ
r121
21 +=θ ),( 42 htO Δ⇒
Computational Fluid Dynamics
211
11 22 h
ffftff n
jnj
nj
nj
nj −+
−+ +−=
Δ−
α
Richardsonʼs Method!
Richardson Method!
),( 22 htO Δ
Similar to Leapfrog!
but unconditionally unstable!!
j-1 j j+1
n
n+1
n-1
Computational Fluid Dynamics
21
111
11
2 hffff
tff n
jnj
nj
nj
nj
nj −
−++
−+ +−−=
Δ−
α
The Richardson method can be made stable by !splitting by time average !
j-1 j j+1
n
n+1
DuFort-Frankel - 1!
n-1
njf f j
n+1 + f jn−1( ) / 2
( ) ( )nj
nj
nj
nj
nj fffrfrf 1
11
11 221 −−
+−+ +−+=+
Computational Fluid Dynamics
xxxxxxt fhthff ⎥⎦⎤
⎢⎣⎡ Δ−=−
2
232
121 ααα
Modified Equation!
DuFort-Frankel - 2!
xxxxxxfhtth ⎥⎦⎤
⎢⎣⎡ Δ+Δ−+
4
45234 2
31
3601 ααα
Amplification factor !
rrr
G21
sin41cos2 22
+−±
=ββ Unconditionally !
stable!
Conditionally consistent!
Computational Fluid Dynamics
FTCS!Stable for!
BTCS!Unconditionally!
Stable!
Crank-Nicolson!Unconditionally!
Stable!
Richardson!Unconditionally!
Unstable !
xxt ff α=
211
1 2h
ffftff n
jnj
nj
nj
nj −++ +−
=Δ−
α ( ) xxxxfrh 6112
2
−α
Parabolic Equation - Summary!
21≤r
2
11
111
1 2h
ffftff n
jnj
nj
nj
nj
+−
+++
+ +−=
Δ−
α ( ) xxxxfrh 6112
2
+α
f jn+1 − f j
n
Δt=
α2h2
f j+1n+1 − 2 f j
n+1 + f j−1n+1( )⎡⎣
+ f j+1n − 2 f j
n + f j−1n( )⎤⎦
xxxxxxxxxx ftfh1212
232 Δ+αα
211
11 22 h
ffftff n
jnj
nj
nj
nj −+
−+ +−=
Δ−
α ),( 22 htO Δ
Computational Fluid Dynamics
DuFort-Frankel! Unconditionally!Stable,!
Conditionally!Consistent!
3-Level Implicit!Unconditionally!
Stable!
xxt ff α=
( ) xxxxfrh 22
12112
−α
Parabolic Equation - Summary!
2
11
111
11
2243
hfff
tfff
nj
nj
nj
nj
nj
nj
+−
+++
−+
+−
=Δ
+−
αxxxxf
h12
2α
21
111
11
2 hffff
tff n
jnj
nj
nj
nj
nj −
−++
−+ +−−=
Δ−
α
And others!!
Computational Fluid Dynamics
Numerical Methods for!Multi-Dimensional Heat
Equations!
Computational Fluid Dynamics
Two-dimensional grid!
j!
j-1!
j+1!
i! i+1!i-1!
⎟⎟⎠
⎞⎜⎜⎝
⎛∂∂+
∂∂=
∂∂
2
2
2
2
yf
xf
tf α
Consider a 2-D heat equation!
Computational Fluid Dynamics
⎟⎟⎠
⎞⎜⎜⎝
⎛∂∂+
∂∂=
∂∂
2
2
2
2
yf
xf
tf α
Applying forward Euler scheme:!
⎟⎟⎠
⎞⎜⎜⎝
⎛Δ
+−+
Δ+−
=Δ− −+−+
+
21,,1,
2,1,,1,
1, 22
yfff
xfff
tff n
jinji
nji
nji
nji
nji
nji
nji α
2-D heat equation!
hyx =Δ=ΔIf!
( )njinji
nji
nji
nji
nji
nji fffff
htff
,1,1,,1,12,
1, 4−+++=Δ−
−+−+
+ α
Explicit Method - 1!
Computational Fluid Dynamics
In matrix form!
f1,1n+1
f1,2n+1
f1,J
n+1
f2,1n+1
f2,2n+1
fI ,J −1n+1
fI ,Jn+1
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
=
f1,1n
f1,2n
f1,J
n
f2,1n
f2,2n
fI ,J −1n
fI ,Jn
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
+αΔth2
−4 1 0 0 1 0 1 −4 1 0 0 1 0 1 −4 1 0 1 1 00 10 0 1
0 1 −4
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
f1,1n
f1,2n
f1,J
n
f2,1n
f2,2n
fI ,J −1n
fI ,Jn
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
Explicit Method - 2!Computational Fluid Dynamics
Explicit Method - 3!
Von Neumann Analysis! imyikxnnj eeεε =
�
εn+1 = εn + αΔth2
eikh + e− ikh + eimh + e−imh − 4( )εn
�
εn+1
εn=1+ αΔt
h22coskh + 2cosmh − 4( )
⎟⎠⎞⎜
⎝⎛ +Δ−=
2sin
2sin41 22
2
mhkhhtα
Worst case!
1811 2 ≤Δ−≤−htα
41
2 ≤Δhtα
Computational Fluid Dynamics
Δtαh2
=12
Δtαh2
=14
�
Δtαh2
= 16
One-dimensional flow!
Two-dimensional flow!
Three-dimensional flow!
Stability limits depend on the dimension of the problems!
Different numerical algorithms usually have different stability limits!
Stability!Computational Fluid Dynamics
Implicit time integration!
Computational Fluid Dynamics
f
i , j
n+1 = fi , j
n +Δtαh2
⎛⎝⎜
⎞⎠⎟
fi+1, jn + fi−1, j
n + fi, j−1n + fi, j+1
n − 4 fi, jn( )
Implicit Methods!
f
i , j
n+1 = fi , j
n +Δtαh2
⎛⎝⎜
⎞⎠⎟
fi+1, jn+1 + fi−1, j
n+1 + fi, j−1n+1 + fi, j+1
n+1 − 4 fi, jn+1( )
Evaluate the spatial derivatives at the new time (n+1), instead of at n!
(1+ 4A) f
i , j
n+1 − A fi+1, jn+1 + fi−1, j
n+1 + fi, j−1n+1 + fi, j+1
n+1( ) = fi , j
n
This gives a set of linear equations for the new temperatures:!
Known source term!
Recall forward in time method!
Computational Fluid Dynamics
�
fi , j
n+1 = 11+ 4A
A fi+1, jn+1 + f i−1, j
n+1 + f i, j−1n+1 + f i, j+1
n+1( ) + fi , j
n( )
Isolate the new fi,j and solve by iteration!
The implicit method is unconditionally stable, but it is necessary to solve a system of linear equations at each time step. Often, the time step must be taken to be small due to accuracy requirements and an explicit method is competitive.!
Implicit Methods!
Computational Fluid Dynamics
Second order accuracy in time can be obtained by using the Crank-Nicolson method!
n
n+1
i i+1
i-1
j+1
j-1
j
Implicit Methods!Computational Fluid Dynamics
The matrix equation is expensive to solve!
Crank-Nicolson!
Crank-Nicolson Method for 2-D Heat Equation!
⎟⎟⎠
⎞⎜⎜⎝
⎛∂∂+
∂∂+
∂∂+
∂∂=
Δ− +++
2
2
2
2
2
12
2
121
2 yf
xf
yf
xf
tff nnnnnn α
( )1,11,
11,
1,1
1,12,
1, 4
2++
−++
+−
++
+ −+++Δ+= nji
nji
nji
nji
nji
nji
nji fffff
htff α
hyx =Δ=ΔIf!
( )njinji
nji
nji
nji fffff
ht
,1,1,,1,12 42
−+++Δ+ −+−+α
Computational Fluid Dynamics
Expensive to solve matrix equations. !
Can larger time-step be achieved without having solve the matrix equation resulting from the two-dimensional system?!
The break through came with the Alternation-Direction-Implicit (ADI) method (Peaceman & Rachford-mid1950ʼs)!
ADI consists of first treating one row implicitly with backward Euler and then reversing roles and treating the other by backwards Euler. !
Peaceman, D., and Rachford, M. (1955). The numerical solution of parabolic and elliptic differential equations, J. SIAM 3, 28-41!
Computational Fluid Dynamics
Fractional Step:!
Alternating Direction Implicit (ADI)!
�
f n+1/ 2 − f n = αΔt2h2
fi+1, jn+1/ 2 − 2 f i, j
n+1/ 2 + f i−1, jn+1/ 2( ) + f i, j+1
n − 2 f i, jn + f i, j−1
n( )[ ]
( )hyx =Δ=Δ
�
f n+1 − f n+1/ 2 = αΔt2h2
fi+1, jn+1/ 2 − 2 f i, j
n+1/ 2 + f i−1, jn+1/ 2( ) + f i, j+1
n+1 − 2 f i, jn+1 + f i, j−1
n+1( )[ ]
Step 1:!
Step 2:!
⎥⎦
⎤⎢⎣
⎡⎟⎟⎠
⎞⎜⎜⎝
⎛∂∂+
∂∂+
∂∂Δ=−
+++
2
2
2
12
2
2/121
21
2 yf
yf
xftff
nnnnn α
Combining the two becomes equivalent to:!
Midpoint! Trapisodial!
Computational Fluid Dynamics
Computational Molecules for the ADI Method!
n
n+1/2
n+1
i i+1
i-1
j+1
j-1
j
Computational Fluid Dynamics
Instead of solving one set of linear equations for the two-dimensional system, solve 1D equations for each grid line.!
The directions can be alternated to prevent any bias!
Computational Fluid Dynamics
In matrix form, for each row!
fi,1n+1/ 2
fi,2n+1/ 2
fi,N
n+1/ 2
⎡
⎣
⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥
=
fi,1n
fi,2n
fi,N
n
⎡
⎣
⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥
+αΔth2
−2 1 01 −2 10 1 −2
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
fi,1n+1/ 2
fi,2n+1/ 2
fi,N
n+1/ 2
⎡
⎣
⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥
+ source
This equation is easily solved by forward elimination and back-substitution!
Computational Fluid Dynamics
Stability Analysis:!
ADI Method is accurate !
Similarly, !
( )22 ,htO Δimyikxnn
j eeεε =
ε n+1/2 = ε n + αΔth2
ε n+1/2 eikh − 2 + e− ikh( ) + ε n eimh − 2 + e− imh( )⎡⎣ ⎤⎦
ε n+1/2
ε n=1− 2αΔt
h2sin2 kh
21+ 2αΔt
h2sin2 mh
2
ε n+1
ε n+1/2=1− 2αΔt
h2sin2 mh
21+ 2αΔt
h2sin2 kh
2
Computational Fluid Dynamics
Combining !
Unconditionally stable! !
1
2sin21
2sin21
2sin21
2sin21
22
22
22
221
<⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
Δ+
Δ−
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
Δ+
Δ−=
+
khht
mhht
mhht
khht
n
n
α
α
α
α
εε
The 3-D version does not have the same desirable stability properties. However, it is possible to generate similar methods for 3D problems!
Computational Fluid Dynamics
Implicit methods for parabolic equations!
• Allow much larger time step (but must be balanced against accuracy!)!
• Preserve the parabolic nature of the equation!
But, require the solution of a linear set of equations and are therefore much more expensive that explicit methods!
ADI provides a way to convert multidimensional problems into a series of 1D problems!
Computational Fluid Dynamics
Approximate factorization!
Splitting!
Computational Fluid Dynamics Approximate Factorization - 1!
The Crank-Nicolson for heat equation becomes !
Define !δ xx ( ) = 1Δx2
( )i−1, j − 2( )i, j + ( )i+1, j⎡⎣ ⎤⎦
δ yy ( ) = 1Δy2
( )i, j−1 − 2( )i, j + ( )i, j+1⎡⎣ ⎤⎦
f n+1 − f n
Δt=α2δ xx f n+1 + f n( ) + α
2δ yy f n+1 + f n( ) +O(Δt 2 ,Δx2 ,Δy2 )
1− αΔt2
δ xx −αΔt2
δ yy⎛⎝⎜
⎞⎠⎟f n+1 = 1+ αΔt
2δ xx +
αΔt2
δ yy⎛⎝⎜
⎞⎠⎟f n
+ΔtO(Δt 2 ,Δx2 ,Δy2 )
which can be rewritten as !
Computational Fluid Dynamics Approximate Factorization - 2!
Factoring each side !
+ΔtO(Δt 2 ,Δx2 ,Δy2 )
1− αΔt2
δ xx⎛⎝⎜
⎞⎠⎟1− αΔt
2δ yy
⎛⎝⎜
⎞⎠⎟f n+1 − α 2Δt 2
4δ xxδ yy f
n+1 =
or !
1+ αΔt2
δ xx⎛⎝⎜
⎞⎠⎟1+ αΔt
2δ yy
⎛⎝⎜
⎞⎠⎟f n − α 2Δt 2
4δ xxδ yy f
n
1− αΔt2
δ xx⎛⎝⎜
⎞⎠⎟1− αΔt
2δ yy
⎛⎝⎜
⎞⎠⎟f n+1 = 1+ αΔt
2δ xx
⎛⎝⎜
⎞⎠⎟1+ αΔt
2δ yy
⎛⎝⎜
⎞⎠⎟f n
+α 2Δt 2
4δ xxδ yy f n+1 − f n( ) + ΔtO(Δt 2 ,Δx2 ,Δy2 )
Crank-Nicolson!
Computational Fluid Dynamics Approximate Factorization - 3!
The ADI method can be written as !
1− αΔt2
δ xx⎛⎝⎜
⎞⎠⎟f n+1/2 = 1+ αΔt
2δ yy
⎛⎝⎜
⎞⎠⎟f n
1− αΔt2
δ yy⎛⎝⎜
⎞⎠⎟f n+1 = 1+ αΔt
2δ xx
⎛⎝⎜
⎞⎠⎟f n+1/2
Eliminating fn+1/2 !
1− αΔt2
δ yy⎛⎝⎜
⎞⎠⎟1− αΔt
2δ xx
⎛⎝⎜
⎞⎠⎟f n+1 = 1+ αΔt
2δ yy
⎛⎝⎜
⎞⎠⎟1+ αΔt
2δ xx
⎛⎝⎜
⎞⎠⎟f n+1
Computational Fluid Dynamics
�
αΔt2
⎛ ⎝ ⎜
⎞ ⎠ ⎟ 2
δyyδxx f n+1 − f n( ) ≈ α2
⎛ ⎝ ⎜
⎞ ⎠ ⎟ 2
Δt 3δxxδyy∂f∂t
= O(Δt 3)
Up to a factor:!
ADI is an approximate factorization of the Crank-Nicolson method!
Approximate Factorization - 4!Computational Fluid Dynamics
The Peaceman-Rachford methods does not have the same stability properties in 3D as in 2D. A method with similar properties is:!
1− αΔt2
δ xx⎛⎝⎜
⎞⎠⎟f n+1* = 1+ αΔt
2δ xx + 2δ yy + 2δ zz( )⎡
⎣⎢⎤⎦⎥f n
1− αΔt2
δ yy⎛⎝⎜
⎞⎠⎟f n+1** = f n+1* − αΔt
2δ yy f
n
1− αΔt2
δ zz⎛⎝⎜
⎞⎠⎟f n+1 = f n+1** − αΔt
2δ zz f
n
Several other splitting methods have been proposed in the literature.!
Approximate Factorization - 5!
Computational Fluid Dynamics
Similar ideas can be used for time splitting:!
fi, jn+1/2 = 1+αΔtδ xx( ) fi, jn
fi, jn+1 = 1+αΔtδ yy( ) fi, jn+1/2
fi, jn+1 = 1+αΔtδ yy( ) 1+αΔtδ xx( ) fi, jn
Eliminate the half step:!
Which is equivalent to the standard FTC method, except for the!
α 2Δt 2δ yyδ xx fi, jn
term, which is higher order.!
Approximate Factorization - 6!Computational Fluid Dynamics
Why splitting? !
1. Stability limits of 1-D case apply.!
2. Different Δt can be used in x and y directions.!
Computational Fluid Dynamics
Implicit time marching by fast
elliptic solvers!
Computational Fluid Dynamics
fi, jn+1 − fi, j
n
Δt= α∇h
2 fi, jn+1
∇h2 fi, j
n+1 −fi, jn+1
αΔt= −
fi, jn
αΔt
∇h2 fi, j
n+1 − λ fi, jn+1 = S
Backward Euler!
Rearrange!
or!
Can be solved by elliptic solvers!
Computational Fluid Dynamics
One-Dimensional Problems!• Explicit, implicit, Crank-Nicolson!• Accuracy, stability!• Various schemes!
Multi-Dimensional Problems!• Alternating Direction Implicit (ADI)!• Approximate Factorization of Crank-Nicolson!
Splitting!
Outline!
Solution Methods for Parabolic Equations!
Recommended