Introduction to Computational Fluid Dynamics.docx

Embed Size (px)

Citation preview

Introduction to Computational Fluid DynamicsInstructor: Dmitri KuzminInstitute of Applied MathematicsUniversity of [email protected]://www.featflow.deFluid (gas and liquid) ows are governed by partial dierential equations which represent conservation laws for the mass, momentum, and energy.Computational Fluid Dynamics (CFD) is theartof replacing such PDE systems by a set of algebraic equations which can be solved using digital computers.http://www.mathematik.uni-dortmund.de/kuzmin/cfdintro/cfd.html

What is uid ow?Fluid ows encountered in everyday life includemeteorological phenomena (rain, wind, hurricanes, oods, res)environmental hazards (air pollution, transport of contaminants)heating, ventilation and air conditioning of buildings, cars etc.combustion in automobile engines and other propulsion systemsinteraction of various objects with the surrounding air/watercomplex ows in furnaces, heat exchangers, chemical reactors etc.processes in human body (blood ow, breathing, drinking . . . )and so on and so forth

What is CFD?Computational Fluid Dynamics(CFD) provides a qualitative (and sometimes even quantitative) prediction of uid ows by means ofmathematical modeling (partial dierential equations)numerical methods (discretization and solution techniques)software tools (solvers, pre- and postprocessing utilities)CFD enables scientists and engineers to perform numerical experiments (i.e. computer simulations) in a virtual ow laboratoryreal experimentCFD simulation

Why use CFD?Numerical simulations of uid ow (will) enablearchitects to design comfortable and safe living environmentsdesigners of vehicles to improve the aerodynamic characteristicschemical engineers to maximize the yield from their equipmentpetroleum engineers to devise optimal oil recovery strategiessurgeons to cure arterial diseases (computational hemodynamics)meteorologists to forecast the weather and warn of natural disasterssafety experts to reduce health risks from radiation and other hazardsmilitary organizations to develop weapons and estimate the damageCFD practitioners to make big bucks by selling colorfulpictures :-)

Examples of CFD applicationsAerodynamic shape design

Examples of CFD applicationsCFD simulations by Lohner et al.

Examples of CFD applicationsSmoke plume from an oil re in BaghdadCFD simulation by Patnaik et al.

Experiments vs. SimulationsCFD gives an insight into ow patterns that are dicult, expensive or impossible to study using traditional (experimental) techniquesExperimentsSimulations

Quantitativedescriptionof owQuantitativepredictionof ow

phenomena using measurementsphenomena using CFD software

for one quantity at a timefor all desired quantities

at a limited number of pointswith high resolution in

and time instantsspace and time

for alaboratory-scalemodelfor the actual ow domain

for a limited range of problemsfor virtually any problem and

and operating conditionsrealistic operating conditions

Error sources: measurement errors,Error sources: modeling, discretiza-

ow disturbances by the probestion, iteration, implementation

Experiments vs. SimulationsAs a rule, CFD does not replace the measurements completely but the amount of experimentation and the overall cost can be signicantly reduced.ExperimentsSimulations

Equipment and personnel

expensivecheap(er)

are dicult to transport

slowfast(er)CFD software is portable,

sequentialparallel

easy to use and modify

single-purposemultiple-purpose

The results of a CFD simulation are never 100% reliable becausethe input data may involve too much guessing or imprecisionthe mathematical model of the problem at hand may be inadequatethe accuracy of the results is limited by the available computing power

Fluid characteristicsMacroscopic propertiesdensity

viscosity

ppressure

Ttemperature

vvelocity

Classication of uid owsviscousinviscid

compressibleincompressible

steadyunsteady

laminarturbulent

single-phasemultiphase

The reliability of CFD simulations is greaterfor laminar/slow ows than for turbulent/fast onesforsingle-phaseows than formulti-phaseowsfor chemically inert systems than for reactive ows

How does CFD make predictions?CFD uses a computer to solve the mathematical equations for the problem at hand. The main components of a CFD design cycle are as follows:the human being (analyst) who states the problem to be solvedscientic knowledge (models, methods) expressed mathematicallythe computer code (software) which embodies this knowledge and provides detailed instructions (algorithms) forthe computer hardware which performs the actual calculationsthe human being who inspects and interprets the simulation resultsCFD is a highly interdisciplinary research area which lies at the interface of physics, applied mathematics, and computer science

