




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
2
3
except for simple flows
4
i
t i i
i
i i i
i i
'
(φ) , is
empirical constant in turbulence models
t i
t lam i i
i
i
j t i i i
i j
x x x
u
x
u
x x
p
x
uu
∂ ϕ
σ
ν γ
ϕ ν ν ρ
ϕ
ϕ ( )
5
6
7
Numerical Analysis
integrals in terms of discrete data points
with their use
8
Finite Difference Grids
uniform or non-uniform
≤ x ≤ x max
with N+
nodes numbered from zero to N
= x min
= x max
= x i
and x i-
9
Finite Difference Grids II
●---●------●----------●---~ ~----●------●---●
x 0
x 1
x 2
x 3
x N-
x N-
x N
grids (M+1 y nodes)
x 0
= x min
x N
= x max
x i
= Δx i
y 0
= y mjn
y M
= y max
y j
=Δy j
dimensions (x, y, z, and time)
10
Finite Difference Grids III
variables: x, y, z and t
x 0
= x min
x N
= x max
x i
= Δx i
y 0
= y mjn
y M
= y max
y j
= Δy j
z 0
= z mkn
z K
= z max
z k
= Δz k
t 0
= t min
t L
= t max
t n
= Δt n
points u(x i
, y j
, z k
, t n
)
( , , , ) i j k n
n
ijk
u =u x y z t
11
Derivative Expressions
polynomials or from Taylor series
( -) .... 3!
1 ( -) 2!
1 ( ) () ( )
3 3
3 2 2
2
= + − + + + = = =
x a dx
df xa dx
df x a dx
df fx fa
xa xa xa
∑
∞
= (^) =
= 0
( -) !
1 ( ) n
n
xa
n
n
xa dx
df
n
fx
0 f/dx
0 = f
and 0! = 1
12
Truncation Error
∑ ∑
∞
= (^) = = + =
0 1
nm
n
xa
n
m n
n
n
xa
n
n
x a dx
df
n
x a dx
df
n
fx
Terms used Truncation error, εm
at unknown location (derivation based
on the theorem of the mean)
1 1
1
1
=
∞ +
= (^) ∑ =
m
x
m
m
nm
n
xa
n
n
ξ
19
Order of the Error Notation
th error term as
O(h
n )
n
' 1 1 2 Oh h
f f f
i i i +
' (^1)
i i
()
' (^1) Oh h
f f f
i i i +
−
First order forward First order backward
Second order central
20
Higher Order Derivatives
'' 2 ''' 3 '
fh f h f f fh
i i i i i
..... 2! 3!
'' 2 ''' 3 ' − 1 = − + − +
fh f h f f fh
i i i i i
( )
2 2
1 1
''' 2 ''''' 4
2
Oh h
fh f h f f f
h
f f f f
i i i i i i i i i +
'' 2 '''' 4 '''''' 6
fh f h f h f f f
i i i i i i
21
Higher Order Directional
expressions at the expense of more
computations
derivative expressions from f (^) i+2 and f (^) i-2,
respectively
f (^) i+1 and fi-1 to eliminate first order error
term
22
Specific Taylor Series
equation
'' 2 ''' 3 ' += + + + +
f kh f kh f f fkh
i i ik i i
'' 2 ''' 3 '
fh f h f f fh
i i i i i
'' 2 ''' 3 ' − 2 = − + − +
fh f h f f fh
i i i i i
'' 2 ''' 3 '
fh f h f f fh
i i i i i
'' 2 ''' 3 ' − 3 = − + − +
fh f h f f fh
i i i i i
23
Second Order Forward
2 term
3 '''
2 ' ''
3 '''
2 ' '' 2 1
h f
h f fh f
h f
h f f f fh f
i i i i
i i i i i i
3 ' '''
2 ' 2 1 '''
i
i i i i
Second
order
error
24
Second Order Backwards
2 term
3 '''
2 ' ''
3 '''
2 ' '' 2 1
h f
h f fh f
h f
h f f f fh f
i i i i
i i i i i i
3 ' '''
2 ' 2 1 '''
i
i i i i
Second
order
error
25
Other Derivative Expressions
26
Order of Error Examples
derivative for e
x around x = 1
log( ) log( )
log( ) log( )
log
log
2 1
2 1
1
2
1
2
h h h
h
n −
⎟ ⎠
⎞ ⎜ ⎝
⎛
⎟ ⎠
⎞ ⎜ ⎝
⎛
≈
ε ε ε
ε
27
Roundoff Error
subtracting close differences
x : f’(x) ≈ (e
x+h
x-h )/(2h)
and error at x = 1 is (e
1+h
1-h )/(2h) - e
3
718282 4. 510 2 ( 0. 1 )
004166 2. (^722815) − − =
− E= x
9
E= x
9
E= x
Second order error
28
Figure 2-1. Effect of Step Size on Error
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+
1.E-17 1.E-15 1.E-13 1.E-11 1.E-09 1.E-07 1.E-05 1.E-03 1.E-
Step Size
Error
2 log 100
510
log^510
log
log (^7)
3
1
2
1
2
= = =
−
−
x
x
h
h
n
ε
ε
29
Uneven Step Sizes
= f(x k
)
in terms of f i
= f(x i
) for k = i + 1 and i – 1
( ) ..... 3!
''' ( ) 2!
'' ' ( )
3 1
2
i i i
i i i i i i x x
f x x
f f f f x x
( ) ..... 3!
''' ( ) 2!
'' ' ( )
2 3 = + − + − + k−i +
i k i
i k i i k i x x
f x x
f f f f x x
( ) ..... 3!
''' ( ) 2!
'' '( )
3 1
2 − 1 =^ + − 1 − + − 1 − + i−−i +
i i i
i i i i i i x x
f x x
f f f f x x
to get an expression for f i
’ (or f i
) 30
First Derivative
’ and rearrange
= x i
= h, we have second
order central difference
of f i
’’[(x i+
) – (x i
)]/[2(x i+
)]
[ ] [
] [ ( ) ( )] ..... 3!
''' ( )
( ) 2!
'' '( ) ( )
3 1
3 1
2 1
2 1 1 1 1 1
− − + − − − +
− = − − − + −
− + −
i i i i
i i i
i i
i i i i i i i i
x x x x
f x x
x x
f f f f x x x x
.....
( ) ( )
3!
( ) ( ) '''
2!
'' ' 1 1
3 1
3 1
1 1
2 1
2 1
1 1
1 1
−
− − − − −
− − − − −
−
−
−
−
−
−
i i
i i i i i
i i
i i i i i
i i
i i i x x
f x x x x
x x
f x x x x
x x
f f f
37
Proof of Same Result
1
1
1
1
1
1
1 1
1
1
1
1
−
−
−
−
i
i
i i
i
i i
i
i i
i i
i i
i i
i i
i i
i
( )
[( ) ] (^) ( )
⎥
−
−
i
i
i
i i
i
i i i i
i i
i
i i i i
i i i
i i i
i
x
x
x
x x
x
x f f x
x f
x
x x x x
f f x
x f f
f
1
2 (^21)
1 1
1 1
2
1
2 1
1
1 1 1
'' 2 2
( )
2 2
1 1
i i i
i ii i i i r r x
f rf r f f
Δ
38
Finite-volume Approach
by finite-difference expressions
terms like ∫ (^) ΔVSdV by SavgΔV
●-------------- | --------------●----------------- | -----------------●
xW = xi-1 xw = xi-1/2 xP = xi xe = xi+1/2 xE= xi+
δxWP = xP – xW , δxwP = xP – x (^) w , δxPe = xe – xP , δxPE = xE – xP
Variables
defined at
Nodes
Volume
boundaries
at Faces
39
Finite Volume Example
Γ +S= 0 dx
d
dx
d ϕ
⎟ =^0 ⎠
⎞ ⎜ ⎝
⎛ ⎟ = Γ + ⎠
⎞ ⎜ ⎝
⎛ Γ +
SAdx dx
d
dx
d SdV dx
d
dx
d ϕ ϕ
⎟+Δ = 0 ⎠
⎞ ⎜ ⎝
⎛ ⎟−Γ ⎠
⎞ ⎜ ⎝
⎛ ⎟+Δ =Γ ⎠
⎞ ⎜ ⎝
⎛ ∫ Γ^ +∫ = ∫ Γ SV dx
d A dx
d SV A dx
d dx SdV Ad dx
d
dx
d A e w
x
x
e
w
ϕ ϕ ϕ ϕ
●-------------- | --------------●----------------- | -----------------●
xW = xi-1 xw = xi-1/2 xP = xi xe = xi+1/2 xE= xi+
δxWP = xP – xW , δxwP = xP – x (^) w , δxPe = xe – xP , δxPE = xE – xP
40
Finite Volume Example II
⎟+Δ = 0 ⎠
⎞ ⎜ ⎝
⎛ ⎟−Γ ⎠
⎞ ⎜ ⎝
⎛ Γ SV dx
d A dx
d A e w
ϕ ϕ
= 0 ⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛
Γ
Γ
Γ
Γ
− −Γ
− Γ (^) p P WP
ww
PE
ee u WP
wwW
PE
eeE u pP WP
P W ww PE
E P e e S x
A
x
A S x
A
x
A S S x
A x
A ϕ δ δ δ
ϕ
δ
ϕ ϕ δ
ϕ ϕ
δ
ϕ ϕ
SΔV=Su +Sp ϕ P
p E W p WP
ww
PE
ee P WP
ww W PE
ee E S a a S x
A
x
A a x
A a x
A a − = + −
Γ
δ δ δ δ
aE ϕE + aW ϕW+Su−aP ϕP= 0 aE ϕE+aWϕW−aPϕP=−Su
aP ϕP=aEϕE+aWϕW+S u
41
Finite-Volume Example III
x x
a a a S x x
A a x x
A a (^) P E W p WP
ww W PE
ee E + δ δ
= + − = δ
= δ
δ
= δ
Γ = 10
1 1 2
10 0
2 ,
(^1 1) = = δ
ϕ ⎟ϕ− ⎠
⎞ ⎜ ⎝
⎛
− δ
ϕ Eϕ E+WϕW−PϕP= i−^ i i+ Sui x
x x x
a a a 42
Finite-Volume Example IV
= 1
(δx) 2 ]φ 1 + φ 2 = 0 with φ 0 = 2 gives –[2 + (δx) 2 ]φ 1 +
φ 2 = –
(2 + δx)φN-1 + φN = 0 with φN = 3 gives φN-2 – [2 +
(δx)
2 ]φN 1 = –
10 0 [ 2 10 ( )] 0
2 1
2 1
(^1 1) = ⇒ϕ − + δ ϕ+ϕ = δ
ϕ ⎟ϕ− ⎠
⎞ ⎜ ⎝
⎛
− δ
ϕ − +
− + i i i
i i
i (^) x x
x x x
43
Finite-Volume Example V
4 3
4 0
4 0
4 2
3 4
2 3 4
1 2 3
1 2
φ − φ = −
φ − φ +φ =
φ − φ +φ =
− φ +φ =−
⎥
⎥
⎥
⎥
⎦
⎤
⎢
⎢
⎢
⎢
⎣
⎡
−
−
=
⎥
⎥
⎥
⎥
⎦
⎤
⎢
⎢
⎢
⎢
⎣
⎡
φ
φ
φ
φ
⎥
⎥
⎥
⎥
⎦
⎤
⎢
⎢
⎢
⎢
⎣
⎡
−
−
−
−
3
0
0
2
0 0 1 2. 4
0 1 2. 4 1
1 2. 4 1 0
4
3
2
1
44
Numerical and Exact Solution
0
0.
1
1.
2
2.
3
0 0.2 0.4 0.6 0.8 1 x
÷
Exact
Numerical
45
0.
0.
0.
0.
0.
0.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
Absolute Error
N = 5
N = 10
N=
46
Error in Gradient
dΗ/dx Error dΗ/dx Error
N = 5 -5.0175 0.5252 -3.7719 1.
N = 10 -5.3713 0.1713 -4.6014 0.
N = 20 -5.5024 0.0403 -5.0648 0.
dΗ/dx Error dΗ/dx Error
N = 5 8.1181 0.8664 6.3976 2.
N = 10 8.7104 0.2741 7.5899 1.
N = 20 8.9184 0.0661 8.2704 0.
Second order First Order
Exact dΗ/dx at x = 0 is -5.
Second order First Order
Exact dΗ/dx at x = L is 8.