CHAPTER 4
Basic Computational Techniques
Discretisation
Discretisation concerns the process of
transferring continuous functions, models,
and equations into discrete counterparts
This process is usually carried out as a first
step toward making them suitable for
numerical evaluation and implementation
on digital computers
As the flow variables in the governing
equations are expressed as a function of
space and time, we have two
discretization types:
Spatial discretization
Temporal discretization
Spatial Discretization
Spatial Discretization
Spatial Discretization
In CFD, there are two common spatial discretization
methods:
Finite difference method
Approximating the derivatives using a
truncated Taylor series
The simplest method
Requires high degree of mesh regularity such
as in structured mesh
Finite volume method
Discretisation starts from the integral form of
the flow equations
Variation of any quantity within a volume
depends entirely on the surface values of the
fluxes
5
Spatial Discretization
(Finite Difference Method)
Finite Difference Method
It is the simplest one conceptually
The simplicity of the method allows us to explore
the properties of various numerical discretisations
and compare their degree of accuracy
Difficult to apply when we are encountered with
complex geometries
Thus it has limited use for practical applications
and only a very small number of engineering codes
rely on this method
However, for solution procedures which require
higher order derivatives or high order of accuracy,
this method can be better suited than other
methods despite the limitation of mesh regularity
7
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
Exact solutions
Example:
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
If only the first term is used,
we will not arrive at point 2
Instead, we will obtain point 3;
as illustrated in the next slide
10
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
Exact solutions
Example:
Estimation using the 1st term:
Percentage error:
[(0.9823 0.9511)/0.9823] x 100 = 3.176 %
11
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
If we use the first two terms,
that is, we add the slope given
by the second term, we will
obtain point 4; as illustrated in
the next slide
Notice that the error has
reduced
12
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
Exact solutions
Example:
Estimation using the first two terms:
[(0.9899 0.9823)/0.9823] x 100 = 0.775 %
Percentage error has reduced!
13
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
Now, if we use the first three
terms, i.e. to account for the
curvature in additional to the
slope, we will obtain point 5; as
illustrated in the next slide
Notice that the error is much
reduced
14
Taylor Expansion
First guess Add to capture
slope
(Not very good)
Add to account
for curvature
Exact solutions
Example:
Estimation using three terms:
[(0.9824 0.9823)/0.9823] x 100 = 0.01 % Much reduced!
15
j+1
j
i, j
j1
i1
i+1
Eq. 1
Finite-difference representation
Hence
Truncation error
And
16
j+1
j
i, j
j1
i1
i+1
The above equation uses the information to the right of the
grid point i,j to calculate its derivative
This is called first-order forward difference
17
j+1
j
i, j
j1
i1
i+1
Eq. 2
Called first-order rearward (or backward) difference
18
Differential to Finite Difference
In most CFD applications, first-order accuracy is not
sufficient
To construct a finite-difference quotient of second-order
accuracy, simply subtract Eq. 2 from Eq. 1
j+1
j
i, j
j1
Called second-order central difference
i1
i+1
19
Differential to Finite Difference
Similar procedures can be applied to the y axis
Difference expression for the y derivatives:
Forward difference
j+1
Rearward difference
i, j
j1
i1
i+1
Central difference
20
Differential Eq. for Transport Phenomena
Recall that the general equation for the transport of mass, heat,
and momentum (3D) is as following
Convection
Diffusion
Production
Given the conditions
We obtain a Poisson equation, which demands for a discretization
of second derivative terms
(Poisson equation)
Second derivative
21
Differential to Finite Difference
Summing the Taylor series expansions bellow:
j+1
j
i, j
j1
i1
i+1
i
22
Differential to Finite Difference
j+1
j
i, j
j1
i1
i+1
i
23
Differential to Finite Difference
For y derivative
Center difference
approximation of the
second derivative
Forward difference
approximation of the
second derivative
j+1
i, j
j1
i1
i+1
i
24
Example of Poisson Eq.
Then
j+1
j
i, j
j1
i1
i+1
i
25
Example 1
6
26
Finite Difference Estimation for Convection Eq.
If the diffusion and production terms are omitted,
the transport equation for 1D problem reduces to a
convection equation:
The exact solution
from
Note that in the exact solution,
the original distribution (shape of
the curve) is maintained while the
flow moves downstream!
27
Finite Difference Estimation for Convection Eq.
In the central difference
method, the principal term of
the truncation error is the odd
(third) order differentiation
term, implying that the method
brings dispersed error
Solution by central difference
method,
70
Dispersed error
60
50
40
30
20
10
0
0
10
15
20
25
30
-10
-20
Also note that the solution is unstable
as it leads to increasing error with time
f(x,t)
f(x,t+dt)
f(x,t+2dt) f(x,t+3dt)
28
Finite Difference Estimation for Convection Eq.
In the upwind difference method,
the principal term of the
truncation error is the even
(second) order differentiation
term, which brings diffused error
Solution by upwind difference
method,
70
Diffusive error
60
50
40
30
20
10
0
0
10
15
20
25
30
-10
Note that the solution is stable,
however it is not as accurate
-20
f(x,t)
f(x,t+dt)
f(x,t+2dt) f(x,t+3dt)
29
Example 2
Fig. 1
Assume 2 = 3, base = 1, tip = 0
Fig. 2
0.2
30
Example 4
Find the temperature at the interior node given in the following figure:
31
Example 5
32
Direct Fit Polynomials
In this method, given
one can fit a
' n 1' data points
x0 , y0 , x1 , y1 , x2 , y2 ,, xn , yn
n th order polynomial given by
Pn x a0 a1x an 1x n 1 an x n
To find the first derivative,
Pnx
dPn ( x )
a1 2a2 x n 1an 1 x n 2 nan x n 1
dx
Similarly other derivatives can be found.
33
Example 5
The upward velocity of a rocket is given as a function of time in Table 1.
Table 2 Velocity as a function of time
t
s
0
10
15
20
22.5
30
v(t)
m/s
0
227.04
362.78
517.35
602.97
901.67
Using the third order polynomial interpolant for velocity, find the acceleration of the
rocket at t = 16s.
34
Solution
For the third order polynomial (also called cubic interpolation), we choose the velocity given by
vt a0 a1t a2 t 2 a3t 3
Since we want to find the velocity at t = 16 s, and we are using third order polynomial, we need to
choose the four points closest to t = 16 s and that also bracket t = 16 s to evaluate it.
The four points are
to 10, t1 15, t2 20, and t3 22.5.
to 10, vto 227.04
t1 15, vt1 362.78
t2 20, vt 2 517.35
t3 22.5, vt3 602.97
http://numericalmethods.eng.usf.edu
35
such that
v10 227.04 a0 a1 10 a2 10 a3 10
2
v15 362.78 a0 a1 15 a2 15 a3 15
2
v20 517.35 a0 a1 20 a2 20 a3 20
2
v22.5 602.97 a0 a1 22.5 a2 22.5 a3 22.5
2
Writing the four equations in matrix form, we have
100
1000 a0 227.04
1 10
1 15
a 362.78
225
3375
1 20
400
8000 a 2 517.35
a
1
22
.
5
506
.
25
11391
602
.
97
36
Solving the above four equations gives
a0 4.3810
a1 21.289
a2 0.13065
a3 0.0054606
Hence
vt a0 a1t a2t 2 a3t 3
4.3810 21.289t 0.13065t 2 0.0054606t 3 , 10 t 22.5
http://numericalmethods.eng.usf.edu
37
Figure 1 Graph of upward velocity of the rocket vs. time.
38
The acceleration at t=16 is given by
a16
Given that
d
vt t 16
dt
t 4.3810 21.289t 0.13065t 2 0.0054606t 3 ,10 t 22.5
d
at vt
dt
d
4.3810 21.289t 0.13065t 2 0.0054606t 3
dt
21.289 0.26130t 0.016382t 2 , 10 t 22.5
a16 21.289 0.2613016 0.01638216
29.664m/s 2
39
END OF LECTURE 6
40