CFD analysis process1.Problem statementinformation about the ow

2.Mathematical modelIBVP = PDE + IC + BC

3.Mesh generationnodes/cells, time instants

4.Space discretizationcoupled ODE/DAE systems

5.Time discretizationalgebraic system Ax = b

6.Iterative solverdiscrete function values

7.CFD softwareimplementation, debugging

8.Simulation runparameters, stopping criteria

9.Postprocessingvisualization, analysis of data

10.Vericationmodel validation / adjustment

Problem statementWhat is known about the ow problem to be dealt with?What physical phenomena need to be taken into account?What is the geometry of the domain and operating conditions?Are there any internal obstacles or free surfaces/interfaces?What is the type of ow (laminar/turbulent, steady/unsteady)?What is the objective of the CFD analysis to be performed?computation of integral quantities (lift, drag, yield)snapshots of eld data for velocities, concentrations etc.shape optimization aimed at an improved performanceWhat is the easiest/cheapest/fastest way to achieve the goal?

Mathematical model1.Choose a suitableow model(viewpoint) and reference frame.2.Identify the forces which cause and inuence the uid motion.3.Dene thecomputational domainin which to solve the problem.4.Formulate conservation laws for the mass, momentum, and energy.5.Simplify the governing equations to reduce the computational eort:use available information about the prevailing ow regimecheck for symmetries and predominant ow directions (1D/2D)neglect the terms which have little or no inuence on the resultsmodel the eect ofsmall-scaleuctuations that cannot be capturedincorporatea prioriknowledge (measurement data, CFD results)6.Add constituitive relations and specify initial/boundary conditions.

Discretization processThe PDE system is transformed into a set of algebraic equations1.Mesh generation (decomposition into cells/elements)structured or unstructured, triangular or quadrilateral?CAD tools + grid generators (Delaunay, advancing front)mesh size, adaptive renement in interesting ow regions2.Space discretization (approximation of spatial derivatives)nite dierences/volumes/elementshigh- vs.low-orderapproximations3.Time discretization (approximation of temporal derivatives)explicit vs. implicit schemes, stability constraintslocaltime-stepping,adaptive time step control

Iterative solution strategyThe couplednonlinearalgebraic equations must be solved iterativelyOuter iterations:the coecients of the discrete problem are updated using the solution values from the previous iteration so as toget rid of the nonlinearities by aNewton-likemethodsolve the governing equations in a segregated fashionInner iterations: the resulting sequence of linear subproblems is typically solved by an iterative method (conjugate gradients, multigrid) because direct solvers (Gaussian elimination) are prohibitively expensiveConvergence criteria: it is necessary to check the residuals, relative solution changes and other indicators to make sure that the iterations converge.As a rule, the algebraic systems to be solved are very large (millions of unknowns) butsparse, i.e., most of the matrix coecients are equal to zero.

CFD simulationsThe computing times for a ow simulation depend onthe choice of numerical algorithms and data structureslinear algebra tools, stopping criteria for iterative solversdiscretization parameters (mesh quality, mesh size, time step)cost per time step and convergence rates for outer iterationsprogramming language (most CFD codes are written in Fortran)many other things (hardware, vectorization, parallelization etc.)The quality of simulation results depends onthe mathematical model and underlying assumptionsapproximation type, stability of the numerical schememesh, time step, error indicators, stopping criteria . . .

Postprocessing and analysisPostprocessing of the simulation results is performed in order to extract the desired information from the computed ow eldcalculation of derived quantities (streamfunction, vorticity)calculation of integral parameters (lift, drag, total mass)visualization (representation of numbers as images)1D data: function values connected by straight lines2D data: streamlines, contour levels, color diagrams3D data: cutlines, cutplanes, isosurfaces, isovolumesarrow plots, particle tracing, animations . . .Systematic data analysis by means of statistical toolsDebugging, verication, and validation of the CFD model

