You are on page 1of 38

MODULE QUESTION

Considering the total time that a user of a CFD code spends on his/her simulation
and applying “best practice”, which statement is correct?
A) Grid generation is the most time-consuming part
B) Turbulence modeling is the most time-consuming part
C) Postprocessing is the most time-consuming part
LEARNING OUTCOMES FOR MODULE 4

At the end of this module, you will:


• Understand some basic aspects of the finite difference method, the control
volume method and the finite element method
• Understand the importance of high-quality grid generation
• Understand how discretization errors can be estimated
• Understand how grid-convergence studies can be reported
References (non complete list)
Hirsch, C., 2007. Numerical computation of internal & external flows. The fundamentals
of computational fluid dynamics. Second Edition. Elsevier.

Versteeg, H.K., Malalasekera, W., 2007. An introduction to computational fluid dynamics.


The finite volume method. Second Edition. Prentice Hall.

Ferziger, J.H., Peric, M., 2002. Computational methods for fluid dynamics. Third Edition.
Springer.

Roache, P.J., 1997. Quantification of uncertainty in computational fluid dynamics.


Annu Rev Fluid Mech 29: 123-160.
The two types of discretization
Space discretization: replacing the spatial continuum by a finite number of points or cells
(“the grid”) where the numerical values of the variables will be determined.

Equation discretization: transformation of the differential or integral equations – as the


case may be – into discrete algebraic equations involving the unknowns at the grid
points.
Space discretization:
• Structured grid: grid with regular topology where neighborhood relation between all
points in given by a one-, two- or three-dimensional array.
• Unstructured grid: grid with irregular topology.
Space discretization:
• Structured grid: grid with regular topology where neighborhood relation between all
points is given by a one-, two- or three-dimensional array.
• Unstructured grid: grid with irregular topology.

Structured grid Unstructured grid


Space discretization:
• Uniform grid: equal spacing between all grid points (= highly uncommon)
• Non-uniform grid: grid with unequal spacing between grid points

Non-uniform structured grid Non-uniform unstructured grid


Space discretization:
• Uniform grid: equal spacing between all grid points (= highly uncommon)
• Non-uniform grid: grid with unequal spacing between grid points

Blocken et al. (2012) van Hooff & Blocken (2010)

Non-uniform unstructured grid Non-uniform unstructured grid


High-quality grid generation: Very time-consuming but very important.
Hirsch (2007): “Grid generation and grid quality are essential elements of the whole
discretization process. Not only is grid generation today a most critical element in the
cost of running CFD simulations, but more importantly, the accuracy of the obtained
numerical results is critically dependent on mesh quality.”

Blocken et al. (2012) van Hooff & Blocken (2010)

Non-uniform unstructured grid Non-uniform unstructured grid


High-quality grid generation: Very time-consuming but very important.
Accuracy is related to size and form of the grid. As grid size goes to zero, also the
discretization error will go to zero. The pace of this variation is given by the order of the
numerical discretization.

Blocken et al. (2012) van Hooff & Blocken (2010)

Non-uniform unstructured grid Non-uniform unstructured grid


Different discretization methods:
Finite difference method (FDM)

Finite volume method (FVM)

Finite element method (FEM)

(Spectral element method, Boundary element method, …)


Different discretization methods:
Finite difference method (FDM):
• Discretization of the continuum space in points
• Main numerical variables are local values at grid points
• Most traditional and oldest method
• In practice only applicable to structured grids
Different discretization methods:
Finite volume method (FVM):
• Discretization of the continuum space in volumes (cells)
• Based on cell-averaged values
• Most widely applied in CFD
• Discretizes integral form of the equations as applied to the volumes - conceptual
simplicity/logic – conservative discretization automatically satisfied
• Very suitable (flexible) method for working with an arbitrary mesh (complex
geometries).

Structured grid Unstructured grid


Different discretization methods:
Finite element method (FEM):
• Originates from world of structural mechanics
• Discretization of the continuum space in elements (= volumes)
• Main numerical variables are local values at mesh points
• Discretizes integral form of the equations
• Very suitable (flexible) method for working with an arbitrary mesh (complex
geometries).

Structured grid Unstructured grid


Finite difference method (FDM)
First derivative of u(x) in point x is defined as:

→0
Finite difference method (FDM)
First derivative of u(x) in point x is defined as:

→0

Taylor series expansion of u(x + x) around u(x) is given by:

Can be re-written as:

Truncation error

Approximation to the first derivative of ux in x.


Finite difference method (FDM)
Limiting truncation error to first and dominant term yields:

The error in the approximation tends to zero like the first power of x and is therefore
called “first order” in x.
Finite difference method (FDM)
Application of this concept in 1D can yield different expressions:
First order forward diff.
(first order accuracy)
First order backward diff.
(first order accuracy)
Central difference
(second order accuracy)

(From Hirsch 2007)


Finite difference method (FDM)
Can also be done for other derivatives, based on more points and in 2D and 3D.

Excellent overview of the finite difference method (incl. finite volume method) can be
found in:
Hirsch, C. 2007. Numerical computation of internal & external flows. The fundamentals of
computational fluid dynamics. Second Edition. Elsevier.
Finite difference method (FDM)
Difference formulae generally can loose at least one order of accuracy (and sometimes
even two) on general non-uniform grids. Guidelines for non-uniform grids (Hirsch 2007):
• Smoothly varying grids with size variation between consecutive cells that is of
second order in the grid size.

