






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Computational Fluid Dynamics
April 12, 2010
2
Introduction
sample problem
3
The Time Derivative
in time like any other derivative we have
not considered these to date
4
Time Derivatives II
differences even when the spatial
coordinates are done by finite elements
or finite volume
5
Time Derivatives III
equations for models of time derivatives
6
ODE Algorithms
using φn^ as initial condition in the
algorithm to get to φ
n+
φn+1^ = φn^ + f averageΔt
7
ODE Algorithms II
Kutta predictor corrector methods that use more terms in faverage
for partial differential equations which balance spatial and temporal accuracy
8
ODE Algorithms III
n+ = φi
n
n+1/ )Δt
9
Numerical PDE Solutions
independent variables (x, y, z, t)
whose values are found from boundary conditions for the problem
equation into a finite difference equation
10
Conduction Equation
ordinary derivatives to partial derivatives
coordinate directions
to get explicit finite-difference equation
n
2
2 α
2 2
1 1 2
1 2
n
i
n i
n i
n
i
11
Conduction Equation II
into differential equation
2
1 1
1
n i
n i
n i
n i
n
α
( )
n i
n i
n i
n
2 1 1 2
1
α α
in terms of T values at old time step 12
Explicit (FTCS) Method
( ) ( ) ( )
n i
n i
n i
n i
n i
n i
n
2 1 1 2 1 1
1
method; can solve one equation at a time
Tni-1 Tin^ Tni+ ●----------●----------●
● Tin+
at the new time step (n+1)
( x )
t f Δ
Δ ≡
19
Stability of Explicit Method
increase in Tin^ should increase Tin+
will cause a decrease in Tin+
keeping f = αΔt/(Δx) 2 ≤ 0.
be less than the limit required for
accuracy in the solution
( ) ( )
Ti fT 1 T 1 1 2 fT
= (^) ++ − + −
20
Crank-Nicholson Method
2
1
2
2 2
1 2 2 1
1
n
i
n i
n i
n i
n i
n
21
Space Derivative at t (^) n+1/
time steps n and n + 1
1 1 2
4 ''''
2 1 1 ''
4 ''''
2 ''' 1 1
3 '''
2 ' '' 1
3 '''
2 ' '' 1
i i i i
i i i
i i i i i
i i i i i
i i i i i
− + −
−
−
+
22
Using Space Derivative at tn+1/
1
2
2
2
2 2
1
2
2
n
i
n
i
n
i
2 2 2
1 1 2
1 1 1
1 1
2 1
1
2
21 2
−
−
n i
n i
n i
n i
n i
n i
n i
n i
n
i
n
i
23
Crank-Nicholson Equation
[ ]
n i
n i
n i
n i
n i
n
1 1
1 1
1 1
−
solved by Thomas algorithm
− fTi + + f T − fT = R
1 2 (^1 )
[ ]
n i
n i
n i
n i
n i
n
1 1
1 1
−
[ ]
Ri = fT + 1 + T − 1 + 2 ( 1 − f ) T 24
Crank-Nicholson Equations
−
−
−
−
n N
n N
n N
n
n
n n
n N
n N
n
n
n
R fT
R fT
f f
f f
f f
f f f
f f f
f f
1
2
3
2
1 0
1 1
1 2
1 3
1 2
1 1
show tridiagonal structure
25
Crank Nicholson Results
0.0005, f = αΔt/(Δx) 2 = 5
n = 6 t = 0.003 0 141.46 177.47 298.2 397.
n = 5 t = 0.0025 0 56.79 252.91 334.12 422.
n = 4 t = 0.002 0 203.86 209.57 347.52 473.
n = 3 t = 0.0015 0 25.7 320.81 439.19 533.
n = 2 t = 0.001 0 352.75 305.27 440.73 599.
n = 1 t = 0.0005 0 -73.35 423.96 690.85 834.
n = 0 t = 0+ 0 1000 1000 1000 1000
t = 0 1000 1000 1000 1000 1000
x = 0 x = .01 x = .02 x = .03 x =.
i = 0 i = 1 i = 2 i = 3 i = 4
26
Crank Nicholson Results II
n = 17 t = 0.0085 0 59.5 123.75 180.95 241.
n = 16 t = 0.008 0 65.1 123.21 188.58 247.
n = 15 t = 0.0075 0 62.29 132.69 192.04 255.
n = 14 t = 0.007 0 70.94 130.31 201.68 264.
n = 13 t = 0.0065 0 65.08 144.07 205.56 273.
n = 12 t = 0.006 0 78.99 138.51 217.76 285.
n = 11 t = 0.0055 0 67.5 159.07 222.68 296.
n = 10 t = 0.005 0 90.79 148.2 237.92 311.
n = 9 t = 0.0045 0 68.71 179.63 245.68 324.
n = 8 t = 0.004 0 109.4 160.3 263.81 347.
n = 7 t = 0.0035 0 66.73 209.02 279.22 363.
x = 0 x = .01 x = .02 x = .03 x =.
i = 0 i = 1 i = 2 i = 3 i = 4
27
Crank Nicholson Results III
Error t = 0.0125 0 0.216 0.272 0.212 0.
Exact t = 0.0125 0 50.43 100.66 150.48 199.
n = 25 t = 0.0125 0 50.21 100.93 150.27 199.
n = 24 t = 0.012 0 51.73 102.36 153.78 203.
n = 23 t = 0.0115 0 52.22 105.35 156.49 208.
n = 22 t = 0.011 0 54.19 106.68 160.64 212.
n = 21 t = 0.0105 0 54.43 110.47 163.53 217.
n = 20 t = 0.01 0 57.1 111.53 168.52 222.
n = 19 t = 0.0095 0 56.86 116.5 171.59 228.
n = 18 t = 0.009 0 60.65 117 177.71 234.
x = 0 x = .01 x = .02 x = .03 x =.
i = 0 i = 1 i = 2 i = 3 i = 4
28
Fully Implicit Method
1 1 1
1 1
1
2
(^112)
n
i
n i
n i
n
i
2
1 1 1
1 1
(^11)
2
(^12)
n
i
n
i
α α
n i
n i
n i
n − fTi + + fT − fT = T
1 (^12 )
spurious oscillations, but less accuracy
29
Fully Implicit Results
n = 6 t = 0.003 0 109.75 217.08 319.77 415.
n = 5 t = 0.0025 0 121.84 240.25 352.17 455.
n = 4 t = 0.002 0 139.05 272.65 396.35 507.
n = 3 t = 0.0015 0 166.26 322.13 460.74 578.
n = 2 t = 0.001 0 218.22 408.43 562.69 682.
n = 1 t = 0.0005 0 358.26 588.17 735.71 830.
n = 0 t = 0+ 0 1000 1000 1000 1000
t = 0 1000 1000 1000 1000 1000
x = 0 x = .01 x = .02 x = .03 x =.
i = 0 i = 1 i = 2 i = 3 i = 4
0.01, Δt = 0.0005, f = αΔt/(Δx) 2 = 5
30
Fully Implicit Results
n = 17 t = 0.0085 0 62.54 124.67 186.01 246.
n = 16 t = 0.008 0 64.55 128.66 191.88 253.
n = 15 t = 0.0075 0 66.77 133.05 198.35 262.
n = 14 t = 0.007 0 69.24 137.93 205.52 271.
n = 13 t = 0.0065 0 72.00 143.38 213.53 281.
n = 12 t = 0.006 0 75.13 149.54 222.55 293.
n = 11 t = 0.0055 0 78.69 156.56 232.81 306.
n = 10 t = 0.005 0 82.82 164.67 244.62 321.
n = 9 t = 0.0045 0 87.68 174.19 258.43 339.
n = 8 t = 0.004 0 93.50 185.57 274.85 360.
n = 7 t = 0.0035 0 100.65 199.49 294.81 385.
x = 0 x = .01 x = .02 x = .03 x =.
i = 0 i = 1 i = 2 i = 3 i = 4
Error in Crank-Nicholson Solution of Conduction Equation
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
0.0001 0.001 0.01 0.1 1 10 100 1000 f = αΔ t/( Δ x)^2
RMS Temperature Erro
Nx = 5 Nx = 10 Nx = 20 Nx = 50 Nx = 100 Nx = 200 Nx = 500 Nx = 1000
Thermal Diffusivity = 1 0 <= x <= (L = 1) T(x,0) = 1000 T(0,t) = T(L,t) = 0 End Time = 1
Error in Fully Implicit Solution of Conduction Equation
0.
0.
0.
0.
0.
1
0.0001 0.001 0.01 0.1 1 10 100 1000 10000 100000 f = αΔ t/( Δ x)^2
RMS Temperature Erro
Nx = 5 Nx = 10 Nx = 20 Nx = 50 Nx = 100 Nx = 200 Nx = 500 Thermal Nx = 1000 Diffusivity = 1 0 <= x <= (L = 1) T(x,0) = 1000 T(0,t) = T(L,t) = 0 End Time = 1
( )
( )
( )
( )
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
0.0001 0.001 0.01 0.1 1 10 100 1000 f = αΔ t/( Δ x)^2
RMS Temperature Erro
Nx = 5 Nx = 10 Nx = 20 Nx = 50 Nx = 100 Nx = 200 Nx = 500 Diffusivity = 1Thermal Nx = 1000 0 <= x <= (L = 1) T(x,0) = 1000 T(0,t) = T(L,t) = 0 End Time = 1
RMS Temperature Error by Execution Time
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E-
1.E+
1.E+
1.E+
1.E+
1.E-02 1.E-01 1.E+00 1.E+01 1.E+02 1.E+03 1.E+04 1.E+ Execution Time (seconds)
RMS Temerature Error
Crank-Nicholson Explicit Fully Implicit DuFort-Frankel
41
von Neumann Stability
equation alone
integration is a series of finite-difference
equations that may diverge
will or will not converge
42
von Neumann Stability II
m
at i x m
M
m
m
m
0
β
43
Fourier Series
expressed as an infinite series of sines
and cosines
n
n n
n
= +∑ ∑
∫ ∫ ∫ − − −
n
n
44
Complex Fourier Series
instead of sines and cosines
∑ (^) ∫
β
n n
i x n
series to complex series omitted here
45
von Neumann Stability III
1 ( , )
( , )
= = = ≤
at t i x
m n
m n e e e
e e
xt
xt G m
m
β
β
ε
ε
46
von Neumann Stability IV
( , )
m m x t e e e e
= = =
ε ε
47
Applying von Neumann
[ ]
n k
n k
n k
n Tk fT 1 T 1 ( 1 2 f ) T
= (^) ++ − + −
[ ]
ε (^) k f ε 1 ε 1 ( 1 2 f ) ε
m e e
=
ε
48
Applying von Neumann II
[ ]
m e e
=
β ε
[ ]
0
0 0
0
m
m m
m
55
Crank Nicholson Stability III
e e 2 cos( m x )
( )
[ ] ( 1 ) 2
2
1
e e f
f
e e
f e f
i x i x
at i x i x
m m
m m
= + + −
⎥ ⎦
⎤ ⎢ ⎣
⎡
β β
β β
e [ 1 f f cos( mx )] f cos( mx ) ( 1 f )
β β
⎟ ⎠
⎞ ⎜ ⎝
⎛ Δ Δ = − 2
cos( ) 1 2 sin
2 x x
m m
β β 56
Crank Nicholson Stability IV
( 1 ) 2
2 sin
2
1 2 sin
f
x f f
x e f f f
⎟+^ − ⎠
⎞ ⎜ ⎝
⎛ = −
⎥ ⎦
⎤
⎢ ⎣
⎡ ⎟ ⎠
⎞ ⎜ ⎝
⎛
β
β
1
2
1 2 sin
2
1 2 sin
≤
⎟ ⎠
⎞ ⎜ ⎝
⎛
⎟ ⎠
⎞ ⎜ ⎝
⎛ −
= =
x f
x f
G e m
m
at
β
β
57
Crank Nicholson Stability V
z is positive; this is always < 1
m
m
at
β
β
unconditionally stable
unreasonable solutions, however 58
Convection Equation
with a constant velocity
time, central space differences)
= 0 ∂
∂
∂
∂
x
u c t
u [ ]
n i
n i
n i
n i u u x
c t u u 1 1
2
− Δ
Δ = −
1 2
1 1 2 sin
⎥≤ ⎦
⎤ ⎢ ⎣
⎡ ⎟ ⎠
⎞ ⎜ ⎝
⎛ Δ − Δ
Δ = = −
Δ x
x
c t G e
at^ β m
59
Convection Equation II
that cannot be satisfied and therefore
FTCS is unstable
of two nearby space nodes (i ± 1)
1 1 2
2
(^111)
n i
n i
n
i
n i
n n i n i
i
−
60
Lax’s Method
number, NC = cΔx/Δt ≤ 1
[ ] [ ]
n i
n i
n i
n n i i u u x
u u c t u (^) 1 1
2 2
− Δ
Δ −
=
[ 1 ( 1 )sin( )] 1