Computational Fluid Dynamics
Lecture 8
Prof. Jiyuan Tu
Solution Errors--Causes
Solution error depends on:
Discretization error depends on:
Discretion error -- usually the dominant contribution
Equation solver error
Choice of computational domain
Implementation of boundary and initial conditions
Grid size (overall refinement)
Grid quality (aspect ratio, orthogonality)
Grid density (local refinement)
Discretisation formula (low/high order)
Equation solver is: (usually) a minor source of solution error
can be source of instability (or poor iterative convergence)
RMIT University
Sources of errors in CFD
Discretization error (DE)
Computer round-off error (ROE)
Errors due to physical modeling (EPM)
(Turbulence modeling)
Human errors inexperience
Wrong computational domain
Wrong Boundary Condition
Garbage in!
Bad numerical scheme
Garbage out!
Bad computational model
Mesh
RMIT University
Sources of errors in CFD
II
DE-Truncation error
x 2
i 1 i
x x o 2 x 2
i
First order
Truncation error
x 2T
in 1 in
o
2
t
t
i
2 x
Local error
Global error
Space The local and global discretization errors
Time
of finite difference method at the third
time step at a specified nodal point
RMIT University
Sources of errors in CFD
II
SP
7 digitsSingle precision :
ROEDigits
4444.6667
4444.666666
15 digitsDouble precision
A+C+B
4444.6666
A+C+B
Example
:
A simple arithmetic
operation performed
with a computer
in a single precision
using seven significant
digits
RMIT University
Sources of errors in CFD
III
As the mesh or time step size decreases,
the discretization error decreases !
but the round-off error increase!
No. of Computations
Accumulated ROE
EPMLaminar Flow
Turbulence Flow
Modeling
Major error
source in CFD
RMIT University
6
Solution Integrity
Why is predictive reliability important ?
Is the computer (human, hardware) infallible?
What should we expect:
solutions are accurate
& can be validated against reliable experiments
Testing Solution
Integrity
Set up physical experiment and measure key data
Compare with personal experience
We know what to expect (most of the time)
Compare with 'standard cases
Expensive, time-consuming
Equivalent to Validation
Rely on theoretical foundation
Equivalent to Verification
RMIT University
Verification & Validation (I)
(from Roache, 1999 Verification and Validation in Computational Science and Engineering)
Verification: (theoretical framework)
The process of determining if a computational simulation
represents the conceptual world
Provides evidence that the model is solved right
Examples of Verification errors:
Insufficient spatial discretization (i.e. not enough grid
points)
Inaccurate discretization scheme
Insufficient temporal discretization (i.e. not small enough
timesteps)
RMIT University
Verification & Validation (II)
Validation:(compare with standard cases)
The process of determining if a computational simulation
represents the real world
Provides evidence that the right model is solved
Examples of Validation errors:
Inappropriate boundary conditions
Inaccurate turbulence model
Comparison with unreliable/ inaccurate experimental
dataad
RMIT University
10
Computational Solution
CFD is implemented by two-stage process:
Discretisation Conversion of the governing partial
differential equations into a system of algebraic equations
Equation Solver iterative solution of the algebraic
equations to provide the approximate solutions
Overview of the Computational Solution Process
RMIT University
11
(Grid) Convergence
CFD produces an approximate solution
solution error = exact solution -- approximate solution
(Grid) Convergence
expect solution error => 0, as x, t => 0
refine grid until the solution no longer changes
Consistency+Stability => (Grid) Convergence
Iterative
convergence
RMIT University
12
Comments -- Convergence
CONSISTENCY + STABILITY => CONVERGENCE
(Lax Equivalence Theorem)
CFD solution obtained on a finite grid
No computer powerful enough to allow x, t => 0
Practical implication:seek grid-independent solution (grid
convergence)
i.e. refine the grid until solution no longer changes
use local refinement solution adaption
RMIT University
13
Consistency
Definition: As x, y, z, t ==> 0, the system of algebraic
equations should recover the governing partial differential
equation at each grid point
Comments: Test by expanding all nodal values of the
dependent variables about the control volume centre
Example: Mass conservation equation
RMIT University
14
Taylor Series Expansion about
point P
Eqn (1) ==>
Comments:
As x, y ==> 0 the original governing equation is
recovered
Scheme (1) is 0( x2, y2), i.e. halving the grid size,
reduces the truncation error by four
Expect solution error to reduce like truncation error
Counter--example: DuFort--Frankel
scheme
RMIT University
15
Finite Grid Solutions (1)
Comments:
Grid refinement may be restricted by memory size or CPU time
Obtain the most accurate solution with fixed NX, NY, NZ
Some grids can increase accuracy but increase the number of iterations to
convergence of the algebraic equation solution
Expect solution error to follow truncation error
Typical truncation error:
( x2/6)[ 3( u)/ x3] + ( y2/6)[ 3( v)/ y3]
Therefore refine grid where solution gradients large:
boundary layers, upwind stagnatn points, forward-facing corners
RMIT University
16
Finite Grid Solutions (2)
Is the grid fine enough?
refine grid until important parameter no longer variant
eg force against a wall
Parameter
Value
Number of elements
RMIT University
17
Equation Structure
Most industrial fluid flows involve significant motion
Momentum equations describe three major interactions
u k
t
x k
x k
x k
(1)
(convective) transport------------------ motion of fluid
diffusion--------------------- (turbulent) eddy diffusivity
source terms--------production of turbulent kinetic energy
Is solution accuracy sensitive to discretisation of specific
terms ? (YES)
RMIT University
18
Higher Order Interpolation(I)
Comments:
So far have interpolated e f p ,E i.e. depends on local values
Now interpolate
assuming u is positive
e f W , p ,E and
RMIT University
W f WW , W ,E
19
Higher Order Interpolation(II)
General three point interpolation:
e p xE E x p / x p x E
(1 ) p xW 2p W x p / xW x p
W
and equivalent formula for
Discretisation Scheme
1
0
3/4
2/3
Centered difference
3-pt upwind
QUICK (4 pt)
4-pt upwind
RMIT University
(14)
/x (e W )//
and
Order (T.E.)
2
2
2
3
20
Bounded Higher Order
Scheme
Numerical dispersion may appear as wiggles
Bounded second order scheme:
In (14) evaluate
~ ,1
max 0, min
p
~ ( )/( )
where
p
p
W
E
W
(15)
Bounded QUICK scheme:
choose (2 3~p )/(1 2~p )
3~ /(1 2~ )
p
0.75
for 5/6 ~p 1.0
for 0.5 ~ 0
p
(16)
otherwise
RMIT University
21
Comments
Above bounded schemes available in FLUENT
Bounded schemes more accurate but less robust than power
law scheme
For fast iterative convergence with higher accuracy, start from
converged power law solution
Bounding is effectively introducing very localised numerical
dissipation
Very large literature on bounded schemes (particularly if shock
waves expected)
Flux corrected transport
Total variation diminishing (TVD) schemes
Reference: CAJ Fletcher, Computational Techniques for
Fluid Dynamics, Vol. II, pp 165-171
RMIT University
22
Unstructured Grid
Discretization
Power-law (segregated eqns. only)
Face value obtained from solution to1D Conv-Diff equation
Second-order upwind (SOU)
Face values obtained through multi-dimensional reconstruction
QUICK scheme
(for quad./hex. cells and seg~ated eqns.)
Higher-order construction of face values from SOU and
interpolation in mesh direction
More accurate for structured meshes that are mainly
flow aligned
n
c0
RMIT University
c1
cf
23
Second Order Upwind (SOU)
Linear reconstruction
provides 2nd order accuracy on unstructured grids
upwind values obtained from linear, piecewise discontinuous
shape functions
limiting is used to suppress wiggles
RMIT University
24
Linear Reconstruction
Linear reconstruction provides:
better accuracy than stencil-based schemes
compatibility with arbitrary cell shapes (tetrahedrals,
triangles)
improved accuracy on skewed grids
Comments:
uses more
information than
stencil-based
scheme
example:
diffusion terms
RMIT University
25
Structured vs Unstructured
Accuracy:
Economy:
both can achieve 2nd 0rder accuracy for the convective terms
structured grids rely on truncation error reduction
unstructured grids rely on linear reconstruction
structured grids lead to fewer operations in the discretised equations
unstructured grids can cover a domain with fewer cells
Robustness:
reliable algorithms available for both types
solution adaption on unstructured grids is less likely to affect
robustness
limiters can be introduced for both to avoid wiggles
RMIT University
26
Systematic Procedure for
Solution Integrity -- Overview
Problem definition
turbulent or laminar flow; steady or transient ?
is the physical model, eg granular multiphase, inaccurate ?
Geometry and grid
is the imported CAD file correct ?
Boundary Conditions
is the upstream boundary too close to the body ?
Solution method
is a higher-order scheme required ?
RMIT University
27
Guidelines Problem
Definition
Define clearly what the problem is
What do you want to find out?
What are the important parameters you need to input?
What will be the defining characteristics of the flow
(eg turbulent heat transfer ?)
Look for computational efficiencies
Can you make any simplifications?
How much of the real domain do you need to model?
Can you run any simple cases first to test your model?
RMIT University
28
Guidelines Geometry
Any possibility of import? ACIS / IGES
Any simplifications?
Symmetry?
Periodic Boundaries?
Use top down approach to geometry creation
Consider dividing the domain up into smaller sections for
more control over the grid
Make use of journal files !
Parametric modelling
Easy transport of geometry specification files
RMIT University
29
Grid Quality
Grid aspect ratio:
AR = y/x
Comments:
Need to choose y small if rapid
solution change in the y direction
If AR < 0.2 or AR > 5,
Grid distortion:
Comments:
Orthogonality ( = 90 deg) desirable
Choose grid so that 45 deg < < 135 deg
Grid distortion causes
possible reduction in accuracy
maybe poor iterative convergence (or divergence)
loss of accuracy
reduced rate of iterative convergence
Area variation: over the computational domain causes reduced
rate of iterative convergence
RMIT University
30
Sudden Changes in Grid Size
Comments:
Could occur at block boundaries in multiblock procedure
Could occur at duct inlet to a plenum chamber
Example: Mass conservation equation
Comments:
T.E. contains diffusion terms (2nd derivs)--destabilising when r x > 1
Make sure grid changes slowly and smoothly
Discretisation of 2nd derivatives requires very smooth grid changes
RMIT University
31
Guidelines Boundary
Conditions
Does your selection of boundary conditions match the real
world conditions ?
Is it possible to limit the domain size by specifying the
boundary condition in more detail ?
eg k, epsilon change rapidly just downstream
of inlet value specification
eg reduce upstream pipe length, if specify inlet profile
Use the patch command to fill areas after initialization.
This is particularly useful for free surface problems.
Are the boundaries in the correct locations?
eg are far-field boundaries far enough away?
RMIT University
32
GuidelinesSolution Convergence
If the residuals are diverging:
Display the contours after initialization. Are the initial conditions
correct?
Check the models. Maybe start as laminar and switch to turbulent
later in the solution, for example.
If the residuals initially reduce & then are oscillatory:
If flow is assumed steady, rerun as a transient problem
Could a different type of boundary condition be more stable? (i.e.
outflow instead of pressure boundary?)
Check for which equation residual is largest
RMIT University
33
Guidelines Solution Accuracy
Higher order differencing schemes are required for
accuracy
Is the problem well-posed ?
Run the solution first with default schemes, then switch to higher
order once converged
Do the boundary conditions suit the problem ?
Incorrect specification of nearby boundary conditions
Adequate grid resolution ?
Distorted volumes solution adaption or revise the grid
High gradients & coarse grid solution adaption
RMIT University
34
Conclusions
Assess CFD solution integrity
physical experiments
personal experience
theoretical foundation
Expect computational solution to converge to the exact
solution as x, y, z, t ==> 0
(seek 'grid - independent' solution)
Finite grid solutions
Avoid --- sudden changes in grid size
--- large c.v. aspect ratios
--- grid distortion
--- large c.v. area variation over domain
RMIT University
35