Quality Assurance of CFD Calculations
Thorsten Hansen
ANSYS Continental Europe
2008 ANSYS, Inc. All rights reserved. 1 ANSYS, Inc. Proprietary
Contents
Definitions
Error types:
Numerical errors
Model errors
System errors
User errors
Error estimation techniques
and procedures
Examples
Best Practice Guidelines
Summary and outlook
2008 ANSYS, Inc. All rights reserved. 2 ANSYS, Inc. Proprietary
Error Hierarchy
Round-off errors
Iteration errors
Difference between converged solution and solution
at iteration n
Solution errors
Difference between converged solution on current
grid and exact solution of model equations
Exact solution Solution on infinitely fine grid
Model errors
Difference between exact solution of model
equations and reality (data or analytic solution)
2008 ANSYS, Inc. All rights reserved. 3 ANSYS, Inc. Proprietary
Round-Off Error
Inaccuracies caused by machine round-off:
High grid aspect ratios
Large differences in length scales
Large variable range
Procedure:
Routine check of above criteria
Define target variables
Calculate with:
Single-precision
Double-precision
Compare target variables
2008 ANSYS, Inc. All rights reserved. 4 ANSYS, Inc. Proprietary
Iteration Error Example
Siemens PG
Maximum residuals
Check for monotonic convergence
2008 ANSYS, Inc. All rights reserved. 5 ANSYS, Inc. Proprietary
Iteration Error Example
Iteration errors:
Relative error: Difference between
Isentropic Efficiency
0.18% 0.01% converged solution
and solution at
iteration n
Convergence criterion
Rmax=10-2 Rmax=10-3 Rmax=10-4
Iteration 35 Iteration 59 Iteration 132
Iteration Number
2008 ANSYS, Inc. All rights reserved. 6 ANSYS, Inc. Proprietary
Iteration Error Example
2D Compressor cascade
2nd order
Rmax = 1 10-3 Rmax = 1 10-4 Rmax = 1 10-5
2008 ANSYS, Inc. All rights reserved. 7 ANSYS, Inc. Proprietary
Iteration Error Example
Max. Res. = 1e-3
Max. Res. = 1e-4
Max. Res. = 1e-5
Isentropic Mach Number
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Xs / L
2008 ANSYS, Inc. All rights reserved. 8 ANSYS, Inc. Proprietary
Residual Definition
Exact difference equation
aP f P = anb f nb + bP
nb
Initial guess or iterated
solution residual
aP f Pn = anb f nbn + bP RP
nb
RP = anb f nbn + bP aP f Pn
nb
2008 ANSYS, Inc. All rights reserved. 9 ANSYS, Inc. Proprietary
Normalization & Norms
Normalization {R} = max ( R ) i i =1KN
Dimensionless quantities
N
1
ai f i a f + bP
n n
nb nb
R =
N
R
i =1
i
2
Ri = nb
a p f max f min K
ai f i n anb f nbn + bP Norms (over all grid points)
Maximum value
R%i = nb
Root-mean-square (rms)
m& in f in
....
K Caution: Different CFD
software different norms
2008 ANSYS, Inc. All rights reserved. 10 ANSYS, Inc. Proprietary
Iteration Error - Best Practice
Define target variables:
Head rise
Efficiency
Mass flow rate
Select convergence criterion (e.g. residual norm)
Plot target variables as a function of convergence criterion
Set convergence criterion such that value of target variable
becomes independent of convergence criterion
Check for monotonic convergence
Check convergence of global balances
2008 ANSYS, Inc. All rights reserved. 11 ANSYS, Inc. Proprietary
Discretisation Error
All discrete methods have solution errors:
Finite volume methods
Finite element methods
Finite difference methods
Spectral methods, ...
Difference between solution on a given grid and exact
solution on an infinitely fine grid
eh = f h f ex
2008 ANSYS, Inc. All rights reserved. 12 ANSYS, Inc. Proprietary
Discretisation Error
Exact solution not available Discretisation error
estimation
Methods:
Comparison of results on different grids
Comparison of results with different discretization
schemes
Theory:
Roache, P. J., Verification and Validation in
Computational Science and Engineering, Hermosa
Publishers, 1998
2008 ANSYS, Inc. All rights reserved. 13 ANSYS, Inc. Proprietary
Discretisation Error Estimation
Taylor series
Discretisation scheme with 1st order truncation error:
f h2 2 f
f h = f ex + h + 2
+K
x ex 2 x ex
2
f h = f ex + hF + h G + K
2
f 2 h = f ex + 2hF + ( 2h ) G + K
F & G:
Derivatives of f
Evaluated at ex independent of grid width h
2008 ANSYS, Inc. All rights reserved. 14 ANSYS, Inc. Proprietary
Discretisation Error Estimation
Discretisation error: eh = f h f ex
f h f ex = hF + h 2G
f h f ex hF
Difference between coarse f 2 h f h = hF + 3h 2G
& fine grid solution f 2 h f h hF
Approximation of
discretisation error:
eh f 2 h f h
eh f 2 h f h
2008 ANSYS, Inc. All rights reserved. 15 ANSYS, Inc. Proprietary
Discretisation Error Estimation
General formula (see
f1 f 2
Roache,1998)
e2 = p
f1 Coarse-grid solution
r 1
f2 Fine-grid solution
r Refinement factor
p Truncation error order
Truncation error order
Inner nodes & boundary
conditions
Theory vs. actual
implementation
2008 ANSYS, Inc. All rights reserved. 16 ANSYS, Inc. Proprietary
Observations
First-order schemes: f h = f ex + hF1 + h 2G1 + K
Solution error halved when h
is halved f h = f ex + h 2G2 + h 3 K 2 + K
Second-order schemes:
Solution error reduced by
factor 4 when h is halved
All consistent schemes:
Same solution for h 0
Error indicator: Differences
between discretization
schemes
Caution:
Taylor series only valid for
sufficiently small h
2008 ANSYS, Inc. All rights reserved. 17 ANSYS, Inc. Proprietary
Discretisation Error Estimation
Impinging jet flow with heat
transfer
2-D, axisymmetric
Grids:
50 50 800 800
ANSYS CFX
SST turbulence model
Discretization schemes:
Upwind differencing
Upwind differencing + HR Target quantities:
correction Heat transfer
Maximum Nusselt number
2008 ANSYS, Inc. All rights reserved. 18 ANSYS, Inc. Proprietary
Discretisation Error Estimation
UPW UPW+HR
200
190
180
Nu_max
170
160
150
0 0.005 0.01 0.015 0.02
1/N
2008 ANSYS, Inc. All rights reserved. 19 ANSYS, Inc. Proprietary
Discretisation Error Estimation
Nu Error
Grid
Method 1 Method 2 Method 1 Method 2 Estim.
50 50 190.175 176.981 22.1 % 13.6 %
100 100 170.230 163.793 9.3 % 5.1 % 8.1 %
200 200 162.664 159.761 4.4 % 2.6 % 2.5 %
400 400 159.646 158.296 2.3 % 1.4 % 0.9 %
800 800 157.808 157.168 1.1% 0.7 % 0.7 %
155.751 155.777
2008 ANSYS, Inc. All rights reserved. 20 ANSYS, Inc. Proprietary
Discretisation Error Estimation
Advantages:
Can be applied to local and integral quantities
Error estimator can be used for extrapolation
Disadvantages:
Difficult to apply to 3-D problems: 100,000 800,000
6,400,000
Requires grids in asymptotic range
Requires truncation error order of discretization scheme
Practical alternative:
Compare solutions obtained with different discretization
schemes
2008 ANSYS, Inc. All rights reserved. 21 ANSYS, Inc. Proprietary
Discretisation Error Estimation
UPW UPW+HR
200
190
180
Nu_max
170
160
150
0 0.005 0.01 0.015 0.02
1/N
2008 ANSYS, Inc. All rights reserved. 22 ANSYS, Inc. Proprietary
Discretisation Error Estimation
Nu Error
Grid
Method 1 Method 2 Method 1 Method 2 Diff.
50 50 190.175 176.981 22.1 % 13.6 % 8.5 %
100 100 170.230 163.793 9.3 % 5.1 % 4.1 %
200 200 162.664 159.761 4.4 % 2.6 % 1.9 %
400 400 159.646 158.296 2.3 % 1.4 % 0.9 %
800 800 157.808 157.168 1.1% 0.7 % 0.4 %
155.751 155.777
2008 ANSYS, Inc. All rights reserved. 23 ANSYS, Inc. Proprietary
Discretisation Error Example
2D Compressor cascade
Maximum residual = 1 10-4
Upwind High Resolution Blend Factor = 1
2008 ANSYS, Inc. All rights reserved. 24 ANSYS, Inc. Proprietary
Discretisation Error Example
Upwind
High Resolution
Blend Factor = 1
Isentropic Mach Number
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Xs / L
2008 ANSYS, Inc. All rights reserved. 25 ANSYS, Inc. Proprietary
Discretisation Error Example
2D Compressor cascade
Maximum Residual = 1 10-4
2nd order
Grid 1 Grid 2 Grid 3
2008 ANSYS, Inc. All rights reserved. 26 ANSYS, Inc. Proprietary
Solution Error, UDS+NAC
Grid 1
Grid 2
Grid 3
Isentropic Ma Number
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Xs / L
2008 ANSYS, Inc. All rights reserved. 27 ANSYS, Inc. Proprietary
Discretisation Error Example
Isentropic efficiency:
Grid Normalized tt
Grid 1 99.50 %
Grid 2 100 %
Grid 3 99.98 %
Computational
Grid 1 Grid 2 Grid 3
Grid
Scheme Normalized tt
Number of
220,000 840,000 3,300,000 UDS 93.67 %
elements
HR 100 %
Minimum grid
22 23 25
angle UDS+NAC 100.16 %
2008 ANSYS, Inc. All rights reserved. 28 ANSYS, Inc. Proprietary
Model Errors
Inadequacies of (empirical)
mathematical models:
Base equations (Euler vs.
RANS, steady-state vs.
unsteady-state, )
Turbulence models
Combustion models
Multi-phase flow models
Discrepancies between data and
calculations remain, even after all
numerical errors have become
insignificant!
2008 ANSYS, Inc. All rights reserved. 29 ANSYS, Inc. Proprietary
Impinging Jet Heat Transfer
2008 ANSYS, Inc. All rights reserved. 30 ANSYS, Inc. Proprietary
Model Error: Impinging Jet
Model error: k-
2008 ANSYS, Inc. All rights reserved. 31 ANSYS, Inc. Proprietary
Model Error: Impinging Jet
250
Data
50 x 50
200 100 x 100
200 x 200
400 x 400
150 800 x 800
Nu, -
100
50
0
0,00 0,02 0,04 0,06 0,08 0,10 0,12 0,14
r, m
2008 ANSYS, Inc. All rights reserved. 32 ANSYS, Inc. Proprietary
Model Errors Example
Tu Contour
Transition
Transition
Transition
Model error turbulence
Transition @ Windturbine airfoil
2008 ANSYS, Inc. All rights reserved. 33 ANSYS, Inc. Proprietary
Systematic Errors
Discrepancies remain, even if
numerical and model errors are
insignificant
Systematic errors:
Approximations of:
Geometry
Component vs. machine
Boundary conditions
(Turbulence, profiles, )
Unsteady-state flow behavior
Fluid and material properties,
Try to understand application
and physics
Document and defend
assumptions !
Uncertainty analysis
2008 ANSYS, Inc. All rights reserved. 34 ANSYS, Inc. Proprietary
Systematic Error Example
1
0.9
0.8
0.7
Span Height
0.6
0.5
0.4
0.3 Plane X0
Plane X1
0.2 Plane X2
Plane X0 EXP.
0.1 Plane X1 EXP.
Plane X2 EXP.
0
Absolute Swirl Angle, degree
2008 ANSYS, Inc. All rights reserved. 35 ANSYS, Inc. Proprietary
Uncertainties
Uncertainties:
Systematic variation of
uncertain parameters
Response surfaces
Quality Assurance
techniques applicable
Design of Experiments
(DOE)
Design for Six Sigma
ANSYS DesignXplorer
Probabilistic Safety
Analysis
2008 ANSYS, Inc. All rights reserved. 36 ANSYS, Inc. Proprietary
Best Practice Guidelines
Try to understand application and physics of the application
Document and defend assumptions:
Geometry
Boundary conditions
Flow regime (laminar, turbulent, steady-state, unsteady-
state, )
Model selection (turbulence, )
Sources of systematic error
Approximations
Data
Accuracy expectations vs. assumptions?
Document as you go!
2008 ANSYS, Inc. All rights reserved. 37 ANSYS, Inc. Proprietary
Best Practice Guidelines
Grid generation:
Scalable grids
Grid angles > 20 and < 160
(accuracy, convergence)
Aspect ratios < 100 on 32-bit
computers
Expansion ratios < 1.5 2
Capture physics based on
experience (shear layers,
shocks, leading, trailing
edges, )
Grid refinement:
Manual, based on error
estimate
Automatic adaptive based on
error sensor
2008 ANSYS, Inc. All rights reserved. 38 ANSYS, Inc. Proprietary
Best Practice Guidelines
Effects of low mesh quality:
Discretization errors
Round-off errors
Poor CFD results
Convergence difficulties
Non-reliable CFD results
Non-scalable meshes
Inconsistent CFD results on
mesh refinement
Goal:
Scalable grid quality (consistent grid quality on
mesh refinement)
2008 ANSYS, Inc. All rights reserved. 39 ANSYS, Inc. Proprietary
Best Practice Guidelines
Avoid sudden change in mesh density
2008 ANSYS, Inc. All rights reserved. 40 ANSYS, Inc. Proprietary
Assessment of Element Types
Hexahedrons Tetrahedrons
Best element type RAM & CPU time per
node
Efficiency per node
1.5 hexahedrons
CPU time per node
Bad for shear layer or tip
Excellent for shear layers clearance resolution
No fully automatic grid (mesh quality)
generation Best element for
man-time effort larger automatic grid generation
than for unstructured and complex geometries
meshes
2008 ANSYS, Inc. All rights reserved. 41 ANSYS, Inc. Proprietary
Capture Flow Physics
Grid must be able to Boundary layers:
capture important Velocity and
physics: temperature
Boundary layers 10-15 elements
Heat transfer Expansion ratios:
Wakes, shock 1.2 1.3
Flow gradients y+ 1 for heat
transfer and transition
modeling
2008 ANSYS, Inc. All rights reserved. 42 ANSYS, Inc. Proprietary
Capture Flow Physics
Example: Velocity profiles at airfoil
Bad Good
2008 ANSYS, Inc. All rights reserved. 43 ANSYS, Inc. Proprietary
Best Practice Guidelines
Iteration error:
Apply procedure outlined above
Discretisation error:
1st order schemes require very, very fine grids for most
applications
Start with 1st order scheme Switch to 2nd order scheme
Compare target variables for both schemes
Error estimation at little extra cost
Uncertainties:
Systematic variation of uncertain parameters (turbulence
boundary conditions, )
Determine influence on target variables
Future Statistical techniques: D46
2008 ANSYS, Inc. All rights reserved. 44 ANSYS, Inc. Proprietary
Summary
Quality assurance essential for
industrial use of CFD methods
Distinguish between numerical, model
and other errors !
Quantify and reduce numerical errors by
deterministic and rational procedures
Quantify model and systematic errors by
validation
Resources:
ERCOFTAC SIG: Quantification of
Uncertainty in CFD
ANSYS CFX Best Practice Guidelines
2008 ANSYS, Inc. All rights reserved. 45 ANSYS, Inc. Proprietary
2008 ANSYS, Inc. All rights reserved. 46 ANSYS, Inc. Proprietary