Computational Fluid
Dynamics (CFD)
BTD3233 / BHA4532
Topic 4
Related Course Outcomes
BTD BHA
Lecture Outline
• Basic aspects of the numerics of CFD
• Basic aspects of discretization
Introduction
• We have already discussed the governing equations related to CFD (physical laws)
• How do we solve them?
• Closed form solutions are generally very difficult to obtain – only for simple, limited
problems
• We need to use numerical methods
Discretization
• Finite difference
Convert the PDEs into a system • Finite element
1st stage
of discrete algebraic eqs • Spectral method
• Finite volume
• etc
2nd stage Implement numerical methods to provide a
solution to the system of algebraic equations
Introduction
• Finite difference method (FDM)
• Uses Taylor series expansion
• Needs high degree of regularity – more suited to structured mesh
• Finite element method (FEM)
• Application of piecewise polynomial functions on local elements to describe
the variation of the unknown field variables
• Weighted residual is introduced to measure and minimize errors associated
with the approximated functions
• A set of nonlinear algebraic equations for the unknown terms of the
approximating functions is solved to obtain the solution
• Has the ability to handle more complex geometry compared to FDM
• Finite volume method (FVM)
• Computational domain is divided into a finite number of control volumes
• Variable values are calculated at the cell centers
• Interpolation is used to express variable values at the cell surfaces
• Can handle complex geometry
Taylor series
Taylor series expanded about point x:
When more terms are • Let’s say we have a continuous function 𝑓(𝑥)
included, the estimation • We want to find the value of 𝑓 at point 2 (𝑥1 + ∆𝑥)
goes closer to the exact
value • We can do this by estimating 𝑓(𝑥1 + ∆𝑥) expressed in terms
𝑓(𝑥) of a Taylors series expanded about point 1 (𝑥1 )
• The more terms we include, the more accurate our
2 estimation
• The estimation becomes the exact value only when the
1 exact value
terms on the right-hand side is infinite 𝒏 → ∞
Taylor’s expansion
𝑥1 first term only
𝑥1 + ∆𝑥
Taylor series
Example Actual function: 𝑓 𝑥 = 5𝑥 4 − 2𝑥 3 + 10𝑥
Let’s say we want to find 𝑓(2.5) and 𝑥1 = 0.5
Terms 𝑓(2.5)
1 5.0625
2 27.0625
3 45.0625
4 109.0625
5 189.0625
Actual value is 189.0625
Finite Difference Method
Example of a 1D and 2D uniform grid for FDM:
FDM
𝜙: Generic flow field variable
𝑖, 𝑗 + 1
If we know 𝜙𝑖,𝑗 , we can express 𝜙𝑖+1,𝑗 in terms of Taylor series as:
𝑖 − 1, 𝑗 𝑖, 𝑗 𝑖 + 1, 𝑗
𝑖, 𝑗 − 1
2
FDM (Forward difference) The lowest-order term in the truncation
We use information only to the right of point 𝑖, 𝑗 error involves 𝜟𝒙 to the first power
Finite difference Truncation error
representation
These terms are the terms that are
neglected in this approximation
This expression is first order accurate First order forward difference
FDM (Backward difference) The lowest-order term in the truncation
We use information only to the left of point 𝑖, 𝑗 error involves 𝜟𝒙 to the first power
Finite difference Truncation error
representation
These terms are the terms that are
neglected in this approximation
This expression is first order accurate First order backward difference
*We call this the difference equation
FDM (Central difference)
1 − 2 :
The lowest-order term in the truncation
error involves 𝜟𝒙 to the second power
Second order central difference
FDM (Second partial derivatives)
Second order accurate central difference
2 +
rearrange
Example of FDM
• Apply FDM to a governing equation (steady state diffusion equation)
• For example a 1D heat conduction process
Γ: diffusion coefficient
Steady state diffusion equation:
𝑆𝜙 : source term
𝛿𝑥 𝛿𝑥
𝑊 𝑃 𝐸
1D grid for the problem
Example of FDM 𝛿𝑥 𝛿𝑥
• The equation needs to be expanded into its non-conservative form:
𝑊 𝑃 𝐸
1D grid for the problem
Summary of FDM
• FDM is derived from the Taylor series expansion
• FDM requires a uniformly distributed mesh
• Non-uniform mesh requires some mathematical manipulation to transform the governing
equation into a generalized coordinates before applying the finite difference approximation
• Higher order accurate quotients require more grid points, which results in more
computational resource
• Higher order difference scheme may result in a higher-quality solution
• For example, a more distinct and sharper shock waves
• The difference equation is not the differential equation
• What we want (and hope) is that the numerical result that we obtain from the
difference equation can represent the closed-form solution (analytical solution) of the
original PDE
• Does the difference equation reduce to the original differential equation as Δ𝑥 → 0 (the
truncation error approaches zero)?
• Yes : the finite difference representation of the PDE is consistent
Finite Volume Method (FVM)
• Discretizes the integral form of the conservation equations directly in the physical space
• Physical domain is divided into control volumes
• The variable values are calculated at the centroid of each control volume
• The variable values at the control surfaces are interpolated (using suitable interpolation method)
• FVM works with control volumes instead of grid intersection points
• Can accommodate unstructured grids
• Many options to define the shape and location of the control volume boundaries
• More flexibility
• FVM is conservative –
Finite Volume Method (FVM)
• Physical domain is divided into control volumes
𝛿𝑥𝑊𝑃 𝛿𝑥𝑃𝐸
𝑤 𝑒
𝑊 𝑃 𝐸
∆𝑥
Example of a control volume around node P in a 1D domain using FVM
• How do we apply this to the steady state diffusion equation?
FVM
• We use the control volume integration for FVM:
CV integration
Apply Gauss’s divergence theorem
FVM
Step 1 Grid generation (meshing)
𝛿𝑥𝑊𝑃 𝛿𝑥𝑃𝐸
𝑤 𝑒
𝑊 𝑃 𝐸
∆𝑥
Step 2 Discretization of the governing equation
A: cross-sectional area of the control volume
ҧ : Average value of 𝑆𝜙 over the control volume
𝑆𝜙
FVM
We need to express these terms in some useful form to be able to solve the equation
*The 𝛤 and 𝜙 values are defined and evaluated at the nodal points (cell center), so
we need to approximate the values at the cell faces
Central differencing
(linear interpolation)
Diffusive flux terms:
FVM
Approximate the source term
using linear form:
Substitute and rearrange:
This type of discretized equation is important to all further development
Example problem: 1D steady state diffusion
Consider the problem of source-free (no heat generation) heat conduction in an insulated rod whose ends are
maintained at constant temperatures of 100oC and 500oC respectively. Calculate the steady state temperature in
the rod. Use FVM with 5 cells.
Solution
Thermal conductivity, k = 1000 W/m-K
Cross-sectional area, A = 10 × 10−3 m2