Chapter 1
Introduction
Ibrahim Sezai
Department of Mechanical Engineering
Eastern Mediterranean University
What is CFD?
CFD is the simulation of fluids engineering systems using modeling
(mathematical physical problem formulation) and numerical methods
(discretization methods, solvers, numerical parameters, and grid
generations, etc.)
Historically only Analytical Fluid Dynamics (AFD) and
Experimental Fluid Dynamics (EFD).
CFD made possible by the advent of digital computer and advancing
with improvements of computer resources
(500 flops, 194720 teraflops, 2003)
ME555 : Computational Fluid Dynamics 2 I. Sezai - Eastern Mediterranean University
1
Why use CFD?
Analysis and Design
1. Simulation-based design instead of “build & test”
More cost effective and more rapid than EFD
CFD provides high-fidelity database for diagnosing flow
field
2. Simulation of physical fluid phenomena that are difficult for
experiments
Full scale simulations (e.g., ships and airplanes)
Environmental effects (wind, weather, etc.)
Hazards (e.g., explosions, radiation, pollution)
Physics (e.g., planetary boundary layer, stellar evolution)
Knowledge and exploration of flow physics
ME555 : Computational Fluid Dynamics 3 I. Sezai - Eastern Mediterranean University
Where is CFD used?
Where is CFD used? Aerospace
• Aerospace
• Automotive
• Biomedical Biomedical
• Chemical
F18 Store Separation
Processing
• HVAC
• Hydraulics
• Marine
• Oil & Gas
• Power Generation
• Sports
Automotive Temperature and natural
convection currents in the eye
following laser heating.
ME555 : Computational Fluid Dynamics 4 I. Sezai - Eastern Mediterranean University
2
Where is CFD used?
Chemical Processing
Where is CFD used?
• Aerospacee
• Automotive
• Biomedical
• Chemical
Processing Polymerization reactor vessel - prediction
of flow separation and residence time
• HVAC effects.
Hydraulics
• Hydraulics
• Marine
• Oil & Gas
• Power Generation
• Sports
HVAC
Streamlines for workstation
ventilation
ME555 : Computational Fluid Dynamics 5 I. Sezai - Eastern Mediterranean University
Where is CFD used?
Where is CFD used?
Marine (movie) Sports
• Aerospace
• Automotive
• Biomedical
• Chemical Processing
• HVAC
• Hydraulics
• Marine
• Oil & Gas
• Power Generation
• Sports
Oil & Gas Power Generation
Flow of lubricating Flow around cooling
mud over drill bit towers
ME555 : Computational Fluid Dynamics 6 I. Sezai - Eastern Mediterranean University
3
COMMERCIAL SOFTWARE
The market is currently dominated by four codes:
1) PHOENICS
2) FLUENT
3) FLOW3D
4) STAR-CD
Prices of the commercial software range between
£10 000 and £ 50 000.
ME555 : Computational Fluid Dynamics 7 I. Sezai - Eastern Mediterranean University
NON-COMMERCIAL SOFTWARE
There are also non-commercial CFD software. One
of the best non-commercial software is OpenFOAM.
The OpenFOAM® (Open Field Operation and
Manipulation) CFD Toolbox is a free, open source
CFD software package.
OpenFOAM has an extensive range of features to
solve anything from complex fluid flows involving
chemical reactions, turbulence and heat transfer, to
two-phase flows, solid dynamics and
electromagnetics.
ME555 : Computational Fluid Dynamics 8 I. Sezai - Eastern Mediterranean University
4
Preference of CFD packages (2016)
[Link]
ME555 : Computational Fluid Dynamics 9 I. Sezai - Eastern Mediterranean University
Advantages of CFD over EFD
Substantial reduction of lead times and costs of
new designs.
Ability to study systems where controlled
experiments are difficult or impossible to
perform (e.g. very large systems).
Ability to study systems under hazardous
conditions at and beyond their normal
performance limits (e.g. safety studies and
accident scenarios).
Practically unlimited level of detail of results.
ME555 : Computational Fluid Dynamics 10 I. Sezai - Eastern Mediterranean University
5
CFD process
Purposes of CFD codes will be different for
different applications:
investigation of bubble-fluid interactions for bubbly flows,
study of wave induced massively separated flows for free-
surface, etc.
Depending on the specific purpose and flow
conditions of the problem, different CFD codes
can be chosen for different applications
(aerospace, marines, combustion, multi-phase
flows, etc.)
Once purposes and CFD codes chosen, “CFD
process” is the steps to set up the IBVP problem
and run the code:
ME555 : Computational Fluid Dynamics 11 I. Sezai - Eastern Mediterranean University
How does a CFD code work?
Geometry Physics Mesh Solve Reports Post-
Processing
Select Heat Transfer Unstructured Steady/ Forces Report Contours
ON/OFF (automatic/ Unsteady (lift/drag, shear
Geometry manual) stress, etc)
Compressible Structured Iterations/ XY Plot Vectors
Geometry ON/OFF (automatic/ Steps
Parameters manual)
Domain Shape Flow Convergence Verification Streamlines
and Size properties Limit
Viscous Precisions Validation
Model (single/
double)
Boundary Numerical
Conditions Scheme
Initial
Conditions
ME555 : Computational Fluid Dynamics 12 I. Sezai - Eastern Mediterranean University
6
All commercial codes contain three basic elements:
1. Pre-processor
2. Solver
3. Post-processor
ME555 : Computational Fluid Dynamics 13 I. Sezai - Eastern Mediterranean University
1) Pre-processor
Provides the input of the problem and transforms this input in a form
suitable for use by the solver. Preprocessing involve:
Definition of the geometry of the region of interest: the
computational domain.
Selection of an appropriate coordinate
Determine the domain size and shape
Any simplifications needed?
What kinds of shapes needed to be used to best resolve the
geometry? (lines, circular, ovals, etc.)
For commercial code, geometry is usually created using
commercial software (either separated from the commercial
code itself, like Gambit, or combined together, like FlowLab)
One of the commercial geometry and mesh modeller is
Gridgen.
ME555 : Computational Fluid Dynamics 14 I. Sezai - Eastern Mediterranean University
7
b) Grid Generation
Grids can either be structured (hexahedral)
or unstructured (tetrahedral). Depends structured
upon type of discretization scheme and
application
• Scheme
Finite differences: structured
Finite volume or finite element:
structured or unstructured
• Application
Thin boundary layers best resolved
with highly-stretched structured unstructured
grids
Unstructured grids useful for
complex geometries
Unstructured grids permit
automatic adaptive refinement
based on the pressure gradient, or
regions interested (FLUENT)
ME555 : Computational Fluid Dynamics 15 I. Sezai - Eastern Mediterranean University
2) SOLVER
There are three basic numerical solution techniques:
a) Finite difference methods
b) Finite element methods
c) Spectral methods
All of these numerical methods perform the following steps:
Approximation of the unknown flow variables by means
of simple functions.
Discretisation by substitution of the approximations into
the governing flow equations and subsequent
mathematical manipulations.
Solution of the algebraic equations.
ME555 : Computational Fluid Dynamics 16 I. Sezai - Eastern Mediterranean University
8
a) Finite Difference Method
The unknowns at each grid point are approximated
by using Taylor series expansion of the derivatives of
Discretise the governing differential equations
directly; e.g.
u v ui 1, j ui 1, j vi , j 1 vi , j 1
0
x y 2x 2 y
ME555 : Computational Fluid Dynamics 17 I. Sezai - Eastern Mediterranean University
b) Finite Element Method
Use simple, piecewise functions valid on the elements to
describe the local variations of unknown flow variables
( x ) S ( x)
where Sα is the shape function.
The finite element method is popular in solid mechanics.
c) Spectral Methods
Approximate the unknowns by means of
Fourier Series
Or series of Chebysev polynomials.
ME555 : Computational Fluid Dynamics 18 I. Sezai - Eastern Mediterranean University
9
Finite Volume Method
is a special form of the finite difference methods.
4 of the 5 commercially available CFD codes use this
method.
Discretise the governing integral equations directly; e.g.
Net mass flow =
uAe uA w vAn vA s 0
The finite-volume method is popular in fluid
mechanics because:
· it rigorously enforces conservation;
· it is flexible in terms of both geometry and the
variety of fluid phenomena;
· it is directly relatable to physical quantities
(mass flux, etc.).
ME555 : Computational Fluid Dynamics 19 I. Sezai - Eastern Mediterranean University
A mesh is generated in the solution domain
ME555 : Computational Fluid Dynamics 20 I. Sezai - Eastern Mediterranean University
10
The conservation of a general flow variable , within a control
volume can be expressed as
Rate of change Net flux of Net flux of
of in the control due to due to Net rate of creation
of inside the
volume with convection into diffusion into the
control volume
respect to time the control volume control volume
For a 2D flow, the above relationship can be expressed
mathematically as
( ) ( u ) ( v ) S (1-1)
t x y x x y y
where Γ = diffusion coefficient
S = Source term
= general flow variable (u, v, w, T, …etc)
ME555 : Computational Fluid Dynamics 21 I. Sezai - Eastern Mediterranean University
The discretized form of the conservation equation (1-1) for
a 2-dimensional control volume is of the form
aPP aW W aEE aSS aN N Su
ME555 : Computational Fluid Dynamics 22 I. Sezai - Eastern Mediterranean University
11
A similar equation is written for each control volume.
At the end, a system of linear algebraic equations is
obtained.
The system of equations are expressed in matrix form as
[ A][ ] [b]
Use any matrix solution method to solve the system of
equations for the unknown variable .
An iterative solution approach is used. Most popular is the
TDMA line-by-line solver for the set of algebraic
equations.
ME555 : Computational Fluid Dynamics 23 I. Sezai - Eastern Mediterranean University
3) Post Processor
The leading CFD packages are now equipped with
versatile data visualization tools. These include:
Domain geometry and grid display
Vector plots
Line and shaded contour plots
2D and 3D surface plots
Particle tracking
View manipulation (translation, rotation, scaling etc)
Color postscript output.
ME555 : Computational Fluid Dynamics 24 I. Sezai - Eastern Mediterranean University
12
Post-Processing (visualization, XY plots)
Lift and drag coefficients of
NACA12 with 60o angle of attack
(CFDSHIP-IOWA, DES)
Wave profile of surface-piercing
NACA24, Re=1.52e6, Fr=0.37
(CFDSHIP-IOWA, DES)
ME555 : Computational Fluid Dynamics 25 I. Sezai - Eastern Mediterranean University
Post-Processing (visualization, Tecplot)
Different colors illustrate different blocks (6)
Re=10^5, DES, NACA12 with angle of attack 60 degrees
ME555 : Computational Fluid Dynamics 26 I. Sezai - Eastern Mediterranean University
13
Post-Processing (NACA12, 2D contour plots, vorticity)
Define and compute new variable: “Data””Alter””Specify
equations””vorticity in x,y plane: v10””compute””OK”.
ME555 : Computational Fluid Dynamics 27 I. Sezai - Eastern Mediterranean University
Post-Processing (NACA12, 2D contour plot)
Extract 2D slice from 3D geometry: “Data””Extract””Slice
from plane””z=0.5””extract”
ME555 : Computational Fluid Dynamics 28 I. Sezai - Eastern Mediterranean University
14
Post-Processing (NACA12, 2D contour plots)
2D contour plots on z=0.5 plane (vorticity and eddy viscosity)
Vorticity z Eddy viscosity
ME555 : Computational Fluid Dynamics 29 I. Sezai - Eastern Mediterranean University
Post-Processing (NACA12, 2D contour plots)
2D contour plots on z=0.5 plane (pressure and streamwise
velocity)
Pressure Streamwise velocity
ME555 : Computational Fluid Dynamics 30 I. Sezai - Eastern Mediterranean University
15
Post-Processing (2D velocity vectors)
2D velocity vectors on z=0.5 plane: turn off “contour” and
activate “vector”, specify the vector variables.
Zoom in
ME555 : Computational Fluid Dynamics 31 I. Sezai - Eastern Mediterranean University
Post-Processing (3D Iso-surface plots, cont’d)
3D Iso-surface plots: pressure, p=constant
3D Iso-surface plots: vorticity magnitude
x2 y2 z2
3D Iso-surface plots: 2 criterion
Second eigenvalue of 1 2
p
2
3D Iso-surface plots: Q criterion
Q
1
ij ij Sij Sij ij ui , j u j ,i 2
2
S ij ui , j u j ,i 2
ME555 : Computational Fluid Dynamics 32 I. Sezai - Eastern Mediterranean University
16
Post-Processing (3D Iso-surface plots)
3D Iso-surface plots: used to define the coherent vortical structures,
including pressure, voriticity magnitude, Q criterion, 2, etc.
Iso-surface of vorticity magnitude
ME555 : Computational Fluid Dynamics 33 I. Sezai - Eastern Mediterranean University
Post-Processing (streamlines)
Streamlines (2D):
Streamlines with contour of pressure
• Streaklines and pathlines (not shown here)
ME555 : Computational Fluid Dynamics 34 I. Sezai - Eastern Mediterranean University
17
Post-Processing (Animations)
Animations (3D): animations can be created by saving CFD solutions
with or without skipping certain number of time steps and playing the
saved frames in a continuous sequence.
Animations are important tools to study time-dependent developments of
vortical/turbulent structures and their interactions
Q=0.4
ME555 : Computational Fluid Dynamics 35 I. Sezai - Eastern Mediterranean University
ParaView Post Processor
ParaView is an open-source, multi-platform data
analysis and visualization tool for CFD results.
ParaView users can quickly build visualizations to
analyze their data using qualitative and quantitative
techniques.
The data exploration can be done interactively in 3D
or programmatically using ParaView's batch
processing capabilities.
ME555 : Computational Fluid Dynamics 36 I. Sezai - Eastern Mediterranean University
18
Examples of ParaView Images
ME555 : Computational Fluid Dynamics 37 I. Sezai - Eastern Mediterranean University
Examples of ParaView Images
ME555 : Computational Fluid Dynamics 38 I. Sezai - Eastern Mediterranean University
19
Problem Solving with CFD
The results of a CFD code are:
at best as good as the physics embedded in it.
at worst as good as its operator.
Three mathematical concepts are useful in determining
the success of CFD codes:
1) Convergence:
- is a property of a numerical method to produce a solution
which approaches the exact solution as the grid spacing is
reduced to zero.
2) Consistency:
- consistent numerical schemes produce systems of algebraic
equations which are equivalent to the original governing
equations as the grid spacing tend to zero.
3) Stability:
- is associated with damping of errors as the numerical method
proceeds.
ME555 : Computational Fluid Dynamics 39 I. Sezai - Eastern Mediterranean University
A CFD code should also have the following
properties:
Conservativeness:
Conservation of a fluid property for each control
volume.
A numerical scheme which possesses the
conservativeness property also ensure global
conservation of the fluid property over the entire
geometry.
Is achieved by means of consistent fluxes of through
the cell faces of adjacent control volumes.
The finite volume approach guarantees conservativeness.
ME555 : Computational Fluid Dynamics 40 I. Sezai - Eastern Mediterranean University
20
Boundedness:
is crucial for stability and requires that in a linear
problem without sources the solution is bounded by
the maximum and minimum boundary values of the
flow variable.
Transportiveness
is a property that accounts for the directional
property of convection terms.
in convection phenomena, a point only experiences
effects due to changes at upstream locations.
a finite volume scheme should consider the relative
strength of diffusion to convection.
ME555 : Computational Fluid Dynamics 41 I. Sezai - Eastern Mediterranean University
Free Fortran compilers:
GNU Fortran
G95
ME555 : Computational Fluid Dynamics 42 I. Sezai - Eastern Mediterranean University
21
ME555 : Computational Fluid Dynamics 43 I. Sezai - Eastern Mediterranean University
ANSYS Free Student Software Downloads
Student version of ANSYS products can be
downloaded freely.
Download ANSYS student 19.2
Limited by 512K cells/nodes.
License duration: Renewable, twelve-month lease.
Download time: 55 mins for 10 Mbps, 15 mins for
51 Mbps
We will use mainly ANSYS CFX
ME555 : Computational Fluid Dynamics 44 I. Sezai - Eastern Mediterranean University
22