Table Of ContentProfessur für
Thermofluiddynamik
Noteson
Computational
Thermo-Fluid Dynamics
CamiloF.Silva,Ph.D.
KilianFörner,M.Sc.
Prof. WolfgangPolifke,Ph.D.
Summer2016
www.tfd.mw.tum.de
Anexpertisamanwhohasmadeallthemistakes,whichcanbemade,
inaverynarrowfield.
NielsBohr(1885-1962).
Contents
1 Introduction 9
1.1 PartialDifferentialEquations(PDEs) . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 Generalitiesonpartialdifferentialequations(PDEs) . . . . . . . . . . . . . . . . . 12
1.3 ParabolicPDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 HyperbolicPDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 EllipticPDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.6 Boundaryconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.1 Dirichletboundarycondition . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.6.2 Neumannboundarycondition . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.6.3 Robinboundarycondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.7 Overviewofthecourse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.8.1 1Dconvectionequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.8.2 1Ddiffusionequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.8.3 1Dconvectiondiffusionequation . . . . . . . . . . . . . . . . . . . . . . . . 23
1.8.4 Morevideos. Nowin2D(Optional) . . . . . . . . . . . . . . . . . . . . . . 24
1.8.5 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2 FiniteDifferences 25
2.1 Computationalgrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2 DerivingFDnumericalschemesofarbitraryorder . . . . . . . . . . . . . . . . . . 27
5
6 CONTENTS
2.2.1 Taylorseriesandtruncationerror . . . . . . . . . . . . . . . . . . . . . . . 28
2.2.2 ForwardEulerscheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.2.3 Centeredscheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.2.4 BackwardEulerscheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.2.5 Secondorderderivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.3 2Dsteadyheatequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.3.1 Discretizingthe2Dsteadyheatequationbyfinitedifferences . . . . . . . 34
2.3.2 Boundaryconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.3.3 Assemblingthelinearsystem . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.4.1 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.4.2 Tips
byJuanPabloGarcia(ex-student) . . . . . . . . . . . . . . . . . . . . . . . . . 40
3 FiniteVolumes 41
3.1 DerivationofalgebraicequationsfromPDE . . . . . . . . . . . . . . . . . . . . . . 42
3.1.1 Applyingdivergencetheorem . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.1.2 Definingcellnormals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.1.3 Applyinganintegralrule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.1.4 ApplyingGreen’stheorem . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.2 ExercisesPart1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3 ExercisesPart2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.3.1 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.3.2 Tips
byJuanPabloGarcia(ex-student) . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.3.3 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4 UnsteadyProblems 53
CONTENTS 7
4.1 Explicittimediscretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.1.1 VonNeumannstabilityanalysisofFEscheme . . . . . . . . . . . . . . . . 56
4.2 Implicittimediscretization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.2.1 VonNeumannanalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3 Theweightedaverageorθ-method . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3.1 VonNeumanAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.4 Predictor-correctormethods(Runge-Kutta) . . . . . . . . . . . . . . . . . . . . . . 65
4.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5 SparseMatricesandLinearSolvers 71
5.1 Sparsematrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.2 Iterativesolversandpreconditioning . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.3 PreconditionedRichardsoniteration . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.4 Projectionmethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.5.1 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.5.2 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6 Green’sfunctions 82
6.1 Green’sfunctionsolutionequationforthesteadyheatequation . . . . . . . . . . 83
6.2 Treatmentofboundaryconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.3 DerivationoftheGreen’sfunctionforasimpleproblem . . . . . . . . . . . . . . . 87
6.4 Whattointegrate? (Warning) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.5 Green’sfunctionsforarectangulardomain . . . . . . . . . . . . . . . . . . . . . . 90
6.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.7.1 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . . 94
8 CONTENTS
7 Optimization 95
7.1 Statementoftheproblem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
7.2 FormulationandOptimalityCondition . . . . . . . . . . . . . . . . . . . . . . . . 98
7.3 GradientDescent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.4 Newton’sMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.5 Constrainedoptimization: themethodofLagrangemultipliers. . . . . . . . . . . 101
7.6 Quasi-1Dapproximationofafin . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
7.7 Exercises: OptimalCoolingFinShape . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.7.1 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . . 106
7.7.2 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
8 FiniteElementMethods 107
8.1 WeakForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
8.2 MainIdea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
8.3 BaseFunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
8.4 TestFunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.5 ElementMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.6 Boundaryconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
8.7 SystemMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
8.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
A AddendumtoFiniteVolumes 118
A.1 UniformrectangulargridandBoundaryConditions . . . . . . . . . . . . . . . . . 118
A.2 Boundaryconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
A.2.1 South . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
1
Introduction
References
[1] KUZMIN D. Aguidetonumericalmethodsfortransportequations. Fiedrich-Alexander-Universität,
2010.
[2] POLIFKE,W.,ANDKOPITZ,J.Wärmeübertragung.Grundlagen,analytischeundnumerischeMethoden.
PearsonStudium,2005.
Objectives
• GettingintroducedtoPDEs
• Coding in Matlab analytical solutions of simple convection, diffusion and convection-diffusion
equations.
9
10 Chapter1:Introduction
Contents
1.1 PartialDifferentialEquations(PDEs) . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 Generalitiesonpartialdifferentialequations(PDEs) . . . . . . . . . . . . . . . 12
1.3 ParabolicPDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 HyperbolicPDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 EllipticPDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.6 Boundaryconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.1 Dirichletboundarycondition . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.6.2 Neumannboundarycondition . . . . . . . . . . . . . . . . . . . . . . . . 18
1.6.3 Robinboundarycondition. . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.7 Overviewofthecourse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.8.1 1Dconvectionequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.8.2 1Ddiffusionequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.8.3 1Dconvectiondiffusionequation. . . . . . . . . . . . . . . . . . . . . . . 23
1.8.4 Morevideos. Nowin2D(Optional) . . . . . . . . . . . . . . . . . . . . . 24
1.8.5 UsefulMATLABcommands . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.1 Partial Differential Equations (PDEs)
How to model pollutant dispersal in a river, or the evolving distribution of a harmful gas in
a city? How to describe heat conduction in solids or the propagation of sound through the
atmosphere? Howtounderstandtheflowofairinthevicinityofanairfoil? Ageneralanswer
to these apparently different queries is given by Partial Differential Equations (PDE). Generally,
PDEsarederivedfromfirstprinciples,asforexamplelawsofconservation. Wewillintroduce
now a general but also simple framework to formulate laws of conservation and derive PDEs
fromthem.
Letφbetheconcentrationperunitmassofaconservedscalar. Examplesofthisscalarφcould
besomeintrinsicpropertiesofagivensubstanceas, forinstance, specificinternalenergy, spe-
cific enthalpy or specific entropy, among others. A given component of the vector of momen-
tumperunitmasscanbealsoseenasanexampleofaconservedscalar φ. Now, ifweassume
ρtobethedensityofthecarrierflow,wedefinew = ρφ. Wearereferingthentotheconcentra-
tion of that scalar per unit volume. The whole amount of that scalar within a defined control
volumeV isgivenby
(cid:90) (cid:90)
W = w(x,t)dV = ρ(x,t)φ(x,t)dV, (1.1)
V V
Description:Grundlagen, analytische und numerische Methoden. Pearson Studium, 2005. In fluid dynamics, this equation is obtained by . Optimization is an enormous field of research and in this course an introduction to this topic will be given. Some. Optimization techniques (Chap. 7) will be reviewed and