Uncertainty and errorWhether or not the results of a CFD simulation can be trusted depends on the degree of uncertainty and on the cumulative eect of various errorsUncertaintyis dened as a potential deciency due to the lack of knowledge (turbulence modeling is a classical example)Erroris dened as a recognizable deciency due to other reasonsAcknowledged errors have certain mechanisms for identifying, estimating and possibly eliminating or at least alleviating themUnacknowledged errors have no standard procedures for detecting them and may remain undiscovered causing a lot of harmLocal errors refer to solution errors at a single grid point or cellGlobal errors refer to solution errors over the entire ow domainLocal errors contribute to the global error and may move throughout the grid.

Classication of errorsAcknowledged errorsPhysical modeling error due to uncertainty and deliberate simplicationsDiscretization errorapproximation of PDEs by algebraic equationsspatial discretization error due to a nite grid resolutiontemporal discretization error due to a nite time step sizeIterative convergence error which depends on the stopping criteriaRound-oerrors due to the nite precision of computer arithmeticUnacknowledged errorsComputer programming error: bugs in coding and logical mistakesUsage error: wrong parameter values, models or boundary conditionsAwareness of these error sources and an ability to control or preclude theerror are important prerequisites for developing and using CFD software

Verication of CFD codesVerication amounts to looking for errors in the implementation of the models (loosely speaking, the question is: are we solving the equations right?)Examine the computer programming by visually checking the source code, documenting it and testing the underlying subprograms individuallyExamine iterative convergence by monitoring the residuals, relative changes of integral quantities and checking if the prescribed tolerance is attainedExamine consistency (check if relevant conservation principles are satised)Examine grid convergence: as the mesh and/or and the time step are rened, the spatial and temporal discretization errors, respectively, should asymptotically approach zero (in the absence ofround-oerrors)Compare the computational results with analytical and numerical solutions for standard benchmark congurations (representative test cases)

Validation of CFD modelsValidation amounts to checking if the model itself is adequate for practical purposes (loosely speaking, the question is: are we solving the right equations?)Verify the code to make sure that the numerical solutions are correct.Compare the results with available experimental data (making a provision for measurement errors) to check if the reality is represented accurately enough.Perform sensitivity analysis and a parametric study to assess the inherent uncertainty due to the insucient understanding of physical processes.Try using dierent models, geometry, and initial/boundary conditions.Report the ndings, document model limitations and parameter settings.The goal of verication and validation is to ensure that the CFD code produces reasonable results for a certain range of ow problems.

Available CFD softwareANSYS CFXhttp://www.ansys.comcommercial

FLUENThttp://www.fluent.comcommercial

STAR-CDhttp://www.cd-adapco.comcommercial

FEMLABhttp://www.comsol.comcommercial

FEATFLOWhttp://www.featflow.deopen-source

As of now, CFD software is not yet at the level where it can be blindly used by designers or analysts without a basic knowledge of the underlying numerics.Experience with numerical solution of simple toy problems makes it easier to analyze strange looking simulation results and identify the source of troubles.New mathematical models (e.g., population balance equations for disperse systems) require modication of existing / development of new CFD tools.

Structure of the course1.Introduction, ow models.2.Equations of uid mechanics.3.Finite Dierence Method.4.Finite Volume Method.5.Finite Element Method.6.Implementation of FEM.7.Time-steppingtechniques.8.Properties of numerical methods.9.Taylor-Galerkinschemes for pure convection.10.Operator-splitting /fractional step methods.11.MPSC techniques /Navier-Stokesequations.12.Algebraic ux correction / Euler equations.

Literature1.CFD-Wikihttp://www.cfd-online.com/Wiki/MainPage2.J. H. Ferziger and M. Peric,Computational Methods for Fluid Dynamics. Springer, 1996.3.C. Hirsch,Numerical Computation of Internal and External Flows. Vol. I and II. John Wiley & Sons, Chichester, 1990.4.P. Wesseling,Principles of Computational Fluid Dynamics. Springer, 2001.5.C. Cuvelier, A. Segal and A. A. van Steenhoven,Finite Element Methods andNavier-StokesEquations. Kluwer, 1986.6.S. Turek,Ecient Solvers for Incompressible Flow Problems: An Algorithmic and Computational Approach, LNCSE6, Springer, 1999.7.R. Lohner,Applied CFD Techniques: An Introduction Based on Finite Element Methods. John Wiley & Sons, 2001.8.J. Donea and A. Huerta,Finite Element Methods for Flow Problems. John Wiley & Sons, 2003.