Title: AN INTRODUCTION TO COMPUTATIONAL FLUID DYNAMICS
1AN INTRODUCTION TO COMPUTATIONAL FLUID DYNAMICS
- Shuisheng He
- School of Engineering
- The Robert Gordon University
2OBJECTIVES
- The lecture aims to convey the following
information/ message to the students - What is CFD
- The main issues involved in CFD, including those
of - Numerical methods
- Turbulence modelling
- The limitations of CFD and the important role of
validation and expertise in CFD
3OUTLINE OF LECTURE
- Introduction
- What is CFD
- What can cannot CFD do
- What does CFD involve
- Issues on numerical methods
- Mesh generation
- Discretization of equation
- Solution of discretized equations
- Turbulence modelling
- Why are turbulence models needed?
- What are available?
- What model should I use?
- Demonstration
- Use of Fluent
41. INTRODUCTION
5What is CFD?
- Computational fluid dynamics (CFD)
- CFD is the analysis, by means of computer-based
simulations, of systems involving fluid flow,
heat transfer and associated phenomena such as
chemical reactions. - CFD involves ...
6What does CFD involve?
- Specification of the problem
- Development of the physical model
- Development of the mathematical model
- Governing equations
- Boundary conditions
- Turbulence modelling
- Mesh generation
- Discretization of the governing equations
- Solution of discretized equations
- Post processing
- Interpretation of the results
7An example
- Initiation of the problem
- DP Offshore Ltd is keen to know what (forces )
caused the damage they recently experienced with
their offshore pipelines. - Development of the physical model
- After a few meetings with the company, we have
finally agreed a specification of the problem
(For me, it defines the physical model of the
problem to be solved)
8An example (cont.)
- Development of the mathematical model
- Governing equations
- Equations momentum, thermal (x), multiphase (x),
- Phase 1 2D, steady Phase 2 unsteady, ,
- The flow is turbulent!
- Boundary conditions
- Decide the computational domain
- Specify boundary conditions
9An example (cont.)
- Development of the mathematical model (cont.)
- Turbulence model
- Initially, a standard 2-eq k-e turbulence model
is chosen for use. - Later, to improve simulation of the transition,
separation stagnation region, I would like to
consider using a RNG or a low-Re model - Mesh generation
- Finer mesh near the wall but not too close to
wall - Finer mesh behind the pipe
10An example (cont.)
- Discretization of the equations
- Start with 1st order upwind, for easy convergence
- Consider to use QUICK for velocities, later.
- There is no reason for not using the default
SIMPLER for pressure. - Solver
- Use Uncoupled rather than coupled method
- Use default setup on under-relaxation, but very
likely, this will need to be changed later - Convergence criterion choose 10-5 initially
check if this is ok by checking if 10-6 makes any
difference. - Iteration
- Start iteration
- Failed
- Plot velocity or other variable to assist
identifying the reason(s) - Potential changes in relaxation factors, mesh,
initial guess, numerical schemes, etc. - Converged solution
- Eventually, solution converged.
11An example (cont.)
- Post processing
- Interpretation of results
Force vector (1 0 0)
pressure viscous total
pressure viscous total zone name
force force force
coefficient coefficient coefficient
n n
n
------------------------- --------------
-------------- -------------- --------------
-------------- -------------- pipe
8.098238 0.12247093 8.2207089
13.221613 0.1999 13.421566 -----------------
-------- -------------- --------------
-------------- -------------- --------------
-------------- net 8.098238
0.12247093 8.2207089 13.221613
0.199 13.421566
12CFD road map
Pre-processor
Solver
Post-processor
13Why CFD?
- Continuity and Navier-Stokes equations for
incompressible fluids
14Why CFD? (cont.)
Important conclusion There is no analytical
solution even for a very simple application, such
as, a turbulent flow in a pipe.
- Analytical solutions are available for only very
few problems. - Experiment combined with empirical correlations
have traditionally been the main tool - an
expensive one. - CFD potentially provides an unlimited power for
solving any flow problems
15CFD applications
- Aerospace
- Automobile industry
- Engine design and performance
- The energy sector
- Oil and gas
- Biofluids
- Many other sectors
16CFD applications (cont.)
- As a design tool, CFD can be used to perform
quick evaluation of design plans and carry out
parametric investigation of these designs. - As a research tool, CFD can provide detailed
information about the flow and thermal field and
turbulence, far beyond these provided by
experiments.
17What can CFD do?
- Flows problems in complex geometries
- Heat transfer
- Combustions
- Chemical reactions
- Multiphase flows
- Non-Newtonian fluid flow
- Unsteady flows
- Shock waves
18What cant CFD do?
- CFD is still struggling to predict even the
simplest flows reliably, for example, - A jet impinging on a wall
- Heat transfer in a vertical pipe
- Flow over a pipe
- Combustion in an engine
- Important conclusions
- Validation is of vital importance to CFD.
- Use of CFD requires more expertise than many
other areas - CFD solutions beyond validation are often sought
and expertise plays an important role here.
19Validation of CFD modelling
- Errors involved in CFD results
- Discretization errors
- Depending on schemes used. Use of higher order
schemes will normally help to reduce such errors - Also depending on mesh size reducing mesh size
will normally help to reduce such errors. - Iteration errors
- For converged solutions, such errors are
relatively small. - Turbulence modelling
- Some turbulence models are proved to produce good
results for certain flows - Some models are better than others under certain
conditions - But no turbulence model can claim to work well
for all flows - Physical problem vs mathematical model
- Approximation in boundary conditions
- Use of a 2D model to simplify calculation
- Simplification in the treatment of properties
20Validation of CFD modelling (cont.)
- CFD results always need validation. They can be
- Compared with experiments
- Compared with analytical solutions
- Checked by intuition/common sense
- Compared with other codes (only for coding
validation!)
21Commercial CFD packages
- Phoenix
- Fluent
- Star-CD
- CFX (FLOW3D)
- Many others
- Computer design tools integrating CFD into a
design package
22How to use a CFD package?
- Specify the problem
- Generate Mesh
- Select equations to solve
- Select turbulence models
- Define boundary conditions
- Select numerical methods
- Iterate solve equations
- Fail calculation does not converge or converges
too slowly
- Improve model
- Physical model
- Mesh
- Better initial guess
- Numerical methods (e.g., solver, convection
scheme) - Under-relaxations
- Post processing
- Interpretation of results Always question the
results
23How to use a CFD package? (cont.)
- Important issues involved in using CFD
- Mesh independence check
- Selection of an appropriate turbulence model
- Validation of the solution based on a simplified
problem (which contains the important features
similar to your problem) - Careful interpretation of your results
24How to use a CFD package? (cont.)
- The commercial packages are so user friendly and
robust, why do we still need CFD experts? - Because they can provide
- Appropriate interpretation of the results and
knowledge on the limitations of CFD - More accurate results (by choosing the right
turbulence model numerical methods) - Ability to obtain results (at all) for complex
problems - Speed both in terms of the time used to generate
the model and the computing time
25Basic CFD strategies
- Finite difference (FD)
- Starting from the differential form of the
equations - The computational domain is covered by a grid
- At each grid point, the differential equations
(partial derivatives) are approximated using
nodal values - Only used in structured grids and normally
straightforward - Disadvantage conservation is not always
guaranteed - Disadvantage Restricted to simple geometries.
- Finite Volume (FV)
- Finite element (FE)
26Basic CFD strategies (cont.)
- Finite difference (FD)
- Finite Volume (FV)
- Starting from the integral form of the governing
equations - The solution domain is covered by control volumes
(CV) - The conservation equations are applied to each CV
- The FV can accommodate any type of grid and
suitable for complex geometries - The method is conservative (as long as surface
integrals are the same for CVs sharing the
boundary) - Most widely used method in CFD
- Disadvantage more difficult to implement higher
than 2nd order methods in 3D. - Finite element (FE)
27Basic CFD strategies (cont.)
- Finite difference (FD)
- Finite Volume (FV)
- Finite element (FE)
- The domain is broken into a set of discrete
volumes finite elements - The equations are multiplied by a weight function
before they are integrated over the entire
domain. - The solution is to search a set of non-linear
algebraic equations for the computational domain. - Advantage FE can easily deal with complex
geometries. - Disadvantage since unstructured in nature, the
resultant matrices of linearized equations are
difficult to find efficient solution methods. - Not often used in CFD
282. ISSUES IN NUMERICAL METHODS
29Mesh generation
- Why do we care?
- 50 time spent on mesh generation
- Convergence depends on mesh
- Accuracy depends on mesh
- Main topics
- Structured/unstructured mesh
- Multi-block
- body fitted
- Adaptive mesh generation
30 - MESH GENERATION - Computational domain and
mesh structure
- Carefully select your computational domain
- The mesh needs
- to be able to resolve the boundary layer
- to be appropriate for the Reynolds number
- to suit the turbulence models selected
- to be able to model the complex geometry
31 - MESH GENERATION - Structure/unstructured mesh
- Structured grid
- A structured grid means that the volume elements
(quadrilateral in 2D) are well ordered and a
simple scheme (e.g., i-j-k indices) can be used
to label elements and identify neighbours. - Unstructured grid
- In unstructured grids, volume elements
(triangular or quadrilateral in 2D) can be joined
in any manner, and special lists must be kept to
identify neighbouring elements
32 - MESH GENERATION - Structure/unstructured mesh
- Structured grid
- Advantages
- Economical in terms of both memory computing
time - Easy to code/more efficient solvers available
- The user has full control in grid generation
- Easy in post processing
- Disadvantages
- Difficult to deal with complex geometries
- Unstructured grid
- Advantages/disadvantages opposite to above
points!
33 - MESH GENERATION - Multi-Block and Overset Mesh
34 - MESH GENERATION - Body fitted mesh -
transformation
Regular mesh
Body fitted mesh
35 - MESH GENERATION - Adaptive mesh generation
- Adaptive mesh generation
- The mesh is modified according to the solution of
the flow - Two types of adaptive methods
- Local mesh refinement
- Mesh re-distribution
- Dynamic adaptive method
- Mesh refinement/redistribution are automatically
carried out during iterations - Demonstration flow past a cylinder
36Equation discretization
- Relevant issues
- Convergence strongly depends on numerical methods
used. - Accuracy discretization errors
- Main topics
- Staggered/collocated variable arrangement
- Convection schemes
- Accuracy
- Artificial diffusion
- Boundedness
- Choice of many schemes
- Pressure-velocity link
- Linearization of source terms
- Boundary conditions
37 - EQUATION DISCRETIZATION - Staggered/collocated
variable arrangement
- Collocated variable arrangement
- All variables are defined at nodes
- Staggered variable arrangement
- Velocities are defined at the faces and scalars
are defined as the nodes
Collocated Arrangement
Staggered Arrangement
38 - EQUATION DISCRETIZATION - Staggered/collocated
variable arrangement
- The problem
- Unless special measures are taken, the collocated
arrangement often results in oscillations - The reason is the weak coupling between velocity
pressure - Staggered variable arrangement
- Almost always been used between 60s and early
80s - Still most often used method for Cartesian grids
- Disadvantage difficult to treat complex geometry
- Collocated variable arrangement
- Methods have been developed to over-come
oscillations in the 80s and such methods are
often being used since. - Used for non-orthogonal, unstructured grids, or,
for multigrid solution methods
39 - EQUATION DISCRETIZATION - Convection schemes
- The problem
- To discretize the equations, convections on CV
faces need to be calculated from variables stored
on nodal locations - When the 2nd order-accurate linear interpolation
is used to calculate the convection on the CV
faces, undesirable oscillation may occur. - Development/use of appropriate convection schemes
have been a very important issue in CFD - There are no best schemes. A choice of schemes is
normally available in commercial CFD packages to
be chosen by the user.
40 - EQUATION DISCRETIZATION - Convection schemes
(cont.)
- The requirements for convection schemes
- Accuracy Schemes can be 1st, 2nd, 3rd...-order
accurate. - Conservativeness Schemes should preserve
conservativeness on the CV faces - Boundedness Schemes should not produce
over-/under-shootings - Transportiveness Schemes should recognize the
flow direction
41 - EQUATION DISCRETIZATION - Convection schemes
(cont.)
- Examples of convection schemes
- 1st order schemes
- Upwind scheme (UW) most often used scheme!
- Power law scheme
- Skewed upwind
- Higher order schemes
- Central differencing scheme (CDS) 2nd order
- Quadratic Upwind Interpolation for Convective
Kinematics (QUICK) 3rd order and very often
used scheme - Bounded higher-order schemes
- Total Variation Diminishing (TVD) a group of
schemes - SMART
42 - EQUATION DISCRETIZATION - Pressure-velocity
link
- The problem
- The pressure appears in the momentum equation as
the driving force for the flow. But for
incompressible flows, there is no transport
equation for the pressure. - In stead, the continuity equation will be
satisfied if the appropriate pressure field is
used in the momentum equations - The non-linear nature of and the coupling
between, the various equations also pose problems
that need care. - The remedy
- Iterative guess-and-correct methods have been
proposed see next slide.
43 - EQUATION DISCRETIZATION - Pressure-velocity
link (cont.)
- Most widely used methods
- SIMPLE (Semi-implicit method for pressure-linked
equations) - A basic guess-and-correct procedure
- SIMPLER (SIMPLE-Revised) used as default in many
commercial codes - Solve an extra equation for pressure correction
(30 more effort than SIMPLE). This is normally
better than SIMPLE. - SIMPLEC (SIMPLE-Consistent) Generally better
than SIMPLE. - PISO (Pressure Implicit with Splitting of
Operators) - Initially developed for unsteady flow
- Involves two correction stages
44 - EQUATION DISCRETIZATION - Linearization of
source terms
- This slide is only relevant to those who develops
CFD codes. - The treatment of source terms requires skills
which can significantly increase the stability
and convergence speed of the iteration. - The basic rule is that the source term should be
linearizated and the linear part can the be
solved directly. - An important rule is that only those of
linearization which result in a negative gradient
can be solved directly
45 - EQUATION DISCRETIZATION - Boundary conditions
- Specification of boundary conditions (BC) is a
very important part of CFD modelling - In most cases, this is straightforward but, in
some cases, it can be very difficult ..., - Typical boundary conditions
- Inlet boundary conditions
- Outlet boundary conditions
- Wall boundary conditions
- Symmetry boundary conditions
- Periodic boundary conditions
46Solution of discretized equations
47 - SOLUTION OF DISCRETIZED EQUATIONS - Solvers
- Discretized Equations large linearized sparse
matrix
48 - SOLUTION OF DISCRETIZED EQUATIONS - Solvers
(cont.)
- The discretized governing equations are always
sparse, non-linear but linearizated, algebraic
equation systems - The matrix from structured mesh is regular and
easier to solve. - A non-structured mesh results in an irregular
matrix. - Number of equations number of nodes
- Number of molecules in each line
- Upwind, CDS for 1D results in a tridiagonal
matrix - QUICK for 1D results in a penta-diagonal matrix
- 2D problems involves 5 more molecules
- 3D problems involves 7 more molecules
49 - SOLUTION OF DISCRETIZED EQUATIONS - Solvers
(cont.)
- Direct methods
- Gauss elimination
- Tridiagonal Matrix Algorithm (TDMA)
- Indirect methods
- Basic methods
- Jacobi
- Gauss-Seidel
- Successive over-relaxation (SOR)
- ADI-TDMA
- Strongly implicit procedure (SIP)
- Conjugate Gradient Methods (CGM)
- Multigrid Methods
50 - SOLUTION OF DISCRETIZED EQUATIONS -
Convergence criteria
- Two basic methods
- Changes between any two iterations are less than
a given level - Residuals in the transport equations are less
than a given value - Criteria can be specified using absolute or
relative values
51 - SOLUTION OF DISCRETIZED EQUATIONS -
Under-relaxation
- Under almost all circumstances, iterations will
not converge unless under-relaxation is used,
because - The governing equations are very non-linear
- And the equations are closely coupled
- Under-relaxation (a)
- Different variables often require different
levels of under-relaxation - Iteration diverged? Relaxation is the first thing
to look at
52 - SOLUTION OF DISCRETIZED EQUATIONS - Solution
of coupled equations
- Governing equations for flow/heat transfer are
almost always coupled - The primary variable of one equation also appear
in equations for other variables - Simultaneous solution Method 1
- Used when equations are linear and tightly
coupled - Can be very expensive
- Sequential solution Method 2
- Solve equations one by one - temporarily treat
other variables as known - Iterations include
- Inner cycles Solve each equation
- Outer cycles cycle between equations
53 - SOLUTION OF DISCRETIZED EQUATIONS - Unsteady
flow solvers
- Explicit method
- use only the values of the variable F from last
time step. - Conditionally stable, first order
- Implicit method
- Mainly use the values of the variable F from the
current time step - Unconditionally stable, first order
- Crank-Nicolson method
- Use a mixture of values of the variable F at the
last and current steps - Unconditionally stable, second order
- Predictor-Corrector method
- Predictor Explicit method
- Corrector (Pseudo-) Crank-Nicolson method
543. Turbulence modelling
55Turbulence modelling
- Turbulence models
- These are semi-empirical mathematical models
introduced to CFD to describe the turbulence in
the flow - Main topics
- Three levels of CFD simulations
- Classification of turbulence models
- Examples of popular models
- Special considerations
- General remarks about turbulence modelling
56The governing equations
- Continuity and Navier-Stokes equations for
incompressible fluids
57The Reynolds averaged Navier-Stokes Equation
The Reynolds averaged Navier-Stokes equations
(RANS)
- NOTES
- The extra terms, Reynolds (turbulent) shear
stresses, have - the effect of mixing, similar to molecular
mixing (diffusion) - These terms need to be modelled
58The three level simulations
- Direct Numerical Simulations (DNS)
- DNS directly solves the NS equations
- There is no modelling in it, so the solution
can be considered as the true representation of
the flow. - It always solves the unsteady form
- It can only be used for very simple flows at the
moment due to its huge requirement on computer
power. - Large Eddy Simulations (LES)
- LES directly solves the NS flow for large
eddies but uses models to simulate the small
scale flows - The solution is again always in unsteady form
- LES can only be used for relatively simple flows
- Reynolds Averaged Navier-Stokes approach (RANS)
- Turbulence models are used to simulate the effect
of turbulence - RANS has been widely used in designs and research
since the 70s - Almost all commercial CFD packages are RANS based.
59Classification of turbulence models
- Eddy viscosity turbulence models
- Model Reynolds stresses as a product of velocity
gradient and an eddy viscosity - Solve 0 to 2 transport equations for turbulence
- Reynolds stress turbulence models
- Solve the transport equations of the Reynolds
stresses - Solve 7 transport equations for turbulence
60Classification of turbulence models
- Eddy viscosity turbulence models
- The key issue is to model the eddy viscosity ?t
- Three types of eddy viscosity models
- Algebraic models (e.g., mixing length model)
- One-equation models solve one transport equation
(normally one for turbulence kinetic energy, k) - Two equation models solve two transport
equations - K-e, k-?, k-t models
61An example of the two-equation model
Jones and Launder (1972) k-e two equation model
Eddy viscosity
Turbulence kinetic energy
Dissipation rate
Closure coefficients
62An example of the Reynolds stress model
The Launder-Reece-Rodi (1975) Reynolds stress
model
Reynolds-stress tensor (six independent equations)
Dissipation rate
Pressure-strain correlation
Auxiliary relations
Closure coefficients Launder (1992)
63Special turbulence models
- Standard models and wall functions
- Standard turbulence models are designed only for
the core region. Wall Functions are used to
bridge the near-wall region for a wall shear
flow. - Standard models are used beyond roughly y50.
- Low-Reynolds number (LRN) turbulence model
- LRN models are designed to be used in the
near-wall region as well as the core region. - LRN models are much more expensive they require
much finer grid than used for standard models - Two-layer models
- In some cases, separate models are used for the
wall and core regions - The wall region model can be a simpler model,
such as, one-equation model - This practice can be more economical than using
LRN models. - Other special models
- Realizable models
- Non-linear eddy viscosity models
- Renormalized Group (RNG) models
64What model should I use?
- Algebraic models
- Main models used until early 70s, and still in
use. - Advantages simple
- Disadvantages lack of generality, ?t vanishes
when du/dy0, etc. - Two-equation models (especially k-e models)
- Most widely used models, standard model in
commercial packages - Advantages best compromise between cost and
capability - Disadvantages no account of individual
components of turbulent stresses ?t vanishes
when du/dy0. - Reynolds shear stress models
- Only recently been included in commercial CFD
codes and still not widely used yet. - Advantages provide the potential of modelling
more complex flows - Disadvantages have to solve up to 7 more
differential equations
65General remarks on turbulence models
- There are no generically best models.
- Near wall treatment is generally a very important
issue. - A good mesh is important to get good accurate
results. - Different models may have different requirement
on the mesh. - Expertise/validation are of great importance to
CFD.
66References
- Numerical Heat Transfer and Fluid Flow
- S.V. Patankar, 1980, Hemisphere Publishing
Corporation, Taylor Francis Group, New York. - An Introduction to Computational Fluid Dynamics
- H.K. Versteeg W. Malalasekera, 1995, Longman
group Limited, London - Computational Methods for Fluid Dynamics
- J.H. Ferziger M. Peric, 1996, Springer-Verlag,
Berlin. - Computational Fluid Dynamics
- J.D. Anderson, Jr, 1995, McGraw-Hill, Singapore