Non-uniform unstructured grid


Finite difference method (FDM)
Difference formulae generally can loose at least one order of accuracy (and sometimes
even two) on general non-uniform grids. Guidelines for non-uniform grids (Hirsch 2007):
• Smoothly varying grids with size variation between consecutive cells that is of
second order in the grid size.
• Avoid discontinuities in grid size of adjacent cells.
• Use laws for grid size variation that are defined by analytical, continuous
functions of the associated coordinate.
• Give particular attention to grid smoothness (and density) in regions of strong
flow gradients.
Grid convergence, discretization error and Richardson extrapolation
- Systematically refining or coarsening the mesh (grid) by a constant factor (e.g., 2 or 2 )
- Goal is to obtain a grid-independent solution
3.5
grid-independent
3.0 solution
variable value

2.5
monotonic
2.0
convergence
1.5
non-monotonic
1.0 convergence

0.5
1 10 100 1000 10000 100000 1000000
number of control volumes
Grid convergence, discretization error and Richardson extrapolation
(Ferziger & Peric 1996)
Derivation will be made from the viewpoint of finite-difference analysis, but it can just as
well be applied for control-volume analysis.
Let:  be the exact solution of the differential or integral equations represented by 
h be the exact solution of the discretized equations (Lh) for a grid with reference
spacing h
 Φ Φ  0
0

The difference between both solutions is the discretisation error h:


Φ
Grid convergence, discretization error and Richardson extrapolation
 Φ Φ  0
0

For sufficiently fine grids, the truncation error (and hence also the discretization error) at
any point in the grid is proportional to the leading term in the Taylor series:

where  depends on the derivatives of the variable  at the given point (gradients in
the flow) but is independent of h
p is the order of the discretization scheme
H represents the higher order terms.
Grid convergence, discretization error and Richardson extrapolation

where  depends on the derivatives of the variable  at the given point (gradients in
the flow) but is independent of h
p is the order of the discretization scheme
H represents the higher order terms.
 Discretization error is small when grid spacing is small
 Discretization error is small when flow gradients are small
 Higher grid resolution in areas of large flow gradients

Structured grid
Grid convergence, discretization error and Richardson extrapolation
Consider three different grids with grid spacing: h, 2h, 4h, and solutions h , 2h and 4h in
a given point or cell:

The exponent p (order of the scheme) and the discretization error on grid h, h, can be
estimated by:

2 2 1
Grid convergence, discretization error and Richardson extrapolation

2 2 1
Estimate of exact solution is then given by “Richardson extrapolation”:

Φ 3.5
grid-independent
3.0 solution

variable value
2.5
monotonic
2.0
convergence
1.5
non-monotonic
1.0 convergence

0.5
1 10 100 1000 10000 100000 1000000
number of control volumes
Grid convergence, discretization error and Richardson extrapolation
Three important comments:
• If the refinement ratio) is different from 2, the factor 2 in the equations must be replaced
by that ratio.

2 2 1

• The exponent p as calculated is the correct order of the scheme. This means that it is
the rate at which the error is reduced when the grid is refined. It can differ from the
formal or theoretical order of the scheme (as defined by the leading term in the
truncation error).
• p can only be calculated when grid convergence is monotonic. Therefore, the grids
must be sufficiently fine.
Uniform reporting of grid-convergence studies (Roache, 1997)
Uniform reporting of grid-convergence studies (Roache, 1997)
Estimates by formulae on previous slides are approximate and do not constitute bounds
on the discretization error  Grid Convergence Indicator (GCI) to quantify the
discretization error in a CFD simulation:

Fs = safety factor
3 for studies with two grids
1.25 for “scrupulously performed grid convergence studies with three or more
grid solutions to determine the observed order of convergence p”.
Uniform reporting of grid-convergence studies (Roache, 1997)
Example: natural cross-ventilation of an isolated building model
Building & Environment Best Paper Award 2012
Uniform reporting of grid-convergence studies (Roache, 1997)
Example: natural cross-ventilation of an isolated building model

(a) Coarse grid A with 144,696 cells; (b) Middle grid B with 314,080 cells; (c) Fine grid C with 575,247 cells.
Uniform reporting of grid-convergence studies (Roache, 1997)
Example: natural cross-ventilation of an isolated building model

Grid convergence index


graphically presented
MODULE QUESTION
Considering the total time that a user of a CFD code spends on his/her simulation
and applying “best practice”, which statement is correct?
A) Grid generation is the most time-consuming part
B) Turbulence modeling is the most time-consuming part
C) Postprocessing is the most time-consuming part
In this module, we have learned about:
• Some basic aspects of the finite difference method, the control volume method
and the finite element method
• The importance of high-quality grid generation
• How discretization errors can be estimated
• How grid-convergence studies can be reported
In the next module, we will focus on:
• How the complexity of near-wall flow can be taken into account in CFD simulations
• The differences between wall functions and low-Reynolds number modeling
• The advantages and disadvantages of wall functions and low-Reynolds number
modeling

You might also like