You are on page 1of 16

NGM_JF006_1: Computational Fluid Dynamics Széchenyi University

Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

11. ERRORS AND UNCERTAINTY IN CFD


In order to develop trust and confidence in CFD simulations, one needs to
understand, evaluate and control the errors and uncertainty associated with
CFD simulations. The definitions of the terms error and uncertainty, based on
the recently adopted AIAA guidelines (American Institute of Aeronautics and
Astronautics, 1998) on CFD are:

Error: a recognizable deficiency in a CFD model that is


NOT CAUSED BY LACK OF KNOWLEDGE.

Causes of errors are:

- Numerical errors:
- roundoff errors
- iterative convergence errors add up to numerical error 
- discretization errors

- Coding errors:
- mistakes or bugs in the code

- User errors:
- incorrect use of code – human error

Uncertainty: a potential deficiency in a CFD model that is:


CAUSED BY LACK OF KNOWLEDGE

Causes of uncertainty are:

- Input uncertainty:
- discrepancies between design, real and/or CFD geometries
- incomplete info on boundary conditions
- incomplete info on material (fluid) properties

- Physical model uncertainty:


- discrepancies between real flow and CFD due to the
negligence of:
- turbulence
- chemical reactions
- incompressibility
- unsteadiness, etc.

1
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

Control and elimination of coding and user errors is part of software engineering
and so for the purposes of this course, we will assume that the CFD modeling
(code) is already free of coding and user errors, i.e. the only aspects to be
controlled & evaluated are those of the numerical error and uncertainty.

11.1. Numerical errors: Stability Analysis

- The aim of Stability Analysis is:


- to quantify the numerical parameters (usually t and x or their
combination) which would lead to a stable, convergent simulation.

- Outcome of Stability Analysis:


- a concrete number representing some form of the maximum allowable
time step – such as the diffusion number or the CFL number (to be
defined later)

- Basic idea of Stability Analysis:


- to determine that how numerical errors propagate from one marching
step to another

- numerical error amplified  simulation unstable


- numerical error does not grow  simulation stable

The two most popular methods for analysing the stability of a numerical method
are:

1) Discrete Perturbation Stability Analysis

2) von Neumann (or Fourier) Stability Analysis

These will be reviewed in the next two sections.

11.2. Discrete Perturbation Stability Analysis

Idea:
In this method, a disturbance is introduced at a point (or cell), and its
effect on the neighbouring points (or cells) is investigated. If the
disturbance

- dies out  numerical method is stable


- grows  numerical technique is unstable

2
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

Example: 1D unsteady heat diffusion:

u  2u
 2
t x
Employ Forward Time Central Space (FTSC) discretisation and explicit
formulation:

uin1  uin uin1  2uin  uin1



t (x) 2

Introduce disturbance (numerical error) at node “i” and time level “n” :

uin1  (uin   ) uin1  2(uin   )  uin1



t (x) 2

Assume that u in  0 and trace the propagation of  to node “i” at time level
“n+1” :


  t   
uin1   1  2    2 

  x  

d ….. diffusion number


(for this particular model equation)

Since we have set u in  0 , we can monitor the propagation of  to time


level “n+1” by examining:
Note that since u in  0 ,  would:
uin 1
1 - completely die out if uin1  0

- not grow if uin1  
- grow if uin1  

The above criterion is satisfied only when

d 1 for the “n+1” time level

3
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

This is the basic idea behind the Discrete Perturbation Stability Analysis
and the method can be extended to more points (i+1, i+2, etc.) and more
time levels (n+1, n+2, etc.). These might yield more strict limitations for d,
such as

2
d for the “n+2” time level
3
Eventually, at m>>n (i.e. after a large number of time steps, close to
ultimate convergence) we get

Stability requirement for the diffusion


1
d umber for the explicit solution of the
2 1D heat diffusion eq.

11.3. Von Neumann stability analysis

(Invented in the 1940’s at Los Alamos, declassified after WW2. Only good for
linear equations!!)

Idea:
The solution of the numerical error,  , of the discretised equation (a finite
difference equation in the case below) is expanded in Fourier series. From
this, the amplification factor can be expressed, which decay or growth will
indicate whether the numerical algorithm is stable or not.

Example: 1D unsteady heat diffusion again with Forward Time Central Space
(FTSC) discretization and explicit formulation:

uin1  uin uin1  2uin  uin1



t (x) 2

The distribution of the numerical error will look something like this
[n122]:

4
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

We can express  n at any time level as:

 n ( x)   Am e ik m x

m
i.e. it is a superposition of waves of different frequency and amplitude
with:

ei( kmx )  cos(km x)  i sin(km x)

where
m is the number of harmonics considered for the Fourier series
km is the wave number

 2 
km   m with m=1,2,3, …..[n123]:
 L 
 2  N
km     for N gridpoints over L
 L  2

Then, the amplification factor can be expressed as (see Anderson pp. 160
or Hoffmann pp. 124):

4    t k m x
G  1 sin 2
x 2 2

The requirement of not amplifying the error between two time steps can
be mathematically expressed as:

 in1 at 4    t 2 k m x
 e  G  1  sin 1
 in x 2 2

