wppii computational fluid dynamics i - unicampphoenics/site_phoenics/apostilas/cfd...wppii...
TRANSCRIPT
Computational Fluid Dynamics IPPPPIIIIWWWW
Numerical Methods forParabolic Equations
Instructor: Hong G. ImUniversity of Michigan
Fall 2001
Computational Fluid Dynamics IPPPPIIIIWWWW
One-Dimensional Problems• Explicit, implicit, Crank-Nicolson• Accuracy, stability• Various schemes• Keller Box method and block tridiagonal system
Multi-Dimensional Problems• Alternating Direction Implicit (ADI)• Approximate Factorization of Crank-Nicolson
Outline
Solution Methods for Parabolic Equations
Computational Fluid Dynamics IPPPPIIIIWWWW
Numerical Methods forOne-Dimensional Heat Equations
Computational Fluid Dynamics IPPPPIIIIWWWW
bxatxf
tf <<>
∂∂=
∂∂ ,0;
2
2
α
which is a parabolic equation requiring
)()0,( 0 xfxf =
In this lecture, we consider a model equation
Initial Condition
)(),();(),( ttbfttaf ba φφ == Boundary Condition(Dirichlet)
)(),();(),( ttbxftta
xf
ba ϕϕ =∂∂=
∂∂ Boundary Condition
(Neumann)
or
and
Computational Fluid Dynamics IPPPPIIIIWWWW
211
1 2h
ffft
ff nj
nj
nj
nj
nj −++ +−
=∆−
α
Explicit: FTCS
( )nj
nj
nj
nj
nj fff
htff 112
1 2 −++ +−∆+= α
j−1 j j+1n
n+1
Explicit Method: FTCS - 1
Computational Fluid Dynamics IPPPPIIIIWWWWModified Equation
xxxxxxxxxx fhthtOfrhxf
tf ),,()61(
12422
2
2
2
∆∆+−=∂∂−
∂∂ αα
2htr ∆= αwhere
- Accuracy ),( 2htO ∆
- If then ),( 22 htO ∆,6/1=r- No odd derivatives; dissipative
Explicit Method: FTCS - 2
Computational Fluid Dynamics IPPPPIIIIWWWWStability: von Neumann Analysis
(Recall Lecture 3, p. 20)
14112<∆−<−
htα
210
2<∆≤
htα
Fourier Condition
Explicit Method: FTCS - 3
[ ])2/(sin412
sin41 222
1
βεε rGhk
htD
n
n
−=∆−=+
Computational Fluid Dynamics IPPPPIIIIWWWWDomain 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 inunphysical solutionbehavior
Explicit Method: FTCS - 4
Computational Fluid Dynamics IPPPPIIIIWWWW
2
11
111
1 2h
ffft
ff nj
nj
nj
nj
nj
+−
+++
+ +−=
∆−
α
Implicit Method: Laasonen (1949)
( ) ( )211
111 /12 htrfrffrrf n
jnj
nj
nj ∆==−−+− +
−++
+ α
j−1 j j+1n
n+1
Tri-diagonal matrix system
Implicit Method - 1
Computational Fluid Dynamics IPPPPIIIIWWWW
- The + sign suggests that implicit method may beless accurate than a carefully implemented explicitmethod.
Modified Equation
xxxxxxxxxx fhthtOfrhxf
tf ),,()61(
12422
2
2
2
∆∆++=∂∂−
∂∂ αα
Implicit Method - 2
Amplification Factor (von Neumann analysis)
[ ] 1)cos1(21 −−+= βrGUnconditionally stable
Computational Fluid Dynamics IPPPPIIIIWWWW
+−+
+−=
∆− −+
+−
+++
+
211
2
11
111
1 222 h
fffh
ffft
ff nj
nj
nj
nj
nj
nj
nj
nj α
Crank-Nicolson Method (1947)
j−1 j j+1n
n+1
Tri-diagonal matrix system
Crank-Nicolson - 1
( ) ( ) nj
nj
nj
nj
nj
nj rffrrfrffrrf 11
11
111 1212 −+
+−
+++ +−−=−++−
Computational Fluid Dynamics IPPPPIIIIWWWW
- 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 IPPPPIIIIWWWW
+−−+
+−=
∆− −+
+−
+++
+
211
2
11
111
1 2)1(
2h
fffh
ffft
ff nj
nj
nj
nj
nj
nj
nj
nj θθα
Generalization
j−1 j j+1n
n+1
Combined Method A - 1
−=
NicolsonCrank1/2Implicit1
(FTCS)Explicit0θ
θ×( )θ−× 1
Computational Fluid Dynamics IPPPPIIIIWWWW
Other Special Cases (for further accuracy improvement):
Combined Method A - 2
),(12
121 42 htO
r∆⇒−=θ(a) If
r121
21 −=θ(b) If and ),(20/1 62 htOr ∆⇒=
Modified Equation
xxxxxxt fhtff
+∆
−=−
1221 2
2 ααθα
xxxxxxfhtht
+∆
−+∆
+−+ 422232
3601
21
61
31 ααθαθθ
Computational Fluid Dynamics IPPPPIIIIWWWW
⇒ unconditionally stable
Combined Method A - 3
121 ≤≤θ
Stability Property
210 <≤θ ⇒ stable only if
θ4210−
≤≤ r
Computational Fluid Dynamics IPPPPIIIIWWWW
( )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
Combined Method B - 1
=implicitfully level-Three1/2
Implicit0θ
( )θ+× 1θ×
n−1
Computational Fluid Dynamics IPPPPIIIIWWWWModified Equation:
Combined Method B - 2
!+∆+
+∆
−−=− )(
1221 2
22 tOfhtff xxxxxxt
ααθα
Special Cases:
),(21 22 htO ∆⇒=θ(a) If
r121
21 +=θ(b) If ),( 42 htO ∆⇒
Computational Fluid Dynamics IPPPPIIIIWWWW
211
11 22 h
ffftff n
jnj
nj
nj
nj −+
−+ +−=
∆−
α
Richardson Method: A Case of Failure
Richardson Method
),( 22 htO ∆
Similar to Leapfrog
but unconditionally unstable!
j−1 j j+1
n
n+1
n−1
Computational Fluid Dynamics IPPPPIIIIWWWW
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 ( ) 2/11 −+ + n
jnj ff
( ) ( )nj
nj
nj
nj
nj fffrfrf 1
11
11 221 −−
+−+ +−+=+
Computational Fluid Dynamics IPPPPIIIIWWWW
xxxxxxt fhthff
∆−=−
2
232
121 ααα
Modified Equation (Recall Homework #1)
DuFort-Frankel - 2
xxxxxxfhtth
∆+∆−+
4
45234 2
31
3601 ααα
Amplification factor
rrr
G21
sin41cos2 22
+−±
=ββ Unconditionally
stable
Conditionally consistent
Computational Fluid Dynamics IPPPPIIIIWWWW
UnconditionallyUnstable
Richardson
UnconditionallyStable
Crank-Nicolson
UnconditionallyStable
BTCS
Stable forFTCS
xxt ff α=
211
1 2h
ffft
ff nj
nj
nj
nj
nj −++ +−
=∆−
α ( ) xxxxfrh 6112
2
−α
Parabolic Equation - Summary
21≤r
2
11
111
1 2h
ffft
ff nj
nj
nj
nj
nj
+−
+++
+ +−=
∆−
α ( ) xxxxfrh 6112
2
+α
( )[( )]n
jnj
nj
nj
nj
nj
nj
nj
fff
fffht
ff
11
11
1112
1
2
22
−+
+−
+++
+
+−+
+−=∆− α
xxxxxxxxxx ftfh1212
232 ∆+αα
211
11 22 h
ffftff n
jnj
nj
nj
nj −+
−+ +−=
∆−
α ),( 22 htO ∆
Computational Fluid Dynamics IPPPPIIIIWWWW
UnconditionallyStable
3-Level Implicit
UnconditionallyStable,
ConditionallyConsistent
DuFort-Frankel
xxt ff α=
( ) xxxxfrh 22
12112
−α
Parabolic Equation - Summary
2
11
111
11
2243
hfff
tfff
nj
nj
nj
nj
nj
nj
+−
+++
−+
+−
=∆
+−
αxxxxfh
12
2α
21
111
11
2 hffff
tff n
jnj
nj
nj
nj
nj −
−++
−+ +−−=
∆−
α
Computational Fluid Dynamics IPPPPIIIIWWWWThe Keller Box Method (1970)
Keller Box - 1
2
2
xf
tf
∂∂=
∂∂ α
- Implicit with ),( 22 htO ∆
Basic Concept:
Define xfvfu∂∂== ;
yielding v
xu =∂∂
xv
tu
∂∂=
∂∂ α
Computational Fluid Dynamics IPPPPIIIIWWWWIn discretized form
Keller Box - 2
12/1
11
1+−
+−
+
=− n
jj
nj
nj v
huu
j
nj
nj
n
nj
nj
hvv
tuu 2/1
12/1
1
2/11
2/1+−
+
+
−+− −
=∆−
αj−1 j
n+1
n
∆tn+1
hj
12/1
+−
njv 1+n
junju
j−1 j
n+1
n
2/11+−
njv 2/1+n
jvnju 2/1−
12/1
+−
nju
where
2;
2
12/1
11
11
2/1
nj
njn
j
nj
njn
j
vvv
uuu
+=
+=
++
+−
++−
Computational Fluid Dynamics IPPPPIIIIWWWWSubstituting
Keller Box - 3
2
11
111
1 +−
++−
+ +=
− nj
nj
j
nj
nj vv
huu
j
nj
nj
n
nj
nj
j
nj
nj
n
nj
nj
hvv
tuu
hvv
tuu 1
1
111
1
1
11
1−
+
−+−
+
+
+−
+ −+
∆+
+−
=∆+
αα
or 0
2211
11
11 =−−− +−
+−
++ nj
jnj
nj
jnj v
huv
hu
( ) ( )nj
nj
nj
nj
n
jnj
nj
n
jnj
nj
n
j vvuut
hvu
th
vut
h11
1
11
11
1
11
1−−
+
+−
+−
+
++
+
−++∆
=+∆
+−∆ ααα
Computational Fluid Dynamics IPPPPIIIIWWWWAdding boundary conditions, e.g.
Keller Box - 4
),,1(; 11
11 JjCuCu J
nJ
n !=== ++
022
:2 12
212
11
211 =−+−−= ++++ nnnn vhuvhuj
( ) ( )nnnn
n
nn
n
nn
n
vvuut
hvut
hvut
h1212
1
212
12
1
211
11
1
2 −++∆
=−∆
++∆ +
++
+
++
+ ααα
11
1:1 Cuj n == +
022
: 1111
11 =−+−−= +++
−+−
nj
jnj
nj
jnj v
huv
hujj
( ) ( )nj
nj
nj
nj
n
jnj
nj
n
jnj
nj
n
j vvuut
hvu
th
vut
h11
1
11
1
11
11
1−−
+
++
+
+−
+−
+
−++∆
=−∆
++∆ ααα
JnJ CuJj == +1:
2R≡
jR≡jη≡
Computational Fluid Dynamics IPPPPIIIIWWWWIn Matrix Form
Keller Box - 5
=
−−−−
−−−−
−−−−
0
0
0
00
010000000011000000
2/12/1000000
000000011000002/12/1000000011000002/12/1000000001
3
2
3
3
2
2
1
1
33
33
22
22
J
J
JJJ
JJ
R
R
R
vu
vuvuvu
hh
hh
hh
"
"
"
"""""""""""
""""""
!
!
!
!
!
ηη
ηη
ηη
[ ] [ ] [ ] CFFF =++ ++
++−
11
111
nj
nj
nj ADB
D1 A1
A2D2B2
B3 D3 A3
DJBJ
Block Tridiagonal Matrix ⇒ Appendix, Linpack
Computational Fluid Dynamics IPPPPIIIIWWWWModified Keller Box Method – Express in terms of
Keller Box - 6
v
Starting with original Keller box method:
u
2
11
111
1 +−
++−
+ +=
− nj
nj
j
nj
nj vv
huu
j
nj
nj
n
nj
nj
j
nj
nj
n
nj
nj
hvv
tuu
hvv
tuu 1
1
111
1
1
11
1−
+
−+−
+
+
+−
+ −+
∆+
+−
=∆+
αα
Eliminating from (b) using (a) nj
nj vv 1
11 , −+−
(a)
(b)
21
1
12
11
11
1
11
1
2222j
nj
nj
j
nj
n
nj
nj
j
nj
nj
j
nj
n
nj
nj
huu
hv
tuu
huu
hv
tuu −
+
−+−
++
+
+−
+ −++
∆+
+−
+=∆+
αααα
Computational Fluid Dynamics IPPPPIIIIWWWWFurther elimination of yields (Tannehill, p. 136)
Keller Box - 7
jnjj
njj
njj CuAuDuB =++ +
+++
−11
111
jn
jj ht
hB α2
1
−∆
=+
Tridiagonal Matrix ⇒ Thomas Algorithm
nj
nj vv ,1+
11
1 2
++
+ −∆
=jn
jj ht
hA α
11
1
1
22
++
+
+
++∆
+∆
=jjn
j
n
jj hht
hth
D αα
( ) ( )1
11
11
1
11 22+
++
+−
+
+−
∆++
∆++
−+
−=
n
jnj
nj
n
jnj
nj
j
nj
nj
j
nj
nj
j th
uuth
uuh
uuh
uuC αα
Computational Fluid Dynamics IPPPPIIIIWWWW
Notes on Keller Box Method
Keller Box - 8
1. Second-order accurate in time and space
2. Accuracy is preserved for nonuniform grids
3. More operations per timestep compared to Crank-Nicolson
Computational Fluid Dynamics IPPPPIIIIWWWW
Numerical Methods forMulti-Dimensional Heat Equations
Computational Fluid Dynamics IPPPPIIIIWWWW
∂∂+
∂∂=
∂∂
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 α
Consider a 2-D heat equation
hyx =∆=∆If
( )nji
nji
nji
nji
nji
nji
nji fffff
htff
,1,1,,1,12,
1, 4−+++=∆−
−+−+
+ α
Explicit Method - 1
Computational Fluid Dynamics IPPPPIIIIWWWWIn matrix form
−
−−
−
∆+
=
−−+
+−
+
+
+
+
+
nJI
nJI
n
n
nJ
n
n
nJI
nJI
n
n
nJ
n
n
nJI
nJI
n
n
nJ
n
n
ff
fff
ff
ht
ff
fff
ff
ff
fff
ff
,
1,
2,2
1,2
,1
2,1
1,1
2
,
1,
2,2
1,2
,1
2,1
1,1
1,
11,
12,2
11,2
1,1
12,1
11,1
410
1001001
101410100141010014
"
"
"
"
"
!!!!
!!!!
!!!!
"
"
"
"
"
"
α
Explicit Method - 2
Computational Fluid Dynamics IPPPPIIIIWWWWExplicit Method - 3
Von Neumann Analysis imyikxnnj eeεε =
( ) nimhimhikhikhnn eeeeh
t εαεε 421 −+++∆+= −−+
( )4cos2cos21 2
1
−+∆+=+
mhkhh
tn
n αεε
+∆−=
2sin
2sin41 22
2
mhkhh
tα
Worst case
1811 2 ≤∆−≤−h
tα41
2 ≤∆h
tα
Computational Fluid Dynamics IPPPPIIIIWWWW
Explicit method for multi-dimensional heat equation is not desirable.
Explicit Method - 4
Stability Condition for Heat Equation
41
2 ≤∆h
tα (2-D)61
2 ≤∆h
tα (3-D)21
2 ≤∆h
tα (1-D)
Computational Fluid Dynamics IPPPPIIIIWWWW
Too expensive!!
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
( )nji
nji
nji
nji
nji fffff
ht
,1,1,,1,12 42
−+++∆+ −+−+α
Computational Fluid Dynamics IPPPPIIIIWWWW
Fractional Step:
ADI - 1
A Clever Remedy – Alternating Direction Implicit (ADI)
( ) ( )[ ]nji
nji
nji
nji
nji
nji
nn ffffffh
tff 1,,1,2/1
,12/1
,2/1
,122/1 22
2 −++
−++
++ +−++−∆=− α
( )hyx =∆=∆
( ) ( )[ ]11,
1,
11,
2/1,1
2/1,
2/1,12
2/11 222
+−
+++
+−
+++
++ +−++−∆=− nji
nji
nji
nji
nji
nji
nn ffffffh
tff α
Step 1:
Step 2:
∂∂+
∂∂+
∂∂∆=−
+++
2
2
2
12
2
2/121
21
2 yf
yf
xftff
nnnnn α
Combining the two becomes equivalent to:
Computational Fluid Dynamics IPPPPIIIIWWWWADI - 2
Computational Molecules for ADI Method
n
n+1/2
n+1
ii+1
i−1
j+1
j−1
j
Computational Fluid Dynamics IPPPPIIIIWWWW
Stability Analysis:
ADI - 3
ADI Method is accurate
Similarly,
( )22 ,htO ∆imyikxnn
j eeεε =
( ) ( )[ ]imhimhnikhikhnnn eeeeh
t −−++ +−++−∆+= 222/12
2/1 εεαεε
2sin21
2sin21
22
222/1
mhh
t
khh
t
n
n
∆+
∆−=
+
α
α
εε
2sin21
2sin21
22
22
2/1
1
khh
t
mhh
t
n
n
∆+
∆−=+
+
α
α
εε
Computational Fluid Dynamics IPPPPIIIIWWWWADI - 4
Combining
Unconditionally stable!
1
2sin21
2sin21
2sin21
2sin21
22
22
22
221
<
∆+
∆−
∆+
∆−=
+
khh
t
mhh
t
mhh
t
khh
t
n
n
α
α
α
α
εε
Unfortunately, a 3-D version does not have the same desirable stability properties.
Computational Fluid Dynamics IPPPPIIIIWWWWApproximate Factorization - 1
The Crank-Nicolson for heat equation becomes
Define ( ) ( ) ( ) ( )[ ]jijijixx x ,1,,12 21+− +−
∆=δ
( ) ( ) ( ) ( )[ ]1,,1,2 21+− +−
∆= jijijiyy y
δ
( ) ( ) ),,(22
222111
yxtOfffft
ff nnyy
nnxx
nn
∆∆∆++++=∆− ++
+
δαδα
),,(22
122
1
222
1
yxttO
fttftt nyyxx
nyyxx
∆∆∆∆+
∆+∆+=
∆−∆− + δαδαδαδα
which can be rewritten as
Computational Fluid Dynamics IPPPPIIIIWWWWApproximate Factorization - 2
Factoring each side
),,( 222 yxttO ∆∆∆∆+
=∆−
∆−
∆− ++ 1
221
421
21 n
yyxxn
yyxx ftftt δδαδαδα
or
nyyxx
nyyxx ftftt δδαδαδα
421
21
22∆−
∆+
∆+
nyyxx
nyyxx fttftt
∆+
∆+=
∆−
∆− + δαδαδαδα
21
21
21
21 1
)( tO ∆( ) ),,(
42221
22
yxttOfft nnyyxx ∆∆∆∆+−∆+ +δδα
Computational Fluid Dynamics IPPPPIIIIWWWWApproximate Factorization - 3
Final factored form of the discrete equation
at an accuracy of
nyyxx
nyyxx fttftt
∆+
∆+=
∆−
∆− + δαδαδαδα
21
21
21
21 1
),,( 222 yxtO ∆∆∆
Note that the ADI method can be written as
nyy
nxx ftft
∆+=
∆− + δαδα
21
21 2/1
2/11
21
21 ++
∆+=
∆− n
xxyn
yy ftft δαδα
which is equivalent to factorized Crank-Nicolson
Computational Fluid Dynamics IPPPPIIIIWWWWSummary of ADI
Why splitting?
1. Stability limits of 1-D case apply.
2. Different ∆t can be used in x and y directions.