Trust and Quality in CFD

download Trust and Quality in CFD

of 6

Transcript of Trust and Quality in CFD

  • 8/16/2019 Trust and Quality in CFD

    1/6

    School of Mechanical Aerospace and Civil Engineering

    MSc/4th Year Advanced CFD

    Trust and Quality in CFD

    T. J. Craft

    George Begg Building, C41

    Reading:J. Ferziger, M. Peric,   Computational Methods for Fluid Dynamics H.K. Versteeg, W. Malalasekara,   An Introduction to Computa- tional Fluid Dynamics: The Finite Volume Method S.V. Patankar,  Numerical Heat Transfer and Fluid Flow No te s: B la ck bo ard a nd CF D/T M we b se rve r:http://cfd.mace.manchester.ac.uk/tmcfd

    - People - T. Craft - Online Teaching Material

    Trust and Quality in CFD 2011/12 1 / 21

    Introduction

    ◮  A number of CFD modelling and solution methods have been studied.

    ◮  All involve some level of approximation.

    ◮  Here we aim to collect together main areas where ‘errors’ arise in CFDsolutions, and how these can be avoided, or their effects minimized.

    ◮  ‘Error’ in this context is rather general – it mainly refers to differences wemight get between a set of CFD results and ‘real-life’ observations or

    measurements.

    U    Ω

    0 100 200 300Theta

    -8

    -6

    -4

    -2

    0

    2

          C    p

    Omega=0

    Omega=2

    Omega=1

    Cp Around Cylinder (k-e, Re=140000)

    Trust and Quality in CFD 2011/12 2 / 21

    ◮  Trust and Quality issues in CFD become important as it is widely used indesign and analysis, and its quantitative results used in criticalapplications.

    ◮  It can be relatively easy to get results out of a CFD code, but how do weensure they make sense and can be trusted?

    ◮  What steps should be taken to check for accuracy and reliability of CFDresults?

    ◮  In order to answer these, we need to have a good understanding of whereerrors and inaccuracies can arise in the modelling and solution process.

    Trust and Quality in CFD 2011/12 3 / 21

    Sources of Errors in CFD

    ◮  Errors, inaccuracies, and differences between CFD results and laboratoryor real-life measurements arise from a number of sources.

    ◮  Some errors can, at least in principle, be systematically reduced.

    ◮ Need to understand how these arise, and check for their influence.

    ◮  Some mismatches between CFD results and measurements may be dueto mathematical models not fully representing the flow physics.

    ◮ Need to understand the limits of turbulence and other models.

    ◮  Other mismatches can arise from incomplete or uncertain problemdefinition.

    ◮ Need to understand the problem physics, and boundary conditions.

    ◮   Errors arising from software, or incorrect use of software, can be present.

    ◮ Need to understand the simulation process well, enabling one tocheck for implementation or usage errors.

    Trust and Quality in CFD 2011/12 4 / 21

  • 8/16/2019 Trust and Quality in CFD

    2/6

    Numerical Errors

    ◮  These generally refer to differences between the CFD solution and theexact solution of the governing differential equations and boundaryconditions.

    ◮  Can broadly be put into two categories:

    ◮ Discretization errors: the discretized equations not representing thedifferential ones exactly.

    P    E W    ∂ U ∂ x 

      ≈  U e  −U w ∆x 

    ◮ Convergence errors: the discretized equations not being solvedexactly.

    a 11   . . .   a 1n 

    ......

    a n 1   . . .   a nn 

    φ 1...

    φ n 

    b 1...

    b n 

    Trust and Quality in CFD 2011/12 5 / 21

    Discretization Errors

    ◮  Analytical derivatives and integrals are approximated in terms of discretenodal variable values.

    P    E W 

    ∂ U 

    ∂ x   ≈

     U e  −U w ∆x 

    ∂ U 

    ∂ t   ≈

     U (n +1)−U (n )

    ∆t 

    ◮  Taylor series expansions can give the order of accuracy of theseapproximations.

    ◮  Order of accuracy does  not  tell us the accuracy of one particular solution – it indicates how rapidly errors decrease as the grid spacing (or timestep) is refined.

    ◮  Note that this convergence rate with grid or time step size will only beobserved for sufficiently small grid spacing or time step.

    Trust and Quality in CFD 2011/12 6 / 21

    ◮  If we write a Taylor series expansion as

    φ e  = φ P  + ∆x 

    ∂φ 

    ∂ x 

    + (∆x )2

    2!

    ∂ 2φ 

    ∂ x 2

    + · · ·

    then the leading order error term is only the largest contribution if  ∆x  issmall enough that ∆x |∂ 2φ /∂ x 2| 

  • 8/16/2019 Trust and Quality in CFD

    3/6

    Convergence Errors

    ◮  The discretized equations areusually solved in an iterativefashion.

    ◮  Convergence errors often relate tothis process being stopped whenthe result is still not sufficiently

    close to the exact solution of thediscretized equation set.

    ◮  The difficulty in quantifying this is that we cannot measure the error norm,||φ  − φ exact ||, since we do not know  φ exact .

    ◮  Simply performing a fixed number of iterations, or continuing until thesolution changes by only some small amount does not guarantee that theerror will be small.

    Trust and Quality in CFD 2011/12 9 / 21

    ◮  Best solution is to monitor the residual error:

    Res  = ||a p φ P  −∑a i φ i  − s φ ||

    ◮   Non-dimensionalizing the residual by some physical quantities associatedwith the flow problem definition helps to assess convergence levels.

    ◮  For example, mass residuals can be normalized by an inlet mass flux,and momentum equation residuals by the inlet momentum flux.

    ◮  As a rule of thumb, residuals normalized as above should often bebrought down to around 10−4 to give sufficient convergence.

    ◮  The level of convergence required can be checked by reducing theresiduals further and then comparing the solutions obtained.

    Trust and Quality in CFD 2011/12 10 / 21

    Mathematical Modelling Errors

    ◮  These relate to how well the governing differential equations representthe real flow physics.

    ◮  For single phase laminar flows the equations can generally be regardedas exact.

    ◮  Mathematical models are often needed to account for turbulence,chemical reaction and combustion, and other processes,

    ◮  These models all have some limits of applicability, and some will performbetter or worse than others in particular flow situations.

    ◮  Choosing the appropriate model(s) for a particular case depends on userexperience, and a knowledge and understanding of the models and flowphysics present in the particular problem.

    ◮  Model validation, usually by comparison with measured data, in a rangeof flows is therefore vital.

    Trust and Quality in CFD 2011/12 11 / 21

    ◮  Validation studies, and model performances in many general classes offlows can often be found in the open research literature.

     – - – :  k -ε ; – – : Basic RSM+GL;- - - : Basic RSM+CL; ——: TCL RSM   y 

    x z 

    Trust and Quality in CFD 2011/12 12 / 21

  • 8/16/2019 Trust and Quality in CFD

    4/6

    ◮  If applying CFD to a new field, validation studies are needed in order togive confidence in the solutions obtained.

    ◮  Sensitivity of the solution to models can be tested by simulating the flowusing different schemes (eg. using different turbulence models).

    ◮  In some cases the choice of model is linked with spatial grid and timestep choices. For example, the use of wall-functions for resolvingnear-wall regions, or the relatively fine grids and small time stepsrequired for models such as LES that resolve some turbulence structures.

    Trust and Quality in CFD 2011/12 13 / 21

    Grid Quality

    ◮  A good quality grid is essential in reducing discretization errors.

    ◮  Poorly constructed grids can introduce significant discretization errors,and can lead to poor, or very slow, convergence.

    ◮  High aspect ratio cells should be avoided, particularly when not alignedwith the flow (eg.away from near-wall regions).

    ◮  Non-uniform grids should beused to give smaller cells incritical flow regions (near walls,around sharp corners, acrossshocks,.. . ).

    Trust and Quality in CFD 2011/12 14 / 21

    ◮  Sudden changes in grid size introduce interpolationand other errors. Cell growth ratios greater thanaround 1.2 should certainly be avoided.

    ◮  Poor grid angles also cause interpolation errors, and may requiredeferred correction methods for gradient reconstruction, etc.

    ◮  Grid cells not aligned with the flow direction tend to lead to numericaldiffusion, so grids should be aligned with the expected flow directionwhere possible.

    ◮  Some codes allow the use of ‘hanging’ nodes, and other non-matchingcell interfaces. Avoid these if possible – particularly in critical flow regions.

    Trust and Quality in CFD 2011/12 15 / 21

    ◮  Some grid generators, solvers and post-processing software can report‘measures’ of grid quality, eg. cell aspect ratios, cell skewness, etc.

    ◮  Grid independence checks should always be performed, so it is best touse grid topologies that can be significantly refined without seriouslydegrading grid quality.

    ◮  For example, as shown below, grid refinement can lead to high aspectratio cells normal to the flow direction.

    Trust and Quality in CFD 2011/12 16 / 21

  • 8/16/2019 Trust and Quality in CFD

    5/6

    Problem Definition Errors

    ◮  These generally arise from making assumptions in the problem set-upwhich change the characteristics or behaviour of the flow.

    ◮  Examples include smoothing out crucial geometrical features, imposingperiodicity or symmetries not present in the real flow, or assuming asteady state when the flow is unsteady.

    ◮  Flow around a circular cylinder:

    ◮  A Von-Karman vortex street develops in real flows.

    Trust and Quality in CFD 2011/12 17 / 21

    ◮  Assuming symmetry will prevent theabove pattern from developing.

      U 

    ◮  Performing a steady statecalculation will also not give thecorrect pattern (and it may bedifficult to obtain convergence).

    ◮  Wrong assumptions may be made for inlet or other boundary conditions.

    ◮  For example, fully developed inlet flowprofiles should not be specified whenthere is only a short entry pipe/duct.

    Trust and Quality in CFD 2011/12 18 / 21

    Problem Definition Uncertainties

    ◮  In some cases flow conditions are not known exactly, and assumptionsmust be made for boundary conditions etc.

    ◮  Inlet conditions are often not known ingreat detail – a flow rate might be given,but not the detailed velocity distribution.

    ◮  Detailed turbulence statistics might not have been measured, or reported.

    ◮  Unfortunately, many fluids problems can be rather sensitive to inputssuch as inlet conditions.

    ◮  These ‘errors’ cannot be easily removed, but sensitivity tests can beperformed – running a number of simulations with different inletconditions.

    ◮  This is routinely done in weather prediction, for example, where detailedmeasurements for boundary conditions are not available, yet results canbe highly sensitive to local flow details.

    Trust and Quality in CFD 2011/12 19 / 21

    User Errors

    ◮  Mainly arise from user inexperience or lack of planning.

    ◮  Incorrect usage of software, or errors in setting flow parameters orboundary conditions may fall into this category.

    ◮  Incorrect post-processing of results also leads to errors.

    ◮  These type of errors can usually be avoided by ensuring users know howto run software tools correctly, and understand the flow problem and

    process of modelling it.

    Trust and Quality in CFD 2011/12 20 / 21

  • 8/16/2019 Trust and Quality in CFD

    6/6

    Software Errors

    ◮  Nearly all software has some ‘bugs’ in it.

    ◮   These can include coding errors, and differences between documentationand actual implementation.

    ◮  Suitable verification tests can usually identify such problems.

    ◮  Again, user experience and knowledge of the flow and modelling canhelp to identify where such errors may be present.

    Trust and Quality in CFD 2011/12 21 / 21