MDB4013Z CFD Part 1 Sep 2019
MDB4013Z CFD Part 1 Sep 2019
MDB4013Z CFD Part 1 Sep 2019
Introduction to CAE
Computational Fluid Dynamics (CFD)
1.1. Definitions
1.2. Why and what is
“Numerical Methods”
1. Introduction to CAE
1.1. Definitions
• creation,
• modification
• analysis
• optimization
of a design
1. Introduction to CAE
1.1. Definitions
• Plan
• Manage
• Control of manufacturing operation
We might model water flow from water tap by dividing it into 1000
parts and use mathematical fluid flow equations to obtain the details
of these parts (i.e. velocity, flow profile).
If you divide it into few number of parts, your simulation will not be
accurate.
If you divide it into too many parts, your computer will take long
time calculating the result!
1. Introduction to CAE,
1.2. Numerical Methods
Example of simulation by dividing the model into parts called mesh.
Calculation will be performed at each node to obtain the details (i.e.
temperature, velocity, flow profile, stress, strain…etc) at these parts.
• Aerospace
Where CAE used?
Aerospace
• Automotive
• Biomedical
• Chemical Processing
• HVAC
• Hydraulics
• Marine
• Oil & Gas Biomedical
• Power Generation
• Sports
• Fire
Automotive
We will study and understand how the software work and the
method used in solving mathematical equations related to fluid
flow, heat and mass transfer and solid mechanics.
Well, because anyone can play with the software, run the
simulation & get results
But the question is, are the results correct & valid?
gives gives
T1
T2 T1
T2
By Li-Zhi Zhang, International Journal of Heat and Mass Transfer 50 (2007) 151–162
Modeling (governing equations)
Navier-Stokes equations (3D in Cartesian coordinates)
u u u u pˆ 2u 2u 2u
u v w 2 2 2
t x y z x x y z
v v v v pˆ 2v 2v 2v
u v w 2 2 2
t x y z y x y z
So this is what discritisation means
22
So what are the component of the
software?
1. Pre processor: Here you will create the geometry,
generate the mesh and define boundary conditions (see
below example on cooling towers
By
Darren
Woolf
The software solver performed discritisation
and solved the relevant equations
Postprocessor: Results presented as follows
By
Darren
Woolf
By
Darren
Woolf
By
Darren
Woolf
By
Darren
Woolf
By
Darren
Woolf
And there are many many many more
examples on research and projects
done using CFD and in general CFD.
y y( xo x ) y( xo ) Represents the
O(x) truncation error
x x which is resulted
due to ignoring
other terms
u u u u pˆ 2u 2u 2u
u v w 2 2 2
t x y z x x y z
v v v v pˆ 2v 2v 2v
u v w 2 2 2
t x y z y x y z
y y( xo x ) y( xo )
O(x)
x x
In mathematics, a Taylor series is a
representation of a function as an infinite
sum of terms that are calculated from the
values of the function's derivatives at a
single point.
y y( xo x ) y( xo )
O(x) It’s a first order
x x equation, which is
The above equation can be written approximated to
as follows: linear equation
y = f(x)
y y y
yi' i 1 i O(x)
x x
yi+1
•
To use above equation for the curve
yi
shown in this slide
Error due to ignoring other y = f(x) •
terms in Taylor series which
yi-1
•
considers the curvature as Δx Δx
linear
yi 1 yi • i+1 xi xi+1
xi-1
x
•i
Δx Since the solution is forward (from i to i+1) it
i+1 is called forward format
i
1.2 First order Backward Differencing Format
In a similar way we can use the previous method between i-1 and i
To use above equation for the curve
shown in this slide
yi yi 1 y = f(x)
yi
'
O(x)
x yi+1
•
Error due to ignoring other
terms in Taylor series which yi
considers the curvature as y = f(x) •
linear
yi-1
•
yi yi 1 •i Δx Δx
x xi-1 xi xi+1
•i-1
Δx Since the solution is backward (from i-1 to i)
i-1 i it is called backward format
d2y
1.3 First order Central Differencing Format dx 2
y = f(x)
To obtain central differencing between i-1 and i+1, Taylor seriesy
expansions is used.
i+1
•
From previous slide yi
y 2 y x 2 3u x 3 nu x n! •
y( xo x ) y( xo ) x 2
x
3
x 2! x 3!
........ n
x 3!
yi-1
•
where ! n 1 Δx Δx
xi-1 xi xi+1
y
y(i 1) y(i ) x......(equation a)
x Between nodes i to i+1
y
y(i 1) y(i ) (x) ......(equation b)
x Between i-1 to i
subtract a and b
y
y(i 1) y(i 1) 2 x
x
Since the solution takes all points (from i-1 to i+1) it is
Re arrange
called central format
y yi 1 yi 1
x 2x
1.4 Second Order Partial Differential Equation (P.D.E)
To obtain more accurate results we need to account for the
y = f(x)
curve curvature not to simply consider it a line (as shown in yi+1
•
previous slide). Therefore Taylor series expansions is used.
yi
From previous slide •
y
y( xo x) y( xo ) x
x
2 y x 2 3 y x3
2
3
n y x n!
........
n
yi-1
•
x 2! x 3! x n!
Δx Δx
where ! n 1
y 2 y x 2 i-1 i i+1
y(i 1) y(i ) x 2 ......(equation a) where ! n 1
x x 2!
Between nodes i to i+1
y y (x)
2 2
y(i 1) y(i ) (x) 2 ......(equation b)
x x 2! Between i-1 to i
sum a and b
2 y x 2 !=n-1, n=2
y(i 1) y(i 1) 2 y(i ) 2 2
x 2 Hence !=2-1=1
Re arrange
2 y yi 1 2 yi yi 1
x 2
x 2
Lets implement what you learn on a fluid and fluid properties
Assume “B” is a fluid property (example density, viscosity …etc) S axis in the
B
f ( B, S ) •i+1 streamline
S
A. Forward differencing representation i • direction
B B Bi
f ( Bi , Si ) i 1 •i-1
S S
B. Backward differencing representation
B B Bi 1 •
S
f ( Bi , Si ) i
S •i i+1
B B Bi 1
f ( Bi , Si ) i 1
S 2S
•
In all of the above we are solving by
•i i+1
using first order (linear)
•i-1 •
D. Second order differencing representation •i i+1
2B
S 2
f ( Bi , S i )
Bi 1 2 Bi Bi 1
S 2
•i-1
This can be done in the x direction
Assume “B” is a fluid property (example density, viscosity …etc)
B
yi+1
•
f ( B, x )
x yi
•
A. Forward differencing representation yi-1
•
B Bi 1 Bi Δx Δx
x x i-1 i i+1
B. Backward differencing representation
B Bi Bi 1
x x
C. Central differencing representation
B Bi 1 Bi 1
x 2x
D. Second order differencing representation
2 B Bi 1 2 Bi Bi 1
x 2 x 2
and can be used in the y direction
Assume “B” is a fluid property (example density, viscosity …etc)
B
f ( B, y )
j+1
•
y
Δy Δy
j
A. Forward differencing representation •
B B j 1 B j
j-1
•
y y
B. Backward differencing representation i-1 i i+1
B B j B j 1
y y
2 B B j 1 2 B j B j 1
y 2
y 2
The previous discritisation techniques are based on differencing
(i.e. difference between i and i+1 or j and j+1, or i and i-1, or j and
j-1….etc)
Hence we call this technique as
finite differencing
Finite Difference Accuracy
y=f(x)
fx 2 fx x 2 3 fx x 3
f ( x x ) f( x) x 2 3 ........
x x 2 x 6
If we take only this
term, the solution
will not be accurate If we add this term, its If we add this term, its
(first guess only) going to be linear first going to be second order.
order, in fact this term This term accounts for the
represents the slope of curve curvature. The
the curve. The accuracy of accuracy of the solution
the solution will improve will improve further
f(x) 4
5
fx 2 fx x 2 3 fx x 3 2
f ( x x ) f( x)
x
x 2 3 ........ • 3
x 2 x 6 1
If we neglect the partial terms, we will get
x
f ( x x ) f ( x ) Δx x+Δx
1 3 x
If we take the first two terms, it will improve the
solution, but first order equation (slope of the
curve, i.e. line)
fx
f ( x x ) f ( x ) x 1 4
x
If we take the first three terms, it will further
improve the solution, second order equation
fx 2 fx x 2
f ( x x ) f( x) x 2 1 5
x x 2
To obtain the exact solution (point 2), we must consider ∞(infinity) terms
f(x) 4
Example
If f(x)=sin 2πx, x=0.2 and Δx=0.02 Exact solution 5
2
At x=0.2, f(x)=sin2π0.2=0.9511, where π=180 • 3
At x+Δx=0.2+0.02=0.22, f(x)=sin2π0.22=0.9823 1
fx 2 fx x 2 3 fx x 3 x
f ( x x ) f ( x ) x 2
3
........
x x 2 x 6
x Δx x+Δx
1. If we take the first term only
f ( x x ) f ( x )
This correspond to point 3,
f (0.22) f (0.2) sin 2 (0.2) 0.9511
error [(0.9823-0.9511)/0.9823]X100= 3.17%
2. If we take the first two terms
fx
f ( x x ) f ( x ) x
x
f (0.22) f (0.2) 2 cos2 0.2(0.02) 0.9899This correspond to point 4, error 0.775% (better)
3. If we take the first three terms
fx 2 fx x 2
f ( x x ) f( x) x 2
x x 2
0.02 2
f (0.22) f (0.2) 2 cos2 0.2(0.02) 4 sin2 0.2 2
2
0.9511 0.0388 0.0075 0.9824 This correspond to point 5, error 0.01% much better
Error %
• • •
i-1, j+1 i, j+1 i+1, j+1
Δ
y
• •P •
i-1, j i, j i+1, j
• • •
i-1, j-1 i, j-1 i+1, j-1
ΔX
u u 2u 3
x u x .............equation b
2
y i 1, j y i , j xy i , j x 2y
i , j 2
Δ
y
relevant nodes shown in the figure • •P •
i-1, j i, j i+1, j
u ui 1, j 1 ui 1, j 1
i 1, j
y
2y
• • •
i-1, j-1 i, j-1 i+1, j-1
u ui 1, j 1 ui 1, j 1 ΔX
i 1, j
y 2y
j=1
A question may come up, what type of differencing are we
suppose to use when we have a node at a boundary (one direction
differencing only)?
2B Bi 1 2 Bi Bi 1 •
S 2
f ( Bi , S i )
S 2 •i i+1
Lets assume that the variation of “u” from the wall to j=3 (distance
from wall 2Δy) is expressed as
u= a+ by+ cy2, ……..(equation 1)
differentiating gives
2)
j=1
u= a+ by+ cy2……..(equation 1)
j=1
Equation 2 at the wall (y=0) gives
gives
Example
Consider the viscous flow of air over a flat plate. At a given station
in the flow direction, the variation of velocity “u” in the “y”direction
is given by
u in ft/second,
L is the characteristic length 1 inch,
viscosity μ=3.7373X10-7 slug/(ft.s)
4
0.1
flow 3
0.1
2
0.1
1. Exact solution
2. By 1st order differencing
3. By the differencing developed for boundary
y = 1 inch C. By the method developed
3. Application to fluid flow (Couette Flow)
u u u u pˆ 2u 2u 2u
u v w 2 2 2
t x y z x x y z
u: velocity in x direction
w: velocity in z direction
v: velocity in y direction
Long fixed plates
N= n
y
N=1 x
Assumptions:
1. 2D (any component z direction is zero), steady (no variation with time),
incompressible (density is constant), and no body force.
2. Couette flow
• No velocity vertical component (v=0)
• No change of velocity in the x direction (change of “u” in x direction = 0)
• No pressure gradient in x and y directions
u u u u pˆ 2u 2u 2u
u v w 2 2 2
t x y z x x y z
Change (u) in x Zero, 2D No pressure Change (u) in x Zero, 2D
Zero, steady direction = 0 v =0 gradient direction = 0
u u u u pˆ 2u 2u 2u
u v w 2 2 2
t x y z x x y z
2u 2u
2 0, 0, then 0
y y 2
j+1 y
j
j-1
N=1 x
2u
0
y 2
Divide the distance in y direction to “n” nodes and use second order differencing
2u u j 1 2u j u j 1
0
y 2
y 2
u j 1 2u j u j 1 0
N= 10
y
N=1
Take n=10 nodes and apply the developed equation in previous slide at
each node, from j=1 to j=10. But velocity at j=1 & j=10 are known
Its a boundary condition.
At j=0, u=0
At j=10, u=0
Then we will get 8 equations. For 10 nodes, number of equations (n-2)
= 10-2=8equations
2u u j 1 2u j u j 1
Use second order differencing 0
y 2
y 2
which you have learned in
previous lectures u j 1 2u j u j 1 0
Node 2 u3 2u2 u1 0
Node 3 u4 2u3 u2 0
Node 4 u5 2u4 u3 0
Node 5 u6 2u5 u4 0
Node 6 u7 2u6 u5 0
Node 7 u8 2u7 u6 0
Node 8 u9 2u8 u7 0
Node 9 u10 2u9 u8 0
Zero (boundary condition)
We have 8 equations and 8 unknowns, the unknowns can be
calculated by using matrix or iterations
a. By solving Matrix
2 1 0 0 0 0 0 0 u2 0
1 2 1 0 0 0 0 0 u 0
3
0 1 2 1 0 0 0 0 u4 0
0 0 1 2 1 0 0 0 u 5 0
0 0 0 1 2 1 0 0 u6 0
0 0 0 0 1 2 1 0 u7 0
0 0 0 0 0 1 2 1 u8 0
0 0 0 0 0 0 1 2 u9 0
4 y
Upper plate moves at
3
1m/s, and v=0 at n=1
2
N=1 x
u2 u3 u4
First guess
0.3 0.3 0.3
0.15 0.3 0.65
0.15 0.4 0.65
u3
u3 2u2 u1 0 u2 0.2 0.4 0.7
2 0.2 0.45 0.7
u4 u2
u4 2u3 u2 0 u3 0.225 0.45 0.725
2 0.225 0.475 0.725
u5 2u4 u3 0 u4 (1 u3 ) / 2 0.237 0.475 0.737
Then repeat the calculations (same procedure for first 0.237 0.487 0.737
iteration) at each iteration until you find the velocity values 0.243 0.487 0.743
are not changing, where the solution is considered as
converged and no further iteration needed. 0.243 0.49 0.743