Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 1
Chapter 7
One-Dimensional Diffusion Equation
Diffusion Equation Diffusion equation contains the dissipation
mechanism for fluid flow with significant viscous or heat conduction effects
Provide guidance for choosing numerical algorithms for viscous fluid flow
)( , ,,
)( , ,,
)( , ,,
1jj1j2jxx2xx
1j1jjxx
1jj1jjxx
nj
1nj
1nj
2
2
TT2Tx
1TL121
x
1L
TTx2
1TL101
x2
1L
TT21TTM21M
t
TT
t
T
x
T
t
T
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 2
7.1 Explicit Methods 7.1.1 FTCS scheme (Two-level scheme) Explicit time-marching
njxx
1nj
2
n1j
nj
n1j
nj
1nj
2
2
TLt
T
x
TT2T
t
TT
x
T
t
T
7.1 Explicit Methods 7.1.2 Richardson and DuFort-Frankel schemes
(Three-level schemes) Richardson
DuFort-Frankel
njxx
1nj
1nj
nj
1nj TL
t2
TT
t
T
t
T
2
1
njxx
nj
1nj
2
n1j
1nj
1nj
n1j
1nj
1nj
TLt
Ts
2
1
t
Ts
2
1
x
TTTT
t2
TT
)()(
)(
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 3
7.1 Explicit Methods 7.1.3 General Three-level schemes
Numerical Consistency
1njxx
njxx
1nj
nj
1nj TeLTdLcTbTaT
n 1 nj j n n 1
xx j xx j
T T1 1 L T L T
t t1 1 2
i e a b c d 1 e t t t
( ) ( )
. ., , , , ( ),
Time derivative Spatial derivative
7.2 Implicit Methods 7.2.1 Fully-Implicit Scheme
Need to solve a system of coupled algebraic equations at time level (n+1)
njxx
nj
1njxx
1nj
2
1n1j
1nj
1n1j
nj
1nj
2
2
TLt
T
TLt
T
x
TT2T
t
TT
x
T
t
T
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 4
7.2 Implicit Methods 7.2.2 Crank-Nicolson Scheme
7.2.3 Generalized Three-Level Scheme
0T 50T.5 0Lt
TTL
TL 50TL.5 0t
T
1nj
njxx
1nj
a
1njxx
njxx
1nj
.)(
.
0TT1Lt
T
t
T1TL
TLTL1t
T
t
T1
1nj
njxx
nj
1nj
a
1njxx
njxx
nj
1nj
)()()(
)()(
7.2 Implicit Methods 7.2.4 Higher-Order Schemes Hybrid FD-FE three-level scheme
Truncation error
0TT1L
t
TM
t
TM1TL
1nj
njxx
nj
x
1nj
xa
)(
)()(
n
jxxxx2
anj T
s12
1
2
1xsTLE )()(
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 5
Higher-Order Scheme Truncation error
Fourth-order scheme
n
jxxxx2
anj T
s12
1
2
1xsTLE )()(
s12
1
2
1
2
112
1
6
5
12
121M
12
1x
then
),,() , ,( If
for any combination of (s, , )
General Three-Level Scheme Hybrid finite-difference/finite-element
j1 j j+1
n+1
n
n1
1
1
Implicit 1+
Explicit ( = 0)
12
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 6
Active nodes for diffusion equation
General Three-Level Scheme Mass and difference operators
t
T
t
T21
t
T
t
TM
21 M
x
TT2TTL
t
TT
t
T
n1j
nj
n1j
nj
x
x
2
n1j
nj
n1jn
jxx
nj
1nj
1nj
)(
,,
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 7
Explicit Three-Level Scheme Explicit Method ( = 0)
(1) FTCS Scheme
(2) Richardson Scheme
(3) DuFort-Frankel Scheme
(4) Fourth-order scheme
1nj
njxx
21n
jnj
1nj
1njxx
njxx
nj
1nj
a
TT1L1
xsT
1T
1
21T
0TLTL1t
T
t
T1TL
)(
)()()(
s12
1
2
1
s2
10
2
10
00
,
,
,
Explicit Three-Level Scheme Explicit Method ( = 0)
Truncation error
Fourth-order scheme
0TT1Lt
T
t
T1TL 1n
jnjxx
nj
1nj
a
)()()(
n
jxxxxxx2
42
n
jxxxx2
anj
T2s12s360
1
6
1xs
Ts12
1
2
1xsTLE
)(
)()(
2
1
s12
1
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 8
Von Neumann Analysis Explicit Three-level scheme
Amplification factor
0TT1Lt
T
t
T1TL 1n
jnjxx
nj
1nj
a
)()()(
01s211s221GG1G11s2G21G1
eGeG11s2eGeG21eG1
1eGx
2
e2eeGx
12
x
1L
2
2
ji1njin
ji1njinji1n
jin2
iijin
2
n1j
nj
n1j2
njxx
)](cos[)])(cos([)(]))[((cos)()(
]))[((cos )()(
))(cos(
))(()(
Numerical Stability Explicit Three-level scheme
For 4th-order scheme
01s211s221GG1 2 )](cos[)])(cos([)(
2
1
s12
14th-order scheme
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 9
Implicit Three-Level Scheme
Truncation error
Fourth-order scheme
0TT1Lt
TM
t
TM1TL 1n
jnjxx
nj
x
1nj
xa
)( )()(
n
jxxxxxx22
42
n
jxxxx2
anj
T2s12s360
1
6
1
s2s2s12xs
Ts12
1
s2
1xsTLE
)(
)()(
ss12
1
2
1
Implicit Three-Level Schemes
(1) Fully-Implicit
(2) Crank-Nicolson
(3) Linear FEM/Imp
(4) Linear FEM/C-N
(5) 3-level Fully Implicit
(6) 4th-order FDM
(7) 4th-order Composite
2
1
12
1s12
1
2
10
12
10
2
10
6
1
106
12
100
100
,
,
, ,
, ,
, ,
, ,
, ,
0TT1Lt
TM
t
TM1TL 1n
jnjxx
nj
x
1nj
xa
)( )()(
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 10
Truncation Error Analysis Implicit three-level scheme
(a) Difference operator
0TLTL1t
TM
t
TM1 1n
jxxnjxx
nj
x
1nj
x
)( )(
n
jxxxxxx
4n
jxxxx
2n
jxx
n
jxxxxxx
6n
jxxxx
4n
jxx
2
2
n1j
nj
n1j2
njxx
T360
xT
12
xT
T6
xT
4
xT
2
x
x
2
TT2Tx
1TL
!!!
)(
Difference Operator
Therefore,
n
jxxxxxxxxn
jxxxxxx1n
jxxxxxx
n
jxxxxxxxx
22n
jxxxxxxn
jxxxx1n
jxxxx
n
jxxxxxx
22n
jxxxxn
jxx
n
jxxtt
2n
jxxtn
jxx1n
jxx
1n
jxxxxxx
41n
jxxxx
21n
jxx
1n1j
1nj
1n1j2
1njxx
TtTT
T2
tTtTT
T2
tTtT
T2
tTtTT
T360
xT
12
xT
TT2Tx
1TL
!
!
!
)(
n
jxxxxxx242n
jxxxx2n
jxx
n
jxxxx
22n
jxx
njxx
1njxx
Ts360
1
s122xsT
s12
1xsT
T12
x1
12
xtT 1
TL1TL
)(
)()(
)(
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 11
Truncation Error Analysis (b) Mass operator
n
jxxxxxx
23n
jxxxx
2n
jt1n
jnj
nj
n
jxxxxxx
23n
jxxxx
2n
jt
n
jttt
2n
jttn
jt
n
jttt
3n
jtt
2n
jtnj
1nj
1nj
T6
tT
2
tTTT
t
1
t
T
T6
tT
2
tT
T3
tT
2
tT
T3
tT
2
tTt
t
1TT
t
1
t
T
)(
!!
!!)(
n
jxxxxxx
42n
jxxxx
2n
jt
n
jtxxxx
4n
jtxx
2n
jtn
jt
n
1jtn
1jtn
jt
n
1jtn
jtn
1jtn
jtx
T12
xT
2
xT
T4
xT
2
xT2T21
TTT21
TT21TTM
!
!!)(
)(
)(
Mass Operator
Time derivative
n
jxxxxxxxx
2n
jxxxxxxn
jxxxxxxx
n
jxxxxxx
2n
jxxxxn
jxxxxx
T2
x2TTM
T2
x2TTM
!
!
n
jxxxxxx2
42
n
jxxxx2n
jt
n
jxxxx22n
jt
n
jxxxxxx
3n
jxxxx2n
jtx
nj
x
1nj
x
T6
1
s2
1
s12xs
Ts2
1xsT
Tt2
1xT
T6
tTt
2
21TM
t
TM
t
TM1
)(
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 12
Diffusion Equation Combine time and spatial derivatives
Numerical consistency
n
jxxxxxx22
42
n
jxxxx2n
j
nj
n
jxxt
Ts360
1
s1226
1
s2s2s12xs
Ts12
1
s2
1xsE
ETTPDE
0tx0E nj , as
Summary Implicit three-level scheme
Explicit three-level scheme ( = 0)
Fourth-order schemes
Composite scheme
n
jxxxx2n
j Ts12
1
s2
1xsE
n
jxxxx2n
j Ts12
1
2
1xsE
ss12
1
2
1s12
1
2
1
:Implicit
:Explicit
2
1
12
1 choose
(Independent of s)
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 13
TnewTold
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 14
Explicit Schemes - DIFEX
3L-4th scheme
Told Tnew
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 15
3-level 4th-order scheme
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 16
Exact Solution
Explicit schemes - DIFEX
s12
1
2
1
289012
1s
6
1s
:4th3L
. :FrankelDuFort
:FTCS
(s < 0.41 for = 1)
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 17
Implicit Schemes - DIFIM
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 18
Tridiagonalmatrix system
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 19
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 20
Explicit Scheme - DIFEX
Implicit Scheme - DIFIM
Numerical Accuracy
Implicit Schemes – DIFIM
(s = 1)
FDM-2nd
FEM-2nd
FDM-4th
FEM-4th
Composite
FDM-2nd
FEM-2nd
FDM-4th
FEM-4th
Composite
correct
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 21
Numerical Accuracy
S = 0.41: stability for explicit FDM-4th
7.3 Boundary and Initial Conditions
Neumann boundary conditions
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 22
1st
2nd
2nd
2nd
2nd
2nd
4th
4th
Rate of convergence depends on the boundary conditions, not just the accuracy of discretization scheme
Explicit treatment of Neumann BCs
Implicit treatment of Neumann BCs
1st
2nd
2nd
2nd
It is important to maintain the same order of accuracy for discretization scheme and boundary conditions
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 23
7.4 Method of Lines (Semi-Discretization)
Discretize the spatial term first
Reduced to ODE in time
Solve a system of ODEs by Runge-Kutta or multistep methods
fuAdt
ud
0uu2ut
s
dt
du
TT2Txdt
dT
TT
1jj1jj
1jj1j2
j
xxt
)(or
)(
Time Integration Linear multistep method (for time integration)
One-step integration (m = 1)
Euler scheme (1= 0 = 0 = 1, 1 = 0)
n
m
0
nm
0
fut
1 Weighted-average of time-derivative and
slope f
)( 1n1
n0
1n1
n0 fftuu Two-level
scheme
njxx
n1j
nj
n1j
n
nn1n
uLuu2ut
sf
ftuu
)(
FTCS
scheme
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 24
Crank-Nicolson Scheme One-step integration (m = 1)
Trapezoid scheme (1= 0 = 1, 0 = 1 = 1/2)
All two-level schemes are special cases of the one-step method
)( 1n1
n0
1n1
n0 fftuu
njxx
n1j
nj
n1j
n
1nnn1n
uLuu2ut
sf
f50f5.0tuu
)(
).(
Two-Step Integration Two-step integration (m = 2)
General three-level schemes
Explicit three-level scheme (2 = 0)
Implicit three-level scheme (2 = 1)
e.g, Three-level fully implicit scheme
)( 2n2
1n1
n0
2n2
1n1
n0 ffftuuu
, , ,
. , ,.
001
50251
012
012
3LFI
HC Chen 3/17/2020
Chapter 7 1D Diffusion Equation 25
Classical 4th-order Runge-Kutta Method
Most widely used one-step methodn
xxnnn1n uLfff2f2f
6
tuu
; **)****(
weighted-average slope
**)****( ,
**)*,(*** ,** ***
*)*,(** ,* .**
*),(* , .*
ff2f2f6
1fftuu
utffftuu
utffft50uu
utffft50uu
nn1n
1nn
2
1n
n
2
1n
nn
Error in eq.(7-53), p. 244
Classical 4th-orderRunge-Kutta Method
t n t n+1/2
f n
f *
f **
f ***
**)****( ff2f2f6
1f n
f
t n+1