Professional Documents
Culture Documents
- 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
- Input uncertainty:
- discrepancies between design, real and/or CFD geometries
- incomplete info on boundary conditions
- incomplete info on material (fluid) properties
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.
The two most popular methods for analysing the stability of a numerical method
are:
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
2
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering
u 2u
2
t x
Employ Forward Time Central Space (FTSC) discretisation and explicit
formulation:
Introduce disturbance (numerical error) at node “i” and time level “n” :
Assume that u in 0 and trace the propagation of to node “i” at time level
“n+1” :
t
uin1 1 2 2
x
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
(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:
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
n ( x) Am e ik m x
m
i.e. it is a superposition of waves of different frequency and amplitude
with:
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:
in1 at 4 t 2 k m x
e G 1 sin 1
in x 2 2
5
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering
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
d1D 0.50
stability criteria for
d 2 D 0.25 diffusion number d
in multi-dimensions
d 3 D 0.16 6
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
u u
c 0 (wave equation, hyperbolic PDE)
t x
Employ FTCS/explicit formulation (Forward Time Central Space)
CFL ≤ 1.0
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:
7
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering
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
- 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
- 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.
The CFL number for practical fluid flows can be expressed as:
u a max t
CFL
x
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.
u u
c 0
t x
u u
c
t x
n 1 uin1 uin
u u ct
n
Rin 1
x
i i
RESIDUAL
N
R n 1
Rin1 Note that the absolute value
DOMAIN ensures that (+) and (-) values do
i 1
not accidentally cancel.
n 1
R n1
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.
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).
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:
with k=2
- 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]
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
These three properties can affect the stability and accuracy of a simulation
significantly.
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:
11.9.2. Boundedness
“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).”
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:
VERIFICATION: means verifying that “we solve the equations right”, i.e.
the goal is to quantify the errors of the numerical
method. This includes:
VALIDATION: means verifying that “we solve the equations right”, i.e.
the goal is to quantify uncertainty. This includes:
15
NGM_JF006_1: Computational Fluid Dynamics Széchenyi University
Instructor: D. Feszty, T. Jakubík Audi Department of Vehicle Engineering
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)
16