computational fluid dynamics i piw numerical methods for parabolic equations instructor: hong g. im...
TRANSCRIPT
Computational Fluid Dynamics IPIW
Numerical Methods forParabolic Equations
Instructor: Hong G. ImUniversity of Michigan
Fall 2005
Computational Fluid Dynamics IPIW
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 IPIW
Numerical Methods forOne-Dimensional Heat Equations
Computational Fluid Dynamics IPIW
bxatx
f
t
f
,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)
)(),();(),( ttbx
ftta
x
fba
Boundary Condition
(Neumann)
or
and
Computational Fluid Dynamics IPIW
2
11
1 2
h
fff
t
ff n
j
n
j
n
j
n
j
n
j
Explicit: FTCS
n
j
n
j
n
j
n
j
n
j fffh
tff 112
1 2
j1 j j+1n
n+1
Explicit Method: FTCS - 1
Computational Fluid Dynamics IPIWModified Equation
xxxxxxxxxx fhthtOfrh
x
f
t
f),,()61(
12422
2
2
2
2h
tr
where
- Accuracy ),( 2htO
- If then ),( 22 htO ,6/1r
- No odd derivatives; dissipative
Explicit Method: FTCS - 2
Computational Fluid Dynamics IPIWStability: von Neumann Analysis
(Recall Lecture 2, p. 60)
14112
h
t
2
10
2
h
tFourier Condition
Explicit Method: FTCS - 3
)2/(sin412
sin41 22
2
1
rGh
kh
tDn
n
Computational Fluid Dynamics IPIW
Computational Fluid Dynamics IPIW
Computational Fluid Dynamics IPIWDomain of Dependence for Explicit Scheme
BC BC
x
t
Initial Data
h
P
tBoundary effect is not felt at P for many time steps
This may result inunphysical solutionbehavior
Explicit Method: FTCS - 4
Computational Fluid Dynamics IPIW
2
1
1
11
1
1 2
h
fff
t
ff n
j
n
j
n
j
n
j
n
j
Implicit Method: Laasonen (1949)
211
111 /12 htrfrffrrf n
jnj
nj
nj
j1 j j+1n
n+1
Tri-diagonal matrix system
Implicit Method - 1
Computational Fluid Dynamics IPIW
- The + sign suggests that implicit method may be less accurate than a carefully implemented explicit method.
Modified Equation
xxxxxxxxxx fhthtOfrh
x
f
t
f),,()61(
12422
2
2
2
Implicit Method - 2
Amplification Factor (von Neumann analysis)
1)cos1(21 rG
Unconditionally stable
Computational Fluid Dynamics IPIW
2
11
2
1
1
11
1
1 22
2 h
fff
h
fff
t
ff n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
Crank-Nicolson Method (1947)
j1 j j+1n
n+1
Tri-diagonal matrix system
Crank-Nicolson - 1
n
j
n
j
n
j
n
j
n
j
n
j rffrrfrffrrf 11
1
1
11
1 1212
Computational Fluid Dynamics IPIW
- Second-order accuracy
Modified Equation
xxxxxxxxxx fhtfh
x
f
t
f
423
2
2
2
360
1
12
1
12
Crank-Nicolson - 2
Amplification Factor (von Neumann analysis)
cos11
cos11
r
rG
Unconditionally stable
),( 22 htO
Computational Fluid Dynamics IPIW
2
11
2
1
1
11
1
1 2)1(
2
h
fff
h
fff
t
ff n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
Generalization
j1 j j+1n
n+1
Combined Method A - 1
NicolsonCrank1/2
Implicit1
(FTCS)Explicit0
1
Computational Fluid Dynamics IPIW
Other Special Cases (for further accuracy improvement):
Combined Method A - 2
),(12
1
2
1 42 htOr
(a) If
r12
1
2
1(b) If and ),(20/1 62 htOr
Modified Equation
xxxxxxt fh
tff
122
1 22
xxxxxxfhtht
422232
360
1
2
1
6
1
3
1
Computational Fluid Dynamics IPIW
unconditionally stable
Combined Method A - 3
12
1
Stability Property
2
10 stable only if
42
10
r
Computational Fluid Dynamics IPIW
2
1
1
11
1
11 21
h
fff
t
ff
t
ff n
j
n
j
n
j
n
j
n
j
n
j
n
j
Generalized Three-Time-Level Implicit Scheme:Richtmyer and Morton (1967)
j1 j j+1
n
n+1
Combined Method B - 1
implicitfully level-Three1/2
Implicit0
1
n1
Computational Fluid Dynamics IPIWModified Equation:
Combined Method B - 2
)(
122
1 22
2 tOfh
tff xxxxxxt
Special Cases:
),(2
1 22 htO (a) If
r12
1
2
1(b) If ),( 42 htO
Computational Fluid Dynamics IPIW
2
11
11 2
2 h
fff
t
ff n
j
n
j
n
j
n
j
n
j
Richardson Method: A Case of Failure
Richardson Method
),( 22 htO
Similar to Leapfrog
but unconditionally unstable!
j1 j j+1
n
n+1
n1
Computational Fluid Dynamics IPIW
2
1
11
1
11
2 h
ffff
t
ff n
j
n
j
n
j
n
j
n
j
n
j
The Richardson method can be made stable by splitting by time average
j1 j j+1
n
n+1
DuFort-Frankel - 1
n1
n
jf 2/11 n
j
n
j ff
n
j
n
j
n
j
n
j
n
j fffrfrf 1
1
1
11 221
Computational Fluid Dynamics IPIW
xxxxxxt fh
thff
2
232
12
1
Modified Equation (Recall Homework #1)
DuFort-Frankel - 2
xxxxxxfh
tth
4
45234 2
3
1
360
1
Amplification factor
r
rrG
21
sin41cos2 22
Unconditionally
stable
Conditionally consistent
Computational Fluid Dynamics IPIW
FTCSStable for
BTCSUnconditionally
Stable
Crank-NicolsonUnconditionally
Stable
RichardsonUnconditionally
Unstable
xxt ff
2
11
1 2
h
fff
t
ff n
j
n
j
n
j
n
j
n
j
xxxxfrh
6112
2
Parabolic Equation - Summary
2
1r
2
1
1
11
1
1 2
h
fff
t
ff n
j
n
j
n
j
n
j
n
j
xxxxfrh
6112
2
n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
fff
fffht
ff
11
1
1
11
12
1
2
22
xxxxxxxxxx ft
fh
1212
232
2
11
11 2
2 h
fff
t
ff n
j
n
j
n
j
n
j
n
j
),( 22 htO
Computational Fluid Dynamics IPIW
DuFort-Frankel Unconditionally
Stable,
Conditionally
Consistent
3-Level Implicit
Unconditionally
Stable
xxt ff
xxxxfrh 2
2
12112
Parabolic Equation - Summary
2
1
1
11
1
11
22
43
h
ffft
fff
n
j
n
j
n
j
n
j
n
j
n
j
xxxxf
h
12
2
2
1
11
1
11
2 h
ffff
t
ff n
j
n
j
n
j
n
j
n
j
n
j
Computational Fluid Dynamics IPIWThe Keller Box Method (1970)
Keller Box - 1
2
2
x
f
t
f
- Implicit with ),( 22 htO
Basic Concept:
Define
x
fvfu
;
yielding v
x
u
x
v
t
u
Computational Fluid Dynamics IPIWIn discretized form
Keller Box - 2
1
2/1
1
1
1
n
j
j
n
j
n
j vh
uu
j
n
j
n
j
n
n
j
n
j
h
vv
t
uu 2/1
1
2/1
1
2/1
1
2/1
j1 j
n+1
n
tn+1
hj
1
2/1
n
jv 1n
ju11
nju
j1 j
n+1
n
2/1
1
n
jv 2/1n
jvn
ju 2/1
1
2/1
n
ju
where
2;
2
1
2/1
1
1
1
1
2/1
n
j
n
jn
j
n
j
n
jn
j
vvv
uuu
Computational Fluid Dynamics IPIWSubstituting
Keller Box - 3
2
11
111
1
nj
nj
j
nj
nj vv
h
uu
j
nj
nj
n
nj
nj
j
nj
nj
n
nj
nj
h
vv
t
uu
h
vv
t
uu 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
t
hvu
t
h11
1
11
11
1
11
1
Computational Fluid Dynamics IPIWAdding boundary conditions, e.g.
Keller Box - 4
),,1(; 11
11 JjCuCu J
nJ
n
022
:2 12
212
11
211 nnnn v
huv
huj
nnnn
n
nn
n
nn
n
vvuut
hvu
t
hvu
t
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
t
hvu
t
h11
1
11
1
11
11
1
JnJ CuJj 1:
2R
jRj
Computational Fluid Dynamics IPIWIn Matrix Form
Keller Box - 5
0
0
0
0
0
0100000000
11000000
2/12/1000000
0000
0001100
0002/12/100
0000011
000002/12/1
000000001
3
2
3
3
2
2
1
1
33
33
22
22
J
J
JJJ
JJ
R
R
R
v
u
v
u
v
u
v
u
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 IPIWModified Keller Box Method – Express in terms of
Keller Box - 6
v
Starting with original Keller box method:
u
2
1
1
11
1
1
n
j
n
j
j
n
j
n
j vv
h
uu
j
nj
nj
n
nj
nj
j
nj
nj
n
nj
nj
h
vv
t
uu
h
vv
t
uu 1
1
111
1
1
11
1
Eliminating from (b) using (a) nj
nj vv 1
11 ,
(a)
(b)
2
1
1
1
2
11
11
1
11
1
2222j
nj
nj
j
nj
n
nj
nj
j
nj
nj
j
nj
n
nj
nj
h
uu
h
v
t
uu
h
uu
h
v
t
uu
Computational Fluid Dynamics IPIWFurther 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
h
t
hD
1
11
11
1
11 22
n
jnj
nj
n
jnj
nj
j
nj
nj
j
nj
nj
j t
huu
t
huu
h
uu
h
uuC
Computational Fluid Dynamics IPIW
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 IPIW
Numerical Methods forMulti-Dimensional Heat Equations
Computational Fluid Dynamics IPIW
2
2
2
2
y
f
x
f
t
f
Applying forward Euler scheme:
2
1,,1,
2
,1,,1,1
, 22
y
fff
x
fff
t
ff nji
nji
nji
nji
nji
nji
nji
nji
Consider a 2-D heat equation
hyx If
nji
nji
nji
nji
nji
nji
nji fffff
ht
ff,1,1,,1,12
,1
, 4
Explicit Method - 1
Computational Fluid Dynamics IPIWIn matrix form
n
JI
n
JI
n
n
n
J
n
n
n
JI
n
JI
n
n
n
J
n
n
n
JI
n
JI
n
n
n
J
n
n
f
f
f
f
f
f
f
h
t
f
f
f
f
f
f
f
f
f
f
f
f
f
f
,
1,
2,2
1,2
,1
2,1
1,1
2
,
1,
2,2
1,2
,1
2,1
1,1
1
,
1
1,
1
2,2
1
1,2
1
,1
1
2,1
1
1,1
410
100
10
01
101410
100141
010014
Explicit Method - 2
Computational Fluid Dynamics IPIWExplicit Method - 3
Von Neumann Analysis imyikxnnj ee
nimhimhikhikhnn eeeeh
t 42
1
4cos2cos212
1
mhkhh
tn
n
2sin
2sin
41 22
2
mhkh
h
t
Worst case
18
112
h
t4
12
h
t
Computational Fluid Dynamics IPIW
Explicit method for multi-dimensional heat equation is not desirable.
Explicit Method - 4
Stability Condition for Heat Equation
4
12
h
t(2-D)
6
12
h
t(3-D)
2
12
h
t(1-D)
Computational Fluid Dynamics IPIW
Too expensive!!
Crank-Nicolson
Crank-Nicolson Method for 2-D Heat Equation
2
2
2
2
2
12
2
121
2 y
f
x
f
y
f
x
f
t
ff nnnnnn
1,
11,
11,
1,1
1,12,
1, 4
2
nji
nji
nji
nji
nji
nji
nji fffff
h
tff
hyx If
nji
nji
nji
nji
nji fffff
h
t,1,1,,1,12
42
Computational Fluid Dynamics IPIW
Fractional Step:
ADI - 1
A Clever Remedy – Alternating Direction Implicit (ADI)
nji
nji
nji
nji
nji
nji
nn ffffffh
tff 1,,1,
2/1,1
2/1,
2/1,12
2/1 222
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
2
1
2 y
f
y
f
x
ftff
nnnnn
Combining the two becomes equivalent to:
Computational Fluid Dynamics IPIWADI - 2
Computational Molecules for ADI Method
n
n+1/2
n+1
ii+1
i1
j+1
j1
j
Computational Fluid Dynamics IPIW
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 IPIWADI - 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.
Conditionally stable and 2, htO
Computational Fluid Dynamics IPIWADI - 5
Advantages:
1. Stability limits of 1-D case apply.
2. Different t can be used in x and y directions.
1. Cannot be directly extended to 3-D problems.
Approximate factorization
Limitations:
Computational Fluid Dynamics IPIWApproximate Factorization - 1
The Crank-Nicolson for heat equation becomes
Define jijijixx x ,1,,122
1
1,,1,22
1
jijijiyy y
),,(22
222111
yxtOfffft
ff nnyy
nnxx
nn
),,(
221
221
222
1
yxttO
ftt
ftt n
yyxxn
yyxx
which can be rewritten as
Computational Fluid Dynamics IPIWApproximate Factorization - 2
Factoring each side
),,( 222 yxttO
1
221
421
21 n
yyxxn
yyxx ft
ftt
or
nyyxx
nyyxx f
tf
tt 42
12
122
nyyxx
nyyxx f
ttf
tt
21
21
21
21 1
)( tO ),,(
42221
22
yxttOfft nn
yyxx
Computational Fluid Dynamics IPIWApproximate Factorization - 3
Final factored form of the discrete equation
at an accuracy of
nyyxx
nyyxx f
ttf
tt
21
21
21
21 1
),,( 222 yxtO
Note that the ADI method can be written as
nyy
nxx f
tf
t
21
21 2/1
2/11
21
21
n
xxn
yy ft
ft
which is equivalent to factorized Crank-Nicolson
Computational Fluid Dynamics IPIWApproximate Factorization - 4
Two-step algorithm
can be written into two steps:
nyyxx
nyyxx f
ttf
tt
21
21
21
21 1
*1
21 ff
t nyy
nyyxxxx f
ttf
t
21
21
21 *
each of which can be solved by TDMA (Thomas algorithm).
(Step 2)
(Step 1)
Computational Fluid Dynamics IPIWApproximate Factorization - 5
Note: Boundary condition for is needed at
*1
21 ff
t nyy
This can be determined from
*f Ni ,1
For example, at 0x
2
11,1
1,1
11,11
,1*,1
2
2 y
ffftff
nj
nj
njn
jj
Similarly, at Lx
2
11,
1,
11,1
,*
,
2
2 y
ffftff
njN
njN
njNn
jNjN
Computational Fluid Dynamics IPIWApproximate Factorization - 6
Generalized 3-D Algorithm: unconditionally stable,
where
nnzzyyxx fRHSf
ttt
1
21
21
21
***
21 ff
tyy
nxx fRHSf
t
*
21
(Step 2)
(Step 1)
nzzyyxx
n fttt
fRHS
21
21
21
**
21 ff
tzz
(Step 3)
22 ,htO