where “a” is a constant, depending on “m”.

And the above requirement is met when


 t  1 Stability requirement for the diffusion
 d  
2 
 x   2
number for the explicit solution of the
1D heat diffusion eq.

5
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

i.e. exactly the same criterion as in the Discrete Perturbation Stability


Analysis.

11.4. Multidimensional considerations

It is easier to extend the von Neumann method to 2D and 3D. Repeating the
same procedure for a 2D diffusion problem

u   2u  2u 
   2  2 
t  x y 
would yield
 1 1  1
t   2

 x  y   2
2

or, in terms of the diffusion number:


1
dx  dy 
2
i.e. for x = y the condition becomes twice as strict, and this trend increases
with adding the 3rd dimension:

d1D  0.50
stability criteria for
d 2 D  0.25 diffusion number d
in multi-dimensions
d 3 D  0.16 6

11.5. The Courant-Friedrich-Loewy (CFL) number

When the above analysis is applied to hyperbolic fluid flows (Euler equations,
and partially the N-S equations), instead of the diffusion number d, the so-called
CFL number (Courant-Friedrich-Loewy number) will become the driving
parameter for stability.

6
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

For example, for:

u u
c 0 (wave equation, hyperbolic PDE)
t x
Employ FTCS/explicit formulation (Forward Time Central Space)

n 1 uin1  uin1 t uin1  uin1


u  c
x
i
2 2
t
CFL number (1928): CFL  c
x

Then, the stability criterion becomes

CFL ≤ 1.0

And again for multi-dimensions it will become:

CFL1D ≤ 1.0
stability criteria for
CFL2D ≤ 0.50 the CFL number
for explicit Finite Difference scheme of the wave equation
CFL3D ≤ 0.33

NOTE:

- The above stability criteria are for EXPLICIT SCHEMES ONLY !!

- IMPLICIT SCHEMES ARE UNCONDITIONALLY STABLE , i.e. any


CFL can be applied to them !!!

7
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

11.6. Stability vs. Accuracy

Anderson argues that although employing very small time steps can improve
STABILITY, it can harm ACCURACY. He uses the following explanation:

[n124]:

Explanation:

- Information from one point to another can propagate only along lines of
characteristics.

- At point A, we can draw information from i-1 and i+1, since the
characteristics at point A go through i-1 and i+1 nodes.

8
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

- If we apply too small time step tb – represented by point B, - then we


cannot draw information from points i-1 and i+1 because they lie outside
of the characteristics running from point B.

- However, in the numerical algorithm (CFD code) we can force the method
to still draw information from i-1 and i+1 (represented by the dashed lines)
which

INTRODUCES INACCURACIES IN PREDICTING THE VALUES AT


POINT B

- if tb << t(CFL=1.0), than this inaccuracy can become very significant

Therefore:

While for stability reasons, one has to choose a CFL number below the
appropriate stability criterion, for accuracy reasons we should stay as close as
possible to this upper limit.

11.7. Local vs. global time stepping

The CFL number for practical fluid flows can be expressed as:

u  a max t
CFL 
x

with: u: local velocity in cell (from eigenvalue analysis)


a: local speed of sound
(u+a): right running wave speed

To satisfy stability criteria, one might set a constant CFL number for every cell.
However, since both (u, a, x) change over the computational domain, clearly,
each cell will have a different t, which we call “local time step”:

x
t LOCAL  CFL GLOBAL
u  a max
This really means that each cell converges at a different – fastest possible – rate.

9
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

So, instead of defining a “global time step” valid for all cells, it is much more
convenient for steady state solvers to define a “global CFL number”, which
ensures that the stability criteria are met in every cell and that overall
convergence is maximized by “local time stepping”.

Note that “local time stepping” is only applicable to steady-state solvers where
time-accuracy is not important. For an unsteady solver, the same “real time
step” has to be applied for each cell.

11.8. Evaluation of convergence

11.8.1. Evaluation of iterations convergence: Residuals

By separating the time-derivative in a PDE and discretising the equation, one


can identify the RHS (Right Hand Side) of the resulting expression as the
RESIDUAL:

u u
c 0
t x
u u
 c
t x
n 1 uin1  uin
u  u  ct
n
 Rin 1
x
i i

RESIDUAL

In a steady-state solution, the RESIDUAL should converge to zero in each and


every cell. For monitoring the convergence of a simulation, the RESIDUALs are
usually summed over the entire domain and normalized as:

N
R n 1
  Rin1 Note that the absolute value
DOMAIN ensures that (+) and (-) values do
i 1
not accidentally cancel.

n 1
R n1
R NORM  Where k0 = (1~10).
R k0

10
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

Very often, k0 is chosen to be 1, so that the residual conveniently starts from 1.0,
as well as it is expressed in term of the logarithm of the RESIDUAL ( log R NORM
n 1
)
what is plotted for visualizing convenience as: [n125]
Note that log 1 = 0, therefore the
+1 graph starts at 0.
iterations
0
-1
-2

-3
-4
-5
log R

