Chapter 2 CFD May 2020
Chapter 2 CFD May 2020
Fluid Mechanics II
Chapter 2
Introduction to Computational Fluid Dynamics
(CFD)
Fluid Mechanics II 1
What is Computational Fluid Dynamics?
▪ Two fundamental approaches to design and analysis
of engineering systems involving fluid flow:
▪ Experimentation (e.g., wind tunnel); global properties
▪ Calculation: analytical and numerical solutions of PDEs;
details about the flow field
Fluid Mechanics II 2
Why use CFD?
▪ Analysis and Design
▪ 1. Simulation-based design instead of “build & test”
▪ More cost effective and more rapid than experimental study
▪ 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)
Fluid Mechanics II 3
Where is CFD used? Biomedical Temperature and natural
convection currents in the eye
following laser heating.
▪ Aerospace
▪ Automotive
▪ Biomedical Chemical Processing
▪ Chemical
Processing Oil & Gas
▪ HVAC Flow of
▪ Hydraulics Automotive lubricating mud
over drill bit
▪ Marine
▪ Oil & Gas
▪ Power Generation
▪ Sports
HVAC
Hydraulics
Fluid Mechanics II 4
Equations of Motion
◼ Transport equations:
❑ Continuity equation
❑ Navier-Stokes equations
❑ Energy equation
❑ Equation of state
❑ Additional transport equations in
turbulence models
Fluid Mechanics II 5
CFD Process
Fluid Mechanics II 6
Solution Procedure
1. A computational domain is chosen and geometry is
created.
Fluid Mechanics II 7
Solution Procedure (cont)
3. Boundary conditions are specified on each edge or on each
face.
4. The type of fluid is specified along with fluid properties (T,
, , etc).
5. Numerical parameters and solution algorithms are selected.
6. Initial conditions are specified for each cell, so that the
iteration process may proceed.
7. Beginning with the initial guesses, discretized forms of
PDEs are solved iteratively, usually at the center of each
cell.
Fluid Mechanics II 8
Solution Procedure (cont)
8. The solution is exact when the sums of all the
terms in PDEs, defined as residual, is zero for
each cell.
▪ A residual can be thought of as a measure of how
much the solution to a given transport equation
deviates from exact, and is monitored.
▪ In CFD solution, the residual decreases with
progressive iterations, and finally the solution
converges.
9. Flow field variables are plotted and analyzed
graphically using postprocessors.
Fluid Mechanics II 9
Grid Generation
▪ FLUENT’s grid generator – ANSYS Meshing.
▪ The grid must represent the geometry correctly and accurately.
▪ The grid must have sufficient grid resolution to capture the flow
physics, otherwise they will be lost.
Fluid Mechanics II 10
Tri/Tet vs. Quad/Hex Meshes
Fluid Mechanics II 11
Hybrid Mesh
Fluid Mechanics II 12
Grid Independence
◼ It is important to know if the solution is grid
independent.
❑ The standard method to test for grid independence is to increase
the resolution (by a factor of 2, or least 20%, in all directions if
feasible) and repeat the simulation.
❑ If the results change appreciably, the original grid is not probably
adequate.
❑ In such a case, an even finer grid should be tried until the grid is
adequately resolved.
◼ It is time consuming.
Fluid Mechanics II 13
Boundary Conditions
◼ Boundary conditions must be applied at all
boundaries of the computational domain.
◼ Appropriate boundary conditions are required in
order to obtain an accurate CFD solution.
Fluid Mechanics II 14
Wall Boundary Conditions
◼ No-slip condition
◼ If the energy equation is solved, either
wall temperature or wall heat flux is used.
◼ Inviscid wall
◼ Zero-shear-stress wall BC along the free
surface
Fluid Mechanics II 15
Inflow/Outflow Boundary Conditions
◼ BCs through which fluid enters (inflow) or leaves (outflow) the
computational domain are either velocity-specified conditions or
pressure-specified conditions.
◼ At a velocity inlet, the velocity of the incoming flow along the inlet
face.
❑ If the energy and/or turbulence equations are solved, the temperature
and/or turbulence properties of the incoming flow are specified.
❑ P is not specified.
◼ At a pressure outlet, the static pressure along the outlet face is
specified; in many cases, this is atm. P (zero gage pressure).
❑ V is not specified.
◼ The temperature and/or turbulence properties are specified at
pressure inlets and outlet.
Fluid Mechanics II 16
Symmetry Boundary Conditions
◼ Symmetry BC forces flow
field variables to be mirror-
imaged across a symmetry
plane.
❑ Save computational time.
Fluid Mechanics II 17
Turbulent CFD Simulations
▪ The CFD can handle laminar flows with ease.
▪ To solve turbulent flows of practical engineering
problems, turbulence models are needed.
▪ No turbulence model is universal, and a turbulent CFD
solution is only as good as appropriateness of the
turbulence models.
▪ The turbulent CFD simulation is much more difficult as
the final features of the turbulent flow field are always
unsteady and 3D – random, swirling, vortical
structures called turbulent eddies of all orientations
arise in a turbulent flow.
Fluid Mechanics II 18
Turbulent Models Available in Fluent
Fluid Mechanics II 19
Solvers and Numerical Parameters
▪ Solvers include: tridiagonal, pentadiagonal solvers, PETSC
solver, solution-adaptive solver, multi-grid solvers, etc.
▪ Solvers can be either direct (Cramer’s rule, Gauss
elimination, LU decomposition) or iterative (Jacobi method,
Gauss-Seidel method, SOR method)
▪ Numerical parameters need to be specified to control the
calculation.
▪ Under relaxation factor, convergence limit, etc.
▪ Different numerical schemes
▪ Monitor residuals (change of results between iterations)
▪ Number of iterations for steady flow or number of time
steps for unsteady flow
▪ Single/double precisions
Fluid Mechanics II 20
Computation of the Numerical Solution
◼ The discretized conservation equations are solved
iteratively. A number of iterations are usually required to
reach a converged solution.
◼ Convergence is reached when:
❑ Changes in solution variables from one iteration to the
next are negligible.
❑ Residuals provide a mechanism to help monitor this
trend.
❑ Overall property conservation is achieved.
❑ Problem setup.
Fluid Mechanics II 21
Computation of the Numerical Solution
Fluid Mechanics II 22
Computation of the Numerical Solution
Fluid Mechanics II 23
Tools to Examine the Results
◼ Graphical tools:
❑ Grid, contour, and vector plots.
❑ XY plots.
❑ Animations.
Fluid Mechanics II 24
Advantages of CFD
◼ Relatively low cost.
❑ Using physical experiments and tests to get essential engineering
data for design can be expensive.
❑ CFD simulations are relatively inexpensive, and costs are likely to
decrease as computers become more powerful.
◼ Speed.
❑ CFD simulations can be executed in a short period of time.
❑ Quick turnaround means engineering data can be introduced
early in the design process.
◼ Ability to simulate real conditions.
❑ Many flow and heat transfer processes cannot be (easily) tested,
e.g. hypersonic flow.
❑ CFD provides the ability to theoretically simulate any physical
condition.
Fluid Mechanics II 25
Advantages of CFD (cont)
◼ Ability to simulate ideal conditions.
❑ CFD allows great control over the physical process, and provides
the ability to isolate specific phenomena for study.
❑ Example: a heat transfer process can be idealized with adiabatic,
constant heat flux, or constant temperature boundaries.
◼ Comprehensive information.
❑ Experiments only permit data to be extracted at a limited number
of locations in the system (e.g. pressure and temperature probes,
heat flux gauges, LDV, etc.).
❑ CFD allows the analyst to examine a large number of locations in
the region of interest, and yields a comprehensive set of flow
parameters for examination.
Fluid Mechanics II 26
Limitations of CFD
◼ Physical models.
❑ CFD solutions rely upon physical models of real world processes
(e.g. turbulence, compressibility, chemistry, multiphase flow,
etc.).
❑ The CFD solutions can only be as accurate as the physical
models on which they are based.
◼ Numerical errors.
❑ Solving equations on a computer invariably introduces numerical
errors.
❑ Truncation error: due to approximations in the numerical models.
Truncation errors will go to zero as the grid is refined. Mesh
refinement is one way to deal with truncation error.
Fluid Mechanics II 27
Limitations of CFD (cont)
◼ Boundary conditions.
❑ As with physical models, the accuracy of the CFD solution is only
as good as the initial/boundary conditions provided to the
numerical model.
❑ Example: flow in a duct with sudden expansion. If flow is supplied
to domain by a pipe, a fully-developed profile for velocity should
be used rather than assume uniform conditions.
Computational Domain Computational Domain
poor better
Fluid Mechanics II 28