Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas.
Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and...
Transcript of Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and...
Computational Fluid Dynamics F7018T
Part II: Finite volume methods
Questions to be answered
• Why numerical solutions of fluid mechanicalproblems?
• What is CFD?• Why is it wrong to compare CFD with FEM?• Can we treat CFD-codes as black-boxes
and blindly trust in the results?• Which errors can be introduced when using
a numerical approach?
Why numerical solutions of fluid mechanical problems?
• The equations of fluid mechanics are solvablefor only a limited numberof flows.
• Experiments can be difficult (expensive) to carry out and/or measuring equipmentmay disturb the flow
• Computer capacityincreases and codesbecomes more efficient
What is CFD?
What is CFD?
• A method that approximate partialdifferential equations by a system of algebraic equations.
• The approximations are applied to small domains in space and/or time.
• The results are obtained in disretelocations in space and time.
• Quality very much dependent on the set-up of the problem and the discretization.
What is CFD?
Carefully performed numerical simulations in combination with accurate validation experiments is a powerful tool for flow prediction and optimisation.
Colourful Fluid Dynamics
Best Practice Guidelines• Model Uncertainty
There is likely to be differences between the model and reality. The most common error in this category is modelling of turbulence since all models that exist are approximations of the flow. Neglecting compressibility and/or Non-Newtonian effects are other sources of error.
• Discretisation or Numerical ErrorThis error appears since the governing equations are solved in discrete
points in space and time. In general, the finer grid used the better solution but also the distribution of the grid points will strongly influence on the results.
• Iteration or Convergence ErrorThe governing equations are generally solved in an iterative manner
starting from an initial guess and leading to a final result. An incomplete iteration procedure naturally results in an error. One reason to an iterative error is that the engineer is not patient enough, finishing the procedure too early. Another is that the iterative parameter used is not the critical one.
Best Practice Guidelines• Round-Off Error
When performing computer based numerical simulations, there is always a limit on the machine accuracy. This is of importance when the difference between two values of a parameter is in the same range as this limit.
• Application UncertaintiesThe application is often complex and all data required is usually not given
regarding geometry and boundary conditions, for instance.
• User ErrorMaybe the most obvious error. This error generally decreases with the
experience of the user.
• Code ErrorTypical codes usually consist of hundreds of thousands of lines and it is
likely that some errors are introduced during the writing.
• Post processing
Definitions
• Verification: Procedure to ensure that the program solves the equations correctly
• Validation: Procedure to test the extent to which the model accurately represents reality
Components of a numericalsolution
• Make a virtual model of reality• Choose mathematical models to solve• Select co-ordinate system• Find appropriate boundary conditions• Select a method for dicretization• Define a grid• Define level (type) of approximation• Select solution method• Set a convergence criteria• Choose method to evaluate the results
Student diploma work at VAC 2005The flow through cooling channel in rocket nozzle
First model with estimated inletboundary conditionTsimulated at a certain point = 398K
New model with prolonged inletTsimulated at same point 762K, close to experimental data
Experimental valuearound 750K
Methods of interest for CFD• Finite Difference Methods
– Simple and effective– Conservation not enforced– Differential form
• Finite Volume Methods– Often used in fluid mechanics– Conservation of mass– Integral form
• Finite Element Methods– Often in solid mechanics– Integral form– Conservation of mass not enforced but it can be included in the
code
Finite Difference Methods
General form of conservation equation = typical equation to solve:
ρ is the densityuj is the velocityΓ is the diffusivity of φqφ is a source or sink of φφ is some quantity, temperature, for instance
Discretization of geometry
Approximations of first derivative
Truncationerror
Finite volume methods
• This conservation equation applies to each CV, as well as to the solution domain as a whole.
• If we sum equations for all CVs the global conservation equation results
• Thus global conservation automatically apply
Control Volumes
and notation
Steps to obtain values
of surfaceintegrals
1. The integral is appr. in terms of the variable value at one or several locations on the cell wall
2. The cell wall values are appr. in terms of the nodal (CV-center)values
Approximation of the integrals
Questions to be answered
• Why numerical solutions of fluid mechanicalproblems?
• What is CFD?• Why is it wrong to compare CFD with FEM?• Can we treat CFD-codes as black-boxes
and blindly trust in the results?• Which errors can be introduced when using
a numerical approach?
Vad är ett finit element?• Området problemet är definierat för delas
upp ett antal finita element• Varje element består av ett antal noder
i=1..n• Lösningsvariabeln uppskattas på det finita
elementet m h a n antal formfunktioner Ni(shape functions) tillhörande varje nod
• Formfunktionen antar värdet 1 på sin egen nod och värdet 0 på övriga noder
Linjärt finit element i 1D
• Elementet har två noder xj, xj+1
• Lösningsvariabeln y* approximeras efter
• Formfunktionerna uppfyller villkoren
121* )()()( ++= jje yxNyxNxy
Xj+1 xxj
1)(0)(
0)(1)(
1211
21
==
==
++ jj
jj
xNxN
xNxN
2D-case
Hur kan part. Diff. Ekvationer lösas med FEM?
• Variationsmetoder (Variational CalculusMethod)– Används vanligen inom strukturmekanik. – Kan appliceras på vissa specialfall för
strömningsproblem (potentialflöde) • Viktade residualer (Method of weighted
residuals)
”The method of weighted residuals”(MWR)
• Söker en lösning på partiell diff. ekvation påformen D[y(x),x]=0 a<x<b
• Approximativa lösningen y*(x) insättes i D vilket ger ett fel R (residual), enligtR=D[y*()]≠0
• Felet minimeras m h a en integral över hela intervallet.
i=1,..,n0)()( =∫ dxxRxwb
ai
”The method of weighted residuals”(MWR)
• wi representerar n stycken godtyckliga viktsfunktioner.
• Olika variationer av MWR existerar och skillnaden är huvudsakligen val av viktsfunktion. Tre av de vanligaste är:– Integral relation method (wi = 0 eller 1) – Galerkin (wi = Ni (x))– Minsta kvadratmetoden
• Resulterar i n algebraiska ekvationer för att lösa okända parametrar.
Hybrid
• I FV kan interpolationsfunktioner (formfunktioner) användas för att approximera lösningsvariabeln så att den är känd i integrationspunkterna.
• Ex: i CFX används formfunktioner för att approximera tryckgradienten och diffusionstermerna.