Notes:
- Make sure that you know in a commercial CFD code that how the
RESIDUAL is monitored, i.e. in normalized or absolute values.

- If the RESIDUAL is not normalised, make sure that the simulation


does converge by the desired orders of magnitude, i.e. at least 5-7 orders
of magnitude for steady and 3-5 orders of magnitude for unsteady
calculations between two real time steps.

11.8.2. Evaluation of grid and time step size convergence

Significant discretisation errors can accumulate from the spatial and temporal
derivatives in the numerical solution of PDE’s. These arise as a result of the
truncation error in the Taylor series and can be reduced by refining the mesh
size and the real time-step size (the latter one is important only for time-
accurate, i.e. unsteady simulations).

The typical strategy is to monitor the target quantities at 2 or 3 successive levels


of mesh/time step refinement.

11
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

Guidelines for mesh refinement were already provided in Sec. 2.6.10 but they
can be summarized as:

x COARSE  select this as default (a reasonable grid spacing)


x COARSE
x MEDIUM 
k
x MEDIUM x COARSE
x FINE  
k k2

with k=2

Guidelines for time-step size refinement studies can be summarized as:

t1  select this as default (a reasonable grid spacing)


t
t 2  1
k
t t
t 3  2  21
k k
with k = (5~10)

- The target quantities monitored during these tests should involve both local
(pressure distribution, etc. ) and integrated parameters (lift, drag, etc.)

- The refinement shall be done until the residual of the target quantities drops
below a certain threshold, which definition is really up to the investigator.

[n126]

STEADY CALCULATIONS UNSTEADY CALCULATIONS

Note:
- Experience shows that the finer the mesh, the smaller t and CFL needs
to be employed!!

12
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

11.9. Consistency, Boundedness and Transportiveness

These three properties can affect the stability and accuracy of a simulation
significantly.

11.9.1. Consistency (also called Conservativeness)

Definition:

“Consistency means that fluxes through a common face are conserved, i.e. that
they are expressed in a consistent manner.”

Example: [n127]

Note:
- This does not mean that quadratic extrapolation is bad, but rather that
it needs to be designed in a consistent manner.

13
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

Lesson:

Inconsistency can lead to inequalities between the INFLOW and OUTFLOW


boundaries, i.e. it can have an overall effect on the computational domain
(and not just a local, cell-based one).

11.9.2. Boundedness

The boundedness criterion is important for convergence. It states that:

“In the absence of sources, the internal nodal values of property  should be
bounded by its boundary values.”

Example [n128]:

for inside

This sets guidelines on how to set up the initial conditions as well as on selecting
the discretisation scheme, i.e. it is wise to select initial conditions INSIDE the
boundary values of INFLOW and OUTFLOW.

For the discretisation scheme, the essential requirement for boundedness is that:

“All coefficients of the discretised equations should have the same sign (usually
positive).”

If the discretisation scheme does not satisfy the boundedness criterion, it is


possible that solution will not converge or if it does, it will exhibit “wiggles”.
When boundedness is satisfied, the matrix of coefficients are diagonally
dominant.

14
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

11.9.3. Transportiveness

Definition:

Transportiveness is the ability of a scheme to identify that in which direction


shall the cells influence each other.
CELL TO BE CALCULATED

Example [n129]: CELLS USED FOR CALCULATION

CENTRAL DIFFERENCING UPWINDING


(1st order backward or forward difference)

BAD FOR SHOCKWAVE RESOLUTION GOOD FOR SHOCK WAVE RESOLUTION

Transportiveness is strongly linked to the Peclet number (Pe) (See Versteeg on


more details on this).

11.10. Verification vs. Validation

According to AIAA (American Institute for Aeronautics and Astronautics)


definitions:

VERIFICATION: means verifying that “we solve the equations right”, i.e.
the goal is to quantify the errors of the numerical
method. This includes:

- grid dependence tests


- time step dependence tests

VALIDATION: means verifying that “we solve the equations right”, i.e.
the goal is to quantify uncertainty. This includes:

- assessment of input uncertainty


- comparison to experiment

15
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering

Every CFD paper MUST contain sections on Verification and Validation.


Detailed guidelines on how to present a CFD work in a technical paper have
been provided in the Project Term handouts and can be found in Versteeg pp.
300-302.

11.10. A note on the best methods for simulating compressible flows

In the previous review, we have pointed out that for compressible flows with
shock waves, the following methods are the most advantageous:

 Governing equations:
- Reynolds-Averaged Navier-Stokes (RANS) for attached turbulent
flows (boundary layers)
- Favre-Averaged Navier-Stokes (FANS) for free turbulent flows
(jets, mixing layers, wakes)

 Conservative form of governing equations:


- more stable solution of problems with shocks
- correct shock location
- correct shock speed
- no “wiggles” around shocks

 Finite Volume Method:


- inherently suited to deal with discontinuities inside cells (Control
Volumes)
- no need for grid transformation
- suitable for both structured and unstructured meshes
- can be coded in both explicit (robust) and implicit (fast) forms

 Fine mesh at shocks:


- adaptive grid methods

16

You might also like