Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and...

29
Computational Fluid Dynamics F7018T Part II: Finite volume methods

Transcript of Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and...

Page 1: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Computational Fluid Dynamics F7018T

Part II: Finite volume methods

Page 2: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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?

Page 3: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 4: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

What is CFD?

Page 5: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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.

Page 6: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 7: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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.

Page 8: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 9: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 10: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 11: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 12: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 13: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 14: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Discretization of geometry

Page 15: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Approximations of first derivative

Page 16: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Truncationerror

Page 17: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Finite volume methods

Page 18: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

• 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

Page 19: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Control Volumes

and notation

Page 20: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 21: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

Approximation of the integrals

Page 22: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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?

Page 23: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 24: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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

Page 25: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

2D-case

Page 26: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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)

Page 27: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

”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

Page 28: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

”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.

Page 29: Computational Fluid Dynamics F7018T/lundstrom_1.pdf · • Finite Difference Methods – Simple and effective – Conservation not enforced – Differential form • Finite Volume

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.