Sei sulla pagina 1di 151

1

CFD Open Series

Essentials of CFD
A Quick Review
Ideen Sadrehaghighi, Ph.D.

Pressure
countours over
NACA 0012 wing
section on
transonic flow

High Lifting
Surfaces

Aerodynamics

ANNAPOLIS, MD
2

Contents
List of Figures ....................................................................................................................................................................... 8

I Introduction.................................................................................................................................... 10
I.1 Motivation by an Example ................................................................................................................................. 11
I.2 CFD Processes......................................................................................................................................................... 13
I.2.1 Partial Differential Equations (PDE) ...................................................................................... 13
I.2.2 Boundary Conditions ............................................................................................................. 13
I.2.3 Math Modeling and Simulation of Physical Processes .......................................................... 13
I.2.4 Verification, Validation and Calibration ................................................................................ 13
I.3 History and Success Stories .............................................................................................................................. 13
I.4 Advantages of using CFD.................................................................................................................................... 16
I.5 Vision for Further ................................................................................................................................................. 17

1 PDE’s of Model Equations.......................................................................................................... 19


1.1 Mathematical Character of Basic Equations ............................................................................................. 19
1.2 Behavior of the Different Classes of PDE ................................................................................................... 20
1.2.1 Hyperbolic Equations ........................................................................................................... 20
1.2.2 Parabolic Equations .............................................................................................................. 21
1.2.3 Elliptic Equations .................................................................................................................. 22
1.2.4 Some Comments .................................................................................................................. 22
1.2.5 The 'Par-Elliptic' problem ..................................................................................................... 23
1.3 Nonsingular Transformation .......................................................................................................................... 23
1.4 Exact (Closed Form) Solution Methods to Model Equations ............................................................. 24
1.2.1 Linear Wave Equation (1st Order)......................................................................................... 24
1.2.2 Inviscid Burgers Equation ..................................................................................................... 24
1.2.3 Diffusion (Heat) Equation ..................................................................................................... 25
1.2.4 Viscous Burgers Equation ..................................................................................................... 26
1.2.5 Tricomi Equation .................................................................................................................. 26
1.2.6 2D Laplace Equation ............................................................................................................. 26
1.2.6.1 Boundary conditions .................................................................................................... 26
1.2.7 Poisson’s Equation ............................................................................................................... 27
1.2.8 The Advection-Diffusion Equation ....................................................................................... 27
1.2.9 The Korteweg-De Vries Equation ......................................................................................... 27
1.2.10 Helmholtz Equation ............................................................................................................ 27
1.2.11 Summary List of Exact Solution Methods .......................................................................... 27

2 Solving System of Linear Algebraic Equation .................................................................... 29


2.1 Eigenvalues and Eigenvectors ........................................................................................................................ 29
2.3.1 Eigenvalues Calculation ..................................................................................................... 29
2.3.1.1 Eigenvector Calculation................................................................................................ 30
2.3.1.2 Right and Left Eigenvectors.......................................................................................... 30
2.3.1.3 Diagonalization of a Matrix .......................................................................................... 30
2.3.1.4 Case Study 1 - Eigenvalues and Eigenvectors of 3D Euler Equation ............................ 31
2.3.1.5 Governing Equations .................................................................................................... 31
2.3.1.6 Transformation Matrix ................................................................................................. 31
2.3.2 Case Study 2 – Non-Reflecting Boundary Condition in 2D .................................................. 32
3

2.3.2.1 Background .................................................................................................................. 32


2.3.2.2 General Fourier Analysis and Eigenvectors .................................................................. 33
2.4 Direct Methods for Solving Systems of Linear Algebraic Equations............................................... 34
2.4.1 Cramer’s Rule ....................................................................................................................... 34
2.4.2 Gaussian Elimination ............................................................................................................ 34
2.4.3 Thomas Algorithm ................................................................................................................ 35
2.4.4 Advanced-Direct Methods ................................................................................................... 35
2.5 Iterative Methods for Solving Systems of Linear Algebraic Equations.......................................... 35
2.5.1 Jacobi Method ...................................................................................................................... 35
2.5.2 Gauss-Seidel iteration .......................................................................................................... 36
2.5.3 Successive Over-Relaxation (SOR) ........................................................................................ 36
2.5.4 SOR by Line ........................................................................................................................... 37
2.5.5 Block-Iterative Methods ....................................................................................................... 37
2.5.6 ADI Methods ........................................................................................................................ 37
2.5.7 Strongly–Implicit Methods ................................................................................................... 38
2.5.8 Advanced iterative methods - Krylov Methods ................................................................... 38

3 Basic CFD (I).................................................................................................................................... 40


3.1 General Remarks .................................................................................................................................................. 40
3.2 Computer Programming Languages & Paradigms for CFD ................................................................ 41
3.2.1 How do Programming Languages Differ?............................................................................. 41
3.2.1.1 Abstraction ................................................................................................................... 41
3.2.1.2 Encapsulation ............................................................................................................... 41
3.2.1.3 Inheritance ................................................................................................................... 42
3.2.1.4 Polymorphism .............................................................................................................. 42
3.2.2 Main Language Styles ........................................................................................................... 42
3.2.3 Comparison between MATLAB, C/C++ and FORTRAN ......................................................... 43
3.2.3.1 FORTRAN ...................................................................................................................... 43
3.2.3.2 C/C++ ............................................................................................................................ 43
3.2.3.3 MATLAB ........................................................................................................................ 44
3.2.3.4 Graphics and GUI programming in MATLAB ................................................................ 44
3.2 Marching and Equilibrium Problems .......................................................................................................... 45
3.3 Numerical Approximation Methods............................................................................................................. 45
3.4 Finite Difference Method (FD)........................................................................................................................ 46
3.4.1 Some Issues with Finite Differencing ................................................................................... 46
3.4.1.1 Truncation Error ........................................................................................................... 46
3.4.1.2 Consistency .................................................................................................................. 48
3.4.1.3 Stability......................................................................................................................... 48
3.5 Finite Volume Method (FV) ............................................................................................................................. 49
3.5.1 Finite Volume Method using a simple 1D example ............................................................. 50
3.5.2 Some Abnormalities Associated with Finite Volume ........................................................... 51
3.5.2.1 Numerical Diffusion Effects .......................................................................................... 51
3.5.3 Balancing the Diffusion vs. Convection using Peclet Number (Pe) ...................................... 52
3.6 Finite Element Method (FE) ............................................................................................................................ 54
3.6.1 Concept of Shape (Basis) Function ....................................................................................... 54
3.6.1.1 Lagrangian Elements .................................................................................................... 54
3.6.2 A simple 1D Discretization Example using Shape (Basis) function ....................................... 55
3.6.3 Example with Heat Source ................................................................................................... 56
4

3.6.4 Steady state Heat Sink The Weak Formulation; Basis Functions and Test Functions ......... 57
3.6.4.1 Test Function ................................................................................................................ 58
3.6.4.2 Weak Formulation........................................................................................................ 58
3.6.5 Effect of Basis Function ........................................................................................................ 59
3.6.6 Different Elements ............................................................................................................... 60
3.6.7 Error Estimation ................................................................................................................... 61
3.6.8 Additional Finite Element Formulations .............................................................................. 61
3.6.9 Mathematics behind the Finite Element Method ................................................................ 61
3.6.10 Summary of Math Procedure for Finite Element Analysis ................................................. 62
3.7 Conceptual Differences between three mostly used Prediction Methods ................................... 62
3.7.1 Finite Differencing (FD) ........................................................................................................ 63
3.7.2 Finite Volume (FV) ................................................................................................................ 63
3.7.3 Finite Element (FE) ............................................................................................................... 63
3.8 Spectral Methods ................................................................................................................................................. 63
3.8.1 Fast Fourier Transform Methods ......................................................................................... 64
3.8.2 Finite Differences vs. Spectral Methods .............................................................................. 65
3.9 Residual Method (WRM)................................................................................................................................... 66
3.9.1 General Formulation ............................................................................................................ 66
3.10 Some Attributes to Spatial Discretization ................................................................................................ 67
3.10.1 Cell-Centered (CC) vs. Node-Centered (NC) ....................................................................... 67
3.10.2 Staggered vs Collocated Grids ............................................................................................ 68
3.10.3 Desired Properties in Discretization Schemes ................................................................... 68
3.11 Spatial Discretization Schemes.................................................................................................................... 69
3.11.2 First-order Upwind (UD)..................................................................................................... 69
3.11.3 Central Differencing (CD) ................................................................................................... 69
3.11.4 Second–order Upwind Differencing (UD) .......................................................................... 69
3.11.5 Power Law Scheme ............................................................................................................ 70
3.11.6 Quadratic Upwind Interpolation for convection Kinetics (QUICK) .................................... 70
3.11.7 Monotone Upstream-Centered Schemes for Conservation Laws (MUSCL) ...................... 70
3.11.8 Total Variation Diminishing (TVD) ...................................................................................... 70
3.11.8.1 Total Variation Diminishing Cubic Interpolated Propagation (TVDCIP) ..................... 70
3.11.9 Monotone Advection and Recons traction Scheme (MARS) ............................................. 71
3.11.9.1 Reconstruction ........................................................................................................... 71
3.11.9.2 Advection ................................................................................................................... 71
3.11.10 Blended Differencing ........................................................................................................ 71
3.11.11 Higher Order Upwind Schemes ........................................................................................ 71

4 Basic CFD (II) ................................................................................................................................. 74


4.10 Temporal Discretization................................................................................................................................. 74
4.10.1 Example of Transient 1D Diffusion with Source Term ...................................................... 75
4.10.2 Euler Implicit ...................................................................................................................... 75
4.10.3 Crank-Nicolson ................................................................................................................... 75
4.10.4 Simple Explicit .................................................................................................................... 76
4.10.5 Runga-Kutta Method .......................................................................................................... 76
4.10.5.1 Explicit Treatment ...................................................................................................... 76
4.10.5.2 Implicit Runge–Kutta methods .................................................................................. 77
4.11 Transient Simulation ....................................................................................................................................... 77
4.11 Steady-State Vs Transient.............................................................................................................................. 78
5

4.11.1 Case Study 1 - Vortex shedding behind a Cylinder - Ran as SS (Wrong!) ........................... 79
4.11.2 Case study 2 - Double sided membrane case - Ran as SS (Right!) ..................................... 79
4.12 Wall Distance Estimation ............................................................................................................................... 80

5 Non-Linear CFD Equations........................................................................................................ 82


5.1 An Overview ........................................................................................................................................................... 83
5.3 Coupled vs Segregated Algorithms ............................................................................................................... 83
5.4 Explicit vs Implicit Methods ............................................................................................................................ 84
5.6 Model Finite Difference Schemes .................................................................................................................. 85
5.7 General Discretization Scheme (Beam-Warming) ................................................................................. 86
5.8 Linearization of Equations ............................................................................................................................... 87
5.8.1 Frozen (Lagging) Coefficient Method ................................................................................... 87
5.8.2 Simple Iterative Method ...................................................................................................... 87
5.8.3 Newton Raphson Linearization Method .............................................................................. 87
5.8.3.1 Newton Linearization with Coupling ............................................................................ 87
5.8.4 Extrapolating the Coefficients .............................................................................................. 88
5.8.5 Approximate Factorization (AF) Scheme.............................................................................. 88
5.8.6 Recommendation on Linearization ...................................................................................... 90
5.9 Pressure Based vs. Density Based Schemes for Finite Volume ......................................................... 90
5.9.1 Basic Pressure Schemes ....................................................................................................... 90
5.9.2 Fast Fluid Dynamic (FFD) ...................................................................................................... 92
5.9.2.1 Fast Fluid Dynamics Model .......................................................................................... 93
5.9.2 Density Based Schemes ........................................................................................................ 93
5.10 Residual Implication ........................................................................................................................................ 95
5.10.1 Explicit Schemes ................................................................................................................. 95
5.10.2 Implicit Schemes ................................................................................................................ 96
5.10.2.1 Convergence Rate and Storage Requirement ............................................................ 97
5.11 Multigrid Methods ............................................................................................................................................ 98
5.11.1 Multigrid Cycle ................................................................................................................... 99
5.11.2 Unstructured Mesh Cycling .............................................................................................. 100
5.11.3 Viscous Flow Consideration ............................................................................................. 101
5.12 Outline of Numerical Aspects of CFD ..................................................................................................... 101
5.13 What Constitute Solver in CFD ................................................................................................................. 105

6 Solution Methods for In-Viscid (Euler) Equations ........................................................ 106


6.1 Background ......................................................................................................................................................... 106
6.2 Method of Characteristics.............................................................................................................................. 106
6.2.1 Linear Systems.................................................................................................................... 106
6.2.2 Non-Linear Systems............................................................................................................ 108
6.3 Shock Capturing Method................................................................................................................................ 110
6.3.1 Explicit McCormack Method .............................................................................................. 110
6.3.2 1D Upwind Flux-Splitting Scheme (Steger-Warming) ........................................................ 110
6.3.3 Total Variation Diminishing (TVD) as other Upwind Schemes ........................................... 111
6.3.3.1 The Upwind Connection to Explicit Artificial Dissipation ........................................... 112
6.3.3 3D Unsteady Euler Equation Solutions Using Flux Vector Splitting ................................... 113
6.3.3.1 Flux Splitting ............................................................................................................... 114
6.4 Method for Solving the Potential Equation ............................................................................................ 115
6.4.1 Conservative Forms ............................................................................................................ 116
6

6.5 Method for Transonic Flow .......................................................................................................................... 116


6.6 Panel Methods for solving the Laplace’s Equation.............................................................................. 117

7 Solution Methods for Viscous (Navier-Stokes) Equations .......................................... 119


7.1 Background ......................................................................................................................................................... 119
7.2 General Transformation................................................................................................................................. 120
7.3 Solution Methods for Compressible Navier-Stokes Equation ........................................................ 121
7.3.1 Compressible Explicit Schemes .......................................................................................... 122
7.3.1.1 McCormack ................................................................................................................ 122
5.3.1.2 Other Explicit Schemes............................................................................................... 123
7.3.2 Compressible Implicit Schemes.......................................................................................... 123
7.3.2.1 Beam-Warming .......................................................................................................... 123
5.3.2.2 Mac Cormack.............................................................................................................. 124
7.3.3 Incompressible Explicit Schemes ....................................................................................... 124
7.3.3.1 Vorticity-Stream Function Approach ......................................................................... 124
7.3.3.2 Primitive-Variable Approach ...................................................................................... 126
7.3.4 Incompressible Implicit Schemes ....................................................................................... 126
7.3.4.1 SIMPLE (Semi-Implicit Method for Pressure Linked Equation) .................................. 126
7.4 Approximation (Thin-Layer) Navier-Stokes Equation ...................................................................... 128
7.5 Parabolized Navier-Stokes Equation ........................................................................................................ 128
7.5.1 3-D Compressible Implicit Numerical Solution of PNS equation ....................................... 129
7.6 2D Compressible Boundary Layer ............................................................................................................. 133
7.6.1 Solution Methods using steady External Flows ................................................................. 133
7.6.1 3D compressible laminar Boundary Layer ......................................................................... 134
7.6.2 Unsteady Boundary Layer .................................................................................................. 135

8 Best Guidelines for CFD Simulation.................................................................................... 137


8.1 Background ......................................................................................................................................................... 137
8.2 Element of Uncertainty ................................................................................................................................... 138
8.2.1 Geometry and Grid Generation ......................................................................................... 138
9.2.2 Convergence....................................................................................................................... 138
8.2.3 Numerical ........................................................................................................................... 139
8.2.4 Reaction.............................................................................................................................. 139
8.2.5 Multiphase Flows ............................................................................................................... 139
8.2.5.1 Not knowing the most important physical mechanisms ........................................... 139
8.2.5.2 Closure Models .......................................................................................................... 139
8.2.5.3 Time-Scale and Length-Scale Separation ................................................................... 140
8.2.5.4 Choice of Model and Governing Equations ............................................................... 140
8.2.5.5 Numerical Errors ........................................................................................................ 140
8.2.3 Avoiding Dangers in Multiphase Flows .............................................................................. 140
8.4 Verification, Validation and Calibration .................................................................................................. 141
8.5 Simulation for Everyone ................................................................................................................................ 141

9 Components of CFD Simulation ........................................................................................... 143


9.1 Background ......................................................................................................................................................... 143
9.2 Simulation vs Modeling .................................................................................................................................. 144
9.3 Simulation Components as Envisioned by NASA................................................................................. 145
7

9.3.1 Formulate the Flow Problem ............................................................................................. 145


9.3.2 Model the Geometry and Flow Domain............................................................................. 146
9.3.3 Establish the Boundary and Initial Conditions ................................................................... 146
9.3.4 Generate the Grid .............................................................................................................. 146
9.3.5 Establish the Simulation Strategy....................................................................................... 146
9.3.6 Establish the Input Parameters and Files ........................................................................... 146
9.3.7 Perform the Simulation ...................................................................................................... 147
9.3.8 Monitor the Simulation for Completion ............................................................................ 147
9.3.9 Post-Process the Simulation to get the Results ................................................................. 147
9.3.10 Make Comparisons of the Results.................................................................................... 147
9.3.11 Repeat the Process to Examine Sensitivities .................................................................... 147
9.3.12 Document ......................................................................................................................... 147
9.4 Comparison of some Commercially Available CFD Software ......................................................... 147
9.4.1 AcuSolve ............................................................................................................................. 148
9.4.2 OpenFOAM ......................................................................................................................... 148
9.4.3 OpenFlower ........................................................................................................................ 148
9.4.4 FLASH.................................................................................................................................. 148
9.4.5 GADGET .............................................................................................................................. 148
9.4.6 HYDRA ................................................................................................................................ 149
9.4.7 ZEUS-MP ............................................................................................................................. 149
9.4.8 ANSYS CFX .......................................................................................................................... 149
9.4.9 ANSYS ICEM CFD................................................................................................................. 149
9.4.10 FLUENT ............................................................................................................................. 149
9.4.11 COMSOL Multi-physics ..................................................................................................... 150
9.4.12 CFDRC ............................................................................................................................... 150
9.4.13 STAR-CD/STAR-CCM+ ....................................................................................................... 150
9.4.14 FLOW3D............................................................................................................................ 150
9.4.15 TACOMA ........................................................................................................................... 150
9.4.16 CONVERGE........................................................................................................................ 151
9.5 Symbolic Math Packages ................................................................................................................................ 151
9.5.1 Maxima ............................................................................................................................... 151
9.5.2 Mathematica ...................................................................................................................... 151
9.5.3 Maple ................................................................................................................................. 151
9.5.4 MatLab ............................................................................................................................... 151

List of Tables
Table 1 Comparison of iterative schemes ............................................................................................................... 36
Table 2 Differences in programming languages ................................................................................................... 41
Table 3 Explicit Discretization Methods .................................................................................................................. 85
Table 4 Implicit Discretization Methods.................................................................................................................. 86
Table 5 Choice of parameters ....................................................................................................................................... 86
Table 6 Classification of the Euler equation on different regimes ............................................................. 106
Table 7 Sequence of alternating spcial differencing for explicit MacCormack scheme .................... 122
Table 8 Decoupling strategy of Boundary Layer equations.......................................................................... 133
Table 9 An Overview of some commercially available CFD software ...................................................... 148
8

List of Figures
Figure 1 CFD application in various areas .............................................................................................................. 10
Figure 2 Qualitative aspects of flow over a supersonic blunt body shock................................................. 11
Figure 3 A simulation of the Hyper-X scramjet vehicle in operation at Mach 7 by NASA ................... 14
Figure 4 The design of a full flight envelope of an airplane ............................................................................. 15
Figure 5 Road Map ............................................................................................................................................................ 17
Figure 6 Domain and boundaries for the solution of hyperbolic equations (Steady) .......................... 20
Figure 7 Domain and boundaries for the solution of hyperbolic equations (unsteady) ..................... 21
Figure 8 Domain and boundaries for the solution of parabolic equations in two dimensions ......... 22
Figure 9 Domain and boundaries for the solution of elliptic equations in two dimensions .............. 22
Figure 10 Two-way interchange of information between Parabolic and Elliptic flows ...................... 23
Figure 11 Solution of linear Wave equation........................................................................................................... 24
Figure 12 Formulation of discontinuities in non-linear Burgers (wave) equation ............................... 25
Figure 13 Rate of Decay of solution to diffusion equation ............................................................................... 25
Figure 14 Solution to Laplace equation ................................................................................................................... 26
Figure 15 Solution to Poisson's equation ................................................................................................................ 27
Figure 16 Iteration Methods Path .............................................................................................................................. 35
Figure 17 SOR by line ...................................................................................................................................................... 37
Figure 18 ADI stencil for implicit method ................................................................................................................ 37
Figure 19 PDE Solvers ..................................................................................................................................................... 39
Figure 20 Contributions from other disciplines to CFD .................................................................................... 40
Figure 21 Linkage between CFD, Experimental & Analytical approach ..................................................... 41
Figure 22 2D representation of Sine function using MATLAB ....................................................................... 44
Figure 23 3D representation of a Sine function using MATLAB .................................................................... 45
Figure 24 Correlation between truncation error and order of accuracy ................................................... 47
Figure 25 Free Jet Flow profile for different order of accuracy ..................................................................... 47
Figure 26 1D stability analysis based on CFL number; (a) CFL < 1 Unstable; (b) CFL ≥ 1 Stable ... 48
Figure 27 Effects of Dissipation & Dispersion a) exact b) 1ST-order c) 2nd -order ......... 51
Figure 28 Effect of retaining TE terms ..................................................................................................................... 52
Figure 29 Correlation between CD and UD schemes for different (Pe) number .................................... 52
Figure 30 Ratio of Convection Vs Diffusion - Effect of (Pe) number ............................................................ 53
Figure 31 Spatial effects of (Pe) number on 1D flow.......................................................................................... 54
Figure 32 Illustration of Different Shape, Basis, and Blending Functions ................................................. 55
Figure 33 A mathematical model of a steady state heat sink. ......................................................................... 57
Figure 34 Basis functions sharing two triangular elements in 2D................................................................ 59
Figure 35 Finite element approximation of the temperature field in the heat sink .............................. 60
Figure 36 Partial sums of the Fourier series of a square wave ...................................................................... 65
Figure 37 Cell Centered and Node Centered .......................................................................................................... 67
Figure 38 Control Volume for spatial discretization of staggered grid vs collocated ........................... 68
Figure 39 Viscous & Inviscid Stencil for a 2nd order accurate MUSCL ......................................................... 70
Figure 40 Different Spatial Scheme ........................................................................................................................... 72
Figure 41 Transient Solution Procedure ................................................................................................................. 78
Figure 42 Transient Solution Sequences ................................................................................................................. 78
Figure 43 Vortex shedding behind a cylinder run wrongly as a Steady State.......................................... 79
Figure 44 Steady-State Force and Monitoring for a flow over a double sided membrane case ....... 80
Figure 45 Near wall velocity profile .......................................................................................................................... 81
Figure 46 Wall function relation in Boundary Layer.......................................................................................... 81
Figure 47 Segregated Solution ..................................................................................................................................... 83
Figure 48 Coupled Solutions......................................................................................................................................... 84
9

Figure 49 Available Solvers as available in Fluent .............................................................................................. 91


Figure 50 Solution Method for FFD ........................................................................................................................... 92
Figure 51 Comparing the Convergence Rates of the ILU-Preconditioned Newton-Krylov Method97
Figure 52 Multi gridding Cycles .................................................................................................................................. 99
Figure 53 Sequence of gridding in unstructured multigrid scheme........................................................ 100
Figure 54 Characteristics of Linear equation ..................................................................................................... 107
Figure 55 Characteristics of Nonlinear solution point (exaggerated)...................................................... 109
Figure 56 Coefficient of Pressure for a Shock..................................................................................................... 112
Figure 57 Cp Contours for a Rotor using Panel Method................................................................................ 117
Figure 58 Vorticity-Stream Function approach for 2D incompressible N-S equations .................... 125
Figure 59 SIMPLE procedure as applied to 2-D equation ............................................................................. 127
Figure 60 Schematic of 3D boundary Layer ........................................................................................................ 134
Figure 61 The Krause Zig-Zag scheme (a) difference tensile (b) continuity equation ...................... 135
Figure 62 Component of Uncertainty within a Simulation ........................................................................... 137
Figure 63 A typical CFD Simulation ........................................................................................................................ 143
Figure 64 Streamlined CFD Simulation Process ................................................................................................ 145
10

I Introduction

Computational fluid dynamics, usually abbreviated as CFD, is a branch of fluid mechanics that uses
numerical analysis and algorithms to solve and analyze problems that involve fluid flows. Computers
are used to perform the calculations required to simulate the interaction of liquids and gases with
surfaces defined by boundary conditions. With high-speed supercomputers, better solutions can be
achieved. Ongoing research yields software that improves the accuracy and speed of complex
simulation scenarios such as transonic or turbulent flows. Initial experimental validation of such
software is performed using a wind tunnel with the final validation coming in full-scale testing, e.g.
flight tests1.
In design and development, CFD programs are now considered to be standard numerical tools which
predict not only fluid flow behavior, but also the transfer of heat, mass (such as in perspiration or
dissolution), phase change (such as in freezing, melting or boiling), chemical reaction (such as
combustion or rusting), mechanical movement (such as an impeller turning, pistons, fans or rudders)
and stress or deformation of related solid structures (such as a mast bending in the wind).

Industrial Environmental Physiological


applications applications applications
•Aerospace •Atmospheric pollution •Cadiovascular flows
•Architecture •Climate calculations (heart, major vessels)
•Automotive •Fire in buildings •Flow in lungs and
•Biomedical •Oceanic flows breathing passages
•Chemical Process •Pollution of natural
•Combustion waters
•Electronics and •Safety
computers
•Food Processing
•Glass manufacturing
•HVAC (heat, ventilation
and cooling)
•Petroleum
•Power
•Marine
•Mechanical
•Metallurgical
•Nuclear
•Train design
•Turbo Machinery
•Water Treatment

Figure 1 CFD application in various areas

1 From Wikipedia.
11

Furthermore, CFD has been applied to deal with problems in environment and architecture. Figure
1 summarizes the scope of CFD application2.

I.1 Motivation by an Example


Imagine that you are an aeronautical engineer in the later 1950s. You have been given the task of
designing an atmospheric entry vehicle in those days it would have been an intercontinental ballistic
missile3. You are well aware of the fact that such vehicles will enter the earth’s atmosphere at very
high velocities, about 7.9 km/s for entry from earth orbit and about 11.2 km/s for entry after
returning from a lunar mission. At these extreme hypersonic speeds, aerodynamic heating of the
entry vehicle becomes very
severe, and is the dominant
concern in the design of such
vehicles. Therefore, you know
that your task involves the
design of a blunt body for
hypersonic speed. Moreover, you
know from supersonic wind
tunnel experiments that the flow
field over the blunt body is
qualitatively like that sketched in
Figure 2. You know that a strong
curved bow shock wave sits in
front of the blunt nose, detached
from the nose by the distance δ,
called the shock detachment
distance. You know that the gas
temperatures between the shock
and the body can be as high as
Figure 2 Qualitative aspects of flow over a supersonic blunt body
7000K for an ICBM, and 11000K
shock
for entry from a lunar mission.
And you know that you must understand some of the details of this flow field in order to intelligently
design the entry vehicle. So, your first logical step is to perform an analysis of the aerodynamic flow
over a blunt body in order to provide detailed information on the pressure and heat transfer
distributions over the body surface, and to examine the properties of the high-temperature shock
layer between the bow shock wave and the body. You ask such questions as: what is the shape of the
bow shock wave; what is the detachment distance δ; what are the velocity, temperature and pressure
distributions throughout the shock layer, etc.? However, much to your dismay, you find that no
reliable, accurate aerodynamic theory exists to answer your questions. You quickly discover that an
accurate and practical analysis of supersonic blunt body flows is beyond your current state-of-the-
art. As a result, you ultimately resort to empirical information along with some simplified but
approximate theories (such as Newtonian theory) in order to carry out your designated task of
designing the entry vehicle.
The above paragraph illustrates one of the most important, yet perplexing, aerodynamic problems of
the 1950s and early 1960s. The application of blunt bodies had become extremely important due to

2 Bin Xia, Da-Wen Sun, “Applications of computational fluid dynamics (CFD) in the food industry: a review”,
Computers and Electronics in Agriculture 34 (2002) 5–24.
3 John D. Anderson Jr., Joris Degroote, G´erard Degrez, Erik Dick, Roger Grundmann and Jan Vierendeels,

“Computational Fluid Dynamics - An Introduction”, 3rd Edition, ISBN: 978-3-540-85055-7, 2009.


12

the advent of ICBMs, and later the manned space program. Yet, no aerodynamic theory existed to
properly calculate the flow over such bodies. Indeed, entire sessions of technical meetings (such as
meetings of the Institute for Aeronautical Sciences in the USA, later to become the American Institute
for Aeronautics and Astronautics) were devoted exclusively to research on the supersonic blunt body
problem. Moreover, some of the best aerodynamicists of that day spent their time on this problem,
funded and strongly encouraged by the NACA (later NASA), the US Air Force and others. What was
causing the difficulty? Why was the flow field over a body moving at supersonic and hypersonic
speeds so hard to calculate? The answer rests basically in the sketch shown in Figure 2, which
illustrates the steady flow over a supersonic blunt body. The region of steady flow near the nose
region behind the shock is locally subsonic, and hence is governed by elliptic partial differential
equations. In contrast, the flow further downstream of the nose becomes supersonic, and this locally
steady supersonic flow is governed by hyperbolic partial differential equations. (What is meant by
‘elliptic’ and ‘hyperbolic’ equations, and the mathematical distinction between them, will be discussed
them later). The dividing line between the subsonic and supersonic regions is called the sonic line, as
sketched in Figure 2.
The change in the mathematical behavior of the governing equations from elliptic in the subsonic
region to hyperbolic in the supersonic region made a consistent mathematical analysis, which
included both regions, virtually impossible to obtain. Techniques were developed for just the
subsonic portion, and other techniques (such as the standard ‘method of characteristics’) were
developed for the supersonic region. Unfortunately, the proper patching of these different techniques
through the transonic region around the sonic line was extremely difficult. Hence, as late as the mid-
1960s, no uniformly valid aerodynamic technique existed to treat the entire flow field over the blunt
body. This situation was clearly noted in the classic textbook by Liepmann and Roshko4 published in
1957, where in a discussion of blunt body they state: The shock shape and detachment distance
cannot, at present, be theoretically predicted. The purpose of this lengthy discussion on the status
of the blunt body problem in the late 1950s is to set the background for the following important point.
In 1966, a breakthrough occurred in the blunt body problem. Using the developing power of
Computational Fluid Dynamics (CFD) at that time, and employing the concept of a ‘time-dependent’
approach to the steady state, Moretti and Abbett5 developed a numerical, finite-difference solution
to the supersonic blunt body problem which constituted the first practical, straightforward
engineering solution for this flow. After 1966, the blunt body problem was no longer a real problem.
Industry and government laboratories quickly adopted this computational technique for their blunt
body analyses. Perhaps the most striking aspect of this comparison is that the supersonic blunt body
problem, which was one of the most serious, most difficult, and most researched theoretical
aerodynamic problems of the 1950s and 1960s, is today assigned as a homework problem in a
computational fluid dynamics graduate course at the University of Maryland. Therein lies an example
of the power of Computational Fluid Dynamics (CFD). The purpose of these notes is to provide an
introduction to computational fluid dynamics. The above example concerning blunt body flows
serves to illustrate the importance of computational fluid dynamics to modern aerodynamic
applications. Here is an important problem which was impossible to solve in a practical fashion
before the advent of computational fluid dynamics (CFD), but which is now tractable and
straightforward using the modern techniques of CFD. Indeed, this is but one example out of many
where CFD is revolutionizing the world of aerodynamics. The purpose of the present author writing
these notes, and your reading these notes and attending the VKI short course, is to introduce you to
this revolution.

4Liepmann, H.W. and Roshko, A., “Elements of Gas dynamics”, Wiley, New York, 1957.
5 Moretti, G. and Abbett, M., ‘A
Time-Dependent Computational Method for Blunt Body Flows,’ AIAA Journal, Vol.
4, No. 12, December 1966, pp. 2136–2141.
13

I.2 CFD Processes

I.2.1 Partial Differential Equations (PDE)


PDEs are mathematical models of continuous physical phenomenon in which a dependent variable,
say u, is a function of more than one independent variable, say t (time), and x (spatial position). PDEs
derived by applying a physical principle such as conservation of mass, momentum or energy. These
equations, governing the kinematic and mechanical behavior of general bodies are referred to as
Conservation Laws. These laws can be written in either the strong of differential form or an integral
form.

I.2.2 Boundary Conditions


Conditions on the (finite) boundary of the domain and/or initial conditions (for transient problems)
are required to obtain for a well posed problem. The Well Posed Problems indicate that conditions on
the (finite) boundary of the domain and/or initial conditions (for transient problems) are required
to obtain a well posed problem. The properties of a well posed problem are:

1. Solution exists
2. Solution is unique
3. Solution depends continuously on the data

I.2.3 Math Modeling and Simulation of Physical Processes


Altogether, the CFD process can be lumped together as:

1. Define the physical problem


2. Create a mathematical (PDE) model
3. Systems of PDEs, ODEs, algebraic equations
4. Define Initial and or boundary conditions to get a well-posed problem
5. Create a Discrete (Numerical) Model
6. Discretize the domain, generate the grid and obtain discrete model
7. Solve the discrete system
8. Analyze Errors in the discrete system
9. Consistency, stability and convergence analysis

I.2.4 Verification, Validation and Calibration


Verification is a procedure to ensure that the program solves the equations correctly. Validation is
done to test how accurately the model represents reality, and calibration is often used to adjust the
simulation to known experimental data in order to study parameter sensitivity in the design process.

I.3 History and Success Stories


The fundamental basis of almost all CFD problems are the Navier–Stokes equations, which define
many single-phase (gas or liquid, but not both) fluid flows. These equations can be simplified by
removing terms describing viscous actions to yield the Euler equations. Further simplification, by
removing terms describing vorticity yields the full potential equations. Finally, for small
perturbations in subsonic and supersonic flows (not transonic or hypersonic) these equations can be
linearized to yield the linearized potential equations. Historically, methods were first developed to
solve the linearized potential equations. Two-dimensional (2D) methods, using conformal
transformations of the flow about a cylinder to the flow about an airfoil were developed in the 1930s6.
One of the earliest type of calculations resembling modern CFD are those by Lewis Fry Richardson,

6 Milne-Thomson, L.M. (1973), “Theoretical Aerodynamics”, Dover Publications. ISBN 0-486-61980-X.


14

in the sense that these calculations used finite differences and divided the physical space in cells.
Although they failed dramatically, these calculations, together with Richardson's book "Weather
prediction by numerical process", set the basis for modern CFD and numerical meteorology7.
The computer power available paced development of 3-D. Probably the first work using computers
to model fluid flow, as governed by the Navier-Stokes equations, was performed at Los Alamos
National Lab, in the T3 group8-9. This group was led by Francis H. Harlow, who is widely considered
as one of the pioneers of CFD. From 1957 to late 1960s, this group developed a variety of numerical
methods to simulate transient two-dimensional fluid flows, such as Particle-in-cell method, Fluid-in-
cell method10, Vorticity stream function method, and Marker-and-cell method. Fromm's vorticity-
stream-function method for 2D, transient, incompressible flow was the first treatment of strongly
contorting incompressible flows in the world. The first paper with three-dimensional model was
published by John Hess and A.M.O. Smith of Douglas Aircraft in 1967. This method discretized the

Figure 3 A simulation of the Hyper-X scramjet vehicle in operation at Mach 7 by NASA

surface of the geometry with panels, giving rise to this class of programs being called Panel Methods.
Their method itself was simplified, in that it did not include lifting flows and hence was mainly
applied to ship hulls and aircraft fuselages. The first lifting Panel Code (A230) was described in a

7 Hunt (1998). "Lewis Fry Richardson and his contributions to mathematics, meteorology, and models of conflict".
Annual Review of Fluid Mechanics.
8 "The Legacy of Group T-3". Retrieved March 13, 2013.
9 Harlow, F. H. (2004). "Fluid dynamics in Group T-3 Los Alamos National Laboratory:(LA-UR-03-3852)".

Journal of Computational Physics (Elsevier) 195 (2): 414–433.


10 Gentry, R. A., Martin, R. E., Daly, J. B. (1966). "An Eulerian differencing method for unsteady compressible

flow problems". Journal of Computational Physics 1 (1): 87–118.


15

paper written by Paul Rubbert and Gary Saaris of Boeing Aircraft11. In time, more advanced three-
dimensional Panel Codes were developed at Boeing (PANAIR, A502), Lockheed (Quadpan), Douglas
(HESS), McDonnell Aircraft (MACAERO), NASA (PMARC) and Analytical Methods (WBAERO, USAERO
and VSAERO). Some (PANAIR, HESS and MACAERO) were higher order codes, using higher order
distributions of surface singularities, while others (Quadpan, PMARC, USAERO and VSAERO) used
single singularities on each surface panel. The advantage of the lower order codes was that they ran
much faster on the computers of the time. Today, VSAERO has grown to be a multi-order code and is
the most widely used program of this class. It has been used in the development of many submarines,
surface ships, automobiles, helicopters, aircraft, and more recently wind turbines. Its sister code,
USAERO is an unsteady panel method that has also been used for modeling such things as high speed
trains and racing yachts. The NASA PMARC code from an early version of VSAERO and a derivative of

Figure 4 The design of a full flight envelope of an airplane

Rubbert, Paul and Saaris, Gary, "Review and Evaluation of a Three-Dimensional Lifting Potential Flow Analysis
11

Method for Arbitrary Configurations," AIAA paper 72-188, presented at the AIAA 10th Aerospace Sciences
Meeting, San Diego California, January 1972.
16

PMARC, named CMARC, is also commercially available. Figure 3 pictures the simulation of the Hyper-
X scramjet vehicle in operation at Mach 7 by NASA.
In the two-dimensional realm, a number of Panel Codes have been developed for airfoil analysis and
design. The codes typically have a boundary layer analysis included, so that viscous effects can be
modeled. Professor Richard Eppler of the University of Stuttgart developed the PROFILE code, partly
with NASA funding, which became available in the early 1980s. This was soon followed by MIT
Professor Mark Drela's XFOIL code. Both PROFILE and XFOIL incorporate two-dimensional panel
codes, with coupled boundary layer codes for airfoil analysis work. PROFILE uses a conformal
transformation method for inverse airfoil design, while XFOIL has both a conformal transformation
and an inverse panel method for airfoil design.
An intermediate step between Panel Codes and Full Potential codes were codes that used the
Transonic Small Disturbance equations. In particular, the three-dimensional WIBCO code, developed
by Charlie Boppe of Grumman Aircraft in the early 1980s has seen heavy use. Developers turned to
Full Potential codes, as panel methods could not calculate the non-linear flow present at transonic
speeds. The first description of a means of using the Full Potential equations was published by Earll
Murman and Julian Cole of Boeing in 1970. Antony Jameson, originally at Grumman Aircraft and the
Courant Institute of NYU, worked with David Caughey to develop the important three-dimensional
Full Potential code FLO22 in 1975. Many Full Potential codes emerged after this, culminating in
Boeing's Tranair (A633) code, which still sees heavy use.
The next step was the Euler equations, which promised to provide more accurate solutions of
transonic flows. The methodology used by Jameson in his 3-D code (1981) was used by others to
produce such programs as Lockheed's TEAM program and Analytical Methods' MGAERO program.
MGAERO is unique in being a structured Cartesian mesh code, while most other such codes use
structured body-fitted grids (with the exception of NASA's highly successful CART3D code,
Lockheed's SPLITFLOW code and Georgia Tech's NASCART-GT).
Antony Jameson also developed the three-dimensional AIRPLANE code which made use of
unstructured tetrahedral grids. In the two-dimensional realm, Mark Drela and Michael Giles, then
graduate students at MIT, developed the ISES Euler program (actually a suite of programs) for airfoil
design and analysis. This code first became available in 1986 and has been further developed to
design, analyze and optimize single or multi-element airfoils, as the MSES program. MSES sees wide
use throughout the world. A derivative of MSES, for the design and analysis of airfoils in a cascade, is
MISES, developed by Harold "Guppy" Youngren while he was a graduate student at MIT. The Navier–
Stokes equations were the ultimate target of development. Two-dimensional codes, such as NASA
Ames' ARC2D code first emerged. A number of 3D codes were developed (ARC3D, OVERFLOW, CFL3D
are three successful NASA contributions), leading to numerous commercial packages.

I.4 Advantages of using CFD


CFD has grown from a mathematical curiosity to become an essential tool in almost every branch of
fluid dynamics. It allows for a deep analysis of the fluid mechanics and local effects in a lot of
equipment. Most of the CFD results will give an improved performance, better reliability, more
confident scale-up, improved product consistency, and higher plant productivity. Some design
engineers actually use CFD to analyze new systems before deciding which and how many validation
tests need to be performed. The advantages of CFD can be categorized as (Wanot, 1996):

 It provides a detailed understanding of flow distribution, weight losses, mass and heat
transfer, particulate separation, etc. Consequently, all these will give plant managers a much
better and deeper understanding of what is happening in a particular process or system.
 It makes it possible to evaluate geometric changes with much less time and cost than would
be involved in laboratory testing.
17

 It can answer many ‘what if’ questions in a short time.


 It is able to reduce scale-up problems because the models are based on fundamental physics
and are scale independent.
 It is particularly useful in simulating conditions where it is not possible to take detailed
measurements such as high temperature or dangerous environment in an oven.
 Since it is a pro-active analysis and design tool, it can highlight the root cause not just the
effect when evaluating plant problems.

I.5 Vision for Further


But of course with advances comes shortcoming like the complaint by Dimitri Mavriplis12 which
seems valid. Chief among them are Lack of investment in new fundamental Algorithm Development,
lack of reliable Turbulence modeling, better collaboration between NASA, government agencies and
private companies, and Poorly positioned to exploit coming Exascale revolution in HPC. It criticizes
while in recent years the design cycle enjoyed considerable advances in isolated development such
as airplane wings, it lacks on the other arenas such as full flight envelope in airplane design. This

Navier Stokes
and Family
Viscous
Boundary
Layer
Steady State Incompressible Turbulent
Euler
Flow Field
Transient Compressible Laminar Velocity
Potentials

Invscid Laplace

Bernouli

Elementry
Flows

Figure 5 Road Map

might be contributed to either deficiency of robust algorithm and turbulence, or both. It also
contributed this to lack of Holy grail of product development, namely Certification. The envisioned
picture in regard to design of full flight of an airplane is shown Figure 4. Borrowing the concepts
from John D. Anderson’s book, we try to established a road map to help you keep track of our building
blocks. Figure 5 shows such a road map. Another point of view, expressed by Charles Hirsch,

12Dimitri Mavriplis, “Exascale Opportunities for Aerospace Engineering”, Department of Mechanical


Engineering University of Wyoming and the Vision CFD2030 Team.
18

indicates that there are key issues and major challenges for industrial CFD analysis and design13,
namely:

 To Create Automatic Structured Grid Generation Tools For Families of Topologies, For
Instance for Turbomachinery Passages.
 Efficient full automatic grid generation systems and flow solvers are to be developed further,
particularly for very complex geometries.
 The necessity for improvements in physical modeling, in particular turbulence and
combustion models.
 Fast, full parallel, CFD algorithms are required to reduce design cycle times (provided by
Exascale HPC).
 The development of robust design methodologies taking into account the presence of
uncertainties.
 Next generation of industrial software systems requires high levels of integration of pre and
post-processors, with CFD/CHT/FSI solvers within a global optimization environment, with
highly effective GUI’s to minimize the engineering time associated to simulations and design.

13Charles Hirsch, Prof. Em. Vrije Universiteit Brussel and President, NUMECA int. “The Challenges Of Present
And Future Industrial CFD”, AIAA-Scitech 2015.
19

1 PDE’s of Model Equations

1.1 Mathematical Character of Basic Equations


The general theory concerning the character of PDE has been developed based on following relation
where A, B, C, D, E, F are assumed to be function of (x, y) only for the time being; making Eq. (4.1)
linear in nature

 2  2  2  κ
A  B  C D  E  F  G(x, y) (4.1)
x 2
xy y 2
x y

It is found that character of Eq. (4.1) depends upon the sign of determinate function B2 - 4AC as the
flow dependencies for each case shown by solid line. In summary,
 2  2  2   2  2
 0  0  0
x 2 y 2 x 2 y x 2 y 2

B2- 4AC < 0 B2- 4AC = 0 B2- 4AC > 0

Elliptic Parabolic Hyperbolic


Boundary Value mixed initial and
initial value problem
problem Boundary value problem
complete contour boundary conditions must be specifying boundary
closed at one end but remain conditions at one end but
boundary specification open at other remain open at others

Laplace equation Heat conduction equation Wave equation

No real charateristics One real charateristics Two real charateristics

In reality, the viscous flow equations are simply too complicated to fit into a single mode. They can
be elliptic, parabolic, and hyperbolic or mixture of all three, depending to specific flow, geometry
and time dependencies. Some examples of these model equations will be dealt extensively later. For
example, the unsteady compressible N-S equations are a mixed set of hyperbolic-parabolic equations,
while, for 2-D unsteady incompressible N-S for x-momentum is mixed set of elliptic-parabolic-
hyperbolic equations as depicted below:

 Parabolic
 
u u u 1 p μ   u  u 
 2 2 u v
 u  v    ,  0 (4.2)
t x y ρ x ρ  x 2 y 2  x y
     
Hyperbolic Elliptic

Consequently, different numerical techniques must be used in to solve the N-S equations in
compressible and incompressible flow regions. Similarly the Euler equations governing an in-viscid,
20

non-heat conducting gas have a different character in different flow regions. If the time dependent
terms are retained, the resulting unsteady equations are hyperbolic and solutions can be obtained by
marching procedures. The situation is different when a steady flow is assumed. In that case, the Euler
equations are elliptic when flow is subsonic and hyperbolic when it is supersonic. It could be said
that Euler’s equation is hyperbolic in temporal domain and elliptic in special domain. Therefore,
different flow regions means different characteristics and demands different solving procedure. A
major difference between subsonic and supersonic flows is that flow disturbances propagate
everywhere throughout a subsonic flow; whereas they cannot propagate upstream in supersonic flow.

1.2 Behavior of the Different Classes of PDE


In this section we simply discuss, without proof, some of the behavior of hyperbolic, parabolic and
elliptic partial differential equations, and relate this behavior to the solution of problems in fluid
dynamics14. For more details on the characteristics of partial differential equations, see any good text
on advanced mathematics, such as [Hildebrand]15.

1.2.1 Hyperbolic Equations


For hyperbolic equations, information at a given point P influences only those regions between the
advancing characteristics. For example, examine Figure 7 (B), which is sketched for a two-
dimensional problem with two independent space variables. Point P is located at a given (x, y).
Consider the left and right-running characteristics through point P, as shown. Information at point P
influences only the shaded region the region labelled I between the two advancing characteristics
through P as demonstrated in Figure 7 (B). This has a direct effect on boundary conditions for
hyperbolic equations. Assume that the x-axis is a given boundary condition for the problem, i.e. the
dependent variables u and v are known along the x-axis. Then the solution can be obtained by
‘marching forward’ in the distance y, starting from the given boundary. However, the solution for u
and v at point P will depend only on that part of the boundary between a and b, as shown. Information
at point c, which is outside the interval ab, is propagated along characteristics through c, and

(A) 3D steady Flow (B) 2D Steady Flow

Figure 6 Domain and boundaries for the solution of hyperbolic equations (Steady)

14 John D. Anderson Jr., Joris Degroote, G´erard Degrez, Erik Dick, Roger Grundmann and Jan Vierendeels,
“Computational Fluid Dynamics - An Introduction”, 3rd Edition, ISBN: 978-3-540-85055-7, 2009.
15 Hildebrand, F.B., “Advanced Calculus for Applications”, Prentice-Hall, New Jersey, 1976.
21

influences only region II in Figure 6 (B). Point P is outside region II, and hence does not feel the
information from point c. For this reason, point P depends on only that part of the boundary which is
intercepted by and included between the two retreating characteristic lines through point P, i.e.
interval ab. As a general rule, in fluid dynamics, the following types of flows are governed by
hyperbolic partial differential equations, and hence exhibit the behavior described above:

1. Steady, inviscid supersonic flow


If the flow is 3-D, there are characteristic surfaces in xyz space, as sketched in Figure 6 (A).
Consider point P at a given (x, y, z) location. Information at P influences the shaded volume
within the advancing characteristic surface. In addition, if the x−y plane is a boundary surface,
then only that portion of the boundary shown as the cross-hatched area in the x−y plane,
intercepted by the retreating characteristic surface, has any effect on P. In Figure 6 (A) , the
dependent variables are solved by starting with data given in the xy-plane, and ‘marching’ in
the z-direction. For an inviscid supersonic flow problem, the general flow direction would
also be in the z-direction.

2. Unsteady inviscid compressible flow


For unsteady one and two-dimensional inviscid flows, the governing equations are
hyperbolic, no matter whether the flow is locally subsonic or supersonic. Here, time is the
marching direction. For one dimensional unsteady flow, consider a point P in the (x, t) plane
shown in Figure 6 (B). Once again, the region influenced by P is the shaded area between the
two advancing characteristics through P, and the interval ab is the only portion of the
boundary along the x-axis upon which the solution at P depends. For two-dimensional
unsteady flow, consider a point P in the (x, y, t) space as shown Figure 7 (B). The region
influenced by P, and the portion of the boundary in the xy-plane upon which the solution at P
depends, are shown in this figure. Starting with known initial data in the xy-plane, the solution
‘marches’ forward in time.

(A) 2D unsteady Flow

(B) 1D unsteedy Flow

Figure 7 Domain and boundaries for the solution of hyperbolic equations (unsteady)

1.2.2 Parabolic Equations


For parabolic equations, information at point P in the xy-plane influences the entire region of the
plane to one side of P. This is sketched in Figure 8 where the single characteristic line through point
P is drawn. Assume the x- and y-axes are boundaries; the solution at P depends on the boundary
conditions along the entire y axis, as well as on that portion of the x-axis from a to b. Solutions to
parabolic equations are also ‘marching’ solutions; starting with boundary conditions along both the
22

x- and y-axes, the flow-field solution is obtained by ‘marching’ in the general x-direction. In fluid
dynamics, there are reduced forms of the Navier–Stokes equations which exhibit parabolic-type
behavior. If the viscous stress terms involving
derivatives with respect to x are ignored in
these equations, we obtain the ‘parabolized’
Navier Stokes equations, which allows a
solution to march downstream in the x-
direction, starting with some prescribed data
along the x- and y-axes. A further reduction of
the Navier–Stokes equations for the case of
high Reynolds number leads to the well-
known boundary layer equations. These
boundary layer equations exhibit the parabolic
behavior shown in Figure 8.
Figure 8 Domain and boundaries for the solution
1.2.3 Elliptic Equations of parabolic equations in two dimensions
For elliptic equations, information at point P in
the xy-plane influences all other regions of the domain. This is sketched in Figure 9, which shows a
rectangular domain. Here, the domain is fully closed, surrounded by the closed boundary. This is in
contrast to the open domains for parabolic and hyperbolic equations discussed earlier. For elliptic
equations, because point P influences all points in
the domain, then in turn the solution at point P is
influenced by the entire closed boundary. Therefore,
the solution at point P must be carried out
simultaneously with the solution at all other points
in the domain. This is in stark contrast to the
‘marching’ solutions germane to parabolic and
hyperbolic equations. For this reason, problems
involving elliptic equations are frequently called
‘equilibrium’, or ‘jury’ problems, because the
solution within the domain depends on the total
boundary around the domain16. In fluid dynamics
steady, subsonic, inviscid flow is governed by elliptic
equations. As a sub-case, this also includes
incompressible flow (which theoretically implies Figure 9 Domain and boundaries for the
that the Mach number is zero). Hence, for such flows, solution of elliptic equations in two dimensions
physical boundary conditions must be applied over
a closed boundary that totally surrounds the flow, and the flow-field solution at all points in the flow
must be obtained simultaneously because the solution at one point influences the solution at all other
points.

1.2.4 Some Comments


At this stage it is instructive to return to our discussion of the inviscid flow over a supersonic blunt
body in particular to Figure 2. There we pointed out that the locally subsonic steady flow is governed
by elliptic partial differential equations, and that the locally supersonic steady flow is governed by
hyperbolic partial differential equations. Now we have a better understanding of what this means
mathematically; and because of the totally different mathematical behavior of elliptic and hyperbolic

16 Anderson, D.A., Tannehill, John C. and Pletcher, Richard H., Computational Fluid Mechanics and Heat Transfer,
McGraw-Hill, New York, 1984.
23

equations, we have a new appreciation for the difficulties that were encountered by early researchers
in trying to solve the blunt body problem. The sudden change in the nature of the governing equations
across the sonic line virtually excluded any practical solution of the steady flow blunt body problem
involving a uniform treatment of both the subsonic and supersonic regions.
However, recall that unsteady inviscid flow is governed by hyperbolic equations no matter whether
the flow is locally subsonic or supersonic. This provides the following opportunity. Starting with
rather arbitrary initial conditions for the flow field in the xy-plane in Figure 6 (B), solve the unsteady,
two-dimensional inviscid flow equations, marching forward in time as sketched in Figure 7 (A). At
large times, the solution approaches a steady state, where the time derivatives of the flow variables
approach zero. This steady state is the desired result, and what you have when you approach this
steady state is a solution for the entire flow field including both the subsonic and supersonic regions.
Moreover, this solution is obtained with the same, uniform method throughout the entire flow.
The above discussion gives the elementary philosophy of the time-dependent technique for the
solution of flow problems. Its practical numerical implementation by Moretti and Abbett17 in 1966
constituted the major scientific breakthrough for the solution of the supersonic blunt body problem
as discussed in Chapter 1. We will examine the actual, closed-form solution to some linear partial
differential equations of the elliptic, parabolic and hyperbolic types.

1.2.5 The 'Par-Elliptic' problem


An important practical use of the parabolic solution procedure is to refine an elliptic-flow solution of
the region outside the boundary layer. In this case it is from the elliptic-flow solution that the
pressure must be extracted: pressures for the
nearest-to-surface cells of the elliptic grid are
transferred to all the cells in the parabolic grid,
at the same z location. In general, because the
cells of the parabolic and elliptic grids are
likely to be of different sizes, as shown below,
interpolation is needed. The above sketch
contains a reminder that a two-way
interchange of information may take place
between the elliptic and parabolic calculations
(see Figure 10). Thus the elliptic calculation
may take place at first, with the assumption
that friction at the solid surfaces is absent. Its
predicted pressure distribution is for that
reason not quite correct. However the ensuing
parabolic calculation takes detailed account of Figure 10 Two-way interchange of information
between Parabolic and Elliptic flows
friction and can report the so-called
'displacement thickness' of the boundary
layer. If this is transmitted back to the elliptic solver, that can repeat its calculation on the assumption
that the effective size of the solid object is larger than it first supposed. Its second flow prediction will
be correspondingly more accurate18.

1.3 Nonsingular Transformation


Suppose a performed on Eq. (1.1) of the form (x, y) ⇾ (ξ, η). This means that x and y are transformed
into new independent variables ξ and η. We also require that this transformation be nonsingular

17 Moretti, G. and Abbett, M., ‘A Time-Dependent Computational Method for Blunt Body Flows,’ AIAA Journal, Vol.
4, No. 12, December 1966, pp. 2136–2141.
18 Parabolic Flows by “PHOENICS”.
24

which provides that a one to one relationship exists between (x, y) and (ξ, η)19. We are also assumed
of a nonsingular mapping provided that the Jacobian of Transformation is nonzero.

ξ ξ
 ( , ) x y
J   ξ x ηy  ξ y ηx  0 (4.3)
 (x, y) η η
x y

Therefore, any real nonsingular transformation does not change the type of PDE20.

1.4 Exact (Closed Form) Solution Methods to Model Equations


Since the exact solutions of Naver-Stokes , Boundary Layer, or Euler methods is not available yet, we
resort to model equation with reduced order to find a closed form solution. For example the viscous
Burger equation can be modelled as a reduced NS equation. The discussion here has centered on the
2nd order equation given by Wave Equation, Heat Equation, and Laplace Equation. In addition, system
of 1st order equations were examined. A number of other very important equations should be
mentioned since they govern common physical phenomena or they are used as simple models for
more complex problems. In many cases, exact analytical solutions for these equations exist.

1.2.1 Linear Wave Equation (1st Order)


The first and widely used is the 1st order linear u u
a 0
wave equation which governs the propagation of a t x
wave moving to the right at a constant speed a.
This is also called the advection equation and (see
Figure 11). A classic example of hyperbolic
equation also requires an initial condition, u(x, 0)
= u0(x). The question of what boundary conditions
are appropriate for this equation can be more
easily be answered after considering its solution.
It is easy to verify that the solution is given by u(x,
t) = u0(x − at). This describes the propagation of
the quantity u(x, t) moving with speed “a” in the x-
direction. The solution is constant along the
characteristic line x − at = c with u(x, t) = u0(c).
Figure 11 Solution of linear Wave equation
From the knowledge of the solution, we can
appreciate that for a > 0 a boundary condition
should be prescribed at x = 0, (e.g., u (0) = α0) where information is being fed into the solution domain.
The value of the solution at x = 1 is determined by the initial conditions or the boundary condition at
x = 0 and cannot, therefore, be prescribed. This simple argument shows that, in a hyperbolic problem,
the selection of appropriate conditions at a boundary point depends on the solution at that point. If
the velocity is negative, the previous treatment of the boundary conditions is reversed.

1.2.2 Inviscid Burgers Equation


This is also called non-linear 1st order wave equation and governs the propagation of nonlinear wave

19 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
20 Taylor, A., E., “Advanced Calculus”, Ginn and Company, Boston, 1955.
25

for 1-D case. An analogous analysis to that


used for the advection equation shows that u  2u
a 2 0
u(x, t) is constant if we are moving with a t x
local velocity also given by u(x, t). This
means that some regions of the solution
advance faster than other regions leading to
the formation of sharp gradients. This is
illustrated in Figure 12. The initial velocity
is represented by a triangular “zig-zag”
wave. Peaks and troughs in the solution will
advance, in opposite directions, with
maximum speed. This will eventually lead to
an overlap as depicted by the dotted line.
This also results in a non-uniqueness of the
solution which is obviously non-physical
and to resolve this problem we must allow
for the formation and propagation of
Figure 13 Rate of Decay of solution to diffusion equation
discontinuities when two characteristics
intersect.

1.2.3 Diffusion (Heat) Equation u u


u 0
Which is parabolic in nature and in addition to t x
appropriate boundary conditions of the form used u ( x, t )   Am e  mt sin k m x
for elliptic equations, we also require an initial m
condition at t = 0 of the form u(x, 0) = u0(x) where
u0 is a given function. If b is constant, this equation
admits solutions of the form u(x, t) = Aeβt sin kx if β
+ k2a = 0. A notable feature of the solution is that
it decays when b is positive as the exponent β < 0.
The rate of decay is a function of a. The more
diffusive the equation (i.e., larger a) the faster the
decay of the solution is. In general the solution can
be made up of many sine waves of different
frequencies, i.e., a Fourier expansion of the form

u ( x, t )   Ame  mt sin km x
m
Figure 12 Formulation of discontinuities in non-
linear Burgers (wave) equation
Where Am and km represent the amplitude and the
frequency of a Fourier mode, respectively. The
decay of the solution depends on the Fourier contents of the initial data since βm = −k2m b. High
frequencies decay at a faster rate than the low frequencies which physically means that the solution
is being smoothed. This is illustrated in Figure 13 which shows the time evolution of u(x, t) for an
initial condition u0(x) = 20x for 0 ≤ x ≤ 1/2 and u0(x) = 20(1 − x) for 1/2 ≤ x ≤ 1. The solution shows a
rapid smoothing of the slope discontinuity of the initial condition at x = 1/2. The presence of a positive
diffusion (a > 0) physically results in a smoothing of the solution which stabilizes it. On the other
hand, negative diffusion (a < 0) is de-stabilizing but most physical problems have positive diffusion.
26

1.2.4 Viscous Burgers Equation


This is the nonlinear equation with diffusion added. This particular form is very similar to the
equations of governing fluid flow and can be used as a simple nonlinear model for numeric.

u u  2u
u  υ 2 (4.4)
t x x
1  (2a 0  1)exp((1  a 0 )/ )
with solution u  where ξ  x  a 0 t  x 0
1  exp((1  a 0 )/ )

1.2.5 Tricomi Equation


This equation governs problems of the mixed type such as inviscid transonic flows. The properties of
Tricomi equations include a change of form from elliptic to hyperbolic character depending upon sign
of y.
2u 2u
y  0 (4.5)
x 2 y 2

1.2.6 2D Laplace Equation


The linear Elliptic 2D Laplace equation (see Figure 14) has following solutions

 2  2
 0 have a solution : (4.5.1)
 2 x y 2
2y
  xy ,   x 2  y 2 ,   ,   e kxsin(kx) k  constant ,   [0,1]
(1  x)  y
2 2

sinh(x) sin(y)  sinh(y) sin(x)



sinh( )

1.2.6.1 Boundary conditions


 2  2
The Dirichlet problem for Laplace's equation  0
consists of finding a solution φ on some domain D  2 x y 2
such that φ on the boundary of D is equal to some
given function. Since the Laplace operator appears
in the heat equation, one physical interpretation of
this problem is as follows: fix the temperature on
the boundary of the domain according to the given
specification of the boundary condition. Allow heat
to flow until a stationary state is reached in which
the temperature at each point on the domain doesn't
change anymore. The temperature distribution in
the interior will then be given by the solution to the
corresponding Dirichlet problem21. The Neumann
boundary conditions for Laplace's equation specify Figure 14 Solution to Laplace equation
not the function φ itself on the boundary of D, but its
normal derivative. Physically, this corresponds to the construction of a potential for a vector field

21 From Wikipedia, the free encyclopedia.


27

whose effect is known at the boundary of D alone.


Solutions of Laplace's equation are called harmonic  2u  2u
  f(x, y)  sin(π x) sin(π y)
functions; they are all analytic within the domain x 2 y 2
where the equation is satisfied. If any two functions
are solutions to Laplace's equation (or any linear sin( x ) sin( y )
u ( x, y ) 
homogeneous differential equation), their sum (or  2 2
any linear combination) is also a solution. This
property, called the principle of superposition, is very
useful, e.g., solutions to complex problems can be
constructed by summing simple solutions22-23.

1.2.7 Poisson’s Equation


This elliptic equation governs the temperature
distribution in the solid with heat source described
by f(x, y). Poisson’s equation (see Figure 15) also
determines the electric field in a region containing
a charge density f(x, y). The f(x, y) in this case is
sin(πx)Sin(πy) and the B.C. is u(x, y)=0 subject to 0
≤ x , 1 ≤ y, ux(0,y)=-sin(yπ)/2π. The solution is Figure 15 Solution to Poisson's equation
obtained in bottom of Figure 15.

1.2.8 The Advection-Diffusion Equation


This particular expression represents the advection of a quantity ξ in a region with velocity u. The
quantity υ is a diffusion or viscosity coefficient and a is a constant > 0.

   2
a  2 (4.6)
t x x
 (x, t)  exp( kxt) sin(kx  at) where k  constant and  (x)  sin(kx)   [0,1]

1.2.9 The Korteweg-De Vries Equation


The motion of nonlinear dispersive wave is governed by this example.

u u  3 u
u  0 (4.7)
t x x 3
1.2.10 Helmholtz Equation
This equation governs the motion of time dependent harmonic waves where k is a frequency
parameter. Application includes the propagation of acoustics waves.

 2u  2u
 2  k 2u  0 (4.8)
x 2
y

1.2.11 Summary List of Exact Solution Methods


The solution is obtained from the list provided below. This list by no means exclusive and many more

22 Hazewinkel, Michiel, ed. (2001), "Laplace equation", Encyclopedia of Mathematics, Springer, ISBN 978-1-
55608-010-4.
23 Example initial-boundary value problems using Laplace's equation from exampleproblems.com.
28

exists in literature.

1. Method of Characteristics
2. Shock Capturing Methods
3. Similarity Solutions
4. SCM (Split Coefficient Method)
5. Methods for solving Potential Equation
6. Methods for solving Laplace equation
7. Separation of Variable
8. Complex Variables
9. Superposition of Non-Linear Equation
10. Transformation of Variables
11. Manufacturing Solutions
29

2 Solving System of Linear Algebraic Equation


2.1 Eigenvalues and Eigenvectors
Before we attend the next section about the solution of model PDE’s, we better familiar ourselves
with the concept of Eigenvalues and Eigenvectors because they play an essential rule in solving the
PDE’s. In linear algebra, an eigenvector or characteristic vector of a linear transformation is a non-
zero vector that does not change its direction when that linear transformation is applied to it. In other
words, if v is a vector that is not the zero vector, then it is an eigenvector of a linear transformation
T if T (v) is a scalar multiple of v. This condition can be written as the equation:

T(v)  λv (4.9)

Where λ is a scalar known as the eigenvalue or characteristic value associated with the eigenvector
v. If the linear transformation [T] is expressed as a square matrix [A] then the equation can be
expressed as the matrix multiplication:

Ax  λx (4.10)

Where x is a column vector. There is a correspondence between n by n square matrices and linear
transformations from an n-dimensional vector space to itself. For this reason, it is equivalent to define
eigenvalues and eigenvectors using either the language of matrices or the language of linear
transformations. Geometrically, an eigenvector corresponding to a real, nonzero eigenvalue points
in a direction that is stretched by the transformation and the eigenvalue is the factor by which it is
stretched. If the eigenvalue is negative, the direction is reversed. The hyperbolic equations have a
both positive distingue eigenvectors, parabolic has one, while the elliptic has complex one.

a11  λ a12 .... a1n   x1   0 


 a .... a 2n  x   0 
 21 a 22  λ  2    or ( A  λI) x  0 (4.11)
 .... .... .... ....  ....  ....
     
 a n1 a n2 .... a nn  λ  x n   0 
Where I is the identity matrix. As shown in Cramer's rule, a linear system of equations has nontrivial
solutions if the determinant vanishes, so the solutions of equation (4.11) are given by

( A  λI)  0 or (1 -  )(2 -  ) ...... (n -  )  0 (4.12)

Each λi may be real but in general is a complex number. The numbers λ1, λ2…. λn, which may not all
have distinct values, are roots of the polynomial and are the eigenvalues of A. This equation is known
as the characteristic equation of A, and the left-hand side is known as the characteristic polynomial.

2.3.1 Eigenvalues Calculation


The eigenvalues of a matrix [A] can be determined by finding the roots of the characteristic
polynomial. Explicit algebraic formulas for the roots of a polynomial exist only if the degree n is 4 or
less. According to the Abel–Ruffini theorem there is no general, explicit and exact algebraic formula
30

for the roots of a polynomial with degree 5 or more. It turns out that any polynomial with degree n is
the characteristic polynomial of some companion matrix of order n. Therefore, for matrices of order
5 or more, the eigenvalues and eigenvectors cannot be obtained by an explicit algebraic formula, and
must therefore be computed by approximate numerical methods. In theory, the coefficients of the
characteristic polynomial can be computed exactly, since they are sums of products of matrix
elements; and there are algorithms that can find all the roots of a polynomial of arbitrary degree to
any required accuracy. However, this approach is not viable in practice because the coefficients
would be contaminated by unavoidable round-off errors, and the roots of a polynomial can be an
extremely sensitive function of the coefficients24.

2.3.1.1 Eigenvector Calculation


The eigenvalues must be determined first. Once these are known, the corresponding eigenvectors
can be calculated directly from the linear system. It should be noted that if vector v is an eigenvector.

( A  λI) v  0 (4.13)

2.3.1.2 Right and Left Eigenvectors


Given an eigenvalue λ, The eigenvector r that satisfies [A]r = λr is sometimes called a (right)
eigenvector for the matrix [A] corresponding to the eigenvalue λ. If λ1, λ2, ..., λr are the eigenvalues and
r1, r2, ..., rr are the corresponding right eigenvectors, then is easy to see that the set of right
eigenvectors form a basis of a vector space. If this vector space is of dimension n, then we can
construct an n × n matrix [R] whose columns are the components of the right eigenvectors, which has
the property that [A][R] = [R][Λ] where [Λ] is the diagonal matrix whose diagonal elements are the
eigenvalues as shown in Eq. (4.14). By appropriate numbering of the eigenvalues and eigenvectors,

1 0 0 .... 0
0  0 .... 0 
 2

[ Λ ]   0 0 3 .... 0 (4.14)
 
.... .... .... .... ....
 0 0 0 ....  n 

it is possible to arrange the columns of the matrix [R] so that λ1 ≥ λ2 ≥ … ≥ λn. In the same spirite, If
this vector space is of dimension n, then we can construct an n × n matrix [L] whose rows are the
components of the left eigenvectors, which has the property that [L][A] = [Λ][L]. This is easily done
if we define [L ] = [R]−1 and define the components of the left eigenvectors to be the elements of the
respective rows of [L]. Beginning with [A][R] = [R][Λ] and multiplying both sides on the left by [R]−1,
we obtain [R]−1[A][R] = [Λ] and multiplying on the right by [R]−1, we have [R]−1[A] = [Λ][R]−1 which
implies that any row of [R]−1 satisfies the properties of a left eigenvector25 or [L][A][R]=[Λ].

2.3.1.3 Diagonalization of a Matrix


Given an n by n matrix [A], we say that [A] is diagonalizable if there is a matrix [X] so that [X]−1[A][X]
= [Λ]. It is clear from the above discussions that if all the eigenvalues are real and district, then we
can use them as matrix of right eigenvectors [R] instead of [X].

24From Wikipedia, the free encyclopedia.


25Kenneth I. Joy, “Eigenvalues and Eigenvectors”, Visualization and Graphics Research Group Department of
Computer Science University of California, Davis.
31

2.3.1.4 Case Study 1 - Eigenvalues and Eigenvectors of 3D Euler Equation


The Eigen system/eigenvalues and eigenvectors of the Euler equations of inviscid flow form the basis
of total variation diminishing (TVD) algorithms in computational fluid dynamics (CFD)26. Whether
the conservation equations are solved in a finite difference or finite volume format, the matrices of
right and left eigenvectors that can be found in the literature are generally decomposed along the
directions of a global (x, y, z) or local (ξ, η, ζ) coordinate system. Such matrix decomposition, however,
is not necessary. The eigenvalues and eigenvector matrix of 3D inviscid flow can be expressed along
any given direction, e.g. through a unit vector (nx, ny, nz) normal to a surface. The resulting expression
is relatively simple and allows for more efficient code implementation in finite volume solvers.

2.3.1.5 Governing Equations


The 3D unsteady Euler equations of inviscid flow, a system of integral conservation equations for
mass, momentum, and energy, can be written in vector notation as the sum of a volume and surface
integral,
 ρ   ρv n 
 ρu   ρuv  pn 
    n x 


t CV
Q dV   F dA  0 where Q   ρv 
 
, F   ρvv n  pny 
 
 ρw  ρwvn  pnz 
CS

ρe 0   ρh 0 v n 

v n  v.n̂  un x  vn y  wn z , n 2x  n 2y  n 2z  1

e0  e  ek , h 0  h  ek , ek 
2

1 2
u  v2  w 2 

with ek being the kinetic energy per unit mass. Static energy, enthalpy, and pressure can all be
expressed in terms of the local speed of sound a , a function of temperature, and the ratio of specific
heats γ,
a2 a2 ρa 2 cp
e , h , p , a 2  γRT , λ  (.)
γ(γ  1) (γ  1) γ cv

2.3.1.6 Transformation Matrix


The first step in determining the Eigen system of the above conservation equations is to derive the
corresponding Jacobian or transformation matrix, which can be found by taking partial derivatives
of the flux

 0 nx ny nz 0 
 (γ  1)e n  uv v n (γ  2)un x un y  (γ  1)vn x un z  (γ  1)wn x (γ  1)n x 
F 
k x n

A 
 (γ  1)e k n y  vv n vn x (γ  1)un y v n  (γ  2)vn y vn z  (γ  1)wn y (γ  1)n y 
Q  
(γ  1)e k n z  wvn wn x (γ  1)un z wv y  (γ  1)vn y v n  (γ  2)wn z (γ  1)n z 
[(γ  1)e k  h 0 ]v n h 0 n x (γ  1)uv n h 0 n y  (γ  1)vn y h 0 n z  (γ  1)wn n γ v n 

We can now rewrite the Euler equations in the format of a general wave equation,

26 Axel Rohde, “Eigenvalues and Eigenvectors Of The Euler Equations In General Geometries”, AIAA 2001-2609.
32


 Q dV  CS F(Q) dA  0
t CV
where F(Q)  [ A] Q

The transformation matrix [A] can be interpreted as a wave speed with local and directional
dependence for a nonlinear multi-dimensional wave. The multidimensional character is really
twofold: (1) we are working in a 3D flow field, where waves can travel in any direction; (2) there are
different types of waves, all traveling at their own characteristic speeds, which are determined by the
eigenvalues of the matrix [A]. The eigenvalues of the transformation matrix [A] are the roots λ of the
characteristic equation,

det (A - λI)  0

where [I] is the identity matrix. It turns out that three eigenvalues are distinct and two are repeated

λ  v n , v n , v n , v n  a , v n - a a is speed of sound

where the left and right eigenvector of A is provided in27. Choosing the first set of eigenvectors, both
left and right, the matrix of right eigenvectors for 2-D flow is obtained after eliminating the fourth
row and fifth column from the general result, whereas the left eigenvector matrix is found by deleting
the fifth row and fourth column from its original 5x5 matrix. It is interesting to note that after
applying the above 2-D definitions, the singularities in the last row of the new 4x4 left eigenvector
matrix disappear. It was demonstrated earlier that two of the five right eigenvectors form a 2-
dimensional subspace, within the general 5-dimensional space spanned by all right eigenvectors, and
that every member of this subspace is itself an eigenvector. This phenomenon was attributed to the
fact that their corresponding eigenvalues are repeated, which creates a “symmetry” within the
eigenvector space. Although it may seem difficult to visualize any symmetry within a 5-dimensional
vector space, part of this symmetry reveals itself when we geometrically interpret the 2-dimensional
subspace as a plane. The Euler equations contain three types, or families of waves, one for every
distinct eigenvalue. Each family of waves carries a different signal. The waves traveling at the speed
of the flow (vn) are called entropy waves, their signal being entropy, whereas waves traveling at the
speed of sound relative to the flow (vn +_ a) are called acoustic waves. Unfortunately, the signal
carried by acoustic waves is not quantifiable in simple thermodynamic terms, but let us just say that
they carry acoustic information28.

2.3.2 Case Study 2 – Non-Reflecting Boundary Condition in 2D


2.3.2.1 Background
When calculating a numerical solution to an unsteady, hyperbolic, partial differential equation on an
infinite domain, it is normal to perform the calculation on a truncated finite domain. This raises the
problem of choosing appropriate boundary conditions for this far-field boundary. Ideally, these
should prevent any non-physical reflections of the outgoing waves, and should be straightforward to
implement numerically. Also, they must produce a well-posed analytic problem since this is a basic
requirement for the corresponding numerical approximation to be consistent and stable. Here the
aim is at turbomachinery flows. In some ways, these flows are more complex than the flow past
isolated airfoils. Wherever the far-field boundary for isolated airfoils can be many chords away from
airfoils, with turbomachinery the far-field can be typically less than one chord away from the blade.

27 Axel Rohde, “Eigenvalues and Eigenvectors Of The Euler Equations In General Geometries”, AIAA 2001-2609.
28 See previous.
33

Consequently, whereas for isolated airfoils the steady-state far-field can be modeled as a vortex
correction to the free stream flow, in turbomachinery the far-field contains a significant component
of several different spatial wavenumbers. This is particularly true for flows which are supersonic in
the flow direction but subsonic in axial direction, in which case shocks propagate indefinitely and can
be reflected by improper boundary conditions. Thus, one of the two aims here to correct formulation
of steady-state non-reflecting boundary conditions which will not produce artificial reflections of
steady waves such as shocks29. The other objective is the formulation of accurate non-reflecting
boundary conditions for unsteady waves. Here again isolated airfoils generally have few issues. The
reason is that the primary concern for isolated airfoils is unsteady flow caused by either airfoils
motion (Airfoil flutter) or a fluid dynamics instability (transonic buzz or install). In either case the
unsteadiness originates in the vicinity of the airfoil and radiates outward. Typically the grids on
which such calculations are tend to perfumed becoming progressively coarser as the waves moves
outwards toward the far field boundary, until a radius is reached at which the wavelength of the
unsteady wave is of the order of a few mesh cells. At this point the numerical viscosity will dissipate
the wave and so the unsteadiness will not reach the far-field boundary and accurate non-reflecting
boundary conditions are unnecessary. One of the main concerns in turbomachinery is the
unsteadiness caused by incoming shock waves and wakes from upstream blade rows. The need to
retain an accurate representation of these incoming waves’ represents the use of coarser grids in the
far-field, an instead one must concentrates on accurate non-reflecting boundary conditions.
Unsteady flows can be split into two classes, nonlinear and linear, depending on the amplitude of the
unsteadiness. If the amplitude is sufficiently small that the disturbance everywhere can be
considered to be linear perturbations to a steady flow, then by the principal of superposition the
solution can be decomposed into a sum of modes with different temporal frequencies and different
inter-blade phase angles. Each of these modes can be analyzed separately and so the problem is
reduced to finding the complex amplitude of the harmonic disturbance. This can be achieved be
either a direct method or a pseudo-time marching method, in either case, there is a need for accurate
boundary condition, and it is found that because there is only a single frequency it is possible to
construct the ext. non-reflecting boundary conditions. In nonlinear unsteady flow there are regions
where the amplitude of the unsteadiness is great enough for a second order effects to become
extremely important. This produces a coupling between the different frequencies, and so they cannot
be separated. In the far-field however it is again assumed that the unsteadiness amplitude are small
so that linear theory can be applied. It is no longer possible to construct exact non-reflecting
boundary conditions which can be implemented numerically, but approximate boundary conditions
can be derived instead.

2.3.2.2 General Fourier Analysis and Eigenvectors


Consider the following general unsteady, two dimensional, hyperbolic PDE,

U U U
A B 0 (4.15)
t x y

Where U is an n-component vector, A and B are constant NxN matrices. Fourier analysis considers
wave like solutions of the form

U(x, y,t)  u ei(kx lyωt) (4.16)

Substituting this into the PDE, results in

29 M. Giles, “Non-Reflecting Boundary Conditions for the Euler Equations”, CFDL-TR-88-1, Feb. 1988.
34

(ωI  kA  lB) u  0 or det(ωI  kA  lB)  0 (4.17)

This is called the dispersion relation and is a polynomial of degree N in each ω, k, and l. The right
eigenvectors requires that

(ωI  kA  lB)u R  u L (ωI  kA  lB)  0 (4.18)

Where uR and uL are right and left eigenvectors of (kA+lB) with eigenvalues ω. By pre-multiplying
Eq. (7.28) by A-1 the left eigenvectors we obtain

uL (ωA 1  kI  lA 1B)  v L A 1 (ωI  kA  lB)  0 (4.19)

From above relation it is obvious that uL is equivalent to vLA-1 and uR is right eigenvector of –k also.
The difference between two sets of left eigenvectors lies in their orthogonality relation with the right
eigenvectors. Since uL is the left eigenvector of (kA+lB), it is orthogonal to the all of the right
eigenvectors of the same matrix except for the ones with the same eigenvalue ω. The key point here
is that the orthogonality for the same k and l but different ω. Thus if ωn and ωm are two different roots
of the dispersion equation for the same values of k and l, then

v L (ωn , k,l ) u R (ωm , k,l )  0 (4.20)

Normally in discussing wave motion one is concerned with propagation on an infinite domain, and
so usually one considers a group of waves with the same k and l and different ω. In that case uR and
uL would be relevant right and left eigenvectors. In analyzing boundary conditions however, a general
solution U at the boundary x=0 can be decomposed into sum of Fourier modes with different values
of ω and l. Each of these modes is then a collection of waves with the same value of ω and l and
different
v L (ω, kn , l ) u R (ω, km , l )  0 (4.21)

2.4 Direct Methods for Solving Systems of Linear Algebraic Equations


The full description of these methods are provided in details in30. Here, a brief overview are given for
familiarizing the user and as depicted in Figure 19.

2.4.1 Cramer’s Rule


This is one of the most elementary methods used. Unfortunately the algorithm is immensely time
consuming. The number of operations being approximately proportional to (N+1)! Where there are
N unknowns. Therefore, Cramer’s rule should be avoided.

2.4.2 Gaussian Elimination


This is very useful and efficient tool for solving systems of algebraic equations, particularly for special
cases of tridiagonal systems. However, the method is not as fast as some others. Approximately, N 3
multiplication are required in solving N equations. Also, round-off errors which can be accumulate
through the many algebraic operation when N is large. Rearranging the equations to extend possible

30Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
35

in order to put the coefficients of the largest on the main diagonal (pivoting) will tend to improve
accuracy. The main objective is to transform the system to upper triangle array by eliminating some
of unknowns.

2.4.3 Thomas Algorithm


Referring the tridiagonal matrix of coefficients, the system is put into an upper triangle form. Some
flexibility exists in the way in which boundary conditions are handled.

2.4.4 Advanced-Direct Methods


Direct methods for systems of algebraic equations which are faster than Gaussian elimination exists.
Unfortunately, none of these methods are general. That is, they are applicable only special class of
equations and associated boundary conditions. Many of these Methods are “field size” limits.
Examples of these are “Error Vector Propagation (EVP), and “Odd-Even Reduction” methods. Clearly,
the fast direct methods should be considered for the problem where overriding consideration is
expected to be CPU time. Again these algorithms are complex and limited.

2.5 Iterative Methods for Solving Systems of Linear Algebraic Equations

This class of methods is referred as “Relaxation


Methods”. It may be further broken into point or
Explicit iterative, and block or Implicit iterative
methods31. The implementation of an elliptic equation
like Laplace Equation can be best suited for this
purpose. While iterative methods can sometimes be
viewed as integration in time, the fact that we are only
interested in the “steady-state” solution allows us to
take “short cuts” to get there as fast as possible as
shown in Figure 16.

2.5.1 Jacobi Method


The Jacobi method is a method of solving a matrix Figure 16 Iteration Methods Path
equation on a matrix that has no zeros along its main
diagonal [Bronshtein & Semendyayev]32. Each diagonal element is solved for, and an approximate
value plugged in. The process is then iterated until it converges. This algorithm is a stripped-down
version of the Jacobi transformation method of matrix diagonalization. The Jacobi method is easily
derived by examining each of the n equations in the linear system of equations Ax=b in isolation. If,
in the i-th equation

n
bi   a ij x kj 1
a x
j1
ij j  bi  x ik 
j i

a ii
(4.22)

Solve for the value of xi while assuming the other entries of x remain fixed.

31See previous.
32 Bronshtein, I.
N. and Semendyayev, K. A.,”Handbook of Mathematics “, 3rd ed. New York: Springer-Verlag, p. 892,
1997.
36

2.5.2 Gauss-Seidel iteration


Among the many iteration schemes available, Gauss-Seidel in one of the most efficient and useful
point-iterative procedure for large system of equations. The method is extremely simple but
converges under certain conditions related to “diagonal dominance” of the coefficients matrix.
Fortunately, the differencing of many steady-state conservation statements provide this diagonal
dominance. The method uses explicit use of the sparseness of matrix coefficients. A sufficient
condition for convergence of GS procedure is

n
a ii   a ij (4.23)
j1
ji

The simplicity of the procedure will be demonstrated below,

 Make initial guess of all unknowns (except one).


 Solve each equation for the unknowns whose coefficients are largest in magnitude using
guessed value initially, and the most recent it computed value thereafter.
 Repeat iteratively until changes in unknown becomes small (x = xcalculated + error).

Finally, for a general system of equations, the multiplications per iteration could be as great as N2 but
could be much less if matrix is spares.

2.5.3 Successive Over-Relaxation (SOR)


Successive Over-Relaxation (SOR) is a technique which can be used to accelerate any iterative
procedure, chief among them Gauss Seidel method. As we apply Gauss-Seidel iteration to a system
of equations, we expect to make several recalculations or iterations before convergence to the
acceptable level. Why not go head and make a correction before the next iteration, hopefully,
accelerating the convergence. According to the form:

n 1*

u i, j  u i,n j  ω u i,n j 1  u i,n j
* *
 (4.24)
n  iteration level , u i,n j 1  the most recent value , u i,n j  value from previous iteration
*

u i,n j 1  newly adjusted and 1 ω  2


*

Where ω is the relaxation parameter and when 1 < ω < 2, over-relaxation is being employed. In some
problems under-relaxation 0 < ω < 1 is appears to be most appropriate when the convergence is
taking oscillatory pattern tends to over-
shoot the final solution. As a comparison Iterative Method Number of iterations
on convergence for the 2-D Laplace Jacobi 1989
equation with Dirichlet boundary Gauss-Seidel 986
conditions on, been made by (Grétar SOR 91
Tryggvason - 2013) and the results are Table 1 Comparison of iterative schemes
for average absolute error (0.001) is
presented in Table 1.
37

2.5.4 SOR by Line


Although this procedure is workable with almost any iterative schemes, it make the most sense to
work with Gauss-Seidel method with SOR. We can chose
either rows or columns for grouping with equal ease. In
the SOR by line, one iterative cycle is completed when the
tridiagonal inversion has been applied to all the rows.
The process then repeated until convergence is achieved.
The improved convergence rate observed for block-
iterative methods compared with point-iterative
methods might be due to greater influence by boundary
values. Where ω is the relaxation parameter and when 1
< ω < 2, over-relaxation is being employed. In some
problems under-relaxation 0 < ω < 1 is appears to be most Figure 17 SOR by line
appropriate when the convergence is taking oscillatory
pattern tens to over-shoot the final solution. The final results, shown in Figure 17, will be

u i,n j 1  (1  ω)u i,n j 


ω
2(1  β )
2
 
u in1,1 j  u in1,1 j  β 2 u i,n j1  u i,n j11  (4.25)

Where n denotes the iteration level, i, j, are represents rows and columns. Thomas Algorithm can be
used to sweep by rows and then advances to the next row. β = Δx/Δy is the grid aspect ratio and ω ≤
(1+β) in order to ensures the diagonal dominance.

2.5.5 Block-Iterative Methods


The Gauss-Seidel iteration method with SOR stands as the best all-around method for finite-
difference solution of elliptic equation. The number of iterations can be usually reduced even further
by use of block-iterative concepts, but number of algebraic operations required per iterative cycle
generally increase. In block iterative group, subgroups of the unknown are singled out and their value
modified simultaneously by obtaining a solution to the simultaneous algebraic equations be
eliminating method. Thus, the block iterative have an implicit nature and sometimes called implicit-
iterative method. The simplest block procedure is SOR by line.

2.5.6 ADI Methods


The SOR by lines proceeds by taking all
the lines in the same direction in a
repetitive manner. The convergence rate
often improved by following the
sequence by rows by a second sequence
in the column. Thus the complete
iteration cycle would consists of a sweep
over all rows followed sweeps over the
columns. The procedure best illustrated
in Figure 18. In numerical analysis, the
Alternating Direction Implicit (ADI)
method is a finite difference method for
solving parabolic, hyperbolic and elliptic
partial differential equations. It is most
notably used to solve the problem of heat
conduction or solving the diffusion Figure 18 ADI stencil for implicit method
38

equation in two or more dimensions. It is an example of an operator splitting method. This method
results in a very complicated set of equations in multiple dimensions, which are costly to solve. The
advantage of the ADI method is that the equations that have to be solved in each step have a simpler
structure and can be solved efficiently with the tridiagonal matrix algorithm. Alternatively, we could
include the over-relaxation as part of row and column sweeps in two steps as:

Step1: u i,n j 1/2  (1  ω)u i,n j 


ω
2(1  β )
2

u in1,1/2j  u in1,1/2j  β 2 u i,n j1  u i,n j1/2
1   (4.26)

Step2 : u i,n j 1  (1  ω)u i,n j 1/2 


ω
2(1  β )
2
 
u in1,1/2j  u in1,1 j  β 2 u i,n j11  u i,n j11 

To preserve the diagonal dominance in Thomas Algorithm we require that ω ≤ (1+β2) in the sweep
by row and ω ≤ (1+β2)/β2 in the sweep by column.

2.5.7 Strongly–Implicit Methods


Another type of block-iterative procedure has been gaining favor as an efficient method for solving
the system of equations, arising from elliptic PDE. To illustrate,

[ A]u  C (4.27)

Where [A] is the relatively sparse matrix of unknown coefficients, u is the column vector of unknown,
and C is a column vectors on known quantities. The objective is to replace the sparse matrix [A] by a
modified matrix [A+P] which can be decomposed into an upper and lower triangle matrices [U] and
[L]. An iterative procedure is defined by

A  P u n 1  C  P u n or LU u n 1  C  P u n (4.28)


Define : V n 1  U u n 1
Step1 : L V n 1  C  P  u n Step2 : U u n 1  V n 1

Which is repeated iteratively. Step 1 consists simply of a forward substation. This is followed by the
backward substitution of Step 2.

2.5.8 Advanced iterative methods - Krylov Methods


There are more advanced iterative methods, chief among them are Conjugate Gradient (CG), Minimal
Residual (MINRES), Generalized Minimal Residual (GMRES), and many others. Many methods work
only for symmetric systems. While the pressure equation is usually symmetric, implicit methods
usually do not lead to symmetric matrices. Usually the system is preconditioned to make it better
behaved33. Generally iterative methods generate a sequence of approximations that are used to
construct a new approximation. Ideally, we only need to keep a few approximations, but one of the
more popular technique, GMRES, requires all the previous iterates. This leads to the restarted
GMRES. At the present time there does not seem to be a “best” Krylov method. In addition to the
relatively simple early methods like the conjugate gradient method, GMRES is fairly popular
(particularly the restarted version) and BiCGSTAB has been used by a number of people. A large
number of pre-written software packages for the solution of elliptic equations is available on-line.

33 Grétar Tryggvason, “Numerical Methods for Elliptic Equations-III”, lecture slides, spring 2013.
39

Figure 19 PDE Solvers


40

3 Basic CFD (I)


3.1 General Remarks
With the advent of Computational Fluid Dynamics (CFD) in recent decades, it has become an
important tool in dealing with complex issues on different disciplines and engineering applications.
It’s relatively low cost, in relation to experimental data, and the limited availability of theoretical
(analytical) data, made it an integral part of design and analysis loops. More importantly, it is
CFD
relatively easy to adapt to new challenges and problems. Although in the beginning it was only used
by limited number of researches and academics in aeronautical and astronautics, today it is an
integral tool for wide variety of applications. But it is still considered somewhat and art and science,
and in some circles, it is recommended
strongly to be used in conjunction with
experimental data, if available.
Moreover, it is also recommended to be
validated with a simplified and sub-set
of theoretical results, whenever
available. These colorations, known as CFD
Verification & Validation are among an
intensive on-going research in CFD field.
Although there are numerous
definitions on CFD, all excellent in their CFD
own rights, the simplest one could be
stated as CFD is the transformation of
the governing equations from
continuum domain into a discrete one.
The PDE’s are approximated by
difference methods (FDE), resulting in
system of algebraic equations to be
solved numerically. The nature of these Figure 20 Contributions from other disciplines to CFD
algebraic equations depends on the
character of the problem posed by the original PDE. The equilibrium (BVP), mathematically elliptic,
usually results in a system to be solved simultaneously in conjunction with satisfying the boundary
conditions. While the marching problems (parabolic or hyperbolic) are usually solved one at a time,
conforming to initial boundary conditions. There are three distinctive disciplines contributing to CFD
analysis;

1. The fluid dynamics which describes the physics of flow behavior as described in in any Fluid
Dynamic text.

2. The mathematical side or the Numerical Analysis which transforms the fundamental
governing equation from continuum into a discrete domain.

3. The computer science (CS) which does that transformation using high-level programming
languages.

The question now arises that do we need expertise of three people from these disciplines in order to
carry out a CFD analysis? The answer is more likely that a person that has some proficiency on each
subsets would be sufficient. These inter-relations are depicted in Figure 20. Emphasis should be
made here regarding the Verification & Validation of CFD analysis with respect to analytical or
41

experimental data. In regard to items (1) and (2), we discussed them briefly before. We will concern
our self with number (3), but restrict ourselves with general information since the aim is not to pay
particular homepage to specific languages,
but outline the general information
available for CFD and its particulars. The
amount of information and discussion and CFD
literature available on each topic is
enormous. Figure 21 shows the three
approaches to fluid dynamic problems
and their strong link as these approaches
do not work in isolation. All three
approaches complement each other and
could be used in coordination. While the Analytical Experimental
experimentalist might prefer of-course
the experimental approach, or the Figure 21 Linkage between CFD, Experimental &
academics the analytical one, the more Analytical approach
realist and deadline conscious analyst
would probably prefer the CFD in conjunction with other two.

3.2 Computer Programming Languages & Paradigms for CFD


3.2.1 How do Programming Languages Differ?
Object-Oriented Programming (OOP) is a programming languages are organized around 'objects'
rather than 'actions' and 'data' rather than 'logic'. The similarities and dissimilarities are depicted in
Table 2. There are 4 pillars of Object Oriented Programming (OOP) as envisioned by [Shri Ram Patel],
which outlined below.

Common Constructs Uncommon Constructs


basic data types (numbers, etc.) type declarations
variables; special types (strings, arrays, matrices,...)
expressions sequential execution
statements concurrency constructs
keywords packages/modules
control constructs objects
procedures general functions
comments generics
errors modifiable state

Table 2 Differences in programming languages

3.2.1.1 Abstraction
Abstraction is a process of exposing essential feature of an entity while hiding other irrelevant detail.
abstraction reduces code complexity and at the same time it makes your aesthetically pleasant.

3.2.1.2 Encapsulation
We have to take in consideration that Encapsulation is somehow related to Data Hiding.
42

Encapsulation is when you hide your modules internal data and all other implementation
details/mechanism from other modules. it is also a way of restricting access to certain properties or
component. Remember, Encapsulation is not data hiding, but Encapsulation leads to data hiding

3.2.1.3 Inheritance
The ability of creating a new class from an existing class. Like there word Inheritance literally means
it is a practice of passing on property, titles, debts, rights and obligations upon the death of an
individual. in OOP this is somehow true(Except the death of an individual), where The base class(the
existing class sometimes called as the Parent class) has properties and methods that will be inherited
by the sub class (sometimes called a subtype or child class) and it can have additional properties or
methods. Inheritance is also a way to use code of an existing objects.

3.2.1.4 Polymorphism
Just like in biology, Polymorphism refers to the ability to take into different forms or stages. A
subclass can define its own unique behavior and still share the same functionalities or behavior of its
parent/base class. Yes, you got it right, subclass can have their own behavior and share some
behavior from its parent class BUT!! not vice versa. A parent class cannot have the behavior
of its subclass.

3.2.2 Main Language Styles


The following are widely considered the main programming paradigms, as seen when measuring
programming language popularity. There is some overlap between paradigms, inevitably, but the
main features or identifiable differences are summarized in this table34:

 Procedural or Structured Languages


 Based on Individual statements, specifies the steps a program must take to reach a
desired state.
 FORTRAN, ALGOL60, ALGOL68, Cobol, Pascal, C, Ada

 Functional Languages
 When you tell the computer to do something it does it. Treats programs as evaluating
mathematical functions and avoids state and mutable data.
 LISP, Scheme, CLOS, ML, Haskell

 Logic Languages
 Inference engine that drives things. Defines program logic, but not detailed control
flow.
 Prolog, GHC

 Object-Oriented Languages
 Bring together data and operations. Organizes programs as objects: data structures
consisting of data fields and methods together with their interactions.
 Smalltalk, C++, Eiffel, Sather, Python, Ada95, Java, OCAML

Note that none of the main programming paradigms have a precise, globally unanimous definition,
nor official international standard. Nor is there any agreement on which paradigm constitutes the
best method to developing software. The subroutines that implement OOP methods may be

34 From Wikipedia, the free encyclopedia.


43

ultimately coded in an imperative, functional, or procedural style that may, or may not, directly alter
state on behalf of the invoking program

3.2.3 Comparison between MATLAB, C/C++ and FORTRAN


On the subject of comparing programming languages such as FORTRAN, C and C++, John C. Chien,
among others writes the following.

3.2.3.1 FORTRAN
In Fortran, you deal with main program, subroutines, data and variables separately. The main
program calls the subroutines which then operate on the data and variables, to print, to compute etc...
For example, to print a number in Fortran, you first define the number, and then write the number
to the screen. In Fortran, data and related functions are defined separately. For example, to print a
number in Fortran, you first define the number, and then write the number to the screen.

3.2.3.2 C/C++
In C++, you deal with main program, classes and objects and functions separately. The class includes
its data and related functions as members. By changing the data, you can define different objects from
the class. In this area, it is like a parametric representation. Member functions are just functions
which operate on the data members. In C++, you declare a class called, say "class print number", then
inside the class you put in the number as the data member, and the function which print the number
as the member function, say "prt()". Then, in the main function (program) you first create an object
from the class, this is a copy of class with number and function in it. You exercise the member function
of the object to print the number. If you had defined the object as "print number myprint", then
"myprint.prt" will print the number for you. The difference is "packaging", in Fortran, there are parts,
in C++ the parts are packaged into many different classes. In this way you can protect your data
similar to your bank account, or money in your pocket instead of money on the desk top with your
name in front of it. With this concept, you can also derive other classes with additional functions in
it, something like custom made PC with add-on in it.
As you see, Fortran and C++ are different things, especially related to the use of classes and objects.
So, if you treat data and the related functions as separate things, then Fortran and C are the way to
go. On the other hand, if you group the data and the related function into classes and use it as object,
then C++ has some nice features for you. Unfortunately, the transformation from Fortran and C to
C++ is not simple because it requires the change in concept. By the way, JAVA is also object-oriented
,without the complexity of the pointer. If your main interest is the solver and number crunching,
then Fortran is the one designed for that purpose, on the other hand, C++ will improve your
vision of the current picture of computer programming technology, therefore, it is essential to
understand its basis concepts.
Similar point of view is in complementing above is expressed by Kenji Taked of Department of
Aeronautics and Astronautics University of Southampton England. Fortran 77 is about the fastest
high-level language for doing numerical computation. Good C code can go about as fast, but it is easier
to write fast F77 than fast C. The reason is that F77 compilers can do a better job optimizing the code.
With C, C++ and FORTRAN 90 the existence of pointers can be detrimental for performance. The
compilers cannot optimize memory accesses if the data is spread all over the place in memory.
However, pointers are incredibly useful for creating useful data structures, such as a linked list for
an unstructured grid. Bear in mind that the performance could be abysmal if implemented naively
though. FORTRAN 90 has two very useful features. The first is dynamic memory allocation. The
second is modules. These make program manageability much easier. Therefore, I think that you can
do well by using a mixture of Fortran 90 and 77. F77 for the number crunching numerical kernel
routines, and F90 for job setup and program management. Similarly, C/C++ could be used together
44

with F77 numerical routines. This seems to give a good balance between performance and flexible
code structure.

3.2.3.3 MATLAB
MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and fourth-
generation programming language. A proprietary programming language developed by
MathWorks®, MATLAB allows matrix manipulations, plotting of functions and data, implementation
of algorithms, creation of user interfaces, and interfacing with programs written in other languages,
including C, C++, C#, Java, Fortran and Python. Although MATLAB is intended primarily for numerical
computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic
computing abilities. An additional package, Simulink, adds graphical multi-domain simulation and
model-based design for dynamic and embedded systems35.
In MATLAB, basic data type is matrix. This would reduce your efforts a lot while writing a CFD code.
On the contrary, a program written in C or Python would give you a complete control over robustness,
speed, accuracy and hence efficiency. Now, MATLAB will solve a Matrix operation for you. C will allow
you to write a program that solves a Matrix operation. Somewhere on the middle ground, C++ is an
object-oriented version of C. If your aim is to want to use CFD as your research tool or to use it in
research and Development environments, it would be rather suggest you to go ahead with MATLAB.
Else (i.e., working in industry using commercial codes), bite the bullet and to use C/C++/Python etc.
Other consideration is economics and time. How much money and time do you have? This is more of
a commercial question. If you have money and no time to write your own matrix manipulation code,
buy MATLAB and use it! Of course, you may want to explore Octave, a rebellious brother of MATLAB.

3.2.3.4 Graphics and GUI programming in MATLAB


MATLAB supports developing applications with graphical user interface (GUI) features. MATLAB
includes GUIDE (GUI development environment) for graphically designing GUIs36. It also has tightly
integrated graph-plotting features. For example, the function plot can be used to produce a graph
from two vectors x and y. The code produces the following figure of the sine function as depicted in
Figure 22.

x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)

Figure 22 2D representation of Sine function using MATLAB

35 From Wikipedia, the free encyclopedia.


36 "MATLAB GUI", MathWorks. 30 April 2011. Retrieved 14 August 2013.
45

A MATLAB program can produce 3D graphics using the functions surf, plot3 or mesh is illustrated in
Figure 23. Further information regarding the MATLAB could be obtained from excellent resource
such as 37-38 among many others.

[X,Y] = meshgrid(-10:0.25:10,-
10:0.25:10);
f = sinc(sqrt((X/pi).^2+(Y/pi).^2));
mesh(X,Y,f);
axis([-10 10 -10 10 -0.3 1])
xlabel('{\bfx}')
ylabel('{\bfy}')
zlabel('{\bfsinc} ({\bfR})')
hidden off

Figure 23 3D representation of a Sine function using MATLAB

3.2 Marching and Equilibrium Problems


Marching or propagation problems are transient or transient-like where the solution of PDE is
required on an open domain, subject to a set of Initial or Boundary conditions. Mathematically, these
are parabolic or hyperbolic, as discussed previously where the flow of information is upstream.
Typical examples include unsteady-inviscid flow, steady-state inviscid supersonic, transient heat
conduction, as well as boundary layer flows. Alternatively, the equilibrium problem is where the
solution is subjected to BC’s enclosing the domain, therefore, they are classified as Boundary Value
Problems (BVP). Mathematically, they are elliptic in nature as the flow of information is scattered
through the domain and propagates in all direction. Examples of equilibrium problems are steady-
state temperature distribution, incompressible inviscid flows, and equilibrium stress distribution in
solids.

3.3 Numerical Approximation Methods


There are several distinct methods of numerical integration as:

 Control Volume Method (FV)


 Finite Difference Method (FD)
 Finite Element Method (FE)
 Weighted Residual (WRM)
 Spectral Methods
 Fast Fourier Transform Methods (FFT)

37 David Houcque, “Introduction To Matlab For Engineering Students”, Northwestern University, (version 1.2,
August 2005).
38 Introduction to MATLAB.
46

 Lattice Boltzmann Methods (LBM)


 Vortex Methods and other Particle Methods
 Boundary Element Method
 Polynomial Fitting
 Integral Method

Among those, the Finite Difference (FD, Finite Element (FEA) and Finite Volume (FV) methods are
the most prominent ones with FD being the older one.

3.4 Finite Difference Method (FD)


The Finite Difference can be used merely as a mathematical tool to develop algebraic approximation
to PDE’s with relative ease. It proceed in rather formal mechanical way, using Taylor’s series
expansion of operating PDE with physical reasoning aside. The equation for u x and uxx evaluated at
point i, can be approximated by

u u  u i u i  u i 1 u i 1  u i 1
 i 1   (5.1)
x i Δx   Δx
   2x
Forward Backward Central

 u
2
u  2u i  u i 1
 i 1
x i
2
(x) 2

Where the ux is approximated using a forward, backward, and central differencing. Δx is small but
finite. Using the same reasoning we obtained an expression for second derivatives. For an excellent
reference in FD, user should refer to39, and will be revisited later.

3.4.1 Some Issues with Finite Differencing


The idea of finite differencing steams from the definition of derivatives as

u(x, y) u(x  Δx, y)  u(x, y)


 lim (5.5)
x Δx0 Δx
3.4.1.1 Truncation Error
Assuming u to be continuous, this will be a reasonable approximation to the derivative. With the aid
of Taylor’s series expansion for expansion of u(x+Δx) could be expressed as

u  2 u (x) 2
u(x  Δx, y)  u(x, y)  Δx  2  ...... (5.6)
x x 2!

Rearranging this and dividing by Δx,

39D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, ISBN 0-89116-
471-5 – 1984.
47

u u(x  Δx , y) - u(x , y)  2 u Δx
   .... (5.7) x - values
x Δx x 2
 2
Truncation error  Ο ( x)

Truncatuin Error →
2.6

Where the truncation error is the difference between PDE and


FDE representation and characterized by using the order 1.2
notation. It is inversely related to the order of accuracy for the 0.5
0.3
equations as depicted in Figure 24 and would be an extremely
important criteria in accuracy of discretized equation as it is Order of Accuracy →
directly related to the stability and accuracy consideration.
Therefore, for Eq. (5.7), it could be said that the forward finite Figure 24 Correlation between
difference representation here is 1st order accurate in space (Δx). truncation error and order of accuracy
For most practical applications, 2nd order accuracy would be
sufficient as by increasing the order of accuracy, the CPU cost would also increase. Free temperature
profile of a jet flow would be an excellent example in that case (see Figure 25). In order to be
acceptable, the difference representation needs to meet the conditions of consistency and stability,
to be discussed next.

First Order Accurate Second Oreder Accurate

Third Order Accutare Fifth Order Accurate

Figure 25 Free Jet Flow profile for different order of accuracy


48

3.4.1.2 Consistency
Consistency deals with extend on which the finite difference equations approximate the PDEs. It is
directly linked to truncation error by means of showing that in the limit, as mesh been refined
infinitely, the difference between the PDE and FDE vanishes, i.e. lim mesh → 0 (PDE-FDE) = 0 as lim
mesh → 0 (TE) = 0. Therefore, for consistency to be satisfied, on the limit, the truncation error should
vanish.

3.4.1.3 Stability
The stability concept is a bit more involved than consistency and in a restrict sense only applicable
to marching problems. A stable numerical scheme is the one that errors do not propagate through
the system. It devises a relation and imposes a restriction between mesh and time step sizes, defined
as CFL number. There are two prominent procedures, namely, the Von Neumann and Fourier for
stability analysis. To better understand, a simple 1D stability criteria could be devised where CFL =
α Δt/Δx with α being a positive constant, as being presented in Figure 26. On the right (b), with
reduced Δx, then CFL < 1, point Q is within computational domain of influence (shaded), and could
be differentiated using the neighbor cells, therefore, is stable. But on the left (a), where CFL < 1, Q lies

Figure 26 1D stability analysis based on CFL number; (a) CFL < 1 Unstable; (b) CFL ≥ 1 Stable

outside of computational domain of influence, therefore, unstable. But on the left (a), where CFL ≥ 1,
Q lies outside of computational domain of influence, therefore, unstable. It is obvious that the size of
mesh, Δx, is crucial in stability here and by reducing it (finer mesh), the stability constrain is satisfied.
Other avenue, if insisting in keeping Δx the same, is to reduce the time step or Δt. This is the main
reason for needing finer step sizes on explicit methodologies which tend to be more unstable. It is
known that the best results for hyperbolic systems using the most common explicit methods are
obtained with CFL near unity (see Figure 26). A more general 3D CFL number using the empirical
formula (Tannehill et al., 1975) defined as:
49

-1
α(Δt)CFL  u v w 1 1 1 
Δt  where (t)CFL     a   
1  2 / Re   Δx Δy Δz x  y  z 2 
2 2

ρ u Δx ρ v Δy ρ w Δz
with Re Δ  Min (Re Δx , Re Δy , Re Δz ) Re Δx  Re Δy  Re Δz 
μ μ μ
and a  (p /  ) 0.5 , safty factor α  0.9 (5.8)

3.5 Finite Volume Method (FV)


On the other hand, the Finite (Control) Volume Method (FVM), examines not only the governing PDE
but also the physical laws or the conservation statement which the PDE represents. The governing
PDE could be transformed through divergence form (conservative) by employing the Gauss
divergence theorem. This enables the preservation of conservation quantity within each individual
control volume. By adding these individual control volumes, the overall conservation of the domain
would be preserved. It is difficult to appreciate the subtle differences which may occur in different
representation using FD or FV. In many cases, especially for simple, linear equations, the resulting
discretization is the same. The differences are more pronounced when irregular meshes are used or
in some boundary conditions. In general, the CV method is preferred over FD, due to the fact that
they conserve the physical quantities.


t 
Q dV   FdV  0 (5.2)
V V

where Q is the vector of conserved variables, F is the vector of fluxes (see Euler equations or Navier–
Stokes equations), V is the volume of the control volume element, and is A the surface area of the
control volume element. The time-dependent term and the body force term are assumed constant
over the volume of the cell. Using the divergence theorem and integrating over the control surface,
we obtain semi-discrete form as

Q
V   (FdA)NS  0 (5.3)
t NS

Where NS represents the number of surfaces surrounding the CV or cells. In general, the FVM
involves the following steps40:

1. Decomposition of the problem domain into control volumes.


2. Formulation of integral balance equations for each control volume.
3. Approximation of integrals by numerical integration.
4. Approximation of function values and derivatives by interpolation with nodal values.
5. Assembling and solution of discrete algebraic system.

Under certain conditions FD and FV schemes yields the same results. An example would be a 2D
steady state conduction with Dirichlet boundaries.

40Computational Engineering, Introduction to Numerical Methods, http://www.springer.com/978-3-540-


30685-6.
50

3.5.1 Finite Volume Method using a simple 1D example


The key to the method is that the integral form of the conservation law


t Ω
U dΩ   . F dΩ  0 (.)
Ω

can be rewritten, using the Gauss Divergence Theorem, as


t Ω
U dΩ   F. n dΓ  0 where Fk is numerical flux (.)
Ω
 
  Fk .n k
faces

For unsteady 1D problem it becomes

 
R X


t Ω
U dΩ   Fx dx 
XL
t Ω
U dΩ  (FR - FL )  0 (.)

In other words, the rate of change of mass in the control volume is equal to the net mass flux through
its boundary. For simplicity, a forward Euler discretization of the time derivative will be considered,
leading to

Δt
U in 1  U in  
Vi faces
Fk .nk where Vi is control volume of cell (.)

Steady state computations provide a special case. Usually the above is used to iterate to the steady
state. There are many convergence acceleration techniques41. For 3D using

Δt    Δt    Δt  
U in 1  U in    Fi 1  Fi1    G j1  G  j1    H k 1  H k -1  (.)
Δx  2 , j,k 2
, j, k  
 Δy  i, 2 ,k i, , k 
2

 Δz  i, j, 2 i, j, 
2 

Dimensional splitting is often used here to improve speed and stability, though accuracy may
diminish (Strang, 1968). Clearly conservation is satisfied due to

 
   F .n
Volumes faces

k k    Fk .n k
i boundary
(.)

so the net flux equal to the contribution from the boundary.

41 Matthew Hubbard, “Finite Volume Schemes: A Tutorial”, University of Leeds, UK.


51

3.5.2 Some Abnormalities Associated with Finite Volume


For fluid flow, there are special considerations. As seen earlier in this section, there are 5 equations
for 5 unknowns (u, v, w, p, T). However, there are two problems with these equations which are
specific to computational fluid dynamics (CFD).
First, the governing equations are not only coupled, but they have non-linear terms, namely the
advection or inertia terms. The handling of these terms has been an ongoing research project for at
least the last 40 years. If these terms are not modeled accurately enough, they will introduce an error
known as “Numerical Diffusion”. As its name indicates, the errors can completely swamp any
physical diffusion and misrepresent the physics of the real world problem. If you model the advection
terms with the usual methods of obtaining high accuracy (central differences, standard Galerkin
schemes), you introduce numerical dispersion errors where the numerical solution oscillates around
the true solution. These dispersion errors can quite easily lead to divergent solutions, especially in
turbulent flows. Most commercial finite volume and finite element methods have discretized these
terms in some special way which is a compromise of accuracy and stability. Finite volume methods
use techniques like skew up winding and QUICK schemes. Successful finite element methods use
some sort of streamline upwind element. (Yes, there are finite element CFD methods available which
do not use this method, but they are not generally applicable).
The second major difficulty with the governing partial differential equations is that no explicit
equation for pressure exists for incompressible flows. For example, if we use the Navier-Stokes or
momentum equations to solve for the velocities, we have only the continuity equation to solve for
pressure. However, pressure does not appear in the continuity equation. This problem has been side-
stepped by manipulating a combination of these equations. The most predominant method
(commercially, that is) for solving this dilemma of the missing pressure equation was developed for
finite volume methods and is known as SIMPLE or some variant of it. This method is well-explained
in the book by Suhas V. Patankar42. Almost all of the commercial finite volume CFD codes use this
method as well as two most popular finite element CFD codes.

3.5.2.1 Numerical Diffusion Effects


Artificial viscosity tends to reduce all gradients in the solution whether induced physically or
numerically. This effect, which is the direct result of even derivative terms in the truncation error, is
also called dissipation (upwind differencing). Another quasi-physical effect of numerical schemes is

Figure 27 Effects of Dissipation & Dispersion a) exact b) 1ST-order c) 2nd -order

called dispersion which is the direct result of odd derivative terms in truncation error (central
differencing). The combined effects are called diffusion. Figure 27 shows these effects. There are
essentially two main classes of convective flux approximation in widespread use, namely

1. ‘Low-order’ schemes, which characteristically generate discretized equation forms that are

42 Suhas V. Patankar, “Numerical Heat Transfer”, Hemisphere Publishing, 1980, ISBN 0-89116-522-3.
52

easy to solve, produce solutions which obey the expected physical bounds, but sometimes give
rise to smearing of gradients. The latter effect has come to be known as ‘numerical diffusion-
dissipation effects. This is a form of truncation error that diminishes as the grid is refined, but
at an increased cost of calculation.

2. ‘Higher-order’ schemes, which better preserve steep gradients, but may result in equations
that are more difficult to solve (and, in extreme cases, may provoke numerical instabilities)
and/or have solutions exhibiting non-physical spatial oscillations (‘wiggles-dispersion
effects’). These oscillations may
in some cases, lead to spurious
values, e.g. negative species mass • Lowest-Order term in TE
fraction or turbulence kinetic Diffusion contain even (Dissiaptive)
energy. This phenomenon is • Lowest -Order term in TE
often termed ‘numerical
contains odd (Disspersive)
dispersion. It too can be
diminished by grid refinement or
by using monotone schemes (e.g. Figure 28 Effect of retaining TE terms
a blending methodology).

The effect of retaining order of terms in TE displaying either the Dissipative or Dispersive effect is can
be illustrated in Figure 28.

3.5.3 Balancing the Diffusion vs. Convection using Peclet Number (Pe)
This is an important property in comparing the CD and UD differencing schemes or other diffusion
related issues. As shown in Figure 29 for higher speed flows (large Pe), the CD differencing becomes
oscillatory and unstable and not suitable, while UD reveals more stable and recommended. On the
other hand, for low speed flows (smaller Pe), such as subsonic flows and denser mesh, CD seems
comparably more stable.

Figure 29 Correlation between CD and UD schemes for different (Pe) number

advection transport rate LU


PeL   Re.Pr  (5.9)
diffusive transport rate α
k
where L  characteri tic length , U  velocity and α 
ρC p
53

To illustrate this more explicitly, solving the 1D convection-diffusion equation on a slab of length L for
variable ϕ subjected to following BC’s

    
(ρ )   Γ  subject to BC  x 0  0 and  x L  L (5.10)
x x  x 

Where ρφ and Γ are independent of x. Differentiating results the analytical exponential solution known
as power law (see Figure 30):

x
(Pe )
 (x)   (0) e L  1 ρuL
 (Pe) where Pe  (5.11)
 (L)   (0) e  1 Γ

Following observations could be made from this plot:

 The ratio of the strengths of convection and diffusion may be measured using the Peclet
number, Pe.
 For high absolute
values of Pe number Pe << 1
Diffusion dominated
(i.e., convection
dominated flow), the Convection dominated
value of the dependent
variable at the Φ0 <ϕ<ϕL
Pe = 0
interface (i.e. x = L/2)
can be seen to be
nearly equal to the
value at the upwind
Pe >> 1
boundary which is the
assumption made by
the upwind scheme. 0<X<L
Such assumption
could not be hold for Figure 30 Ratio of Convection Vs Diffusion - Effect of (Pe) number
small Pe values
(diffusion dominated; see Figure 30).
 When Pe=0, (no flow, or pure diffusion), ϕ could be interpolated using a simple linear average
between the values at x = 0 and x = L.
 The upwind scheme always calculates diffusion assuming a linear relationship between the
dependent variable and distance and therefore over estimates diffusion at large absolute
values of Pe43.
Another point of view of above on a 1D spatial mesh, for general contours of variable ϕ at point p, for
Pe = 0 i.e., pure diffusion, the contours are concentric circles for constant values of ϕ because
diffusion tends to spread out ϕ evenly in all directions. As Pe increases, the curve becomes more
elliptic and the value of ϕ at E node is more influenced by the upstream node. At Pe = infinity i.e.,
pure convection, the contours are completely outstretched and value of ϕ at E is affected only by

43 “Discretization of Convection –Diffusion type equation”; 10th-Indo–German Winter Academy 2011.


54

upstream conditions (see Figure 31).


3.6 Finite Element Method (FE)
The finite element method (FEM) is used in
structural analysis of solids, but is also
applicable to fluids. However, the FEM
formulation requires special care to ensure
a conservative solution. The FEM
formulation has been adapted for use with
fluid dynamics governing equations.
Figure 31 Spatial effects of (Pe) number on 1D flow
Although FEM must be carefully
formulated to be conservative, it is much
more stable than the finite volume approach. However, FEM can require more memory and has
slower solution times than the FVM. In this method, a weighted residual equation is formed:

R i   Wi QdV ε (5.4)


Ri

Where Ri is the equation residual at an element vertex i, Q is the conservation equation expressed on
an element basis, Wi is the weight factor, and Vε is the volume of the element44. This is very general
statements and to illustrate we resort to simple examples below.

3.6.1 Concept of Shape (Basis) Function


The shape function is the function which interpolates the solution between the discrete values
obtained at the mesh nodes. Therefore, appropriate functions have to be used and, as already
mentioned, low order polynomials are typically chosen as shape functions. For three-dimensional
finite element simulations it is convenient to discretize the simulation domain using tetrahedrons, as
depicted. Thus, linear shape functions must be defined for each tetrahedron of the mesh, in order to
apply the Galerkin method. For one dimensional shape function, If a polynomial is selected as basis
function, then

1 , i  j
N i (x)  a1  a 2 x  a 3 x 2  . . . . . . . .
N i (x j )  δ ij   (5.4)
0 , i  j
1 - Linear Case : For two nodes of x1 and x 2 we have N i (x)  a i1  a i2 x
2 - Quadratic Case : x1 , x 2 , and x 3 N i (x)  a i1  a i2 x  a i3 x 2
3 - Cubic Case : x1 , x 2 , x 3 and x 4 N i (x)  a i1  a i2 x  a i3 x 2  ai 4 x 3

3.6.1.1 Lagrangian Elements


To avoid solving this so complex system of equations, the well-known properties of the Lagrangian
polynomials can be used where it compasses all these shape functions:

44 Wikipedia, the free encyclopedia.


55

(x - x1 )(x - x 2 ). . . . (x - x i-1 )(x - x i 1 ). . . . (x - x n )


N ie (x)  (5.5)
(x i - x1 )(x i - x 2 ). . . . (x i - x i-1 )(x i - x i 1 ). . . . (x i - x n )
n x  xj
N ie (x)  
j1(j1) xi  x j

This equation is easier to implement, as can be checked using this Matlab code. The graphic
representation of each case show case in Figure 3245.

Linear Quadratic

Lagrangian
Cubic

Figure 32 Illustration of Different Shape, Basis, and Blending Functions

3.6.2 A simple 1D Discretization Example using Shape (Basis) function


This definition is applicable to every bit as of FV method. The description of the laws of physics for
space and time-dependent problems are usually expressed in terms of partial differential equations
(PDEs). The Finite Element Method (FEM) is used to compute such approximations46. Take, for
example, a function u that may be the dependent variable in a PDE (i.e., temperature, electric
potential, pressure, etc.) The function u can be approximated by a function uh using linear

45 CFD online, 2009.


46 Detailed Explanation of the Finite Element Method (FEM), COMSOL Inc.
56

combinations of basis (shape) functions according to the following expressions:

u  uh where u h   u i ψi (5.5)
i

Here, ψi denotes the basis functions and ui denotes the coefficients of the functions that approximate
u with uh. The principle for a 1D problem. u could, for instance, represent the temperature along the
length (x) of a rod that is non-uniformly heated. Here, the linear basis functions have a value of 1 at
their respective nodes and 0 at other nodes. In this case, there are seven elements along the portion
of the x-axis, where the function u is defined (i.e., the length of rod). One of the benefits of using the
finite element method is that it offers great freedom in the selection of discretization, both in the
elements that may be used to discretize space and the basis functions. Depending on the problem at
hand, other functions may be chosen instead of linear functions.

3.6.3 Example with Heat Source


Say there is a solid with time-varying temperature but negligible variations in space. In this case, the
equation for conservation of internal (thermal) energy may result in an equation for the change of
temperature, with a very small change in time, due to a heat source g:

dT
c p  g(T, t) (5.6)
dt
Here, ρ denotes the density and cp denotes the heat capacity. Temperature, T, is the dependent
variable and time, t, is the independent variable. The function may describe a heat source that varies
with temperature and time. The ODE in Eq. (5.6) states that if there is a change in temperature in
time, then this has to be balanced (or caused) by the heat source. Oftentimes, there are variations in
time and space. The temperature in the solid at the positions closer to a heat source may, for instance,
be slightly higher than elsewhere. Such variations further give rise to a heat flux between the different
parts within the solid. In such cases, the conservation of energy can result in a heat transfer equation
that expresses the changes in both time and spatial variables (x), such as:

T
c p  .q  g(T, t, x) (5.7)
t

As before, T is the dependent variable, while x (x = (x, y, z)) and t are the independent variables. The
heat flux vector in the solid is denoted by q = (qx, qy, qz) while the divergence of q describes the change
in heat flux along the spatial coordinates referred to as Fourier’s law. Here, the derivatives are
expressed in terms of t, x, y, and z. When a differential equation is expressed in terms of the
derivatives of more than one independent variable, it is referred to as a partial differential equation
(PDE), since each derivative may represent a change in one direction out of several possible
directions. Further note that the derivatives in ODEs are expressed using d, while partial derivatives
are expressed using the more curly ∂. Rather than solving PDEs analytically, an alternative option is
to search for approximate numerical solutions to solve the numerical model equations. The finite
element method is exactly this type of method; a numerical method for the solution of PDEs. Similar
to the thermal energy conservation referenced above, it is possible to derive the equations for the
conservation of momentum and mass that form the basis for fluid dynamics. Further, the equations
for electromagnetic fields and fluxes can be derived for space and time-dependent problems, forming
57

systems of PDEs. Continuing this discussion, let's see how the so-called weak formulation can be
derived from the PDEs.

3.6.4 Steady state Heat Sink The Weak Formulation; Basis Functions and Test Functions
Assume that the temperature distribution in a heat sink is being studied, given by Eq. (5.7), but now
at steady state, meaning that the time derivative of the temperature field is zero in Eq. (5.7). The
domain equation for the model domain, Ω, is the following:

.(-kT)  g (T, x) in Ω (5.8)


with B.C. T  T0 on Ω1
(kT).n  h (T  Tamb ) on Ω 2
(kT).n  0 on Ω 3

further, assume that the temperature along a boundary (∂Ω1) is known, in addition to the expression
for the heat flux normal to some other boundaries (∂Ω2). On the remaining boundaries, the heat flux
is zero in the outward direction (∂Ω3). The boundary conditions at these boundaries then becomes
where h denotes the heat transfer coefficient and Tamb denotes the ambient temperature. The
outward unit normal vector to the boundary surface is denoted by n. The situation is best described

Figure 33 A mathematical model of a steady state heat sink.

in Figure 33. The next step is to multiply both sides of Eq. (5.8) by a test function φ and integrate
over the domain Ω:
58

 .(-kT)  dV   g(T, x) dV


Ω Ω
in Ω (5.9)

3.6.4.1 Test Function


The test function φ and the solution T are assumed to belong to Hilbert spaces. A Hilbert space is an
infinite dimensional function space with functions of specific properties. It can be viewed as a
collection of functions with certain nice properties, such that these functions can be conveniently
manipulated in the same way as ordinary vectors in a vector space. For example, you can form linear
combinations of functions in this collection (the functions have a well-defined length referred to as
norm) and you can measure the angle between the functions, just like Euclidean vectors. Indeed, after
applying the finite element method on these functions, they are simply converted to ordinary vectors.
The finite element method is a systematic way to convert the functions in an infinite dimensional
function space to first functions in a finite dimensional function space and then finally ordinary
vectors (in a vector space) that are tractable with numerical methods.

3.6.4.2 Weak Formulation


The weak formulation is obtained by requiring (5.9) to hold for all test functions in the test function
space instead of Eq. (5.8) for all points in Ω. A problem formulation based on Eq. (5.8) is thus
sometimes referred to as the pointwise formulation. In the so-called Galerkin Method, it is assumed
that the solution T belongs to the same Hilbert space as the test functions. This is usually written as
φ ϵ H and T ϵ H, where H denotes the Hilbert space. Using Green’s first identity (essentially integration
by parts), the following equation can be derived from (5.9):

 kT. dV   (kT) . n dS   g (T, x)  dV


Ω 2Ω Ω
(5.10)

The weak formulation, or Variational formulation, of Eq. (5.8) is obtained by requiring this equality
to hold for all test functions in the Hilbert space. It is called “weak” because it relaxes the requirement
(5.8), where all the terms of the PDE must be well defined in all points. The relations in (5.10) and
(5.11) instead only require equality in an integral sense. For example, a discontinuity of a first
derivative for the solution is perfectly allowed by the weak formulation since it does not hinder
integration. It does, however, introduce a distribution for the second derivative that is not a function
in the ordinary sense. As such, the requirement (5.8) does not make sense at the point of the
discontinuity.
A distribution can sometimes be integrated, making (5.9) well defined. It is possible to show that the
weak formulation, together with boundary conditions (5.8), is directly related to the solution from
the pointwise formulation. And, for cases where the solution is differentiable enough (i.e., when
second derivatives are well defined), these solutions are the same. The formulations are equivalent,
since deriving (5.10) from (5.8) relies on Green’s first identity, which only holds if T has continuous
second derivatives. This is the first step in the finite element formulation. With the weak formulation,
it is possible to discretize the mathematical model equations to obtain the numerical model
equations. The Galerkin method one of the many possible finite element method formulations can be
used for discretization. First, the discretization implies looking for an approximate solution to Eq.
(5.10) in a finite-dimensional subspace to the Hilbert space H so that T ≈ Th. This implies that the
approximate solution is expressed as a linear combination of a set of basis functions ψi that belong
to the subspace:
Th (x)   Ti ψi (x) (5.11)
i
59

The discretized version of Eq. (5.10) for every test function ψj therefore becomes:

 T  kψ .ψ dV    (kT ψ ).nψ dS   g T ψ


i
i i j
i
i i j
i
i i ψ jdV (5.12)
Ω 2Ω Ω

The unknowns here are the coefficients Ti in the approximation of the function T(x). Eq. (5.12) then
forms a system of equations of the same dimension as the finite-dimensional function space. If n
number of test functions ψj are used so that j goes from 1 to n, a system of n number of equations is
obtained according to (5.12). From Eq. (5.11), there are also n unknown coefficients (Ti).
Once the system is discretized and the boundary conditions are imposed, a system of equations is
obtained according to the following expression:

ATh  b (5.13)

where T is the vector of unknowns, T h = {T1, .., Ti, …, Tn}, and A is an NxN matrix containing the
coefficients of Ti in each equation j within its components Aji. The right-hand side is a vector of the
dimension 1 to n. A is the system matrix, often referred to as the stiffness matrix, harkening back to
the finite element method’s first application as well as its use in structural mechanics. If the source
function is nonlinear with respect to temperature or if the heat transfer coefficient depends on
temperature, then the equation system is also nonlinear and the vector b becomes a nonlinear
function of the unknown coefficients Ti. One of the benefits of the finite element method is its ability
to select test and basis functions. It is possible to select test and basis functions that are supported
over a very small geometrical region. This implies that the integrals in Eq. (5.12) are zero everywhere,
except in very limited regions where the functions ψj and ψi overlap, as all of the above integrals
include products of the functions or gradients of the functions i and j. The support of the test and
basis functions is difficult to depict in 3D, but the 2D analogy can be visualized.

3.6.5 Effect of Basis Function


Assume that there is a 2D geometrical domain and that linear functions of x and y are selected, each
with a value of 1 at a point i, but zero at other points k. The next step is to discretize the 2D domain
using triangles and depict how two basis functions (test or shape functions) could appear for two
neighboring nodes i and j in a triangular mesh. Two neighboring basis functions share two triangular
elements. As such, there is some overlap between the two basis functions, as shown in Figure 34 (A
- B). Further, note that if i = j, then there is a complete overlap between the functions. These
contributions from the coefficients for the unknown vector T that correspond to the diagonal

(B) Not overlapping


(A) Overlapping

Figure 34 Basis functions sharing two triangular elements in 2D


60

components of the system matrix Ajj. If the two basis functions are now a little further apart where
these functions do not share elements but they have one element vertex in common. As the Figure
34 (A) indicates, they do not overlap. When the basis functions overlap, the integrals in Eq. (5.12)
have a nonzero value and the contributions to the system matrix are nonzero. When there is no
overlap, the integrals are zero and the contribution to the system matrix is therefore zero as well.
This means that each equation in the system of equations for (5.12) for the nodes 1 to n only gets a
few non-zero terms from neighboring nodes that share the same element. The system matrix A in Eq.
(5.13) becomes sparse, with nonzero terms only for the matrix components that correspond to
overlapping Tij. The solution of the system of algebraic equations gives an approximation of the
solution to the PDE. The denser the mesh, the closer the approximate solution gets to the actual
solution47.

3.6.6 Different Elements


As mentioned above, the Galerkin Method utilizes the same set of functions for the basis functions
and the test functions. Yet, even for this method, there are many ways (infinitely many, in theory) of
defining the basis functions (i.e., the elements in a Galerkin finite element formulation). Let's review
some of the most common elements. The linear basis functions, as defined in a triangular mesh that
forms triangular linear elements, are depicted in Figure 35. The basis functions are expressed as
functions of the positions of the nodes (x and y in 2D and x, y, and z in 3D). In 2D, rectangular elements
are often applied to structural mechanics analyses. They can also be used for boundary layer meshing
in CFD and heat transfer modeling. Their 3D analogy is known as the hexahedral elements, and they
are commonly applied to structural mechanics and boundary layer meshing as well. In the transition
from hexahedral boundary layer elements to tetrahedral elements, pyramidal elements are usually
placed on top of the boundary layer elements.
The corresponding second-order elements (quadratic elements) are shown in the figure below. Here,
the edges and surfaces facing a domain boundary are frequently curved, while the edges and surfaces
facing the internal portion of the
domain are lines or flat surfaces.
Note, however, that there is also the
option to define all edges and
surfaces as curved. Lagrangian and
serendipity most common element
types in 2D and 3D.
It is difficult to depict the basis of the
quadratic basis functions in 3D inside
the elements above, but color fields
can be used to plot function values on
the element surfaces. When
discussing FEM, an important
element to consider is the error
estimate. This is because when an
estimated error tolerance is reached, Figure 35 Finite element approximation of the temperature
convergence occurs. Note that the field in the heat sink
discussion here is more general in
nature rather than specific to FEM.

47 Detailed Explanation of the Finite Element Method (FEM), COMSOL Inc.


61

3.6.7 Error Estimation


The finite element method gives an approximate solution to the mathematical model equations. The
difference between the solution to the numerical equations and the exact solution to the
mathematical model equations is the error: e = u - uh}. In many cases, the error can be estimated
before the numerical equations are solved (i.e., an a priori error estimate). A priori estimates are
often used solely to predict the convergence order of the applied finite element method. For instance,
if the problem is well posed and the numerical method converges, the norm of the error decreases
with the typical element size h according to O(hα), where α denotes the order of convergence. This
simply indicates how fast the norm of the error is expected to decrease as the mesh is made denser.
An a priori estimate can only be found for simple problems. Furthermore, the estimates frequently
contain different unknown constants, making quantitative predictions impossible. An a posteriori
estimate uses the approximate solution, in combination with other approximations to related
problems, in order to estimate the norm of the error.

3.6.8 Additional Finite Element Formulations


In the examples above, we have formulated the discretization of the model equations using the same
set of functions for the basis and test functions. One finite element formulation where the test
functions are different from the basis functions is called a Petrov-Galerkin Method. This method is
common, for example, in the solution of convection-diffusion problems to implement stabilization
only to the streamline direction. It is also referred to as the streamline upwind/Petrov-Galerkin (SUPG)
method. In the solution of coupled systems of equations, different basis functions may be used for
different dependent variables. A typical example is the solution of the Navier-Stokes equations,
where the pressure is often more smooth and easy to approximate than the velocity. Methods where
the basis (and test) functions for different dependent variables in a coupled system belong to
different function spaces are called mixed finite element methods.

3.6.9 Mathematics behind the Finite Element Method


To enlighten ourselves without details, we resort to the following statements. According to Jeff H
Peterson48, the mathematical basis for the FEM, lies in the math of Hilbert spaces. A Hilbert space is
a way of treating a function like a vector so that we can do some vector math tricks with it. Remember
that a vector is a series of values multiplied by a set of orthogonal basis vectors (like the unit vectors
that define the x, y, and z directions... think i, j, k unit vectors). We can use a similar technique to
define a function. First, we pick a set of basis functions instead of vectors (the functions need to be
orthogonal to each other Orthogonal functions but that's getting too much into the math) and then we
can define the original function as a sum of coefficients multiplied by those basis functions like this:


u   αk ψk where ψ is the basis function (.)
k 1

The next step is to convert our differential equation into something called the "weak formulation".
This is basically multiplying by a test function and then integrating over the space. Without going into
the specifics, this is how we convert our differential equation into a form we can use our vector math
on. This form is an "inner product" (the equivalent of a dot product except we're dealing with
functions now, see Inner product space) of our solution and the test function. This inner product is

48Jeff H Peterson, “What exactly is Finite element analysis – Quora”, PhD in mathematical modeling of crystal
growth systems.
62

an integral and we can use Integration by parts to convert it to more manageable form (that also
includes some nice ways to impose boundary conditions).
After this, we recognize that we're actually dealing with a finite-dimensional space. Thus the function
vectors aren't infinite and we're not really summing to infinity. This is what is meant by discretization
in the FEM. Remember our basis functions we picked earlier? We use a finite number of these to
represent the solution of our differential equation like this:

N
u   α k ψ k (.)
k 1

The only difference between this and what's above is that now our sum is finite. The next trick is to
let our test function be a basis function. We also make sure to choose basis functions such that they
don't overlap. This ensures that they are "orthogonal" like we wanted earlier and gives us a really
easy way to approximate our solution over the domain of interest. These basis functions are often
polynomials (especially quadratic polynomials). It almost seems like we've made the problem harder
by adding all this abstraction and mathematics but at the end of all of this, what have we really done
here? We have converted the problem into its matrix form and we can now solve it using matrix
algebra. If the problem was linear to begin with, we're simply solving

Ax  b (.)

which, is what most numerical methods classes teach you how to solve. Of course even if the problem
wasn't linear, we can linearize it with something like Newton's method and still solve it. For a simple
problem such as Poisson's equation, the matrix A is very easy to compute and is often called the
"Stiffness Matrix" in homage to the FEM's beginnings in elasticity problems. This matrix is formed by
the inner product of the basis functions with themselves (very sparse and diagonal dominant if you
constructed your problem rationally) multiplied by whatever constant is in your original equation.
The solution vector then is a list of the coefficients being multiplied by the basis functions, and in
order to plot your solution and get real values out, you multiply this by your series of basis functions.
This provides a function (albeit a long, complicated one) that approximates the solution to your
problem.

3.6.10 Summary of Math Procedure for Finite Element Analysis


So in short we are performing these steps:

 Convert our problem into a vector problem using the properties of Hilbert spaces.
 Create the weak formulation so that now we can pose our problem as an inner product.
 Discretize our domain and choose basis functions that don't overlap elements.
 Convert our inner product into a set of linear equations.
 Solve the linear set of equations and get your solution.

3.7 Conceptual Differences between three mostly used Prediction Methods


The partial differential equations shown earlier in this section must be discretized or transformed
into a set of algebraic equations which can be solved digitally. There are numerous methods available
to do this discretization. The three most popular, based on the number of commercial (CFD) codes
are:

 Finite Difference (FD)


63

 Finite Volume (FV)


 Finite Element (FE)

3.7.1 Finite Differencing (FD)


In the Finite Difference Method (FD), the partial derivatives are replaced with a series expansion
representation, usually a Taylor series. The series is truncated usually after 1 or 2 terms. The more
terms you include, the more accurate the solution. However, more terms in the expansion causes the
complexity and number of discrete points or nodes of the solution to increase dramatically. Applying
this method to a regularly shaped geometry is straightforward. However, for irregularly shaped
geometries, the equations must be transformed before the Taylor series can be applied. This
transformation introduces all sorts of problems in terms of additional cross-coupling of equations,
mesh generation and general convergence49.

3.7.2 Finite Volume (FV)


In the Finite Volume Method (FV), the governing equations are integrated over a volume or cell
assuming a piece-wise linear variation of the dependent variables (u, v, w, p, T). Again the piece-wise
linear variation determines both the accuracy and the complexity. Using these integrations, you
essentially balance fluxes across the boundaries of the individual volumes. The flux is calculated at
the mid-point between the discrete nodes in the domain. Hence, you must calculate a flux between
all neighboring nodes in the domain. In a topologically regular mesh (same number of divisions in
any one direction), this flux calculation is quite straightforward. In an irregular mesh (as in an
automatically generated tetrahedral mesh), this calculation will lead to an excruciating amount of
fluxes and a major bookkeeping effort to make sure all the fluxes have been calculated properly.

3.7.3 Finite Element (FE)


In the Finite Element Method (FE), Galerkin's method of weighted residuals is generally used. In this
method, the governing partial differential equations are integrated over an element or volume after
having been multiplied by a weight function. The dependent variables are represented on the
element by a shape function, which is the same form as the weight function. The shape function may
take any of several forms. The main advantage as well as the main disadvantage of finite elements is
that it is a mathematical approach that is difficult to put any physical significance on the terms in the
algebraic equations. In the finite volume method, you are always dealing with fluxes, not so with finite
elements. However, the application of finite elements on any geometric shape is the same. Also, the
boundary conditions which must be added after the fact for finite volume methods are an integral
part of the discretized equations. While it is true that early (FE) CFD methods struggled with
modeling high speed flows as many of the successfully applications demonstrated (FV) techniques to
the (FE) discretization method has produced a highly robust means of predicting not only high speed
turbulent flows, but compressible flows, as well. All of this has been accomplished with the strictest
application of Galerkin's method of weighted residuals. For simple geometries, you can show that all
3 of these methods produce the exact same solution matrix or digital representation. All 3 methods
can produce similar sets of discretized equations for the governing equations of fluid flow and heat
transfer.

3.8 Spectral Methods


Spectral methods are powerful methods used for the solution of partial differential equations. Unlike
finite difference methods, spectral methods are global methods, where the computation at any given
point depends not only on information at neighboring points, but on information from the entire

49 “Finite Element vs Finite Volume”, Autodesk Knowledge Network.


64

domain. The numerical solution is expressed as a finite expansion of some set of basis functions.
When the PDE is written in terms of the coefficients of this expansion, the method is known as a
Galerkin spectral method. Spectral methods converged exponentially, which makes them more
accurate than local methods. Global methods are preferable to local methods when the solution
varies considerably in time or space, when very high spatial resolution is required, and also when
long time integration is needed50. In the past several years, the activity on both theory and application
of spectral methods have been concentrated on collocation spectral methods. One of the reasons is
that collocation methods deals with nonlinear terms more easily than Galerkin methods. The
nonlinear terms are treated on a FD manner, via grid points values multiplication. The underlying
idea of a collocation spectral method is to approximate the unknown solution in the entire
computational domain by an interpolating high order polynomial at the collocation points. The
spatial derivatives of the solution are approximated by the derivatives of the polynomial and the time
derivative, if it exists, is solved through classical finite differences schemes. Periodic and non-periodic
problems are respectively treated with trigonometric and algebraic polynomials. Some of the
methods commonly used in the literature are the Fourier collocation methods for periodic domains
and the Jacobi polynomials for non-periodic domains, with the Chebyshev and Legendre polynomials
as special cases51.

3.8.1 Fast Fourier Transform Methods


The most accurate method for calculating spatial derivatives is to use Fast Fourier Transforms.
Instead of being (Δx)2, (Δx)6 or (Δx)n , the spectral, semi-spectral or Galerkin methods converge to
the exact solution faster than any algebraic value of n < ∞. As Δx decreases, the rate of convergence
is exponential. That does not mean however, that for some finite value of Δx that the spectral method
will give a perfect solution52. The French mathematician J. B. J. Fourier discovered that periodic
waveforms can be modeled as the sum of sine and cosine waves called a Fourier series. The
mathematical expression is given in Equation 1 for a generic signal with a known range. Application
of Equation (5.5) for a square wave with increasing values of “n” yields to Figure 36 , where it is
apparent that as n -> ∞ the square wave is more accurately reproduced.

1 
  nx   nx 
f(x)  a 0   a n cos    b n sin   (5.5)
2 n 1   L   L 

The Fourier transform is used to represent a periodic function by a discrete sum of complex
exponentials. Instead of Eq. (5.5) above, we could equally write the summation in complex form:

 inπn L inπn
1
f(x)   e
2L L
L
, cn  f(x) e L
dx (5.6)


If we define a new variable k = 2πn⁄α we can define the Fourier Integral (after some math):

50 Sigal Gottlieb and David Gottlieb (2009), Scholarpedia.


51 Bruno Costa, “Spectral Methods for Partial Differential Equations”, A Mathematical Journal Vol. 6, No 4, (1-
32). December 2004.
52 Computational Fluid Dynamics lecture series in Spectral Methods.
65


f(k)   f(x) eikxdx (5.7)


If we want a result for F(k), which is called the Fourier Transform f(x), we apply equation (5.6) in the
limit as approaches infinity with the Fourier series coefficients cn = ckα/2π. The Fourier transform is
closely related to a Fourier series and is used to represent a general function by a continuous
superposition (or integral) of complex exponentials. The Fourier transform decomposes an arbitrary
waveform into its sine components, thus revealing its frequency content that might else be difficult
to detect. A Discrete-Time Fourier transform (DTFT) is a form of the Fourier transform that is
applicable to uniformly sampled continuous functions. The Fast Fourier Transform (FFT) takes
advantage of powers of two and is a numerically efficient implementation of computing DTFTs.
Simply stated, the FFT is an efficient numerical algorithm that allows for the transformation of a time
dependent signal into the frequency domain (or vice-versa)53.

Figure 36 Partial sums of the Fourier series of a square wave

3.8.2 Finite Differences vs. Spectral Methods


Finite difference methods are obtained by approximating a function u(x) by a local polynomial
interpolant, and the derivatives of u(x) are then approximated by differentiating this local
polynomial. Here local refers to the use of nearby grid points to approximate the function or its
derivative at a given point. For slowly varying functions, the use of local polynomial interpolants
based on a small number of interpolating grid points is very reasonable. Indeed, it seems to make
little sense to include function values far away from the point of interest in approximating the
derivative. However, using low-degree local polynomials to approximate solutions containing very
significant spatial or temporal variation requires a very fine grid in order to accurately resolve the
function. Clearly, the use of fine grids requires significant computational resources in simulations of

53A Guide to Random Data Analysis for Computational Fluid Dynamics, Published by Computer Aided
Engineering Associates Inc.
66

interest to science and engineering. In the face of such limitations we seek alternative schemes that
will allow coarser grids, and therefore fewer computational resources. Spectral methods are such
methods; they use all available function values to construct the necessary approximations.

3.9 Residual Method (WRM)


Weighted residual methods (WRM) assume that a solution can be approximated analytically or
piecewise analytically. In general a solution to a PDE can be expressed as a superposition of a base
set of functions
N
T(x , t)   a j (t) j (x) (.)
j1

where the coefficients aj are determined by a chosen method. The method attempts to minimize the
error, for instance, finite differences try to minimize the error specifically at the chosen grid points.
WRM’s represent a particular group of methods where an integral error is minimized in a certain
way and thereby defining the specific method. Depending on the maximization WRM generate

 Finite Volume Method,


 Finite Element Methods,
 Finite Difference Methods.
 Spectral Methods,

3.9.1 General Formulation


The starting point for WRM’s is an expansion in a set of base or trial functions. Often these are
analytical in which case the numerical solution will be analytical

N
T(x, y,z, t)  T0 (x, y,z, t)   a j (t) j (x, y,z) (.)
j1

with the trial functions φj(x; y; z). T0(x; y; z; t) is chosen to satisfy initial or boundary conditions and
the coefficients aj(t) have to be determined. possible trial functions are φj(x) = xj-1 or φj(x) = sin(jπx).
The expansion is chosen to satisfy a differential equation L(͠T) = 0 (where T is the exact solution)

T 2T
L(T)  α 2  0 , (.)
t x
However, the numerical solution is an approximate solution, i.e., T≠ ̅T such that the operator L
applied to T produces a residual L (T) = R . The goal of WRM’s is to choose the coefficients aj such
that the residual R becomes small (in fact 0) over a chosen domain. In integral form this can be
achieved with the condition

 W m (x, y,z) R dx dy dz  0 (.)

where Wm is a set of weight functions (m = 1 , , , , M) which are used to evaluate above equation. The
exact solution always satisfies (6.2) if the weight functions are analytic. This is in particular true also
for any given subdomain of the domain for which a solution is sought. There are four main categories
of weight or test functions which are applied in WRM’s, namely,
67

1. Subdomain method
2. Collocation method
3. Least squares method
4. Galerkin method

For excellent discussion regarding these method and general information, readers should consult54.

3.10 Some Attributes to Spatial Discretization


3.10.1 Cell-Centered (CC) vs. Node-Centered (NC)
The cell-centered (CC) referred to a discretization that uses primal grid cells as control volumes, as
opposed to node centered (NC) that uses median-dual cells as control volumes. Illustrates the control
volume partitioning of a finite volume discretization. Performance of flow solvers can also vary with
each algorithm and mesh data structure used. While the CC based solvers integrate the fluxes on the
faces of individual cells, NC based solvers integrate the fluxes over cells connected to individual cells.
Though the number of faces is the same in both approaches, the actual finite volume used in CC based
is smaller hence better spatial resolution. On the other hand, the NC based approach works with less
memory, especially for tetrahedral cells when usually the numbers of cells are five-six times of
nodes55. In cell-centered scheme, the control volumes are identical with the grid cells and the flow
variables are associated with the centers of the grid cells as illustrated in Figure 37. When we
evaluate the discretized flow equations, we have to supply the convective and the viscous fluxes at
the midpoints of the faces of the control volume. However, in cell-vertex scheme, the flow variables
are associated with the grid nodes (vertices) rather than the cell centroids. Median-dual control
volumes are formed by connecting the centroids, face- and edge-midpoints of all cells sharing the
particular node. The definition of a median-dual control volume results in a polyhedral hull around
each grid node.

Figure 37 Cell Centered and Node Centered

54Weighted Residual Methods, Chapter 6.


55 Diskin, Boris; Thomas, James: “Comparison of Node-Centered and Cell-Centered Unstructured Finite-Volume
Discretization: Inviscid Fluxes,” AIAA Journal 2010.
68

3.10.2 Staggered vs Collocated Grids


This has nothing to do with grid generation techniques but rather spatial discretization. A staggered
grid is a setting for the spatial discretization, in which the variables are not defined at the same
position as in case of the collocated grid. On a staggered grid the scalar variables (pressure, density,
total enthalpy etc.) are stored in the cell centers
of the control volumes, whereas the velocity or
momentum variables are located at the cell
faces. This is different from a collocated grid
arrangement, where all variables are stored in
the same positions. A staggered storage is
mainly used on structured grids for
compressible or incompressible flow
simulations. Using a staggered grid is a simple
way to avoid odd-even decoupling between the
pressure and velocity. Odd-even decoupling is a
discretization error that can occur on collocated
grids and which leads to checkerboard patterns
in the solutions. The disadvantage of using
staggered grids is that different variable are
stored at different places and this makes it more Figure 38 Control Volume for spatial
difficult to handle different control volumes for discretization of staggered grid vs collocated
different variables and to keep track of the
metrics56. Most modern codes instead use a collocated storage. Figure 38 shows a regular staggered
grid for the discretization of two dimensional incompressible Navier-Stokes equations. When solving
the incompressible Navier-Stokes in the primitive variables (u, v, and p) formulation, we need to
discretize the pressure and the velocity components. On a staggered grid these primitive variables
are all defined at different location, with pressure p at the cell center and the velocity components at
the center of the cell faces57.

3.10.3 Desired Properties in Discretization Schemes


In general, any discretization scheme should have the following properties:

 Conservativeness - global conservation of properties must be insured, i.e., flux consistency


in control volume (Flux IN = Flux OUT).
 Boundedness - values predicted by scheme should be within realistic bounds. For linear
problems (Heat conduction), those would be the boundary values. For non-linear problems,
the values within the domain could be outside of boundary values.
 Transportiveness - As diffusion works in all direction, but convection only in flow direction,
the numerical scheme should recognize the flow direction since it effects the balance of
convection vs. diffusion (Peclet Number).

The manner in which the convective and diffusive fluxes are expressed in terms of nodal φ values is
one of the key factors determining accuracy and stability, for both steady-state and transient

56 CFD Online.
57 Nikhil Kumar, PhD candidate - Scientific computing.
69

calculations. At the high Reynolds numbers often encountered in practice, the choice of convective
flux approximation is particularly important.

3.11 Spatial Discretization Schemes


It is worth noting that concept of discretization commonly refers to Domain Discretization (Grid
Generation), Spatial discretization (Governing Equation), and Temporal discretization (Transient
case). Here we are concerned with Spatial Discretization of G.E. From Wikipedia, the free
encyclopedia, in mathematics, discretization concerns the process of transferring continuous
functions, models, and equations into discrete counterparts. This process is usually carried out as a
first step toward making them suitable for numerical evaluation and implementation on digital
computers. Among most frequently used discretization schemes are upwind differencing (UD),
Central Differencing (CD), Total Variation Diminishing (TVD), Monotone Upstream-Centered
Schemes (MUSCL), and Quadratic Upwind Interpolation for convection Kinetics (QUICK). Each has its
own characteristics and feasibility, to be discussed below. In addition, order of accuracy
consideration for a jet flow temperature profile has been shown below for 1st – 5th order (see Figure
25). Dramatic difference in the character of the solution between the first and second order or higher
is present, but higher order doesn’t mean it’s always more accurate (more CPU time & round off
errors).

3.11.2 First-order Upwind (UD)


Perhaps the most widely used and simplest scheme as shown in Figure 40 (a). It is conservative,
bounded and very stable but dissipative and creates false diffusion. Flux limiters are recommended
to encounter that. It is 1st order accurate and ideal for flow exhibiting a primary direction. Usually
recommended for hyperbolic flow regions58.

3.11.3 Central Differencing (CD)


This is a 2nd order accurate scheme as shown in Figure 40 (b). It is bounded at lower Peclet (Pe)
number, but not bounded or conservative at higher Pe number as such correlation shown in Figure
9. Not recommended for Uni-directional flows due to its symmetry character. Although it is not
dissipative, it is dispersive and usually recommended for elliptic flow regions. In order to overcome
the issues with un-roundness and wiggles in solution, leading to stability issues, a deferred linear
interpolation approach for CD is proposed a

 f   f, UD   f, CD   f, UD (5.12)
   
implicit explicit

As indicated, the upwind part is treated implicitly while the difference between the central-difference
and upwind values is treated explicitly. Provided that the numerical solution converges, this
approach leads to pure second-order accuracy. On some commercial suites such as Fluent©, the
usage of CD differencing is restricted to pressure-based solvers.

3.11.4 Second–order Upwind Differencing (UD)


This 2nd order accurate scheme as shown in Figure 40 (c) is as its first-order cousin, depends on the
flow direction but not bounded. To a lesser extent, it is still dissipative. Flux limiters are advised on
its implementation59.

58 Georgia Tech Computational Fluid Dynamics Graduate Course; spring 2007.


59 Georgia Tech Computational Fluid Dynamics Graduate Course; spring 2007.
70

3.11.5 Power Law Scheme


This is based on the analytical solution of the one-dimensional convection-diffusion equation. The
face value is determined from an exponential profile through the cell values. The exponential profile
is approximated by the following (see Figure 40 (d)).

(1  0.1 Pe) 5
e  P  ( E   P ) (5.13)
Pe

Where Pe is the Peclet number and for Pe > 10 the diffusion is ignored and 1st order upwind is used.

3.11.6 Quadratic Upwind Interpolation for convection Kinetics (QUICK)


This is a 3nd order accurate scheme, independent to flow direction and not bounded. It is based on a
weighted average of second-order-upwind and central interpolations of the variables. It uses
consistent quadratic profile, therefore, conservative. It has a build in transportivness and is
conditionally bounded.

3.11.7 Monotone Upstream-Centered Schemes for Conservation Laws (MUSCL)


This is a highly accurate scheme for solutions that exhibit shocks and discontinuities. It is a
combination of 1st and 2nd order accurate. Further, the 2nd order spatial accuracy for the inviscid
fluxes is achieved in by using MUSCL
extrapolation to reconstruct an
approximate value of the primitive
variables, each side of each cell face.
The MUSCL scheme uses a 13 point
stencil per cell in three dimensions,
as shown in Figure 39. The viscous
flux is calculated using a Green's
Theorem approach to calculate the
derivatives at cell faces and central
differencing is used to calculate the
scalar values. The viscous fluxes Figure 39 Viscous & Inviscid Stencil for a 2nd order accurate
require an additional twelve points MUSCL
to be added to the inviscid stencil for
a total of 25 cells in the stencil per
cell.

3.11.8 Total Variation Diminishing (TVD)


This is a 2nd order upwind differencing and defined as a system which does not increase the total
variation of the solution,

TV(u n 1 )  TV(u n ) where TV(u)   u j1  u j (5.14)


j

3.11.8.1 Total Variation Diminishing Cubic Interpolated Propagation (TVDCIP)


For special case of fire science, proposed the new scheme, TVDCIP (Total Variation Diminishing Cubic
Interpolated Propagation), that consists of the spatial interpolation and the mathematical algorithm
for switching scheme with high order accuracy. TVDCIP method is applied to solve the nonlinear
71

hyperbolic partial differential equations numerically such as Navier-Stokes type equations.60 It is


basically used for convection terms. Other special cases including viscoelastic flows, the polymeric
stress derivative term in the momentum we adopt a Fourth-Order Accurate Compact scheme (COM4)
which has no dissipative error.61

3.11.9 Monotone Advection and Recons traction Scheme (MARS)


MARS is a multidimensional second-order accurate differencing scheme that operates in two
separate steps:

3.11.9.1 Reconstruction
A set of monotone gradients are computed using a multidimensional Total Variation Diminishing
(TVD) scheme. The cell flow properties and the gradients completely define a second-order accurate
spatial discretization.

3.11.9.2 Advection
The reconstructed cell-face flow properties are used to compute the face fluxes for all advected
properties using a monotone and bounded advection scheme. This incorporates a variable
compression level which controls the amount of second-order up winding of the scheme without
affecting the order of accuracy of the spatial discretization. MARS does not rely on any problem
dependent parameters to work properly and it can automatically handle all flow problems and mesh
types supported. However, the user can control the ability of the advection scheme to accurately
capture sharp discontinuities in the flow by setting the scheme’s compression level to a value
between 0 and 1. Low values for this parameter result in a computationally efficient scheme at the
expense of sharpness of resolution. High values improve the resolution but result in an increased
number of iterations when steady flows are computed. The default value for this parameter is 0.5
which is a compromise between accuracy and convergence rate. Of all schemes available, MARS
possesses the least sensitivity of solution accuracy to the mesh structure and skewness.

3.11.10 Blended Differencing


In this method a higher-order, non-monotone scheme like CD or LUD is blended with the lower-order
UD scheme to suppress dispersion. However, the blending factor γ is now user-specified, giving

 jBD  γ jCD/LUD  (1  γ) jUD where 0  γ 1 (5.15)

Evidently, this practice will sometimes involve some trial-and-error adjustments for optimal results.

3.11.11 Higher Order Upwind Schemes


Even though the fluxes were computed exactly, the solution was very inaccurate due to numerical
diffusion. Since the advection is exact, the problem must lie with the averaging of the solution and
the assumption of a constant state in each cell. To generate more accurate schemes, we need to
reconstruct a more accurate representation of the function in each cell. A fairly general family of
higher order methods can be constructed by weighing the slopes in each cell in different ways.
Evaluation of the function at the cell boundary (see Figure 40 (e)). Different values of k give different
second order schemes. To prevent oscillations near shocks when using high order schemes, we have
already talked about artificial viscosity where we attempt to smooth out oscillations around the
shocks. The more modern approach is to prevent the appearance of oscillations by either:

60 T. Yamanashi, H. Uchida, and M. Morita,” Study on the Numerical Accuracy for the CFD”, Tokyo University of
Science, 1-3 Kagurazaka, Shinjuku-ku, Tokyo, 162-8601, Japan.
61 S.K. Lele, “Compact finite difference schemes with spectral-like resolution”, J. Computational Phys. 103 (1992).
72

 Limit the slopes when the variables are extrapolated to the cell boundaries.
 Limit the fluxes near shocks to prevent under or over shoot.
 Reduce the cell Reynolds number (Pe < small ⇾ smaller grid size).

To prevent oscillations, apply Limiters to reduce the slopes where they will cause oscillations62.

1 k
u Lj1/2  u j  u j  u j1   1  k u j1  u j  (5.16)
4 4
1 k
u Rj1/2  u j1  u j1  u j   1  k u j2  u j1 
4 4
1
k  -1  Second order k   Third order
3
k  0  Fromm' s scheme k  1  Centeral
1
k  QUICK
2

Figure 40 Different Spatial Scheme

62 Grétar Tryggvason, “Computational Fluid Dynamics Lecture Series”, spring 2013.


73
74

4 Basic CFD (II)

4.10 Temporal Discretization


To account for transient effects, the governing equations must be discretized in time63. As it turns
out, the temporal discretization is slightly easier to deal with than that for the spatial effects. Since
the governing equation is hyperbolic/parabolic in time, the solution at time t depends upon its
history and not on its future. Transient effects are usually dealt with by using a time stepping
procedure, with an initial condition provided. The time dimension is divided into a set of discrete
time steps, each of size ∆t. The solution algorithm therefore marches forward in time, computing a
solution at each time step. The spatial discretization for the time-dependent equations is identical to
the steady-state case. Temporal discretization involves the integration of every term in the
differential equations over the time step ∆t. The integration of transient effects takes several forms,
each yielding a different accuracy. For simplicity, we express the time dependent transport of a scalar
ϕ as

(ρ )
 L( ) (5.17)
t
Where the function L is an operator that incorporates all of the non-transient terms, namely:
diffusion, convection, and source terms. Integrating the above equation over a control volume yields

(ρ )

V
t
dV   L( )dV  L( )
V
(5.18)

After the spatial discretization has been performed using the techniques described in the other
sections, we obtain where L denotes the spatial discretization operator (the discretized diffusion,
convection, and source terms), and V denotes the volume. At this point, we make an important
observation. The temporal discretization of the transient term (LHS) need not be the same as that of
the discretized diffusion, convection and source terms (RHS). Each term can be treated differently yield
different accuracies. We are now ready to perform the transient discretization. In the framework of
the finite volume method, there are various methods that can be used to perform this task, the most
popular of which are the Euler implicit, Crank-Nicolson, and the fully implicit schemes. The
temporal discretization of the diffusion, convection, and source terms will be presented first,
followed by the methods used for the transient term. We assume the values at a given control volume
are known at an initial time t and we are interested in obtaining the values at time t+∆t. This method
states that the time integral of a given variable is equal to a weighted average between existing and
future values. For a given control volume ϕ, the RHS of the general discretized equation L(ϕ)
contains terms involving values at ϕ and its neighboring control volumes. The temporal
discretization is carried out through an integration over time of the RHS where each unknown is
involved in the process. An integration over time of the RHS where each unknown is involved in the
process.

63 CFD on Line discussion


75

t
t Δt

φ dt  f φ t Δt  (1  f) φ t Δt  (5.19)

Where f is a weighing factor between 0 and 1. The following holds:

 f = 0 results in the fully explicit scheme


 f = 1 results in the fully implicit scheme
 f = 0.5 results in the Crank-Nicolson scheme

The product of most frequently schemes are described below. Other notable schemes are time spilt
McCormack method, Lax-Wendorff, and ADI, as well as many more as described in various text
books.

4.10.1 Example of Transient 1D Diffusion with Source Term


Retaining the time derivative in the conservation equation we get,

d  dU  U
k   Qv  (.)
dx  dx  t

The right hand side includes effects of the source term and the diffusion term.

t  Δt
U U
 f 
d  dU 
k   Qv  or   (x, t)  t  Δt
 (1  f) t Δt (.)
dx  dx  t t t

where the right hand side includes effects of the source term and the diffusion term. The transient
term on the left can expressed simple explicit method as

U U
1 t

  dtdx  (U t1 - U t 0 ) x (.)
t t0
t

Or, one of following methods.

4.10.2 Euler Implicit


The 1st order accurate Euler Implicit is probably the most used techniques in transient simulation
because of its simplicity. It is

 n 1   n
 L( n 1 ) (5.20)
Δt
Where L denote the spatial discretization. This is unconditionally stable and results in a tridiagonal
system of algebraic equations to be solved by Thomas algorithm.

4.10.3 Crank-Nicolson
This is also an implicit scheme and like previous method it is unconditionally stable, but 2nd order
accurate in time. The equations can be written as
76

 n 1   n
 L( n ,  n 1 ) (5.21)
Δt
Where again L is an operator of spatial discretization and the resulting equations yields a tridiagonal
system of linear algebraic equations.

4.10.4 Simple Explicit


The following explicit scheme which is 1st order accurate in time is presented as

 n 1   n
 L( n ) (5.22)
Δt

Although the explicit schemes are not recommended because of the obvious reasons, nevertheless,
it is mentioned as completeness.

4.10.5 Runga-Kutta Method


In numerical analysis, the Runge–Kutta methods are a family of implicit and explicit iterative
methods, which includes the well-known routine called the Euler Methods (yn+1 = yn+ hf(xn,yn)), used
in temporal discretization for the approximate solutions of ordinary differential equations64. These
methods were developed around 1900 by the German mathematicians C. Runge and M. W. Kutta.

4.10.5.1 Explicit Treatment


The family of explicit Runge–Kutta methods is a generalization of the method mentioned above. It is
given by:

k1  f(t n , y n ),

k 2  f(t n  c 2 h, y n  h(a 21k1 )),
s

(5.23) y n 1  y n  h  b i k i k 3  f(t n  c3h, y n  h(a 31k1  a 32k 2 ))
i 1 . . . .

k s  f(t n  cs h, y n  h(a s1k1  a s2k 2  .......  a s,s 1k s 1 ))

To specify a particular method, one needs to provide the integer s (the number of stages), and the
coefficients aij (for 1 ≤ j < i ≤ s), bi (for i = 1, 2,..., s) and ci (for i = 2, 3,.., s). The matrix [aij] is called the
Runge–Kutta matrix, while the bi and ci are known as the weights and the nodes defined by

i 1

a
j1
ij  c i for i  2,......, s (5.24)

By far the most often used is the classical fourth-order Runge-Kutta formula RK4, which has a
certain sleekness of organization about it65:

64“Runge–Kutta methods”, From Wikipedia, the free encyclopedia.


65 “Numerical
Recipes In C: The Art of Scientific Computing”, (ISBN 0-521-43108-5), Copyright (C) 1988-1992 by
Cambridge University Press.
77

k1  h f x n , y n  
 
k  h f  x  h , y  k1  


2

n
2
n
2 
y n 1  y n  h f(x n , y n )   (5.25)
k  h f  x  h , y  k 2 
 3 
n
2
n
2 
 
k 4  h f x n  h, y n  k 3  

y n 1  y n 
k1 k 2 k 3 k 4
6

3

3

6
  h5  
Therefore, fourth-order Runge-Kutta method requires four evaluations of the right hand side per
each step size h.

4.10.5.2 Implicit Runge–Kutta methods


All Runge–Kutta methods mentioned up to now are explicit methods. Explicit Runge–Kutta methods
are generally unsuitable for the solution of stiff equations because their region of absolute stability
is small; in particular, it is bounded. This issue is especially important in the solution of partial
differential equations. The instability of explicit Runge–Kutta methods motivates the development of
implicit methods. An implicit Runge–Kutta method has the form

s  s 
y n 1  y n   bi k i where k i  f  t n  ci h, y n  h  a ijk i  (5.26)
i 1  j1 
The difference with an explicit method is that in an explicit method, the sum over j only goes up to i-
1. The coefficient aij of an explicit method is lower triangular. In an implicit method, the sum over j
goes up to s and the coefficient matrix is not triangular. The consequence of this difference is that at
every step, a system of algebraic equations has to be solved. This increases the computational cost
considerably. If a method with s stages is used to solve a differential equation with m components,
then the system of algebraic equations has ms components. This can be contrasted with implicit
linear multistep methods (the other big family of methods for ODEs): an implicit s-step linear
multistep method needs to solve a system of algebraic equations with only m components, so the size
of the system does not increase as the number of steps increase.

4.11 Transient Simulation


Alternatively, the transient (un-steady) scheme could be visualized as series of quasi-Steady-State
solutions to be advanced temporally until pre-defined run time reached. Figure 41 and Figure 42,
depicts such solution propagation though time steps66. Unlike steady-state where the solution is
advanced until residuals fall below pre-defined tolerance level, in transient analysis, there is really
no pre-set convergence criteria defined expect the duration time. The transient residuals although
should fall but could exhibit certain small oscillations, characteristic of unsteady flow. AS long as that
oscillation are small enough to limit the temporal approximation errors. The choice of time step is of

66 Bakker André, Applied Computational Fluid Dynamics; Solution Methods; 2002.


78

course most important and should be


elected carefully. It is restricted by CFL
number on explicit methods. For fully
implicit methods, although in principal it
could be any value, but in practice other
considerations impose limit as previously
indicated. Usually there are options of static
(constant) step size, or more robust
dynamic evaluation as dictated internally
by the solver. For spatial schemes, as
eluded before, there are two main choices,
each with its own advantages and
shortcomings. While the low-order
schemes are relatively easier to implement,
but they tend to give rise to numerical
Figure 42 Transient Solution Sequences
diffusions which smears the flow gradients.
Some of these could be adjusted by refining
the mesh but at increased
computational cost. The
higher-order schemes which
better preserve steep
gradients are harder to
implement and could provoke
numerical instabilities
(dispersion) and oscillations.
These could also be reduced
with finer mesh but more CPU
intensive.

4.11 Steady-State Vs Figure 41 Transient Solution Procedure


Transient
"How do I know in advance whether to perform a steady-state or an unsteady CFD simulation?" The
simple answer is, "you don't know", so it is imperative to provide some help on when to use unsteady
(also known as transient or time-dependent) simulations67. When you run a steady-state simulation
it uses an iterative scheme to progress to convergence. If you see persistent oscillations in the
residuals plot (solver diagnostics) or oscillations in a key monitor, such as a drag force monitor, with
increasing iterations then that's a good indicator the flow may be unsteady (transient) and the
simulation needs to be run as an unsteady. When you are unsure as to whether your simulation is
unsteady or steady-state it is always worth running a steady-state simulation first because it typically
takes an order of magnitude less CPU time to complete. If the steady-state simulation is sufficient
then you'll save a lot of time over running an unsteady simulation. As an example let us examine the
residual and force monitors for an unsteady simulation of vortex shedding behind a cylinder (see
Figure 43 (a)) and compare them with those generated by the same simulation running, incorrectly,
in steady-state mode.

67 “Steady-State or Unsteady CFD Simulation?” Symscape, Computational Fluid Dynamics Software for All.
79

4.11.1 Case Study 1 - Vortex shedding behind a Cylinder - Ran as SS (Wrong!)


Remember that vortex shedding behind a cylinder is unsteady as described in the previous section,
so it is interesting to see what happens when you try to run the same simulation in steady-state mode.
Clearly after only 20 updates (200 iterations) there is something wrong, as expected, indicated by
the widely oscillating lift force. For a steady-state simulation you'd expect some oscillations in the lift
force values when you first start the simulation and then see them damp out to a fixed value with
increasing iterations. Something is also wrong, as expected, with the residuals. For a steady-state
simulation you should see all residuals reduce relatively smoothly toward or below 1e-3 with
increasing iterations (see Figure 43 (b)-(c)).

(a) Pressure
Contours

(b) Steady-State
Force Monitor for
a flow pass a Circle

(c) Steady-State
Residual Monitor
for a flow pass a
Circle

Figure 43 Vortex shedding behind a cylinder run wrongly as a Steady State

4.11.2 Case study 2 - Double sided membrane case - Ran as SS (Right!)


For a steady-state simulation the residuals and force profile should be something similar to those in
the tutorial "Flow Over a Double-Sided Membrane". Note the converged lift and drag force values
with increasing iterations68. The relatively smooth reduction below 1e-3 in all the residuals with
increasing iterations. In conclusion, if you run a steady-state simulation for an unsteady flow then
you will get poor results, but as I just pointed out there is usually a good indication from the steady
state results that an unsteady simulation was necessary. However, if you find that that your
simulation has a steady-state then you can avoid the unnecessary expense of performing an unsteady
simulation (see Figure 44).

68 “Steady-State or Unsteady CFD Simulation?” Symscape, Computational Fluid Dynamics Software for All.
80

(a) Double Sided


Membrance

(b) Steady-State
Force Monitor

(c) Steady-State
Residual Monitor

Figure 44 Steady-State Force and Monitoring for a flow over a double sided membrane case

4.12 Wall Distance Estimation


The non-dimensional y+ quantity, (based on local cell fluid velocity from the wall to the first node),
has a different meanings in terms of Boundary Layer theory and CFD. In Boundary Layer, y+ is simply
a local thickness Reynolds number. In CFD, y+ is a non-dimensional distance from the wall to the first
grid point. Typical range of y+ for a flow over a smooth flat plate with no adverse pressure gradient
is from wall out to about 150 (see Figure 45). For finer mesh lower values of y+ should be used. The
mechanism for estimating y+ could be followed by using the local Re x and an imperial skin friction
correlation as follow:

ρU  L BL
Cf  2log10 (Re x )  0.65
 2.3
Re x  (5.27)
μ
1 τw y μ
τ w  Cf  ρU 2 2 u  y
2 ρ ρu 

Now that we know how to obtain non-dimensional y+ (mostly imperially), you might asked why?
Estimating y+ is so important because placing the first layer of mesh had tremendous impact in CFD
and Near Wall analogy. It dictates how many cell needed to resolve flow accurately. As you approach
the wall you will notice that the velocity decreases non-linearly up to a point where the fluid will have
zero velocity at the wall. This is what is termed the "no slip" wall condition in CFD. If we plot a
typical velocity profile in the near-wall region, we can see that we have a large change in velocity in
the wall normal direction and it is important to our CFD simulation that we capture this gradient
correctly. Now that we know how to obtain non-dimensional y+ (mostly imperially), you might asked
why? Estimating y+ is so important because placing the first layer of mesh had tremendous impact in
81

CFD and Near Wall analogy. It dictates how many cell needed to resolve flow accurately. As you
approach the wall you will notice that the velocity decreases non-linearly up to a point where the
fluid will have zero velocity at the wall. This is what is termed the "no slip" wall condition in CFD. If
we plot a typical velocity profile in the near-
wall region, we can see that we have a large
change in velocity in the wall normal direction
and it is important to our CFD simulation that
we capture this gradient correctly. To do this,
we need to use inflation layer meshing
to accurately capture the boundary layer
region for any wall-bounded turbulent
flows. The image below plots the non-
dimensional velocity versus the non-
dimensional wall normal distance, with each
line from top to bottom demonstrating the
difference between a favorable pressure
gradient (APG) through to adverse pressure
gradient (FPG) with flow separation. (See
Figure 45). It is clear that the flow behavior
in the near wall region is fairly complex and
Figure 45 Near wall velocity profile
needs to be captured appropriately to have
any confidence in our CFD results,
especially if we intend to report key engineering data such as separation points or pressure drops.
Providing a suitable inflation mesh for the geometry is strongly tied to the choice of the turbulence
model, and the flow field we are interested in capturing. We can elect to resolve the complete profile
of the boundary layer of alternatively we can make use of empirical wall functions to reduce the cell
count. To use a wall function approach
for a particular turbulence model with
confidence, we need to ensure that our
y+ values are within a certain
range. Figure 46 exemplifies the
relationship between y+ and first layer
of boundary layer. It is considered good
practice to include between 10 and 15
layers situated within the boundary
layer of your flow to accurately resolve
and predict any separation or
reattachment points69. Figure 46 Wall function relation in Boundary Layer

69 LEAP CFD Team, Leap Australia CFD Team Blog, 2014.


82
83

5 Non-Linear CFD Equations

5.1 An Overview
The solution methods could be depending on flow characteristics such steady/un-steady,
compressible/incompressible, viscous/inviscid as well as parameters such as Mach number which
govern flow speed for subsonic/transonic/supersonic regions. Each dependency, or their
combination, could alter the mathematical nature of the equations, therefore, influencing the
selection of appropriate method of solution. Moreover, the 2D & 3D versions of same equations could
under similar conditions, exhibit different characteristics. For example, while 2D boundary layer
equations are parabolic in nature and could be solved by marching methods, the 3D are hyperbolic
and require different technique. The time dependency could also play dominant role. Prime example
would be un-steady Euler equation which of course requires time integration as it is hyperbolic for
all flow regions, and could benefit from a time marching procedure. On the other hand, the steady-
state version, although simpler, has elliptic behavior for subsonic regions, parabolic for sonic and
hyperbolic for supersonic flows. Therefore, requiring different strategy on each occasion as
previously noted70.

5.3 Coupled vs Segregated Algorithms


The segregated and coupled approaches differ in the way that the continuity, momentum, and (where
appropriate) energy and species
equations are solved, separated.
The solver solves these
equations sequentially (i.e.,
segregated from one another –
see Figure 47), while the
coupled solver solves them
simultaneously (i.e., coupled
together – see Figure 48). Both
formulations solve the equations
for additional scalars (e.g.,
turbulence or radiation
quantities) sequentially. The
segregated solver traditionally
has been used for
incompressible and mildly
compressible flows. The coupled
approach, on the other hand,
was originally designed for high-
speed compressible flows. Both
approaches are now applicable
to a broad range of flows (from
incompressible to highly
compressible), but the origins of
the coupled formulation may Figure 47 Segregated Solution
give it a performance advantage

70Diskin, Boris; Thomas, James: “Comparison of Node-Centered and Cell-Centered Unstructured Finite-Volume
Discretizations: Inviscid Fluxes,” AIAA Journal 2010.
84

over the segregated solver for


high-speed compressible flows.71
Coupled flow needs more
resources like memory and
computational time as it solves
coupled equations. But that also
means, it's more stable in cases
with high density fluctuations like
supersonic flow with shocks etc.
It's not the best choice for a
standard case as it might be
unstable unless you reduce the
courant number a lot. Segregated
flow is a good choice for most cases
since it runs fast, but can have
problems with supersonic flows.
Mathematically, the main
difference is that the fully coupled
solver operates on the full Jacobian
matrix as one entity. The
segregated solver splits the
Jacobian matrix into smaller sub- Figure 48 Coupled Solutions
problems, usually by degree of
freedom type. Different solution strategies can then be used for each sub-problem. The optimal
choice between segregated and fully coupled is problem specific. The fully coupled solver generally
requires less iterations but takes up more memory and solution time per iteration.72

5.4 Explicit vs Implicit Methods


The solution methods could be characterized into two main category of Explicit and Implicit. While
the Explicit schemes have the advantage of relative ease in implementation, as they don’t require any
matrix inversions, but are bounded by step size and stability considerations. On the other hand, the
implicit schemes are more prone to be stable, but computationally intensive as they mostly require
linearization of systems of equations and matrix solvers. The linearization of the equations are mostly
achieved by Taylor series expansion of non-linear coefficient matrixes. The final resultant expression
could be devised as multiple simpler steps to solve using concepts such Approximate Factorization
(AF). The matrix solvers are also could be grouped as Iterative solvers (Guass-Seidel, SOR, ADI, block
iterative) or direct solvers using schemes such as Guassian Elimination or Thomas Algorithm. Multi-
Grid methods such those implicating V or W cycles for interpolating and extrapolating the results
back and forth between different mesh densities. The validity and feasibility of each method depends
to the application. In Computational Fluid Dynamics (CFD), the governing equations are nonlinear,
and the number of unknown variables is typically very large. Under these conditions implicitly
formulated equations are almost always solved using iterative techniques. Iterations are used to
advance a solution through a sequence of steps from a starting state to a final, converged state. This
is true whether the solution sought is either one step in a transient problem or a final steady-state
result. In either case, the iteration steps resemble a time-like process. Of course, the iteration steps
usually do not correspond to a realistic time-dependent behavior. In fact, it is this aspect of an implicit

71 Solver Panel, Fluent® Inc. 2003.


72 N. Elabbasi, Certified Consultant, Veryst Engineering, COMSOL Discussion Forum.
85

method that makes it attractive for steady-state computations, because the number of iterations
required for a solution is often much smaller than the number of time steps needed for an accurate
transient that asymptotically approaches steady conditions. On the other hand, it is also this
“distorted transient” feature that leads to the question, “What are the consequences of using an
implicit versus an explicit solution method for a time-dependent problem?” The answer to this
question has two parts. The first part has to do with numerical stability, and the second part with
numerical accuracy.

5.6 Model Finite Difference Schemes


Now we examine briefly the various Finite-Difference Schemes applied to various model equations
such as wave equations, heat equations, Laplace equation, and Burgers equations as their exact
solution are available and obtained before. These equations can be used to model the behavior of
more complicated partial difference equations. Reader should refer to73 for further details. Here, we
only present the results in Table 3 and Table 4 as they unique to two different Implicit and Explicit
methods. Each of model exhibits certain distinctive features that characteristic of the class of
methods. Detail description on each method is available in74. Based on the information presented
here, it is clear that many techniques can be used to solve the same problem. The difference is the
quality of solution produced and its applicability to problem in hand. The selection can be aided by
experience gained in programming the various methods to solve the equations.

Table 3 Explicit Discretization Methods


Methods Accuracy Stability Test Case Viscosity Useage
ADE 1st order yes 2-D Heat None no
Brailovskaya 1st order conditional 1-D Burges Viscous no
DuFort-Frankel 2nd order yes 1-D Heat None yes
Euler 1st order no 1-D Wave None no
FTCS 1st order conditional 1-D Burges Viscous no
Hopscotch 1st order yes 2-D Heat None no
Iterative Method Explicit conditional 2-D Laplace None yes
Lax 1st order conditional 1-D Wave None no
Lax-Wendroff 2nd order conditional 1-D Wave None yes
Leap Frog 2nd order conditional 1-D Wave None yes
MacCormack 2nd order conditional 1-D Wave None yes
MacCormack 2nd order yes 1-D Burgers Viscous yes
Richardson’s 2nd order no 1-D Heat None no
Rusanov 4th order conditional 1-D Burges Viscous yes
Simple Explicit 1st order conditional 1-D Heat None no
Time -Split Mac Cormack 2nd order Conditional 2-D Burgers Viscous yes
Upstream 1st order conditional 1-D Wave None no
Upwind 2nd order conditional 1-D Wave None yes
Warming-Kutler-Lomax 3rd order conditional 1-D Wave None yes

73 D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, ISBN 0-89116-
471-5 – 1984.
74 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat

Transfer”, Hemisphere Publishing Corporation.


86

Table 4 Implicit Discretization Methods


Methods Accuracy Stability test Viscosity Useage
ADI 2nd order yes 2-D Heat None yes
Allen-Cheng 1st order conditional 1-D Burgers Viscous no
Beam-Warming 2nd order conditional 1-D Burgers None yes
Briley-MacDonald 1st order yes 1-D Burgers Viscous yes
Crank-Nicolson 2nd order yes 1-D Heat None yes
Euler 1st order yes 1-D Wave None no
Simple Implicit 1st order yes 1-D Heat None no
Splitting/Fractional-Step 1st order conditional 2-D Heat None no
Trapezoidal 2nd order yes 1-D Wave None yes
Upwind – (Beam Warming) 2nd order conditional 1-D Wave None yes

5.7 General Discretization Scheme (Beam-Warming)


Among prominent and widely used integration techniques, but not limited, are Crank-Nicolson,
Beam-Warming and Mac-Cormack’s predictor-corrector schemes75. Most could be used cross
governing equations and techniques. Other notables are Euler and Trapezoidal implicit method. In
fact, most of legacy methods are interpedently related. For example, the Implicit Beam-Warming
spatial differencing for vector E is

θ1  Δx  i Δx  i θ  1  
ΔiE  (Δ E)  (E )  2 Δ i 1E  O  θ1   θ 2 (x) 2  (x) 3 
1  θ 2 x 1  θ 2 x 1  θ2  2  
where Δ i E  Ei 1  Ei (6.1)

This general differencing formula, with appropriate choices of parameters θ1 and θ2 reproduces
many of the standard differencing schemes as perceived in following Table 5,

Table 5 Choice of parameters


Θ1 Θ2 Scheme Order of accuracy
0 0 Euler (explicit) (Δx)2
0 -1/2 Leap Frog (explicit) (Δx)3
1/2 0 Trapezoidal (implicit) (Δx)3
1 0 Euler (implicit) (Δx)2
1 1/2 Three-point backward (implicit) (Δx)3

As evident, many different methods could be used to solve the same problem. The difference in the
quality of the solutions is frequently small and the selection of the optimal technique becomes
difficult. However, the selection process could be aided by experience gained to solve model
equations.

75Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
87

5.8 Linearization of Equations


For any implicit method, the equation of fluid flow are non-linear in unknown due to appearance of
quantities at i+1 level in coefficients. Prime example is the term u (∂u/∂x) which is from convective
term in NS equation. A simple forward differencing, has been used to approximated by 1D as76

u u  ui
u  u i 1 i 1 (6.2)
x Δx
Which of course non-linear.

5.8.1 Frozen (Lagging) Coefficient Method


In this method simply ignore the non-linear coefficient and evaluate it at known station as

u u  ui
u  u i i 1 (6.3)
x Δx

The procedure provides a consistent representation (0th order Taylor series expansion) and ensure
that the differencing scheme is formally no better than 1st-order accurate in marching coordinates.

5.8.2 Simple Iterative Method


In this method, the lagged coefficient is updated through a simple iteration until a specified
convergence criteria is satisfied77. This is complement to previous method.

u i 1  u i  ε where   1 (6.4)

5.8.3 Newton Raphson Linearization Method


This is by far the method of choice and used extensively. The Newton’s method also called quasi-
linearization proceeds as follows. Let assume (A) and (B) represent the non-linearity. Define ∆ as
change in variable between two consecutive iterations (n),

 A  A n 1  Â n and  B  Bn 1  B̂n (6.5)


A n 1Bn 1  (Â n   A )(B̂n   B )
Expanding, after some manipulation, and dropping the 2nd order term ( A )( B )
A n 1 Bn 1  Â n Bn 1  A n 1B̂n  Â n B̂n for n  0  A n 1  Â n

Which is now linear. The carrot denotes an evaluation of variables from previous iteration.

5.8.3.1 Newton Linearization with Coupling


Several investigators have observed that convergence of iteration can be accelerated by solving the
momentum and continuity equations in coupled manner. The v (∂u/∂y) term is linearized by using

76 K. A. Haffmann, S. T. Chiang, “Computational Fluid Dynamics”, 4th edition, Aug. 2000.


77 K. A. Haffmann, S. T. Chiang, “Computational Fluid Dynamics”, 4th edition, Aug. 2000.
88

v in 1  v̂ in 1  δ v , u in 1  û in 1  δ u (6.6)
after product terms involving δ dropped :
n 1 n 1 n 1 n 1
 u  n 1  u  n 1  û  n 1  û 
 v   v̂   v    v̂  
 y   y   y   y 

Which of course is linear78.

5.8.4 Extrapolating the Coefficients


Values of the coefficients can be obtained at n+1 level by extrapolating based on values already
obtained from previous n level. Formally, the truncation error of this procedure can be made as small
as we wish79. For example, we can use

u u u in  u in 1
n n

u n 1
u  n
Δx   ο(x) 2 where   ο(x) 2
x i x
i i
i Δx 
n 1
u un
u in 1  u in  i i
Δx   ο(x) 2 (6.7)
Δx 

A similar procedure can be used for other coefficients needed at n+1 level.

5.8.5 Approximate Factorization (AF) Scheme


The difficulty of working with large matrices resulting from straightforward implementation of
implicit schemes to PDEs in higher dimensions has led to the development of the so-called split or
factored schemes. As the name implies, such schemes split a multi-dimensional problem to a series
of one-dimensional ones, which are much easier to solve. Of course, in general, this conversion cannot
be done exactly and some error is incurred. However, as we will show below, the splitting error is of
the same order as the error already incurred in discretizing the problem in space and time. That is,
the splitting approximation does not erode the order of accuracy of the scheme.80 The basic system
uner consideration is of the form (2D) given by

U E F
  0 (6.8)
t x y

Where U is the vector of conservative variables and E and F are vector of function of U. If the
Traezoidal rule ( ϴ1=1/2, Ɵ2=0) is used as the basis integration scheme,

Δt  U   U  
n n 1

U n 1  U n       (6.9)
2  t   t  
Δt  E F   E F  
n n 1

U n 1  U n        
2  x y   x y  

78 D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, 1984.
79 D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, 1984.
80 Moin, P; “Fundamentals Engineering Numerical Analysis”, Cambridge University Press.
89

This expression provides a 2nd order integration algoritem for the unkown vector, Un+1, at the next
time level. A local Taylors series expasion of direvtives of E and F used to obtain a Linear equation
such that

E

E n 1  E n  A U n 1  U n  where A 
U
(6.10)

F

F n 1  F n  B U n 1  U n  where B 
U

When the linearization given by Eqs. (9.15) is substitued into Eq. (9.14), a linear system for Un+1
results as

 Δt   
I    An   Bn U n 1 
 2  x y 
 
n
Δt  
I    An   Bn U n  Δt E  F  (6.11)
 2  x y   x y 

This is a linear system for theunknown Un+1. Direct solution of Eq. (9.16) is usually avioded due to
llarge operation count in treating muti-dimensional system. The path chosen is ususlly to reduce the
multi-dimensional problem into a sequence of one-demensional inversrsions using the method of
Approximate Factorization (AP) in cross flow plane. Equation (9.16) may be approximatly facotred
into


 I  
Δt 
An   I   Δt  Bn  U n 1 
 2 x  2 y 
n

 I  
Δt 
An   I   Δt  Bn  U n  Δt  E  F  (6.12)
 2 x  2 y   x y 

This equation is much easier and more cost effective to implement than the large system encountered
in the non-factored form. Basically, the multi-dimensional problem is reduced to a series of one-
dimensional problems by ignoring the cross terms while maintaine the formal order of accuracy.

ΔU n  U n 1  U n (6.13)
n

 I  
Δt 
A  n   I   Δt  B n  ΔU n  Δt  E  F 
 2 x  2 y   x y 
n

 I  
Δt 
A  n  ΔU '  Δt E  F 
 2 x   x y 
 Δt  n 
 I   2 y B 
  ΔU  ΔU
n '

 

The solution of this system is not trival. The x and y sweeps each require the solution of block
90

tridiagonal system of equations, or better known as TDMA (Thomas Algorithm). Each block is M x
M if there are M elements in the unknown U vector.

5.8.6 Recommendation on Linearization


For many calculations, the linearization introduced by simply lagging the coefficients will cause no
serious deter ration of accuracy. Errors associated with linearization of coefficients are simply
truncation errors which can be controlled by adjustment in marching step size. Many investigators
have been used this procedures satisfactory. For any problem in which this linearization causes
special difficulties, extrapolation or newton’s linearization with coupling is recommended81.

5.9 Pressure Based vs. Density Based Schemes for Finite Volume
The prime Finite Volume Solution Methods, are pressure or density based methods. The pressure
based schemes are mainly developed for incompressible, low Reynolds number application when
pressure value is guessed to begin and updated using Poisson’s equation after solving the momentum
equations. The main advantage is the decoupling of the momentum and energy equation when the
flow variables could be determined in segregated fashion. Among notable methods are SIMPLE
(Semi-Implicit Methods for Pressure-Linked Equations) and PISO. The density based methods are
more rigorous due to fact that governing equations are solved in coupled environment where
pressure is obtained through equation of state. In both cases, additional scalar equations are solved
in a segregated fashion. Most commercial CFD vendors try to provide both methods82.

5.9.1 Basic Pressure Schemes


These methods are called either segregated or coupled method. With segregated methods an
equation for a certain variable is solved for all cells, and then the equation for the next variable is
solved for all cells, etc. With coupled methods, for a given cell equations for all variables are solved,
and that process is then repeated for all cells83. The segregated solution method is the default method
in most commercial finite volume codes. It is best suited for incompressible flows or compressible
flows at low Mach number. Compressible flows at high Mach number, especially when they involve
shock waves, are best solved with the coupled solver. Here we are focused here in incompressible
(M < 0.3). Equation system to be solved is the continuity equation together with the momentum
equations, while the continuity equation is considered as a side condition, demanding a divergence-
free flow field. Pressure does not appear in the continuity equation of continuity and equations of
momentum and continuity need to be coupled (see Figure 49). Three norm exist to solve the system
of Navier-Stokes equations for incompressible fluid flow:

1. Methods that are based on the vorticity equation.


2. Methods that are based on artificial compressibility (Chorin, 1967)
3. Methods that are based on pressure iterations or pressure correction:
A. Prjection Methods (Chorin and Temam, 1968)
B. Marker and Cell Method – MAC (Harlow and Welch, 1965)
C. Fractional step method (Kim and Moin, 1975)
D. SIMPLE, SIMPLER, SIMPLEST, PISO, (Patankar, 1981)
E. Fast Fluid Dynamic (Joe Stam, 1999).

81 See Previous.
82 Introduction to ANSYS Fluent, 2010.
83 Georgia Tech Computational Fluid Dynamics, “Solution Methods for Navier Stokes Equations”, Spring 2007.
91

Figure 49 Available Solvers as available in Fluent

While 1&2 are hardly used in CFD, the third one, known as pressure corrections methods are used
extensively. The basic idea is to make use of a Poisson equation for the pressure; as pressure appears
only in the momentum equations in form of a partial derivative of first order. This can be achieved
by computing the derivative ∂P/∂xi such that the result yields a divergence free flow field. An
adequate iterative method is formulated that iterates the pressure until the conservation of mass and
momentum is obtained. These methods are also known as projection methods.
This is celebrated Poisson Equation. The RHS of the equation is a function of the partial derivatives
of the velocity components and is obtained from the convective part of the momentum equations. All
other terms i.e. the time derivative and the local change of the molecular transport (i.e. the diffusive
type terms) are removed because of the continuity side condition84. The basic procedure can be
visualized as

1. Computation of a velocity field from the solution of the momentum equations with an initial
(guessed) or no pressure field.

84 Georgia Tech Computational Fluid Dynamics, “Solution Methods for Navier Stokes Equations”, Spring 2007.
92

2. Computation of the pressure from the Poisson equation with the previously computed.
3. velocity field. Correction of the velocity field with the “new” pressure.

u i u j  (u i u j ) 1 p μ  u j
2

0 ,    (6.14)
x i t x i ρ x j ρ x i x i
  1 p μ  2 u j 
 u j  (u i u j )  
Take divergence of M omentum       
x j t x i  x j
 ρ x j ρ x i x i 
  u j     (u i u j )  1  2p μ  2  u j 
      
 t  x j  x j  x i  ρ x j x j ρ x i x i  x j 
 
0 0

 2p    (u i u j ) 
 ρ  
x j x j x j  x i 

    
 2p f (u i )

5.9.2 Fast Fluid Dynamic (FFD)


As the naming specifies, Fast fluid Dynamic is a fast (50 times by some estimate) method to solve the
incompressible NS equation. It was purposed originally by (Joe Stam)85 for computer graphics and
animation. In recent years it has been also used for indoor airflow simulation. The model would not
be accurate enough for most engineering applications. Indeed, it suffers from too much “numerical
dissipation”, i.e., the flow tends to dampen too rapidly as compared to actual experiments. In a
computer graphical application, on the other hand, this is not so bad, especially in an interactive
system where the flow is “kept alive” by an animator applying external forces. It applies a time-
splitting technique to separate the Navier-Stokes equations into several simple equations. Then those
spitted equations are solved one by one. Thus, FFD can solve the Navier-Stoke equations without a
trial correction iterations used in CFD. This is the reason why FFD is much faster than CFD. However,
current FFD model applied many low-order schemes, so its accuracy is poorer than CFD. It splits the
momentum equation over time in 4 steps, (see Figure 50). Because of a linear interpolation used in
a semi-Lagrangian approach for advection equation, the FFD has a significant numerical diffusion. To
reduce the numerical diffusion in the FFD model, improvements have been purposed in two fronts.
One is applying a high-order interpolation scheme in the semi-Lagrangian solver86. The other
improvement was to solve the advection equation using the convectional method used in CFD, such

Add Force Advect Diffuse Project

Figure 50 Solution Method for FFD

85Jos Stam, “Stable Fluids”.


86 Wangda Zuo, Qingyan Chen, “Improvements On The Fast Fluid Dynamic Model For Indoor Airflow
Simulation”, Fourth National Conference of IBPSA-USA, New York City, New York, August 11 – 13, 2010.
93

as the Lax-Wendroff scheme and the QUICK.

5.9.2.1 Fast Fluid Dynamics Model


The first approach is the use of Fast Fluid Dynamics (FFD) that is an intermediate model between the
nodal and CFD models. The FFD, developed for computer flow visualization, can efficiently solve the
incompressible Navier-Stokes equations (top), energy equation (middle) and species transport
equations (bottom):

u u 1 P  2u 1 
 -u   ν 2  SF 
t x ρ x x ρ 
T T  T
2 
    2
 -u  α 2  ST   -u k 2 SG (6.15)
t x x  t x x
c c  c
2

 -u  kc  S 
t x x 2
c

where S is the source term and G is the pressure term. The FFD method applies a time-splitting
method (Ferziger and Peric 2002) to solve the governing equations (4). The purpose of the splitting
method is to divide a complex problem (equation) into several simple ones (Ferziger and Peric 2002;
John 1982; Levi and Peyroutet 2001) since solving these simple equations is mathematically easy
and numerically fast87. Then solutions of these simple equations can be integrated into an
approximated solution for the complex equation. The splitted equations in the FFD are as follows:

   2
 -u k SG
t x x 2
 1   n   2    1  2 2   3     2 
 2  2 
S , k 2  , u 2 
Δt

   Δt
 x  Δt
 x
AddingSource Diffusion Advection
 n 1 3 
 
and finally G
Δt

Projection (Pressure)

where superscripts (1), (2), and (3) represent temporary variables. The FFD computes sequentially
the above four equations. First source is added through equation. Then the FFD calculates diffusion
equation by using a first order implicit scheme. After that, advection equation is solved with a semi-
Lagrangian solver. For the momentum equation, the FFD solves pressure equation together with
continuity equation by using a pressure-correction projection method [Chorin ]88. It is worth to notice
that there is an extra projection step before the advection step in the implemented FFD code, which
is to provide a divergence-free velocity field for the semi-Lagrangian solver in the advection equation.

5.9.2 Density Based Schemes


The system of governing equations for a single-component fluid, written to describe the mean how

87 Wangda Zuo, Qingyan Chen, “Simulations Of Air Distributions In Buildings By Ffd On Gpu”, HVAC&R Research.
88Chorin, A.J. (1967) "A numerical method for solving incompressible viscous flow problems," Journal of
Computational Physics, 2, 12-26.
94

properties89, is cast in integral Cartesian form for an arbitrary control volume V with differential
surface area dA as follow:


t V
WdV   [F  G ]  dA   HdV W, F and G are defined as :
V

ρv i  0 
ρ   
ρu   
 ρv i u  p î  τ xi 
      
W  ρv  , F  ρv i v  pĵ  , G  τ yi  i, j  1,3 (6.15)
ρw     
  ρv i w  pk̂  τ zi 

ρE 
 ρv i E  pv   τ v  q 
   ij j 

and the vector H contains source terms such as body forces and energy sources. Here ρ, v, E, and p
are the density, velocity, total energy per unit mass, and pressure of the uid, respectively. τ is the
viscous stress tensor, and q is the heat flux. Total energy E is related to the total enthalpy H by

2
V
E  H  P/ρ and Hh (6.16)
2

The implicit-time stepping method (also known as dual-time formulation) is available in the density-
based explicit and implicit formulation. When performing unsteady simulations with implicit-time
stepping (dual-time stepping), we use a low Mach number time-derivative unsteady preconditioner
to provide accurate results both for pure convective processes (e.g., simulating unsteady turbulence)
and for acoustic processes (e.g., simulating wave propagation). Here we introduce a preconditioned
pseudo-time-derivative term into Equation 6.15 as

 W 

t V
WdV 
Q τ  QdV   [F  G].dA  V H dV (6.17)
 V
Γ

 ρP 0 0 0 ρT 
 ρ u ρ 0 0 ρ T u 
W  P

where Q  [p,u, T] T
,     ρP v 0 ρ 0 ρT v 
Q  
 ρP w 0 0 ρ ρT w 
 ρ P H  δ ρu ρv ρw ρ T H  ρC P 
ρ ρ
and ρ P  , ρT  with δ  1 ideal gas  0 incompressible
P T T P

Where t denotes physical-time and τ is a pseudo-time used in the time-marching procedure. Note
that as τ⇾1, the second term on the left side of Equation 6.17 vanishes and Equation 6.15 is
recovered. The time-dependent term in Equation 6.17 is discretized in an implicit fashion by means

89 Fluent Guide,” Using the Solver”, 2006.


95

of either a first- or second-order accurate, backward difference in time. The dual-time formulation is
written in semi-discrete form as follows:

Γ ε 0 W 
 Δτ  Δt Q  ΔQ  V  F  G .dA 
k 1 1
 
H
1
Δt
ε 0 W k  ε1W n  ε 2 W n 1  (6.18)

Where (ε0 = ε1 = 1/2; ε2 = 0) gives first-order time accuracy, and (ε0 = 3/2; ε1 = 2; ε2 =1/2) gives
second-order. The k is the inner iteration counter and n represents any given physical-time level.
The pseudo-time-derivative is driven to zero at each physical time level by a series of inner iterations
using either the implicit or explicit time-marching algorithm.

5.10 Residual Implication


IN short, the non-linear NS equations are linearized and the accuracy of the linearized equations to the non-
linear ones is the residual where the linear solver solves the linear equations. The discretization of the
spatial terms in the governing equations results in a large coupled set of ordinary differential
equations of the form

d(VM w)
 R(w)  0 (6.19)
dt

Where V represents the local control volume, M the mass matrix, and R (w) the spatially discretized
terms. For a vertex-based scheme, the mass matrix relates the average value of a control volume to
the values at the vertices of the mesh. Both V and M are constants for static meshes, and can therefore
be taken outside of the time derivative. For steady-state cases, these equations must be integrated in
time towards t → ∞, where the time derivatives become vanishingly small. Since time accuracy is not
a concern in such cases, the mass matrix may be lumped i.e. replaced by the identity matrix and each
equation may be advanced with the maximum permissible time step, as determined from local
stability considerations.

5.10.1 Explicit Schemes


A simple time integration scheme is obtained by replacing the time derivative by a simple forward
difference and evaluating the residual at the current time level:

w n 1  w n
V  R(w n )  0 (6.20)
Δt
This corresponds to a single-stage explicit scheme, since updates are obtained from one evaluation
of currently available quantities. Like Runge-Kutta schemes for ordinary differential equations,
multistage time-stepping schemes (which are required with higher-order discretization for stability
reasons) involve the combination of updates obtained at multiple explicitly evaluated intermediate
states90. The stage coefficients of these schemes can be optimized either to provide large time steps
at the expense of time accuracy or to enhance high-frequency damping properties of the scheme,

90 D. J. Mavriplis, “Unstructured Grid Techniques”, Annu. Rev. Fluid. Mech. 1997. 29:473–514.
96

which is required in the context of a multigrid algorithm (Jameson et al91, van Leer et al92).These
schemes are extremely simple to implement and require little additional computer storage. However,
stability considerations restrict the maximum permissible time step to values proportional to the
local cell size. Thus, finer meshes lead to smaller time steps, which in turn lead to larger solution
times. For very fine meshes, the convergence of explicit schemes becomes unacceptably slow, and
more sophisticated solution strategies must be adopted.

5.10.2 Implicit Schemes


An implicit scheme is obtained by evaluating the spatial residual terms at the new time level n+1.
Since these quantities are not known explicitly, a linearization must be performed about the current
time level:
 V R 
   Δw  R(w )
n
(6.21)
 Δt w 
Where ∂R/∂w represents the Jacobian and constitutes a large sparse matrix93. At each time step, the
above linear system must be solved for the corrections ∆w=wn+ 1- wn from which the flow variables
can be updated. Implicit schemes may be classified by the degree to which the true Jacobian matrix
is approximated. If an exact linearization is employed, the method is unconditionally stable and
reduces to Newton’s method for ∆t → ∞. Although the quadratic convergence properties of Newton’s
method generally produce solutions in a very small number of time steps (often of the order of 10)
[Venkatakrishnan & Barth]94, [Barth & Linton]95, [Nielsen]96, each time step requires the inversion of
a large sparse matrix, which becomes prohibitively expensive in terms of storage and CPU-time for
fine meshes. A common simplification is to replace the exact linearization with one based on a first-
order discretization [Mavriplis, Anderson]97. While this considerably reduces the storage
requirements of the linear system and improves its condition number, it precludes attaining
quadratic convergence rates, owing to the use of an inexact linearization. This in turn favors the use
of iterative methods to solve the linear system, which can be used to converge the system only
partially, because exact inversion of the Jacobian is no longer beneficial, owing to the mismatch
between Jacobian and residual. However, rigorous criteria for determining the optimal level of
convergence of the linear system at each time step have yet to be determined. Simple iterative
schemes such as Jacobi and Gauss-Seidel schemes have been utilized successfully in the context of
implicit schemes with first-order linearization. However, since these are still local techniques, their
convergence degrades with grid size. More sophisticated techniques such as preconditioned GMRES
methods provide enhanced convergence rates, particularly when applied with powerful
preconditioners such as Incomplete Lower Upper (ILU) factorization methods, which provide more
global information for the solution of the linear system.

91 Jameson A, Schmidt W, Turkel E.,” Numerical solution of the Euler equations by finite volume methods using
Runge-Kutta time stepping schemes”, AIAA Pap. 81-125- 1981.
92 van Leer B, Tai CH, Powell KG.,” Design of optimally-smoothing multi-stage schemes for the Euler equations”,

AIAA Pap. 89-1933,1989.


93 See 148.
94 Venkatkrishnan V, Barth TJ., “Application of direct solvers to unstructured meshes for the Euler and Navier-

Stokes equations using upwind schemes”, AIAA Pap. 89-0364, 1989.


95 Barth TJ, Linton SW.,”An unstructured mesh Newton solver for compressible fluid flow and its parallel

implementation”, AIAAPap. 95-022, 1995.


96 Nielsen EJ, Anderson WK, Walters RW, Keyes DE.,”Application of Newton-Krylov methodology to a three-

dimensional unstructured Euler code”, Proc. AIAA CFD Conf., 12th, San Diego. AIAA Pap. 95-1733-CP- 1995.
97 Anderson WK, Rausch R, Bonhaus D.,”Implicit Multigrid Algorithms for Incompressible Turbulent Flows On

Unstructured Grids”, Proc. AIAA CFD Conf., 12th, San Diego. AIAA Pap. 95-1740-CP, 1995.
97

Although 1st -order linearization methods require substantially less memory overheads than exact
linearization methods, their memory requirements are still nontrivial. For example, on a three-
dimensional tetrahedral grid, the first-order Jacobian of a vertex-based scheme requires on the order
of 350 storage locations per vertex, over three times the number required for the implementation of
an explicit scheme. An ILU preconditioning strategy can require an equivalent additional amount of
memory. Since GMRES methods only require the evaluation of matrix vector products of the form
(∂R/∂w).∆w, it is possible to forgo the storage of the Jacobian, and evaluate the Jacobian vector
product directly by finite-difference techniques:

R Rw  ε Δw   R(w)
 Δw  (6.22)
w ε
Where ε represents a small parameter. This requires multiple residual evaluations (one for each
matrix vector product) and represents a classic tradeoff between storage and computation,
particularly for expensive nonlinear residual constructions. However, it also permits the use of the
more accurate second order linearization in the implicit scheme, by using the same second-order
residual in the finite difference evaluation as in the right-hand side of equation, as is done in the so-
called Newton-Krylov methods.

5.10.2.1 Convergence Rate and Storage Requirement


Figure 51 compares the convergence rates of a Newton-Krylov method that employs ILU
preconditioning with convergence of a Gauss-Seidel iterative method applied to a first-order
linearization, as well as with the convergence obtained by a multigrid scheme using the same Gauss-
Seidel solver as a multilevel smoother (Solid line: Gauss Siedel; Dotted line: ILU Preconditioned
Newton-Krylov; Dashed line: Multigrid method -using Gauss Siedel as smoother). The depicted case
involves the solution of two-
dimensional subsonic inviscid flow
over a NACA 0012 airfoil on a mesh
of 8578 points, using a vertex-based
second-order upwind scheme98. The
quadratic convergence property of
the Newton-Krylov approach is
evident, which achieves a very rapid
asymptotic convergence rate in
terms of number of iterations. When
compared in terms of overall CPU-
time, the Newton-Krylov scheme,
although still superior to the Gauss-
Seidel implicit method, is overtaken
by the multigrid scheme, due to the
expense of each Newton-Krylov
iteration. Additional improvements
to Newton-Krylov methods can be
achieved through continuation
techniques, which provide better Figure 51 Comparing the Convergence Rates of the ILU-
initial guesses (for example by Preconditioned Newton-Krylov Method

98Nielsen EJ, Anderson WK, Walters RW, Keyes DE. ,”Application of Newton-Krylov methodology to a three-
dimensional unstructured Euler code”, Proc. AIAA CFD Conf., 12th, San Diego. AIAA Pap. 95-1733-CP, 1995.
98

coarse to fine mesh sequencing), in order to reduce the initial phase of poor convergence of these
schemes. However, one of the drawbacks of these methods is that they still require powerful
preconditioners in order to be effective, and the best known preconditioners are generally matrix
based (such as ILU), which entail storage requirements similar to those of the first order
linearization. A compromise, with obvious limitations, is to use a weaker but low-storage
preconditioner, such as block-diagonal with a Newton-Krylov Method 99. For upwind discretization
based on reconstruction techniques, higher-order Jacobian vector products can be formed by
multiplying the first-order Jacobian with a higher-order reconstructed vector. Although the method
requires the storage of the first-order Jacobian, it is exact and, unlike finite-difference techniques, can
also be applied directly to the solution of the adjoin equations, which is required in particular
formulations of the design optimization problem. Additional approximations to the exact Jacobian
can be employed to further reduce the memory requirements of implicit schemes. For example, one
may choose to group sub-regions of the mesh together and only retain the terms of the Jacobian that
pertain to coupling within each region100.
These regions may be determined by a variety of methods and may exhibit varying degrees of
overlap. These approximations may be applied to the Jacobian itself but are most often applied to the
matrix-based preconditioners operating on the true Jacobian. Alternatively, the regions may be
reduced to lines through the mesh joining neighboring vertices, as in the method of line lets, which
attempts to approximate the Alternate Direction Implicit (ADI) scheme of structured grids101. On
sequential machines, the regions or lines can be processed individually, thus reducing the maximum
memory requirements to that of the largest region or line (although on parallel machines no savings
are realized if each region is assigned to an individual processor). The numerical coupling between
regions or lines is lost in these approaches, a loss that in turn degrades overall convergence, as the
number of regions increases. However, this degradation can be minimized by judicious choices of the
regions based on the character of the problem, a technique that has not yet been fully exploited. If
these regions are reduced to individual grid points (i.e. all implicit coupling between grid points is
discarded), only the diagonal block matrices of the original Jacobian are retained, and the point-
implicit method is obtained 102-103. These terms represent the coupling between the various fluid
dynamic equations at a grid point. While point-implicit methods can offer increases in efficiency over
regular explicit schemes, they are also plagued by slow convergence for fine grids. Point-implicit
methods are sometimes viewed as preconditioning techniques for explicit schemes, where the point-
implicit matrix is the preconditioner.

5.11 Multigrid Methods


Multigrid methods are effective techniques that can deliver fast convergence rates with minimal
memory overheads. The basic idea of a multigrid method is to accelerate the solution of a set of fine
grid equations by time stepping on a sequence of fine and coarse grids using a simple explicit scheme.
Multigrid methods capitalize on the effectiveness of explicit methods in reducing high frequency
error modes. A high-frequency error can be thought of as a solution component that oscillates
between neighboring grid points. While explicit methods are effective at eliminating such errors, they
are relatively ineffective at reducing low-frequency or global error components. This is to be

99 Shakib F, Hughes TJR, Johan Z., “A multi element group preconditioned GMRES algorithm for non-symmetric
problems arising in finite element analysis”, Computer. Methods Appl. Mech. Eng. 87:415–56, 1989.
100 Chan TF, Mathew TP.,” Domain decomposition algorithms”, Acta Numer. pp. 61–143.
101 Hassan O, Morgan K, Peraire J., “An implicit finite element method for high speed flows”, AIAA Pap. 90-0402.
102 Hassan O, Morgan K, Peraire J., “An implicit finite element method for high speed flows”, AIAA Pap. 90-0402.
103 Thareja RR, Stewart JR, Hassan O, Morgan K, Peraire J., “A point implicit unstructured grid solver for the Euler

and Navier-Stokes equations.”, AIAA Pap. 88-0036, 1988.


99

expected, because explicit schemes rely exclusively on local information supplied through the
residual stencil.
The multigrid strategy consists in explicitly time stepping the fine grid equations until the high-
frequency errors have been conquered. The solution is then transferred to a coarser grid, where the
remaining low-frequency errors now manifest themselves as high-frequency errors and can be
effectively damped by the same explicit method. The process is repeated recursively through a
complete sequence of grids, where each level is responsible for a particular bandwidth of errors.
When the coarsest grid of the sequence is reached, the corrections are interpolated back to each
successively finer grid. This entire multigrid cycle is then repeated until overall convergence is
achieved. For structured grids, simply get rid of every other line of grid and make sure that grid is
sufficient for coursing. But for unstructured meshes, the issue is more complicated. Given a fine
unstructured mesh, there is no simple procedure for constructing uniformly coarser levels, as in the
structured-grid case. One of the drawbacks of this approach is that it still requires the user to
generate multiple grids for a single solution, which is at best tedious. With this in mind, several efforts
have been pursued to automate the process. But first we consider the typical (i.e. V &W) cycle which
is the essence of the multigrid process.

5.11.1 Multigrid Cycle


Usually iterative methods would reduce the high-frequency (i.e., oscillatory) errors but fails to reduce
the low-frequency (i.e., smooth) errors thus will results poor rate of convergence104. High-frequency
and low-frequency are the names of the errors that are referring to the error in the coarser and finer
mesh. In the case of the iterative methods, the solution in the finer grid looks smoother but if we
transfer the solution to the coarser grid it will be oscillating. To solve this problem we need to do
sampling of the solution from finer grid to coarser grid where a few iterations (iterative methods for
example, Gauss-Seidel) need to be done to reduce the high-frequency error. Transferring the solution
from finer grid to coarser grid is called restriction. After the few steps of the restriction are done, the
error of high-frequency will be reduced. Later this solution is transferred to finer grid for further

Figure 52 Multi gridding Cycles

calculation and by then the low-frequency error is also minimized. Transferring the solution from
coarser grid to finer grid is called the prolongation or interpolation, (see Figure 52). On the finer grid
it is suggested to do a few more iterations to keep the high-frequency error still small. So the solution
that is in the finer grid will be having less high-frequency and less low-frequency error. These cycles
have to be continued until the solution meets the desired convergence criteria. Prolongation,
restriction and less iteration in the finer grid gives a faster convergence rate and quicker solution
than the normal stationary iterative methods.105

104 Ezhilmathi, “Magic behind the Most of the CFD solvers for HPC “, Scientific Computing blog, 2013.
105 Same as above.
100

5.11.2 Unstructured Mesh Cycling


Methods that remove selected mesh points, using graph-based algorithms, and re-triangulate the
remaining subset of vertices have been demonstrated as effective tools for generating coarse-level
multigrid meshes 106-107. However, for very complex geometries, the generation of coarse meshes that
conform to the original geometry either manually or automatically, becomes an unpleasant task. A
usual and tedious approach to unstructured multigrid methods is to generate a sequence of
completely independent coarse and fine meshes and use linear interpolation to transfer variables
back and forth between the various meshes of the sequence, within a multigrid cycle 108-109. The
meshes may be generated using any
feasible grid generation technique
and will generally be non-nested, and
may even not contain any common
points. The only requirement is that
they conform to the same domain
boundaries. This technique is more
flexible than the nested subdivision
approach, since the fine and coarse
meshes are not constrained, and may
be optimized independently for
accuracy and speed of convergence
respectively. Furthermore, this
approach can be applied to a problem
with a pre-specified fine mesh. The
inter grid transfer operators can be
determined in a preprocessing
operation but require smart search
techniques to determine the patterns
between coarse and fine grid
elements, which in principle may
overlap randomly. Once these have
been determined and stored, grid
transfers are simply implemented as
a weighted gather and scatter of data
between coarse and fine grid arrays.
Application of this technique to a
three-dimensional inviscid flow is
depicted in Figure 53 where two
grids from the sequence of grids
employed in the overset mesh
multigrid scheme for the
computation of transonic flow over
an aircraft configuration. Yet another Figure 53 Sequence of gridding in unstructured multigrid
approach is provided by scheme

106 Guillard H.,”Node nested multigrid with Delaunay coarsening”, INRIA Rep. No. 1898 1993.
107 Matheson L, Tarjan R.,”Unstructured multigrid strategies on massively parallel computers: a case for
integrated design”, Hawaii. Int. Conf. Syst. Sci., 27th, 2:169–78. New York: IEEE, 1994.
108 Mavriplis DJ., “Three-dimensional multigrid for the Euler equations”, AIAA J. 30(7):1753–61, 1992.
109 Leclercq MP., “Resolution des equations d’Euler par des methods multigrilles conditions aux limites en regime

hypersonique”, PhD thesis. Dep. Appl. Math, Univ. de Saint- Etienne.


101

agglomeration (collection) multigrid methods. Based on the control-volume formulation, these


methods form coarser-level meshes by blending or agglomerating fine-level control volumes
together with their neighbors110. The resulting coarse mesh contains a smaller number of larger and
more complex control volumes. The precise manner in which control volumes are agglomerated can
be controlled through a graph-based algorithm similar to the vertex removal procedure described
above.
The flow solver must be modified to run on arbitrarily shaped control volumes on the coarse levels.
For inviscid-flow control-volume formulations, this presents little difficulty, since the equations are
generally discretized as fluxes over individual control-volume faces, which can be used to build
contour integrals about arbitrarily shaped control volumes. The observed convergence rate of the
agglomeration multigrid method is almost identical to that obtained with the overset-mesh method.

5.11.3 Viscous Flow Consideration


For viscous flows, the discretization of diffusion terms on arbitrarily shaped control volumes is no
longer straightforward. An algebraic interpretation of agglomeration multigrid provides a
mechanism for dealing with equations sets that contain diffusion terms. Borrowing from the
algebraic multigrid literature (Ruge&St¨uben 1987), a coarse-grid operator may be constructed by
projecting the fine-grid operator onto the space spanned by the coarse-grid basis functions. In
general, the multigrid convergence rates achieved for viscous flow cases are substantially slower
than those achieved for inviscid cases. The slower convergence in the viscous flow cases is principally
due to the anisotropic stretching of the mesh in the boundary-layer and wake regions. Unstructured
multigrid methods offer the possibility of designing schemes that are insensitive to anisotropic
effects. The graph-based agglomeration or vertex coarsening algorithms described above can be
modified to merge only those neighboring control volumes or delete only those neighboring vertices
that are the most strongly coupled to the current point. By coarsening or agglomerating only in the
direction of strongest coupling, as determined by the magnitude of the coefficients in the fine-grid
discrete equations, rather than eliminating all possible neighbors, coarse levels that are optimal for
the problem at hand can be generated. An alternate strategy for improving the convergence of
multigrid methods is to employ a stronger smoother as the base grid solver. Any of the implicit
methods described above may be substituted for an explicit method. Of course, most. There is an
obvious duality between the construction of sub regions for implicit methods and coarsening
strategies for multigrid methods that should be exploited in the future to better couple locally implicit
strategies with multigrid methods.
The above discussion on multigrid methods centers on the Full Approximation Storage (FAS)
technique, where multigrid is applied directly to the nonlinear form of the governing equations.
Multigrid may also be employed as a solver for the linear system arising at each time step of an
implicit scheme, or even as a preconditioner for an iterative solution strategy. While these strategies
may yield desirable robustness characteristics, they are plagued by the high memory requirements
of the implicit linearization, which are avoided in the FAS approach.

5.12 Outline of Numerical Aspects of CFD


This section covering the outline of CFD and brought to you by CFD-Wiki and mentioned here as a
recap. The user should refer to this page for further reference. Be aware that this is lengthy and
general list and not all the items are relevant to the problem in hand. Top level is displayed as red,
next green, black, brown, and so on.

Lallemand M, Steve H, Dervieux A., “Unstructured multi gridding by volume agglomeration: current status”,
110

Computational. Fluids 21(3):397–433.


102

 Basic aspects of governing equations as related to CFD


 Classification of governing equations
 Integral form of governing equations
 Differential form of governing equations
 Forms of the governing equations suited for CFD
 Generic scalar transport equation
 Mathematical behavior of Partial Differential Equations
 Classification of physical behavior
 Equilibrium problems
 Marching problems
 Mathematical Classification of flows
 Hyperbolic flows
 Parabolic flows
 Elliptic flows
 Mixed flow types
 Stability Analysis
 Fourier stability analysis
 von Neuman stability analysis
 Courant–Friedrichs–Lewy (CFL) condition
 Properties of Numerical Solution Methods
 Consistency
 Stability
 Conservation
 Boundedness
 Realizability
 Accuracy
 Solution of Euler equation
 Method of Characteristics
 Shock Capturing Techniques
 Explicit Mac Cormack Method
 Flux Splitting (Stegar-Warming)
 Total Variation Diminishing (TVD) scheme
 Artificial Dissipation
 The SCM
 Beam & Warming Approximate Factorization scheme
 Solution of Poisson's equation
 Type-Dependent Differencing
 Solution of Navier-Stokes equations
 Explicit schemes
 Mac Cormack Predictor-Corrector scheme
 Beam & Warming (AF)
 Vorticity-Stream function
 Velocity-Pressure Coupling
 Rhie-Chow Interpolation
 Fully Coupled Methods - FC
 Density Methods
 De-Coupled Methods - DC
103

 Pressure Methods
 SIMPLE
 SIMPLEC - SIMPLE Consistent
 SIMPLEM – SIMPLE Modified
 SIMPLEX
 SIMPLEST - SIMPLE Shortened
 SIMPLER - SIMPLE Revised
 PISO - Pressure Implicit with Split Operator
 PRIME - Pressure Implicit Momentum Explicit
 MSIMPLEC, MPISO , SIMPLESSEC , SIMPLESSE
 CPC - Compressible Pressure Correction algorithm
 MCBA - Mass Conservation Based Algorithms
 GCBA - Geometric Conservation Based Algorithms
 IPSA - Inter-Phase Slip Algorithm
 CPI - Consistent Physical Interpolation
 MWIM - Momentum Weighted Interpolation Method
 PWIM - Pressure Weighted Interpolation Method
 ACM - Artificial Compressibility Method
 CIP - Cubic Interpolating Polynomial Method
 Discrete Operator Splitting
 Solution of Boltzmann Equation CFD Related algorithms
 Wall distance Calculations
 Moore's k-tree algorithm
 Transport equation based wall distance calculation
 Geometrical Calculations
 Area calculations
 Volume calculations
 Calculation on non-orthogonal curvilinear structured grids, finite-volume method
 General Discretization
 Domain (Field) Discretization
 Grid or Mesh Generation
 Structured
 Algebraic
 PDE
 Adaptive Meshes
 Unstructured
 Advancing Front
 Delaney Triangulation
 Octree Decomposition
 Unstructured Hexahedral Meshes
 Hybrid Meshes
 Overset Meshes
 Cartesian Meshes
 Polyhedral Meshes
 Adaptive Meshes
 Governing Equations Discretization
 Finite Difference
104

 Finite Element
 Spectral Volume
 Discontinuous Galerkin
 Finite Element
 Finite Volume
 Generic scalar transport equation
 Source term linearization
 Gradient computation
 Special Discretization
 Discretization of the diffusion term
 Discretization of the convection term
 Discretization of the transient term
 Time Discretization
 Euler Method
 Crank-Nicolson Method
 Predictor-Corrector Methods
 Runge Kutta Methods
 Adams Bashforth Method
 Adams Moulton Method
 Implicit second order Method

 Linear systems of equations


 Direct methods
 Gaussian elimination
 LU decomposition
 Tri-Diagonal Matrix Algorithm - (TDMA -Thomas Algorithm)
 Iterative methods
 Gauss-Seidel Method
 Jacobi Method
 Successive 0ver-Relaxation Method - SOR
 Stone's Method
 Alternating Direction Implicit (ADI) Method
 Conjugate Gradient Methods
 Conjugate Gradient Method of Golub and van Loan
 Bi-Conjugate Gradient Method
 Bi-Conjugate Gradient stabilized Method
 Matrix factorization and preconditioning
 Incomplete LU factorization - ILU
 Incomplete Cholesky factorization
 Multigrid methods
 Geometric Multigrid – Full Approximation Storage (FAS)
 Algebraic Multigrid - AMG
 Efficiency and stability
 Limiters
 Flux Limiters
 Gradient Limiters
105

5.13 What Constitute Solver in CFD


According to Aditya Kashi, the “Solver” in CFD, can mean several things depending on the context
which been used. It can refer to the spatial discretization scheme, like “finite volume solver” or
“spectral element solver”. In less than often, it can refer to the algorithm used for time stepping (also
called “integrator”), such as “explicit Runge-Kutta” etc. But It usually refers to the algorithm used for
solving the system of linear equations that needs to be solved (PDE solver) such as “sparse LU solver”
or “GMRES solver”.
106

6 Solution Methods for In-Viscid (Euler) Equations


6.1 Background
The interest in Euler equations arises from the fact that in many primary design the information
about the pressure alone is needed. In boundary layer where the skin friction and heat transfer is
required, the outer edge condition using the Euler. The Euler equation is also of interest because of
interest in major flow internal discontinuities such as shock wave or contact surfaces. Solutions
relating to Rankine-Hugonist Eqautions are embedded in Euler equation. The Euler equations govern
the motion of an Inviscid, Non-heat-Conducting flow have different character in different regions. If
the flow is time-dependent,
the flow regimes is hyperbolic Subsonic Sonic Supersonic
Flow
for all the Mach numbers and M<1 M=1 M>1
solution can be obtained using Steady Elliptic Parabolic Hyperbolic
marching procedures. The
situation is very different Unsteady Hyperbolic Hyperbolic Hyperbolic
when a steady flow is
assumed. In this case, Euler Table 6 Classification of the Euler equation on different regimes
equations are elliptic when the flow is subsonic, and hyperbolic when the flow is supersonic. For
transonic flows, has required research and development for many years.
Table 6 shows the different flow regimes and corresponding mathematical character of the
equations.

6.2 Method of Characteristics


For inviscid flows, method of Characteristics is the oldest and most nearly exact method which still
used to solve parabolic PDE’s. Other notable methods are Shock-Capturing which could be used to
capture large pressure gradients within a supersonic flow using a predictor-corrector scheme such
as Mac Cormack’s. The Euler equations for steady-state, isentropic, irrotational can be combined into
a single equation as potential equation. This could be treated using a type-dependent differentiation
where for supersonic regions where the flow is hyperbolic an upwind differential recommended. For
subsonic region, where the flow is elliptic, a central differencing recommended. Evidently, the
solution methods are dependent on several parameters confined to problem at hand. The description
for some legacy discretization methods and their characteristic behavior are available in literature.
Closed form solutions of non-linear hyperbolic partial differential equation do not exists for general
cases. In order to obtain the solution to such an equations we are required to resort to numerical
methods. The method of characteristics is the oldest and most nearly exact method in use to solve
hyperbolic PDEs. Even though this technique is been replaced by newer finite difference method. A
background in characteristic theory and its application is essential. The method of characteristics is
a technique which utilizes the known physical behavior of the solution in each point in the flow.

6.2.1 Linear Systems


Consider Steady Supersonic of Inviscid, Non-heat conducting of small perturbation for 2D perfect
gas111 as depicted in Figure 54.

111D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, ISBN 0-89116-
471-5 – 1984.
107

 
(1  M  ) xx   yy  0 denoting (1  M  )  β 2 and u  ,v  (7.1)
x y
u v v u w w
β2  0 ,  0 write in vector form  [ A] 0
x y x y x y
 1
u   0  2
where w    and [ A]  β
v  
 1 0 

The eigenvalues of this system are the eigenvalues of [A]. These are obtained by extracting the roots
of characteristics equation of [A] as

1
λ 
[ A]  λ[I ]  0 or β2  0 ,
1 λ
1 1 1
λ2   0 , λ1  , λ2   (7.2)
β 2
β β

This is pair of roots from the differential equation of


characteristics. Next we determine the
compatibility equation. These equations are
obtained by pre-multiplying the system of equations
by left eigenvectors of [A]. This effectively provides
a method for writing the equations along the
characteristics. Let L1 represents the left
eigenvectors of [A] corresponding to λ1 and L2 Figure 54 Characteristics of Linear equation
represents the left eigenvectors corresponding to λ2.
Drive the eigenvectors of [A]:

L  A  λ I  0
i T
i (7.3)
 1 1
   2
 
l β β  β  β 
L1   1   l1 , l 2   0 L1    , L2   
l 2    1 1  1
LT 1 
 β 
 
A

The compatibility equations along λ1 is obtained from


108

L  w    w 
T
T
i
x  [A]w y  0 or Li x  λi w y  0 (7.4)

 1 
u x  β u y 
compatabilty along λ1 is obtained [-β 1]  0
vx  1 vy 
 β 

βu  v   1  βu  v   0 in similar manar  βu  v   1  βu  v 
x β y x β y

It is expressed the fact that quantity (βu-v) is constant along λ1, and (βu+v) is constant along λ2. The
quantities are called Riemann Invariants. Since these two quantities are constant and opposite pair
of characteristics, it is easy to determine u and v at a point. If at a point we know (βu-v) and (βu+v),
we can immediately compute both u and v.

6.2.2 Non-Linear Systems


The development presented so far is for a system linear equations for simplicity. In more complex
nonlinear settings, the results are not as easily obtained. In the general case, the characteristics slopes
are not constant and vary with fluid properties112 shown in Figure 55. For a general nonlinear
problem, the characteristics equation must be integrated numerically to obtain a complete flow field
solutions. Consider a 2D supersonics flow of a perfect gas over a flat surface. The Euler equation
governing this inviscid flow as a matrix form

w w
 [ A] 0 (7.5)
x y
 v 
 uv  a2  0 
u  
p

v u  a2
 
2
1  0 v 2
u  a2 
where w   
0
and [A]  2  u ρu 
p u  a2  
   ρva ρua 2
2
uv 0 
e   ρv

ρu
v
u u

v 2
u a 2 


The eigenvalues of [A] determine the characteristics direction and are113

v v uv  a u 2  v 2  a 2 uv  a u 2  v 2  a 2
λ1  , λ2  , λ3  , λ  (7.6)
u2  a2 u2  a2
4
u u

The matrix of left eigenvectors associated with these values of λ may be written as

See previous.
112

D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, ISBN 0-89116-
113

471-5 – 1984.
109

 ρu ρv 
 0 1
a2 a2
 ρu ρv 1 0
1
 
[ T]    1

u 1 1
0 (7.7)
 u  v2  a 2
2 v u  v2  a 2
2 ρva 
 1 u 1 1 
 v 0
 u  v  a
2 2 2 v u 2  v2  a 2 ρva 

We obtain the compatibility relations by pre-multiplying the original system by [T]-1. These relations
along the wave fronts are given by:

du dv β dp dy
v u   0 along  λ3 (7.8)
ds 3 ds 3 ρ ds 3 dx
du dv β dp dy
v u   0 along  λ4
ds 4 ds 4 ρ ds 4 dx

These are an ordinary differential equations which holds along the characteristic with slope λ 3, λ4,
while arc length along this characteristics is denoted by s 3, s4. In contrast to linear example (Figure
54 vs. Figure 55), the analytical solution for characteristics is not known for the general nonlinear
problem. It is clear that we must
numerically integrate to determine the
shape of the characteristics in step by
step manner. Consider the
characteristic defined by λ3. Stating at
an initial data surface, the expression
can be integrated to obtain the
coordinates of next point at the curve.
At the same time, the differentials
equation defining the other wave front
characteristics can be integrated. For a
simple first-order integration this
provide us with two equations for wave
front characteristics. From this
expressions, we determine the
coordinate of their intersection, point
A. Once the point A is known, the
compatibility relations, (7.8), are
integrated along the characteristics to Figure 55 Characteristics of Nonlinear solution point
this point. This provide a system of (exaggerated)
equations at point A. This is a first-
order estimate of the both the location of point A and the associated flow variables. In the next step,
the new intersection point B can be calculated which now includes the nonlinear nature of the
characteristic curve. In a similar manner, the dependent variables at point B are computed. Since the
problem is nonlinear, the final intersection point B does not necessary appear at the same value of x
for all solution points. Consequently, the solution is usually interpolated onto an x=constant surface
before the next integration step. This requires additional logic and added considerably to the
110

difficulty in turning an accurate solution114

6.3 Shock Capturing Method


6.3.1 Explicit McCormack Method
The shock capturing schemes are most used techniques for computing inviscid flows with shocks. In
this approach, the Euler’s equations are cast in conservative form for and shocks wave predicted as
part of solution. The shock waves predicted by these methods are smeared over several grid intervals
bur the simplicity of the approach may outweigh the slight compromised in the results. First we
consider 2D supersonic flow. We assume the x-axis forms the body surface and marching direction.
The equations can be written as

 ρu   ρv 
E F
  0 where E  p  ρu 2  and F   ρuv  (7.9)
x y
 ρuv  p  ρv 
2

Equation (8.35) is a hyperbolic PDE and explicit Mac Cormack scheme would be a good choice as

E in 1  E in 
Δx n
Δy
 
Fi 1  Fin 
1
E in 1  E in  E in 1 
Δy

Δx n 1

Fi  Fin11  (7.10)

2

predictor corrector

At the end of predictor/corrector step, E must be decoded to obtain the primitive variables. This way,
the flux vector can be evaluated for the next integration step. The y-components of velocity v is
immediately known

2
E E γ E2  γ E2  γ 1
v 3 , ρ 1 , u     (2H  v 2 ) , p  E 2  ρu 2 (7.11)
E1 u γ  1 E1  γ  1 E1  γ 1

Having completed this process, F can be recalculate and the next step can be implemented.

6.3.2 1D Upwind Flux-Splitting Scheme (Steger-Warming)


This is usually used as a Shock Capturing Method and belongs to a class of solutions as AUSM
(Advection Upstream Splitting Method). It is developed as a numerical inviscid flux function for
solving a general system of conservation equations. It is based on the upwind concept and was
motivated to provide an alternative approach to other upwind methods, such as the Godunov
method, flux difference splitting methods by Roe115, Solomon and Osher, flux vector splitting
methods by Van Leer116, and Steger and Warming. The AUSM first recognizes that the inviscid flux
consist of two physically distinct parts, i.e., convective and pressure fluxes. The former is associated
with the flow (advection) speed, while the latter with the acoustic speed; or respectively classified as
the linear and nonlinear fields. Currently, the convective and pressure fluxes are formulated using

114 D. Anderson, J., Tannehill, R., Pletcher,”Computational Fluid Mechanics and Heat Transfer”, ISBN 0-89116-
471-5 – 1984.
115 Roe Flux Differencing Scheme Details.
116 Bram van Leer, “Flux-Vector Splitting for the 1990s”, The University of Michigan, N91-21073.
111

the eigenvalues of the flux Jacobian matrices. To illustrates the flux splitting concepts, consider the
one-dimensional system of hyperbolic PDE,

U E  U  E  E
 0 define E  E   E  so   0 (7.12)
t x t x x

Where the plus indicates a backward differencing, a minus forward differencing is required. The split
flux can be used either for explicit or implicit algorithms. For example, a second-order upwind,
predictor/corrector scheme (Beam & Warming, 1975) used as

Predicter U nj 1  U nj 
Δt
Δx
 E j  Δ E j  (7.13)

Correcter U nj 1
1 n
 U j  U nj 1 
2
Δt
Δx
 
 2 E j n   E nj 1 
Δx

Δt 2  n
Δ E j  ΔE j n 1 
An implicit algorithm using the trapezoidal rule is derived


I 
Δt
2x
 

[A j ]   Δ[A j ]  ΔU nj  
Δt
Δx

E   ΔE   (7.14)
 

This algorithm is 1st order accurate in space, 2nd order accurate in time. The left hand side can be AF
and ignoring the 2nd order cross terms as


 I 
Δt
2x

[A j ]   I 
Δt
2x

Δ[A j ] ΔU nj  
Δt
Δx

E   ΔE   (7.15)
  

 I 
Δt


[A j ] ΔUj  
Δt
Δx

E   ΔE  
 2 x 
 Δt 
 I  Δ[A j ] ΔU nj  ΔUj
 2x 

In this equations, each one dimensional sweep required the solution of two block bi-diagonal (here
1) system. Usually the advantages of AP is more pronounced in multi-dimension problem. The use of
split flux techniques for shock capturing applications produces somewhat better results than
standard central difference schemes.

6.3.3 Total Variation Diminishing (TVD) as other Upwind Schemes


In numerical methods, Total Variation Diminishing (TVD) is a property of certain discretization
schemes used to solve hyperbolic partial differential equations. To capture the variation fine grids
(∆x = very small) are needed and the computation becomes heavy and therefore un-economic. The
use of coarse grids with central difference scheme, upwind scheme, hybrid difference scheme, and
power law scheme gives false shock predictions. TVD scheme enables sharper shock predictions on
coarse grids saving computation time and as the scheme preserves monotonicity there are no
spurious oscillations in the solution. In systems described by partial differential equations, such as
the following 1D hyperbolic advection equation,
112

U U E
 [ A] where [ A]  (7.16)
t x U
U
TV   dx   U j1  U j subject to TVU n 1   TVU n 
x

Conventional shock capturing schemes for the solution of nonlinear hyperbolic conservation laws
are linear and L2-norm stable when considered in the constant coefficient case117. There are three
major difficulties in using such schemes to compute discontinuous solutions of a nonlinear system,
such as the compressible Euler equations:

1. Schemes that are second (or higher) order accurate may produce oscillations wherever the
solution is not smooth.
2. Nonlinear instabilities may develop in spite of the &-stability in the constant coefficient case.
3. The scheme may select a nonphysical solution.

It is well known that monotone conservative difference schemes always converge and that their limit
is the physical weak solution satisfying an entropy inequality. Thus monotone schemes are
guaranteed not to have difficulties (2) and (3). However, monotone schemes are only first-order
accurate. Consequently, they produce rather crude approximations whenever the solution varies
strongly in space or time. When using a second- (or higher) order accurate scheme, some of these
difficulties can be overcome by adding a hefty amount of numerical dissipation to the scheme.
Unfortunately, this process brings about an irretrievable loss of information that exhibits itself in
degraded accuracy and smeared discontinuities. Thus, a typical complaint about conventional
schemes which are developed under the guidelines of linear theory is that they are not robust and/or
not accurate enough. The class of TVD schemes contains monotone schemes, but is significantly
larger as it includes second-order accurate schemes.

6.3.3.1 The Upwind Connection to Explicit Artificial Dissipation


If the viscosity isn’t large enough, velocity oscillations about the correct mean velocity are observed
to develop behind a shock. These oscillations can be interpreted as a macroscopic version of heat
energy, i.e., fluctuating kinetic energy in place of fluctuating molecular energy118. These upwind
schemes all claim
(with good
justification) to be
physically consistent
since they follow in
some sense the
characteristics of the
flow. They in general
can be shown to
produce sharp
oscillation free shocks
without added
artificial dissipation. Figure 56 Coefficient of Pressure for a Shock
Figure 56 shows the

117 H. C. Yee, NASA, “Implicit Total Variation Diminishing (TVD) schemes for steady-state calculations”, Journal of
Computational Physics, March 1985.
118 Flow Science Blog, “What are Artificial and Numerical Viscosities?”
113

coefficient of pressure for a shock without artificial dissipation (left); with artificial dissipation
(right). Also these schemes have an inherent amount of internal dissipation, due to the one sided
differences, which cannot be modified or decreased. It may be advantageous to have the flexibility of
a simple central difference scheme with a controllable amount of artificial dissipation. It can be
shown that the upwind schemes have an equivalence to central difference schemes with added
dissipation. The central schemes are much simpler and more flexible and are therefore desirable if
the dissipation can be added in an analogous fashion to the upwind schemes119. This is often called
the Implicit Artificial Dissipation as opposed to Explicit one which purposely added to a difference
equation and, been discussed in 9.5. In general, the flux of any scheme can be written as

f  f FTCS  f  f FTCS (7.17)


  
FTCS flux flux due to Artifical Viscosity

and FTCS  Forward Time & Central Space

6.3.3 3D Unsteady Euler Equation Solutions Using Flux Vector Splitting


To compute the flow of a store released from an aircraft, it is desirable to solve the unsteady Euler
equations on a grid that moves with the store along its trajectory120. The purpose of this paper is to
solve the three-dimensional unsteady Euler equations on a time-dependent grid. The computations
presented here are for bodies whose motion is prescribed. As the solution advances in time, body
motion could be determined from the Euler equations by using force and moment coefficients
obtained from the Euler solution in the dynamic equations of motion for the body to determine the
trajectory of the body. The objective of this report is to present and verify dynamic-grid Euler
equations computations. Following the development in, The strong conservation law of the Euler
equations in curvilinear coordinates can be written as:

Q F G H
   0 (7.18)
τ ξ η ζ
ρ  ρU   ρV   ρW 
 ρu   ρuU  ξ p   ρuV  η p   ρuW  ζ p 
   x   x   x 
Q  J  ρv  , F  J  ρvU  ξ y p  , G  J  ρvV  η y p  , H  J  ρvW  ζ y p 
       
ρw   ρwU  ξ z p   ρwV  ηz p   ρwW  ζ z p 
 ρe   U(e  p)  ξ t p V(e  p)  η t p  W(e  p)  ζ t p
 ( , ,  )
and ξ  ξ (x, y, z) , η  η (x, y, z) , ζ (x, y, z) , t   and J 
 ( x, y , z )
M atrices of transformation are :
ξ x  J (y η z ζ  y ζ z η ) , ξ y  J (x η z ζ  x ζ z η ) , ξ z  J (x η y ζ  x ζ y η )
η x  J (y ξ z ζ  y ζ z ξ ) , η y  J (x ξ z ζ  x ζ z ξ ) , η z  J (x ξ y ζ  x ζ x ξ )
 x  J (y ξ z  y z ξ ) ,  y  J (x ξ z  x z ξ ) ,  z  J (x ξ y  x y ξ )
with contvariant velocity components
U  ξ x u  ξ y v  ξ z w , V  ηx u  η y v  ηz w , W  ζ x u  ζ y v  ζ z w

T. H. Pulliam, “Solution Methods in Computational Fluid Dynamics”, NASA Ames Research Center, USA.
119

David, L., Whitfield, “Three-Dimensional Unsteady Euler Equation Solutions Using Flux Vector Splitting”,
120

NASA-CR-173254 19840008789.
114

The three-dimensional Euler equations, Equation (7.18), are a hyperbolic system of five equations
and hence have five characteristic velocities in each of the three spatial directions. These
characteristic velocities are determined from the quasilinear form of Equation (7.18). A finite volume
discretization of Equation (7.18) balances the increase of the conserved quantity in a computational
cell, or volume, with the flux of the quantity through the surface of the cell. Assuming the dependent
variables are constant in the interior of cell i, j, k, and that the flux vectors F, G, and H are constant
over the constant ξ , constant η and constant surfaces of the ζ , respectively, an explicit discretization
of Equation (7.18) is

(Q i,n j,1k - Q i,n j,k )  - (Fin1/2,j,k - Fin-1/2,j,k )  (G i,n j1/2,k - G i,n j1/2,k )

Q / 

 (H i,n j,k 1/2 - G i,n j,k 1/2 ) (7.29)

and time step Δτ is given in121, or using the classical Runge-Kutta scheme. The central difference
operator is been used in Eq. (7.29) indicates the flux vectors are evaluated at cell faces in this finite
volume formulation. The numerical scheme used is a finite volume version of the second-order
upwind scheme of Warming and Beam122, while the present scheme is an extension of that used by
Deese123.

6.3.3.1 Flux Splitting


Hyperbolic partial differential equations, such as the Euler equations, are characterized by the
existence of a limited domain of dependence. The solution at a point does not depend on every other
point in the field; this means that information travels only in certain characteristic directions.
Numerical schemes intended to solve hyperbolic equations are usually enhanced by insuring that the
numerical method propagates information in the direction specified by the partial differential
equation. This can be done by using an upwind method, or one in which the difference operator is
taken in the direction from which the information should come. Stability properties are often
improved by unwinding, and it is usually unnecessary to add smoothing terms or artificial viscosity
to an upwind method. The three-dimensional Euler equations, Equation (7.18), are a hyperbolic
system of five equations and hence have five characteristic velocities in each of the three spatial
directions. These characteristic velocities are determined from the quasilinear form of Equation
(7.18). Details of splitting and test cases can be obtained from124. It is suffice to show that five
eigenvalues are:

λ1k  λ 2k  λ 3k  ku
 
kv 
kw , λ 4k  θ k  c k , λ 5k  θ k  c k (7.20)
θk
1
where k  ξ, η, ζ and k  (k  k  k )
2
x
2
y
2 2
z and finally c is speed of sound

121 David, L., Whitfield, “Three-Dimensional Unsteady Euler Equation Solutions Using Flux Vector Splitting”,
NASA-CR-173254 -19840008789.
122 Warming, R. F. , and Beam, K. M., "Upwind Second·-Order Difference Schemes .md Applications in Aerodynamic

Flows," AIAA ,Journal, Vol. 14. No.9, September 1976, pp. 1241-1249.
123 Deese, J. E, "Numerical Experi1D:ents with the Split-Flux··Vector Form of the Euler Equations," AIAA Paper No.

83-0122, January 1983.


124 David, L., Whitfield, “Three-Dimensional Unsteady Euler Equation Solutions Using Flux Vector Splitting”,

NASA-CR-173254 -19840008789.
115

As evident, two of the five right eigenvectors form a 2-dimensional subspace, within the general 5-
dimensional space spanned by all right eigenvectors, and that every member of this subspace is itself
an eigenvector. This phenomenon was attributed to the fact that their corresponding eigenvalues are
repeated, which creates a “symmetry” within the eigenvector space. Although it may seem difficult
to visualize any symmetry within a 5-dimensional vector space, part of this symmetry reveals itself
when we geometrically interpret the 2-dimensional subspace as a plane. The Euler equations contain
three types, or families of waves, one for every distinct eigenvalue. Each family of waves carries a
different signal. The waves traveling at the speed of the flow (λk1,2,3 ) are called entropy waves, their
signal being entropy, whereas waves traveling at the speed of sound relative to the flow ( λk4,5 ) are
called acoustic waves. Unfortunately, the signal carried by acoustic waves is not quantifiable in
simple thermodynamic terms, but let us just say that they carry acoustic information125.

6.4 Method for Solving the Potential Equation


The full potential equation could be either conservative or non-conservative form. Here we deal with
non-conservative form which obtained using the continuity equation and some manipulation via
momentum equation. The 3-D velocity potential equation in non-conservative form is,

  
u , v , w (7.18)
x y z
  x2    y2   2  2 x y 2  2 y z
Continuity : 1 - 2   xx  1  2  yy  1  z2  zz    x2 z  xz  2  yz  0
 a  2 xy
 a     a  a a a
u 2  v 2  w2 dp
M omentum & Energy :   constant 
2 d
  x2   y2   z2  ρ   x   y   z 
2 2 2

dp  ρd    2 d
 2  a  2 
  
γ 1 2
where a  a 0  V and V  u 2  v 2  w 2 , a 0  speed of sound
2

Note that for an incompressible flow, a →∞, the velocity potential reduces to linear Laplace’s equation
and could be solve with relative ease. It represents a combination of continuity, momentum and
energy equations and could be solved for velocities (i.e., Mach number) and then temperature,
pressure and density could be obtained using the isentropic relations, previously defined for local
values. It should be noted that the total quantities are known and obtained from free-stream
conditions. For a 2-D flow, after substituting for u, v, we obtain:

 u2   v2  2uv
1 - 2   xx  1  2   yy   2  xy  0 (7.19)
 a   a  a

After the landmark paper by126 , it points to type dependent differencing. The idea is:

Axel Rohde, ”Eigenvalues And Eigenvectors Of The Euler Equations In General Geometries”, AIAA 2001-2609.
125
126 Murman, E, M, and Cole, J, D,
“Calculation of Plane Steady Transonic Flows”, AIAA Journal, Volume 9, pp. 114-
121, 1971.
116

uv uv
 1  0  hyperbolic ,  1  0  elliptic (7.20)
a a

If the flow is subsonic, elliptic equation prevails and central differencing are used for the derivatives.
On the other hand, if the flow is supersonic, the equation is hyperbolic and upwind differencing could
be used.

6.4.1 Conservative Forms


The conservation form potential equation for 2-D may be written:

 ( u)  ( v)  
 0 where u  ,v  (7.21)
x y x y
1/γ 1
 γ 1 2 2 
from Energy equation ρ  1  M  (u  v 2  1
 2 
 A1  ξ 2x  ξ 2y
 U  V 
 ρ    ρ   0 where U  A1 ξ  A 2 η , V  A 2 ξ  A 3 η  A 2  ξ x ηx  ξ y ηy
 J ξ  J η  A  η2  η2
 3 x y

 ( , )
J  ξ x η y  ξ y η x where ξ x  Jyη , ξ y  Jx η , η x  Jyξ , η y  Jx ξ
 (x, y)
1/(γ 1)
 γ 1 2 
ρ  1  M  (U x  V y  1)
 2 

Where U and V are contravariant velocity components.

6.5 Method for Transonic Flow


The full potential equation is useful for describing transonic flows when shoch wave’s strength is
small. We use the scheme of retarded density as an example. A second-order finite differencing
approximation can be written for a 2D conservative potential equation in conservative form as:

 ρU   ρV 
ξ    η   0 (7.22)
 J  i 1, j  J  i, j1
2 2

1
U i 1/2,j  (A1 ) i 1/2,j (i 1, j  i, j )  (A 2 ) i 1/2,j (i 1, j1  i 1, j1  i, j1  i, j1 )
4
1
V i, j1/2  (A 3 ) i, j1/2 (i, j1  i, j )  (A 2 ) i, j1/2 (i 1, j1  i 1, j1  i 1, j  i 1, j )
4
 U   ρV 
 ξ ~ ρi     η   0
  J  i 1/2,j   J  i, j1
2

where retarded density ~ ρ  (1  ν


i )ρ
i  k, j ν
i 1/2,j ρ
i  k, j i  2k1/2,j

0 U i 1/2,j  0   1 
with k and ν  max 0, C1 1  2 
1 U i 1/2,j  0   M 
117

Where the constant C1 is unity for small regions of supersonic flow but must be increased in regions
where shocks strength is appreciable. This information may be used throughout the flow to solve the
full potential equation at points which are either elliptic or hyperbolic. The solution procedure used
to solve the set of resulting difference equations may take many forms. We choose the Approximate
Factorization (AF) scheme. The full potential equation may be written as

N( n 1   n )  ωL n  0 (7.23)

Where ω is the relaxation parameter, Lϕn represents the residual of resulting equation, and N is
operator which determines the iteration method consist of N=N1N2. The N1 and N2 must be selected
so their product approximates L. The procedure uses simple matrix operation and the overall scheme
is stable.

6.6 Panel Methods for solving the Laplace’s Equation


Potential flow plays an important historical role in the theory of flight since 50s and before the CFD
applications become fashionable. Numerical models based on this approach are known as panel
methods in the aerodynamics community. Panel
methods are numerical models based on simplifying
assumptions about the physics and properties of the flow
of air over an aircraft127. It is well known fact that the
Boing® used panel techniques for design of original 747s
where they are still in service. The viscosity of air in the
flow field is neglected, and the net effect of viscosity on a
wing is summarized by requiring that the flow leaves the
sharp trailing edge of the wing smoothly. The
compressibility of air is neglected, and the curl of the
velocity field is assumed to be zero (no vorticity in the
flow field). Under these assumptions, the vector velocity
describing the flow field can be represented as the
gradient of a scalar velocity potential, to solve the
problem of potential flow over a solid object. Laplace’s
equation must be solved subject to the boundary
condition that there be no flow across the surface of the
object. This is usually referred to as the tangent-flow Figure 57 Cp Contours for a Rotor using
boundary condition. Additionally, the flow far from the Panel Method
object is required to be uniform. The results of solving
Laplace’s equation subject to tangent-flow boundary conditions provide an approximation of cruise
conditions for an airplane. The basic solution procedure for panel methods consists of discretizing
the surface of the object with flat panels and selecting singularities to be distributed over the panels
in a specified manner, but with unknown singularity-strength parameters. Since each singularity is a
solution to Laplace’s equation, a linear combination of the singular solutions is also a solution. The
tangent-flow boundary condition is required to be satisfied at a discrete number of points called
collocation points. This process leads to a system of linear algebraic equations to be solved for the
unknown singularity-strength parameters. Details of the procedure vary depending on the
singularities used and other details of problem formulation, but the end result is always a system of
linear algebraic equations to be solved for the unknown singularity-strength parameters. Panel

127 R. L. Fearn, “Airfoil Aerodynamics Using Panel Methods”, The Mathematica Journal, 2008.
118

methods are applicable to 2 and 3-D flows (see Figure 57) and has one distinctive feature. That is a
solution for body pressure distribution can be obtained without solving the entire domain. For flow
over a 2D, the flat panels become straight lines, but can be thought of as infinitely long rectangular
panels in the three-dimensional interpretation.
119

7 Solution Methods for Viscous (Navier-Stokes) Equations

7.1 Background
The Navier-Stokes equation are very difficult to solve in their complete form. In general, a very large
amount of computer resources is needed to obtain a solution. This is particularly true for the
compressible N-S equations which are a mixed set of elliptic-parabolic equations, while the unsteady
incompressible N-S equations are a mixed set of hyperbolic-parabolic equations. As a consequence,
different numerical techniques must be used to solve them. The time dependent solution is normally
used when a steady-state flow is computed. That is, the unsteady N-S solutions are integrated in time
until a steady-state solution is achieved. Thus, for a three-dimensional flow field a four-dimensional
(3 space +1 time) problem must be solved. Besides being very CPU intensive, it needs a very large
amount of storage. That is why whenever possible, the complete compressible N-S equation should
be avoided. The compressible N-S equations in Cartesian coordinates without body force or external
heat addition, in vector notation can be written as:

U E F G
   0 where U, E, F, and G are given by (8.1)
t x y z
ρ   ρu 
 ρu   ρu  p  τ xx
2 
   
U   ρv  , E ρuv  τ xy 
   
ρw   ρuw  p  τ xz 
 E t  (E t  p)u  uτ xx  vτ xy  wτ xz  q x 
 

 ρv   ρw 
 ρuv  τ xy   ρuw  τ xz 
   
F  ρv 2
 p  τ yy
 , G  ρvw  τ yz

   
 ρvw  τ yz   ρw 2  p  τ zz 
(E t  p)v  uτ xy  vτ yy  wτ yz  q y  (E t  p)w  uτ xz  vτ yz  wτ zz  q z 
   
where
2  u v w  2  v u w  2  w u v 
τ xx  μ 2    , τ yy  μ 2    , τ zz  μ 2   
3  x y z  3  y x z  3  z x y 
 u v   w u   v w 
τ xy  τ yx  μ   , τ xz  τ zx  μ   , τ yz  τ zy  μ  
 y x   x z   z y 
T T T  u 2  v2  w 2 
q x  k , q y  k , q z  k and E t  ρ e  
x y z  2 
120

7.2 General Transformation


These equations can be expressed in terms of a generalized non-orthogonal curvilinear coordinated
system

ξ  ξ (x, y, z) , η  η (x, y, z) , ζ (x, y, z) , t  t (8.2)


x x x
 ( , ,  ) 1 1
J  1   1/ y y y
 ( x, y , z ) J  (x, y,z)
z z z
 ( , ,  )
where matrices are :
ξ x  J (y η z ζ  y ζ z η ) , ξ y  J (x η z ζ  x ζ z η ) , ξ z  J (x η y ζ  x ζ y η )
η x  J (y ξ z ζ  y ζ z ξ ) , η y  J (x ξ z ζ  x ζ z ξ ) , η z  J (x ξ y ζ  x ζ x ξ )
 x  J (y ξ z  y z ξ ) ,  y  J (x ξ z  x z ξ ) ,  z  J (x ξ y  x y ξ )

The generalized transformation to the compressible N-S equations (Eq. 7.1) written in vector form
as128

U t  ξ x E ξ  η x E η  ζ x E ζ  ξ y Fξ  η y Fη  ζ y Fζ  ξ z G ξ  η z G η  ζ z G ζ  0 (8.3)
       
 U   Eξ x  Fξ y  Gξ z   Eη x  Fη y  Gη z   Eζ x  Fζ y  Gζ z 
     0

    
J J
  
    J
  
    J
  
 U1  t  E1   F1   G 1 
U1 E1 F1 G 1
   0
t ξ η ζ

By no means is this form of representation is conclusive. Many texts and researchers are attain their
own representation as they see to be relevant. But the concepts should be the same. This is the strong
conversation form of governing equation which is best suited for finite differencing schemes. It
should be noted that the vectors E1, F1and G1 contain partial derivatives of viscous and heat transfer
terms which also has to be transformed. Alternatively, the vectors E, F, and G can be split into an
inviscid (i) and a viscous parts (v). Reason for doing this becomes evident later, and also this make it
more modular and easy to handle.

128Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
121

U  (E i - E v )  (Fi - Fv )  (G i - G v )
   0 (8.4)
t x y z
  U   1
   
 ξ x (E i  E v )  ξ y (Fi  Fv )  ξ z (G i  G v ) 
t  J  ξ  J


 1
  
 η x (E i  E v )  η y (Fi  Fv )  η z (G i  G v ) 
η  J


 1
   
 ζ x (E i  E v )  ζ y (Fi  Fv )  ζ z (G i  G v )   0
ζ  J 

 ρ   ρu   0 
 ρu   ρu 2  p   τ xx 
     
U   ρv  , E i   ρuv  , Ev   τ xy 
     
ρw   ρuw  p   τ xz 
 E t  (E t  p)u uτ xx  vτ xy  wτ xz  q x 
 

 ρv   0 
 ρuv    xy 
   
Fi   ρv 2  p  , Fv    yy 
   
 ρvw    yz 
(E t  p)v u xy  v yy  w yz  q y 
 

 ρw   0 
 ρuw    xz 
   
G i   ρvw  , Gv    yz 
   
 ρw  p 
2
  zz 
(E t  p)w u xz  v yz  w zz  q z 
 

7.3 Solution Methods for Compressible Navier-Stokes Equation


The unsteady compressible N-S equations are a mixed set of hyperbolic-parabolic equations, while
the unsteady incompressible is a mixed set of elliptic-parabolic. As a consequence, different
numerical techniques should be used to solve N-S equations in compressible vs incompressible flow
regimes. We start with compressible methods first and divide the categories to Explicit and Implicit
schemes.
122

7.3.1 Compressible Explicit Schemes

7.3.1.1 McCormack
The Mac Cormack Explicit, the predictor/corrector which gained a lots of popularity among research
cycles in 70s and early 80s. For an excellent discussion on these and many more, reader is advised to
review129. The compressible N-S equations results:

U E F G
   0 (8.5)
t x y z

predictor U i,n j,1k  U i,n j,k 


Δt n
Δx
 
E i 1, j,k  E i,n j,k 
Δt n
Δy

Fi, j1,k  Fi,nj,k  
Δt n
Δz

G i, j,k 1  G i,n j,k 
corrector U i,n j,1k 
1 n

2
U i, j,k  U i,n j,1k 
Δx

Δt n 1

E i, j,k  E in1,1 j,k 
Δy

Δt n 1
Fi, j,k  Fi,nj11,k 
Δz

Δt n 1
 
G i, j,k  G i,n j,1k 1  

Where x= i Δx, y= j Δy and z = k Δz. This is 2nd order accurate in both space and time. The choice of
Δt for stability consideration is obtained from130 as:

-1
α(Δt)CFL  u v w 1 1 1 
Δt  where (t)CFL    a    (8.6)
1  2 / Re   Δx Δy Δz x 2 y 2 z 2 
ρ u Δx ρ v Δy ρ w Δz
with Re Δ  M in (Re Δx , Re Δy , Re Δz ) Re Δx  Re Δy  Re Δz 
μ μ μ
and a  (p /  ) 0.5 , safty factor α  0.9

The explicit scheme is 2nd order accurate in both space and time. In the present form, forward

Predictor Corrector
Step X-derivative Y-derivative Z-derivative X-derivative Y-derivative Z-derivative
1 F F F B B B
2 B B F F F B
3 F F B B B F
4 B F B F B F
5 F B F B F B
6 B F F F B B
7 F B B B F F
8 B B B F F F
9 F F F B B B
. . . . . . .
. . . . . . .
Table 7 Sequence of alternating spcial differencing for explicit MacCormack scheme

129 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
130 Tannehill, J, C., Holst, T, L, and Rakich, J, V, “Numerical Computation of Two-Dimensional Viscous Blunt Body

Flows and Impinging Shock”, AIAA Paper 75-154, Pasadena, Ca, USA, 1975.
123

differencing are used for all special derivatives in the predictor step while backward differences are
used in the corrector step. The forward and backward differencing can be alternated between
predictor and corrector steps as well as between the three spatial derivatives in sequential fashion.
This eliminates any bias due to the on sided differencing. An example of suitable sequence is given in
Table 7 (F-Forward, B-Backward). Moreover, the derivatives appearing in viscous terms of E, F and
G must be differenced correctly in order to maintain 2nd order accuracy. The x derivative terms
appearing in E are differenced in the opposite direction to that for dE/dx while the y-derivative and
z are approximated with central differencing. Likewise, the y derivative terms appearing in F and z
derivative terms appearing in G are differenced in opposite direction to that used for dF/dy and
dG/dz respectively. Cross-derivative terms in F and G are approximated with central differencing.
After each predictor or corrector step, the primitive variables (ρ, u, v, w, e, p, T) can be found be
decoding the U vector.
McCormack modified the original method by splitting the original McCormack scheme into a
sequence of one-dimensional operations131. Thus, it become possible to advance the solution in each
direction (Δtx, Δty, and Δtz) with large differences in mesh spacing (Δx, Δy, Δz). The explicit Mac
Cormack algorithm is a suitable method for solving both steady and unsteady flows at moderate to
low Reynolds numbers. However, it is not satisfactory method for solving high Reynolds number
flows where the viscous regions become very thin. For these flows, the mesh must be highly refined
to resolve the viscous regions. This leads to small time steps and longer computer time.

5.3.1.2 Other Explicit Schemes


In addition to Mac Cormack scheme, other explicit methods can be used to solve the Compressible N-
S equation, including:
 Hopscotch Method
 Leapfrog/DuFort-Frankel Method
 Brailovskaya Method
 Allen-Cheng Method
 Lax-Wendroff Method

These as discussed earlier might be used for Heat equation and viscous Burger’s equation, but
difficult to apply to more complicated equation like compressible N-S. For one thing, all the above,
except the Lax-Wendroff, are 1st order accurate in time. So they cannot be used for accurately
compute the time evolution of a flow field. In addition, all have stability restriction which limits the
maximum time steps.

7.3.2 Compressible Implicit Schemes


7.3.2.1 Beam-Warming
In the Beam-Warming scheme, the solution is marched in time using

θ1Δt  n Δt  n θ  1  
Δn U  (Δ U)  (U )  2 Δ n 1U    θ1   θ 2 (t)2  (t)3 
1  θ 2 t 1  θ 2 t 1  θ2  2  
Δ n U  U n 1  U n (8.7)

This is a general difference formula (revisited) with appropriate choice of parameters ϴ1 and ϴ2,
represents many of the standard difference scheme. For compressible N-S equations, either the

131MacCormack, R, W, “Numerica solution of the Interaction of a shock wave with Laminar boundary layer”,
Proceding of 2nd International Conference in Numerical Methods in Fluid Dynamics, pp. 151-163.
124

implicit Euler implicit scheme (ϴ1=1, ϴ2=0), which is first order accurate in time, or a three point
backward implicit scheme (ϴ1=1, ϴ2=1/2), which is 2nd order accurate in time, is normally used. The
difference formula so called delta form is linearized using truncated Taylor series expansion. For
example
 E 
n
n 1 n 1
E  E 
n
 (U  U )  Ο[(t) ]
n 2
(8.8)
 U 
Δ E  [ A]Δ n U  Ο[(Δt)2 ]
n

Where [A] is the Jacobian matrix. The details for a 2D compressible N-S equation is provided in132.

5.3.2.2 Mac Cormack


Mac Cormack (1981) also developed an implicit algorithm analog to his explicit method. This new
method consists of two stages. In the first stage, uses the original Mac Cormack scheme while the
second stage employs an implicit algorithm which eliminates any stability restriction. The resulting
matrix equations are either lower or upper block equations with details in133. The implicit Mac
Cormack method is defined by:

 λΔt  n 1 λΔt n 1
1  Δu i  (u i ) explicit  Δu i 1
n
Predictor : (8.9)
 Δx  Δx
Δu in 1  u in 1  u in  
(u in ) explicit  u in 1 explicit
 u in
 λΔt  n 1 n 1 λΔt n 1
Corrector : 1  Δu i  (u i ) explicit  Δu i 1
 Δx  Δx
1

u in 1  u in  u in 1  Δu in 1
2
   1
  
u in 1 explicit  u in  u in 1
2 explicit

 Δu in 1 
explicit

 2μ Δx  
λ   c    , 0.0 c,μ  0
  Δx Δt  

This method is unconditionally stable and 2nd order accurate in both space and time, provided that
μΔt/(Δx)2 is bounded as Δt and Δx approach zero. For detail explanation of method and accuracy, as
well as a 2nd order N-S example, reader could refer to134.

7.3.3 Incompressible Explicit Schemes

7.3.3.1 Vorticity-Stream Function Approach


Taking curl of incompressible momentum equation above, the vorticity potential equation is derived
as

132 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
133 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat

Transfer”, Hemisphere Publishing Corporation.


134 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984:”Computational Fluid Mechanics and Heat

Transfer”, Hemisphere Publishing Corporation.


125

v u ψ ψ Dω
ω  , u v , ω

 V  ν 2 ω (8.10)
x y y x Dt 0

Where the scalars such as pressure vanish. While vorticity is not a primary variable in flow analysis,
it is still extremely instructive to examine the impact of vorticity vector on N-S equation. The first
term on the right arises from the convective derivative and is called vortex stretching term. The
second term is obviously a viscous-diffusion term. The vorticity–stream function approach is one of
the most popular methods for solving 2D incompressible N-S equations. This parabolic PDE is called
Vorticity Transport Equation. An additional equation involving the new dependent variables ω and ψ
can be obtained as
 2ψ  2ψ
  ω (8.11)
x 2 y 2

Step 1
Set initial ω
and ψ at t=0
Step 6 Solve Step 2
for Pressure - Solve
if solution not Vorticity
converged Transport
return to step Eqation for ω
2 Voticity- at t+Δt
Stream
Function
Approach
Step 3
Step 5
Iterate for
detemine
new ψ
value of ω on
(Poisson
boundries
Equation)

Step 4
u=ψx v=ψy

Figure 58 Vorticity-Stream Function approach for 2D incompressible N-S equations

This an elliptic equation (Poisson equation) which can be solved readily. As a result of change
variables, we have been able to separate the mixed elliptic-parabolic 2D incompressible N-S equation
into one parabolic equation and one elliptic one. In order to determine the pressure, we have
differentiate the x-momentum equation with respect to y (d/dy), and y-momentum with x (d/dx) and
adding to obtain:
126

 u v u v 
 2 p  2ρ   (8.12)
 x y y x 

Which is a Poisson equations for pressure. These equations are normally solved using time marching
procedure described in Figure 58.

7.3.3.2 Primitive-Variable Approach


The vorticity-stream function approach for solving the incompressible N-S equations losses it
attractiveness when applied to 3-D flow because a single scalar stream function does not exist in that
case. One of the early techniques proposed for solving incompressible N-S equation in primitive
variables form is the artificial compressibility method of135. In this method, the continuity equation
is modified to include an artificial compressibility term which vanishes when a steady-state solution
is reached. With the additional of this term, to continuity equation, the resulting N-S equations are
mixed set of hyperbolic-parabolic equations which can be solved with standard time dependent
approach.
ρ u v w
   0 (8.13)
t  x y z

Where ρ’ is an artificial density and t’ is a fictitious time which is analogous to real time in a
compressible flow. The artificial density is related to the pressure by an artificial equation of state
p=ρ’/β where β is an artificial compressibility factor to be determine later.
In general, an implicit finite-differencing scheme is recommended over an explicit one. The artificial
compressibility method is one of technique for solving the incompressible N-S equations. By far the
most common primitive-variable approach is using a Poisson equation for pressure in place of the
continuity equation.

7.3.4 Incompressible Implicit Schemes

7.3.4.1 SIMPLE (Semi-Implicit Method for Pressure Linked Equation)


Since the SIMPLE procedure was described in detail previously, here an outline of it would be
sufficient. It is suffice to say that it can also be applied to the incompressible N-S equation. This
procedure based on a cyclic series of guess-and-correct operations to solve the governing equations.
The velocity is first calculated from the momentum equation using a guess pressure. The pressure
and velocities are then corrected so as to satisfy continuity. This process is continued until the
solution converges. In this procedure, the actual pressure p, u, v is written as

p  p0  p u  u 0  u v  v0  v (8.14)

Where p0, u0, v0 are the estimated values of velocity and p’, u’ and v’ are the velocity corrections. The
pressure corrections are related to the velocity corrections by approximate form of momentum
equations as

135 Chorin. A, J, “A Numerical Method for Solving Incompressible Viscous Flow Problem”, Journal of Computational

Physics, Volume 2, pp. 12-26, 1967.


127

u  p Δt p
ρ   u  
t x ρ x
v p Δt p
ρ   v   (8.15)
t y ρ y

Where Δt’ is a fictitious time increment. After combining and substituting in continuity equation,

 u v   u o v 0  Δt    2 p  2 p 
        0 (8.16)
x y   x y  ρ  x 2 y 2 

0

 u0 v0   t   2
      p
 x y    

Where the Poisson equation


can be solved for the pressure
correction. The procedure
Step 1
can be described in fig with Guess p0
steps starting with step 1
until it converges. The
SIMPLE procedure has been Step 5
used successfully to solve a Replace Step 2
number of incompressible p0,u0,v0, Solve for
flow problems. However, for with p , u, u0,v0
certain cases, it is found that v
the convergence rate is not
satisfactory. This id due to the
pressure correction equation
tends to overestimate the
value of p’ even though the Step 4 Step 3
corresponding velocities Correct Solve for
the pressure
correction are reasonable. correction
pressure
That is why an under p=p0+p' p'
relaxation constant ωp is been
used for pressure correction
as indicated below: Figure 59 SIMPLE procedure as applied to 2-D equation

p  p 0  ωp p (8.17)

Figure 59 shows the necessary steps in SIMPLE procedure. The SIMPLE procedure has been revised
to improve the rate of convergence. The new procedure is called SIMPLER (SIMPLR Revised). In
SIMPLER the velocity corrections are computed in the same manner as the SIMPLE, but a complete
Poisson equation for the pressure is used. Also, the velocity field is guessed initially instead of
pressure.
128

7.4 Approximation (Thin-Layer) Navier-Stokes Equation

For Thin-Layer approximation to the Navier-Stokes equations, the viscous terms containing
derivatives in the direction parallel to the body surface are neglected in unsteady N-S equations. But
all other terms in momentum equation are retained.

U E F G
   0 (8.18)
t x y z
ρ   ρu   ρv   ρw 
 ρu   ρu 2  p   ρuv  τ xy   ρuw 
       
U   ρv  E   ρuv  F ρv 2  p  τ yy  G   ρvw 
       
ρw   ρuw   ρvw  τ yz   ρw  p 
2

 E t  (E t  p)u (E t  p)v  uτ xy  vτ yy  wτ yz  q y  (E t  p)w


 

Although the thin-layer N-S equations are considerably less complicated the complete N-S, a
substantial amount of computer effort is still required to solve these equations. The thin-layer N-S
equations are a mixed set of hyperbolic-parabolic PDE in time. As a consequence, the time dependent
approach can be applied in the same manner of full N-S. Thus, the methods of solving complete N-S
equations previously discussed can be applied here also.

7.5 Parabolized Navier-Stokes Equation


The parabolized N-S (PNS) equations Have recently gained popularity because the can predict
complex 3-D, steady, supersonic, viscous flow field in an efficient manner. This efficiency achieved
because the equations can be solved using a space marching finite-difference technique as oppose
the time marching technique which is normally employed for the full N-S equations. The PNS
equations are for an entire supersonic flow field similar somewhat to solving either the inviscid
portions using an Euler equations or the viscous portion using the Boundary Layer equations. The
PNS are mixt set of hyperbolic-parabolic equations provided that certain conditions provided. These
condition include the requirement that the inviscid outer region of the flow field be supersonic and
stream wise velocity component be everywhere positive136.
An additional constraint is caused by the presence of the stream wise pressure gradient in the stream
wise momentum equation. If this term included everywhere in the flow field, then upstream influence
can occur in the subsonic portion of the boundary layer and a space marching method of the solution
is not well-poised. This leads to exponentially growing solutions which are often called departure
solutions. Several techniques are available to circumvent this difficulty. One of the novel technique
for handling the stream wise pressure gradient term was proposed by Vigneron.137 In this approach,
a fraction of pressure gradient term, ω (dp/dx) in the stream wise momentum equation is retained
in the subsonic viscous region and the remainder (1-ω) (dp/dx) is either omitted or is evaluated
explicitly using a back-ward differencing for the “sub-layer approximation” techniques. The
parameter ω can be obtained by analyzing the 2-D PNS equation, where ω was inserted for pressure

136 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984,”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
137 Vigneron, Y, C, Rakich, J, V, and Tannehill, J, C, “Calculation of Supersonic Viscous Flow over Delta Wings with

Sharp Subsoinc Leading Edge”, AIAA paper 78-1137, Seattle, Washington, 1978.
129

gradient (ωp). By ignoring the viscous term and obtaining the eigenvalues of the remaining Euler
equation, an expression can be obtained for ω as

γM 2x σλM 2x
ω  (8.19)
1  (γ  1)M 2x 1  (γ  1)M 2x

Where σ is safety factor. The PNS equations in generalized coordinates can be obtained by simply
dropping the unsteady and viscous terms containing partial derivatives with respect to stream wise
direction ξ. The resulting equations become:

E3 F3 G 3





0 where E3 
1
J
 
ξ x Ei  ξ y Fi  ξ z G i (8.20)

1
 
F3  η x (Ei  Ev )  η y (Fi  Fv )  ηz (G i  G v )
J
1
 
G 3  ζ x (Ei  Ev )  ζ y (Fi  Fv )  ζ z (G i  Gv )
J

And the prime indicates that the terms containing viscous partial derivatives w.r.t ξ have been
ignored. The stress and heat flux terms are reduced to

 xx 
2
3

 2( x u   x u )  ( y v   y v )  ( z w   z w )  (8.21)

2

 yy   2( y v   y v )  ( x u   y u )  ( z w   z w )
3

2

 zz   2( z w   z w )  ( xu   y u )  ( y v   y v )
3


 xy   yx    y u   y u   x v   y v 
 xz   zx    u
z    z u   x w   y w 

 yz   zy    v
z    z v   y w   y w 

qx  -k(  xT   xT ) , qy  -k(  yT   yT ) , qz  -k(  zT   zT )

Bear in mind that for many applications, the thin–layer approximation can also be applied to the PNS
equations.

7.5.1 3-D Compressible Implicit Numerical Solution of PNS equation


As previously indicated, the PNS equations are mix set of hyperbolic-parabolic equations in the
stream wise direction provided following has been met:

 Inviscid flow is supersonic.


 Stream wise velocity component is everywhere greater than zero.
130

 Stream wise pressure gradient term in stream wise momentum equation is either omitted or
the departure behavior is suppressed.

Until recently, the PNS equations have been solved using iterative, implicit finite-differencing
schemes. Vigneron were the first to employ a more efficient non-iterative, implicit approximation
factorization (AF) scheme to solve the PNS equations. Let us apply 3-D compressible PNS equations
written in Cartesian coordinates (x is stream wise direction) as

 u   0 
 u 2  p  (1   ) p 
E p F G    
   0 where E   uv  p 0 
x x y z    
 uw   0 
( Et  p)u   0 
E  Ei  p , F  Fi  Fv , G  G i  G v (8.22)

Where we incorporate the pressure gradient term in stream wise direction separately. The solution
is marched in x-direction using the Beam and Warming marching technique as

θ1  Δx  i Δx  i θ  1  
ΔiE  (Δ E)  (E )  2 Δ i 1E  O  θ1   θ 2 (x) 2  (x) 3 
1  θ 2 x 1  θ 2 x 1  θ2  2  
where Δ i E  Ei 1  Ei , x  ix
substituti ng governing equatio ns in BW marching fo rmula: (8.23)
θ1  Δx   (i F)  (i G)  Δx   (F i )  (G i )  θ 2
ΔiE          Δ i 1E
1  θ 2  y z  1  θ 2  y z  1  θ 2
where Δ i E  Δ i E  Δ ip , Δ i F  Δ i Fi  Δ i Fv , Δ i G  Δ iG i  Δ iG v

Where the inviscid delta terms ΔiE, ΔiF and ΔiG are linearized using the Taylor series expansion. In
order to linearize the inviscid delta terms, we make use of the fact that E’, Fi, and Gi are function of
only the vector U.
131

 U3 
 U 2 U3 
 ρ   U1   
 U1 
 ρu   U 
   2  U 32 ~ 
U   U 2  U 32  U 24 
For example, Fi   U1
~
U   ρv    U 3  where U  (γ  1) U 5  2 
       2U1 
ρw   U 4   U3U 4 
 E t   U 5   U1 
 ~ U 

 U5  U 3 
 U1 
 E  i
i

(E) i 1  (E)i     U  (x)


2

 U 
Δ i E  [Q]i Δ i U
 F 
i

(Fi ) i 1  (Fi ) i   i  i U  (x) 2 or Δ i Fi  [R ]i Δ i U (8.24)
 U  Δ i G  [S]i Δ i U
 i

 G i  i
i

(G i ) i 1  (G i ) i     U  (x)
2

 U 

Where [Q], [R], and [S] are the Jacobian of matrices dE’/dU, dFi/dU, and dGi/dU which are given in138.
The viscous delta terms can be linearized using a method suggested by Steger 139. In order to apply
this linearization method, the coefficients of viscosity (μ) and thermal conductivity (k) are assumed
to be locally independent of U, and the cross derivative viscous terms are neglected. As the result of
these assumptions Fv and Gv have the general form of

   5  β k  i 
fk  αk (β k ) , f i 1  f i  α ik    Δ   Ο(Δx)
2
U
y y  L 1 
 U L
 L
 
   5  β k  i 
gk  αk (β k ) , g i 1  g i  α ik    Δ   Ο(Δx)
2
  U
z z  L 1  U L 
L

α k is indep endent of U and β k is a function of U. We can write :
i

Δ i Fv  [ V ]i Δ i U , Δ i G v  [ W ]i Δ i U

Where the [V] and [W] are the Jacobian matrices for viscous terms. We now ready to put everything
in our marching order equation (BW) and the results

138 Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984,”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
139 Steger, J, L, “Implicit finite difference Simulation of the flow about Arbitrary Geometries with application to

Aitfoils”, AIAA paper 77-665, Albuquerque, NM, 1077.


132

 
i
  R V
  S w

i


 E  θ Δx 
  Fi Fv   G i G v 
 
 i
   1  y  U  U   z  U  U  Δ U 
U  1  θ 2
         
 Q 
   A   B  

Δx  Fi G i  θ2
     Δ i 1E  Δ i p
1  θ 2  y z  1  θ 2
 p  i 1p  (x) 2
i


 θ1Δx  [ A ] [B]  
i

or [Q] 
i
   Δ i U  R.H.S .
 1  θ 2  y y  
 
Using Appriximate Factoriziation :
 θ1Δx  [ A ]    
 
i
 [B] 
i
   θ Δx  i
  Q 
-1
[Q]    [Q]i  1   Δ U  R.H.S .
i i


 1  θ 2  z     1 θ2  y  
 

The partial derivative d/dy and d/dz are approximated by 2nd order accurate central differencing.
The algorithm is implemented in the following manner:

 θ1Δx  [ A ]    
 
i
 [B] 
i
   θ Δx  i
 Q 
-1
    [Q]i  1 
 y  Δ U  R.H.S .
i i
[Q ] 

 1  θ 2  z     1 θ2   
 

 θ1Δx  [ A ]  
i
 i
Step 1 : [Q ]i
   Δ U 1  R.H.S .

 1  θ 2  z   
Step 2 : Δ U 2  [Q] Δ U 1
i i i


 θ1Δx  [B]  
i
 i
Step 3 : [Q ]i
 
 
 Δ U  Δ U 2
i

 1  θ 2  y  
 
i 1
Step 4 : U U ΔU
i i

In steps 1 and 3, the system of equations can be solved using a block tridiagonal solve. As the result
of manipulation in step 2, the inverse matrix does not have to be determined in the solution process.
Finally, in step 4, the vector of unknown at station i+1 (Ui+1) is determined and the primitive variable
can be obtained in the following manner

U i21 U i31 U i41


ρ n 1  U1i 1 , u n 1  , v n 1
 , w n 1
 ,
U1i 1 U1i 1 U1i 1
U i51 (u i 1 ) 2  (vi 1 ) 2  (w i 1 ) 2
e n 1  
U1i 1 2
133

7.6 2D Compressible Boundary Layer


The 2D formulation which are
both applicable to Cartesian and Equation Marched to obtain
axisymmetric flow are devised in x- momentum ujn+1
Table 8. The m, is a flow index energy Hjn+1
equal to the unity for Equation of state + continuity vjn+1
axisymmetric flow (rm = r) and
equal to zero for 2D flow (rm = 1). Table 8 Decoupling strategy of Boundary Layer equations
For a generalized 2D, unsteady,
compressible equations, they are:

ρ  m  m
continuty :  (r ρu)  (r ρv)  0 (8.29)
t x y
u u u p 1   m  u 
momentum : ρ  ρu  ρv   m r  μ 
t x y x r y   y 

H p H H 1   m  μ H  1  u  
energy : ρ   ρu  ρv  m r   u 1  μ 
t t x y r y   Pr y  Pr  y  
u2  w2
state : ρ  ρ(p,T) and H  cpT 
2

7.6.1 Solution Methods using steady External Flows


The boundary layer equations for a steady (unsteady dealt later), compressible, 2-D or Axisymmetric
flow to be written as

 m  m
continuty : (r ρu)  (r ρv)  0 (8.30)
x y
u u du 1   m  u 
momentum : ρu  ρv   eue e  m r  μ 
x y dx r y   y 

H H 1   m  μ H  1  u  
energy : ρu  ρv  m r   u 1  μ  
x y r y   Pr y  Pr  y  
state : ρ  ρ(p,T)

Property relationships are also needed to evaluate μ, k and cp as a function of (usually) temperature.
The primary dependent variable in the momentum equation in u and it is useful to think it as
transport equation for u in which terms representing convection, diffusion, and a source term.
Likewise, the energy equation can be viewed as a transport equation for H. This interpretation can
also be extended to include the unsteady term. With this, the equations can be cast as:

  1   m   
ρu  ρv  m r λ μ   S
 (8.31)
x y r y   y 
   
source term
Convetionof  Diffusion of 
134

Where ϕ is a generalized variable which would be u for the boundary layer momentum equation and
H for the boundary layer energy equation, λ is a generalized diffusion equation and S represents the
source term. The source term are those terms which are involved a derivative of ϕ. The term
ρeuedue/dx is an example. The momentum and energy equations which can be cast into this the
general form are parabolic in x, therefore, a marching method will be sufficient. By making
appropriate assumptions regarding the coefficients, it is possible to decouple the finite difference
representation of the equation permitting the momentum, continuity, and energy equations to be
marched independently. This strategy is illustrated in
Table 8. After each marching step the coefficients in the equations are updated140. Listed below are
the popular solitons methods

 Simple Explicit
 Crank-Nicolson and Fully Implicit Methods
 The DuFort-Frankel Method
 The Box and Modified Box Methods

And the recommended finite-difference schemes for their estimated order of increasing
programming effort as

 DuFort_Frankel
 Fully Implicit (including Patankar-Spalding version)
 Crank-Nicolson implicit
 Fully implicit with continuity equation coupling
 Crank-Nicolson implicit with continuity coupling
 Modified box scheme
 Box method

7.6.1 3D compressible laminar Boundary Layer


The three dimensional unsteady boundary layer equation in Cartesian coordinates (see Figure 60),
applicable to a compressible laminar flow, are
given below with y-direction is normal to the
wall. By far, the most commonly case which
involves 3D boundary layer is on bodies of
revolution at incident angle. The subject of 3D
boundary layer equations will not be covered
extensively. Instead, we will outline the general
numerical strategy required for such solutions.
Although the 3D boundary layer equations have
hyperbolic nature in the x-z plane, it has inviscid
flow solution, required to provide pressure
gradient input. This is considerably more
difficult than 2D flows considered so far.
Figure 60 Schematic of 3D boundary Layer

140Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984,”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
135

 u v w


   0 (8.32)
t x y z
u u v w p   u 
X - momntum :  u  v  w -   
t x y z x y  y 
w w w w p   w 
Z - momntum :  u  v  w -   
t x y z z y  y 
H H H H    H  1  u w 
Energy :  u  v  w     1   u w 
t x y z y  Pr y  Pr  y y 
u2  w2
where H  cpT 
2

A few common difference schemes will be outlined. Chief among them are
 Crank-Nicolson scheme
 Krause zig-zag
scheme
The Krause
difference scheme is
somewhat simpler
than CN scheme,
primarily because
most difference
representation are
only averaged
between n+1 and n.
(see Figure 61).
 Some variations
Figure 61 The Krause Zig-Zag scheme (a) difference tensile (b)
7.6.2 Unsteady Boundary continuity equation
Layer
The unsteady 2D boundary 
n 1 / 2
 nj ,k 1   nj ,k   nj ,k1   nj ,k11
layer equations differs only in 
z i , j 2z
couple of terms. It is also
parabolic but with time as the
marching parameter. Values
of u, v, H and fluid properties must be stored at grid points. The main objective is to develop
computational procedures which will provide accurate and stable results when flow reversal (u<0)
is present. When the flow reversal occurs in thru steady flow, it is crucial to employ a difference
representation which permits upstream influence. One of such techniques is Krause zig-zag
representation as discussed earlier. The usual boundary conditions are:

At x  x 0 , u(t, x 0 , y) , and H(t, x 0 , y) are prescribed for all y and t.


At y  0 , u(t, x,0)  v(t, x,0)  0.0 lim y u(t, x, y)  u e (t, x).
136
137

8 Best Guidelines for CFD Simulation


8.1 Background
Computational fluid dynamics does not provide an exact solution to all problems, but is in many cases
a reliable tool that can provide useful results when an experienced user employs it141. Still is some
circles considered an art that science. An inexperienced user, on the other hand, may obtain very nice
graphs that are very far from being a prediction of the stated problem. Some of the problems arise
from the many default settings in commercial CFD codes, since the user may obtain results without
knowing what the code is doing by accepting settings that are not appropriate for the specific
problem. The user must make an active decision regarding each setting because many problems can
arise from a user failing to understand what the proper settings should be. A CFD simulation contains
both errors and uncertainties. An error is defined as a recognizable deficiency that is not due to a
lack of knowledge, whereas an uncertainty is a potential deficiency that is due to a lack of knowledge.
Poor simulation results may arise for many different reasons; the user may make mistakes in
formulating the problem to solve or in formulating the geometry and meshing. Numerical errors may
occur due to lack of convergence and a poor choice of discretization methods. The models for
turbulence, reactions and multiphase flow are not exact descriptions of the

Figure 62 Component of Uncertainty within a Simulation

real world, and poor results may be introduced by not selecting the best model for the specific case.
In the end, the robustness and reliability of the simulations should be analyzed by sensitivity analysis,
verification, validation and calibration. Figure 62 shows components of uncertainty within a
simulation where Up is all the other flow parameters which contribute to the uncertainty, i.e.,
boundary conditions, initial conditions, spatial and temporal discretization, choice of turbulence,
auxiliary equations, etc. In general, it is good practice to study the obtained simulation results
critically. CFD is not (yet) at the stage at which it can be treated as a black box. Simulation results
should be verified with experimental findings, fluid-mechanics theory and, sometimes, instinct. It
may also help to understand the limitations of the CFD model if a simulation is performed for a case

141 Computational Fluid Dynamics for Engineers, Cambridge University Press.


138

regarding which the results are known, prior to exploring new ground with the model. Some common
errors and recommendations for best practice are given in this chapter.

8.2 Element of Uncertainty


8.2.1 Geometry and Grid Generation
 Make sure that the CAD geometry is complete for the flow simulation. The CAD drawing
should be kept as simple as possible, but it must not be simpler than that. All details smaller
than the computational cells can in most cases be removed, but small details on the surface
can sometimes be important for the flow, e.g. a welded joint may induce flow separation.
 Symmetric boundary conditions restrict the solution to a symmetric solution, and no
transport is allowed across the symmetry plane, e.g. bubble columns and fluidized beds are
poorly described by 2D simulations.
 When the inflow and outflow are not known exactly, they should be put far from the region
of interest.
 With constant-pressure outflow, specify the direction of the outflow (e.g. normal to the plane)
to minimize the pressure difference across the surface.
 Use pressure outflow for multiple outflow boundaries.
 Avoid having non-orthogonal cells close to the boundaries. The angle between the grid lines
and the boundary should be close to 90◦. Use body-fitted grids when the grid cannot be
aligned with the surface.
 Avoid the use of highly skewed cells. The angles should be kept between 40◦ and 140◦. The
maximum skewness should be < 0.95 and the average below 0.33. The aspect ratio should be
below 5, but may be up to 10 inside the boundary layer.
 The squish index describes how the cell faces are oriented, where 0 is a perfect cell and the
upper limit is 1. The recommendation is that the maximum squish index should be below
0.99.
 Perform a grid check to avoid problems due to incorrect connectivity. This can often be done
in the mesh-generator software.

9.2.2 Convergence
 Use different convergence criteria for different variables. Concentration may need a lower
residual than velocity.
 Monitor integral quantities of solution-sensitive variables.
 Make global balances for mass, momentum and energy.
 Monitor the solution at specific important points.
 Test for steady state by switching to a transient solver.
 Plot the residual to evaluate whether the solution is poor in some regions of the
computational domain.
 Use more robust numerical schemes, e.g. initially employ first-order upwind, changing
to a higher order for the final iterations.
 Reduce the under-relaxation or CFL number initially.
 Examine the local residual. The convergence problem might be localized to one small region. Use
grid adaptation to refine or coarsen the mesh in areas where it is needed.
 Using a fine grid throughout may diminish the convergence rate.
 Solve steady-state problems transiently.
 Try different initial guesses, e.g. obtain an initial guess from a short transient simulation or obtain
an initial guess from a steady-state simulation.
139

 Solve for only a few variables at a time, e.g. solve for the flow field first and keep the velocities
constant whilst solving concentration and chemical reactions. Finally solve for all variables.
 Use the coupled solver for high-speed compressible flows, highly coupled flows with strong body
forces or flows being solved on very fine meshes. Keep in mind that the coupled solver requires
1.5–2 times more memory than needed by a segregated solver.

8.2.3 Numerical
 The exact inlet conditions for the turbulence properties are usually not known exactly. The
value of k/ε times the average velocity gives an order-of-magnitude estimation of how far
into the system the settings at the inlet will survive.
 Exact inlet conditions for LES are not possible. Modern CFD programs can generate simple
turbulent eddies at the inlet, but the inlet should be far from the area of interest in order to
allow a proper statistical distribution of eddies to develop. Periodic boundary conditions
should be used when possible, but may introduce unphysical correlations. As always, it is
important to verify the obtained solution critically.
 For RANS models, the lower level of y+ should typically be between 20 and 30 at the walls. Some
commercial CFD programs can be made to accept lower y+ levels by adjusting the appropriate
model. (Check the manual for actual values.) The upper limit of y+ is usually in the range 80–100.
 LES models require additional treatment at no-slip walls.
 For low-Re turbulence models the first grid should be at y+ < 4, preferably at y+ ≈ 1 with 5–10
mesh points below y+=20. Standard wall functions are not recommended for flow with a
negative pressure gradient, e.g. with flow separation at the wall.

8.2.4 Reaction
 Check the Dahmk¨ohler number. Slow chemical reactions with Da≪1 are straightforward.
Very fast, mixing-controlled, isothermal chemical reactions with Da ≫ 1 can be modeled
rather accurately. Most other conditions with Da ≈ 1 and reactions that lead to heat formation
and changes in density will give uncertain results.
 Very low residuals as a convergence criterion for concentration are often required, and
monitoring integral quantities for mass balances or steady local concentrations usually
provides more reliable indicators than low residuals.

8.2.5 Multiphase Flows


Generally speaking, multiphase flows are more challenging than single-phase flows, and errors in
multiphase flow simulations are typically larger than those in single-phase simulations and
propagating faster. These errors may have a number of different origins. They are:

8.2.5.1 Not knowing the most important physical mechanisms


Because of the wide variety of multiphase flow types, there is not one ‘generic’ model for multiphase
flows. Before attempting to model a multiphase flow system, it is very important to understand the
physical mechanisms occurring in the flow system. This includes understanding the most important
forces and mechanisms in the flow and the properties of the fluid(s) and/or solids, as well as a good
estimate of the length scales and timescales of the physical processes. Only with this knowledge can
appropriate models be selected and their shortcomings in a simulation estimated.

8.2.5.2 Closure Models


Most errors in multiphase flow simulations arise from shortcomings of the closure models employed.
Most closure models are empirically determined, which makes them applicable, strictly speaking,
only under conditions similar to those for the data they are built from. Analytical closure models are
140

developed for ‘ideal’ conditions, which are hardly ever met in reality. Using closure models for
conditions or regimes different from those to which they are applicable may be asking for trouble.

8.2.5.3 Time-Scale and Length-Scale Separation


In the derivation of turbulence models, a separation between the timescales and length scales of the
‘large’ eddies carrying the energy and the scale(s) at which energy is dissipated is assumed. Similar
assumptions are required in order to derive governing and closure models for multiphase flows. For
instance, many closure models require the particles to be smaller than the large-scale flow structures
in a flow.

8.2.5.4 Choice of Model and Governing Equations


It is important to understand the implications and assumptions of each multiphase model, and under
what conditions it may be employed. For instance, in the derivation of the Euler–Euler or two-fluid
model, the pressure gradient over large interfaces, which is important in separated-flow situations,
is neglected. This means that such a model will not capture the dynamics of free surfaces very
accurately.

8.2.5.5 Numerical Errors


Many numerical errors potentially arising in single-phase calculations may also arise in multiphase
flow calculations. Therefore, it is important to check the best-practice guidelines for single-phase
flow computations. However, there may be additional problems. Many of the ideas employed in
solving multiphase flows arise from single-phase flows, leading to slow convergence, or, worse, an
erroneous result.

8.2.3 Avoiding Dangers in Multiphase Flows


To minimize the potential problems occurring when performing multiphase flow simulations, the
following checklist may be employed,

I. If possible, start the simulation with a single-phase flow situation resembling the system. This
simulation can be optimized in terms of grid size, time step, etc. by using the best-practice
guidelines for single-phase flow.
II. Determine the regime of the multiphase flow in terms of dimensionless parameters (Re, We,
St,) . . . This enables the choice of suitable closure models and may give insight into the
expected flow situation.
III. Make an estimate of the forces acting on bubbles, particles or droplets and under which
conditions these forces will occur.
IV. Make a suitable selection of the turbulence model and decide which terms (and coupling to
the dispersed phase) are important.
V. If possible, start with a geometry, flow properties and dispersed-phase properties similar to
those of a system of which you know the behavior or for which experimental data are
available. This creates confidence in the models employed.
VI. If there is a large size distribution of the dispersed phase, a multi-fluid approach might be
required for the dispersed phase. This allows the use of a range of size classes, which can be
monitored separately. Size distributions can have a big effect on the flow.
VII. First-order-accurate models, such as the VOF model and the surface-tension models, require
a very fine mesh – in these cases a relatively mesh-independent solution is very important.
VIII. Make sure that iterations are well converged. Many popular commercial CFD solvers will start with
a new time step when a specified maximum number of iterations is reached, regardless of
convergence criteria. This may be detrimental in terms of the quality of results obtained.
141

8.4 Verification, Validation and Calibration


Verification is a procedure to ensure that the program solves the equations correctly. Validation is
done to test how accurately the model represents reality, and calibration is often used to adjust the
simulation to known experimental data in order to study parameter sensitivity (‘what if’) in the
design process. More detailed discussion of V&V, Uncertainty, Errors and Sensitivity analysis would
present later on.

8.5 Simulation for Everyone


Putting simulation into the hands of the non-expert is a subject that elicits much discussion within
CFD committees142. A crucial element is the relationship between the simulation expert and the non-
expert, where the responsibility of the expert ends and the ability for the non-expert to be able to use
simulation safely starts. This requires simulation experts to design smart simulation applications and
is somewhat analogous to the traditional handbooks where experts would develop solutions in a
parametric form and a working engineer didn’t have to know how those solutions were developed
but would use a formula and perhaps some graphs in conjunction with the formula to come to some
kind of a prediction. For this approach to work with simulation, it is extremely important for the
simulation application to have incorporated into it a solution validation & verification procedure,
since inexperienced and non-expert users are less likely to be able to judge accuracy.
The development of the most effective smart applications requires both external software and
internal company design processes. In this case, the experience and knowledge of the in-house
application experts can be embedded into the interface for the simulation tool. Whilst an expert in
simulation is required to develop these context-specific tools, most small/medium enterprises often
do not employ dedicated simulation engineers so need to rely on external consultants. The most
difficult part of developing an application for non-expert users is getting the technical requirements
from the organization defined in such a way that they can be distilled into an application that can
then be released to the general population. It requires a process that has a clear statement of what
senior engineering staff expect these applications to do and how do they define success and
acceptance for them. The benefits are huge once the tool is created as it can then be inserted into the
workflow, saving engineering time and making solutions operator-independent but it requires
acceptance into the culture of the organization.
According to Jean-François Imbert , “A smart application can’t be commercial software only. It is a tool
which combines commercial software and embedded knowledge-based processes and rules in order to
secure the product simulation and design.” This is easier said than to be done. From previous
experience, all the commercial vendors, has their own deadline and customers. And their cooperation
regarding this, would be hard to come by. Rendering to Oxford Dictionaries, democratization is the
action of making something available to everyone. In the context of engineering simulations, it is
making simulation tools available to everyone. It could be argued (and has been) that the tools have
been available to everyone for some time, including free and open source codes, tools that can be run
on laptop computers with relatively modest specifications and tools with easy to use interfaces and
GUIs. The limiting factor though is the ability to be able to use those tools effectively and responsibly.
The complexities of the simulation are generally hidden from the user (no need to see the mesh or
select the turbulence model) and the terminology used is that of the application engineers, rather
than simulation engineers.
There are now a number of organizations offering CAE app-building facilities, whether they are
mainstream code vendors allowing users to create apps from their more general purpose code or
independent organizations. There has been a growing call for software vendors to provide users with
tools for solution verification. These tools can be incorporated into the approved workflow for use

142 This article, written by Althea de Souza , first appeared in NAFEMS Benchmark Magazine, April 2017 edition.
142

by non-experts. There is still a problem with validation; it is directly tied to the user. A strong
argument is that this is as it should be, since validation entirely depends on how the tool is used and
has little to do with the mathematical solution procedure. This is particularly important with general
purpose codes that are used for a wide range of applications. Can vendors put anything into the tools
to guide the users? Asking for a demonstration of simulation validation from non-expert users will
always prove challenging and so tools designed for this class of user should be built very carefully
around a proven simulation approach and tightly restricted to prevent use outside the scope of
applicability.
Distinguishing between the development of design rules and the application of design rules can help
to differentiate when an expert or non-expert user can undertake an activity. Developing design rules
requires validation and expert involvement, whereas applying design rules can be done by non-
experts using smart tools. Smart applications should have been verified and have embedded
modelling rules so users are not expected to carry out verification. Validation of both the software
and the tightly constrained modelling approach is a pre-requisite for smart tools and should be
conducted before they are released to users143.

143 David Quinn, “The Big Issues in Engineering Simulation- Democratization”, May 25, 2017.
143

9 Components of CFD Simulation


9.1 Background
Having positioned CFD, and its importance, in the global technological world of virtual prototyping,
we should now look at the main components of a CFD system144. We wish to answer the following
question: What are the steps you have to define in order to develop, or to apply, a CFD simulation?
We make no difference at this stage between these two options, as it is similarly essential for the

Figure 63 A typical CFD Simulation

User of a CFD code to understand clearly the different options available and to be able to exercise a
critical judgment on all the steps involved. At this juncture, it is imperative to define difference
between Modeling and Simulation, since both terms used interchangely in CFD.

144 Introduction: An Initial Guide to CFD and to this Volume; page 1, 2007.
144

9.2 Simulation vs Modeling


A model is a physical, mathematical, or otherwise logical representation of a system, or process. The
Simulation is a method of implementing a model over time145. A typical CFD component of simulation
is illustrated in Figure 63, and steps are defined below:

Part I: It selects the mathematical model, defining the level of the approximation to reality that will
be simulated. This could be include what kind of equation would be sufficient for simulation, Euler,
N-S, Heat Transfer, etc. For most commercially available CFD codes this step is automatically defined
within the code and the no need for end-users intervention. Then the discretization of G.E. which
includes examples of CD, UD, QUICK, MARS etc.

Part II : It covers the discretization phase, which has three main components, namely Spatial
Discretization, Temporal Discretization, and Field Discretization as defined by the grid generation
which discussed in details and quite tedious. Spatial and Temporal discretization of the governing
equation in space and time respectively.

Part III: The numerical scheme must be analyzed and its properties of stability and accuracy have to
be established. The immediate following step II is to decide upon the type of the solver needed
(density based, pressure based, steady, unsteady, etc.) to address the specific problem. Later, it is
required to select appropriate physical model (turbulence, multiphase, species transport,
combustion or aerodynamic) based on the problem defined. The selection of solver and physical
model should be followed by defining the material properties, operating conditions and boundary
conditions. One should also establish convergence monitors in order to avoid extra computing time.
Once the solver and physics are set up, the flow field should be initialized. Numerical stability and
consistency criteria would be stablished for different flow solver (Implicit vs Explicit).

Part IV: The solution of the numerical scheme has to be obtained, by selecting the most appropriate
time integration methods, as well as the subsequent resolution method of the algebraic systems,
including convergence acceleration techniques. Monitoring solutions as well as revising the solution
control during the run also important.

Part V: Graphic post-processing of the numerical data to understand and interpret the physical
properties of the obtained simulation results. This is made possible by the existence of powerful
visualization software. Whenever possible, it must verify the result. Repeat the process to obtain the
mesh and other flow sensitivities. Alternatively, another way is to be envisioned as following (see
Figure 64). They are simulation process which can be further streamlined. The solver and solver
setting, as well as, pre-processing, including, mesh generation and CAD date (solid molding), and post
processing are represented. It is well known in CFD circuits that about %70 of engineer times is
spend in pre-processing (CAD data and Mesh Generation). So that it is a big field by itself and requires
keen specialties.

145 Grand Challenges on the Theory of Modeling and Simulation


145

Material
Physical Models: Properties
Turbulence Boundary
Combustion Conditions
Radiation Solver Settings
Mutiphase
Moving Mesh
Transport Equations:
Mass - Momentum
Energy
Equation of state
Supporting physical
Post models Solid Modling
Processing

Material Properties
Boundary Conditions Mesh Generation
Initila Conditions

Figure 64 Streamlined CFD Simulation Process

9.3 Simulation Components as Envisioned by NASA


Finally, NPARC (alliance for CFD verification and validation) of NASA describes the CFD simulation
process as below. Bear in mind that this is a detailed and lengthy endower and not all the components
are needed all the time, but the user should be confident with the concepts at least.

1. Formulate the Flow Problem


2. Model the Geometry and Flow Domain
3. Establish the Boundary and Initial Conditions
4. Generate the Grid
5. Establish the Simulation Strategy
6. Establish the Input Parameters and Files
7. Perform the Simulation
8. Monitor the Simulation for Completion
9. Post-process the Simulation to get the Results
10. Make Comparisons of the Results
11. Repeat the Process to Examine Sensitivities

Further details include:

9.3.1 Formulate the Flow Problem


The first step of the analysis process is to formulate the flow problem by seeking answers to the
following questions:
146

 What is the objective of the analysis?


 What is the easiest way to obtain those objective?
 What geometry should be included?
 What are the freestream and/or operating conditions?
 What dimensionality of the spatial model is required? (1D, quasi-1D, 2D,
axisymmetric, 3D) what should the flow domain look like? What temporal modeling
is appropriate? (steady or unsteady)
 What is the nature of the viscous flow? (inviscid, laminar, turbulent)
 How should the gas be modeled?

9.3.2 Model the Geometry and Flow Domain


The body about which flow is to be analyzed requires modeling. This generally involves modeling the
geometry with a CAD software package. Approximations of the geometry and simplifications may be
required to allow an analysis with reasonable effort. Concurrently, decisions are made as to the
extent of the finite flow domain in which the flow is to be simulated. Portions of the boundary of the
flow domain coincide with the surfaces of the body geometry. Other surfaces are free boundaries
over which flow enters or leaves. The geometry and flow domain are modeled in such a manner as to
provide input for the grid generation. Thus, the modeling often takes into account the structure and
topology of the grid generation.

9.3.3 Establish the Boundary and Initial Conditions


Since a finite flow domain is specified, physical conditions are required on the boundaries of the flow
domain. The simulation generally starts from an initial solution and uses an iterative method to reach
a final flow field solution.

9.3.4 Generate the Grid


The flow domain is discretized into a grid. The grid generation involves defining the structure and
topology and then generating a grid on that topology. Currently all cases involve multi-block,
structured grids; however, the grid blocks may be abutting, contiguous, non-contiguous, and
overlapping. The grid should exhibit some minimal grid quality as defined by measures of
orthogonality (especially at the boundaries), relative grid spacing (15% to 20% stretching is
considered a maximum value), grid skewness, etc... Further the maximum spacing’s should be
consistent with the desired resolution of important features. The resolution of boundary layers
requires the grid to be clustered in the direction normal to the surface with the spacing of the first
grid point off the wall to be well within the laminar sublayer of the boundary layer. For turbulent
flows, the first point off the wall should exhibit a y+ value of less than 1.0

9.3.5 Establish the Simulation Strategy


The strategy for performing the simulation involves determining such things as the use of space-
marching or time-marching, the choice of turbulence or chemistry model, and the choice of
algorithms.

9.3.6 Establish the Input Parameters and Files


A CFD codes generally requires that an input data file be created listing the values of the input
parameters consisted with the desired strategy. Further, a grid file containing the grid and boundary
condition information is generally required. The files for the grid and initial flow solution need to be
generated.
147

9.3.7 Perform the Simulation


The simulation is performed with various possible with options for interactive or batch processing
and distributed processing.

9.3.8 Monitor the Simulation for Completion


As the simulation proceeds, the solution is monitored to determine if a "converged" solution has been
obtained, which iterative convergence is. Further discussion can be found on the page entitled
Examining Iterative Convergence.

9.3.9 Post-Process the Simulation to get the Results


Post-Processing involves extracting the desired flow properties (thrust, lift, drag, etc.) from the
computed flow field.

9.3.10 Make Comparisons of the Results


The computed flow properties are then compared to results from analytic, computational, or
experimental studies to establish the validity of the computed results.

9.3.11 Repeat the Process to Examine Sensitivities


The sensitivity of the computed results should be examined to understand the possible differences
in the accuracy of results and / or performance of the computation with respect to such things as:

 dimensionality
 flow conditions
 initial conditions
 marching strategy
 algorithms
 grid topology and density
 turbulence model
 chemistry model
 flux model
 artificial viscosity
 boundary conditions

Further information can be found on the pages entitled Verification & Validation Assessment.

9.3.12 Document
Documenting the findings of an analysis involves describing each of these steps in the process. Again,
the user normally does not have the luxury of time to perform all of these, but it is mentioned here
for completeness.

9.4 Comparison of some Commercially Available CFD Software


There are multitude of commercially available CFD tools and in-house software designed for special
needs. On a commercially available front, there are about 30 packages and three of them, general
purpose products, covering about %50 percent of market. They are ANASYS© CFX and FLEUNT, and
CD© Star-CD, and its sister product Star-CCM+. A comparison of these 3 codes been made on Table
9). An OpenFOAM is another arrival which until recently was open source and free to use. It has one
disadvantage: namely lack of GUI interface but on the plus side it has open-source routine which are
easily to manipulate. Each has its own strength and shortcoming and the user is advised to choose
according to specific needs. But in general, they are yields to the same results for general application.
148

A good source of what is available and their associated problems is the CFD-online site. Beside these,
there are number of research oriented codes which attribute to specific problems and needs.

Supported Pressure Multi- System


Density Based Discretization
Grid Type Based grid Solver
Structured SIMPLE Coupled UD
Algebraic Gauss-
Fluent Unstructured SIMPLEC Implicit TVD
Geometric Seidel
Hybrid PISO Preconditioned QUICK
Star- UD
Structured SIMPLE
CD Conjugate TVD
Unstructured SIMPLEC
Star- ----------- ----------- Gradient OUICK
Hybrid PISO
CCM+ CD
UD
Structured Algebraic
TVD
CFX Unstructured SIMPLE Coupled
----------- ILU QUICK
Hybrid
CD
Table 9 An Overview of some commercially available CFD software

9.4.1 AcuSolve© (http://www.altair.com)


It is a leading general-purpose Computational Fluid Dynamics (CFD) solver that is capable of solving
the most demanding industrial and scientific applications. AcuSolve’s robust and scalable solver
technology empowers users by providing unparalleled accuracy on fully unstructured meshes.
Applications ranging from steady RANS simulations to complex, transient, multi-physics simulations
are handled with ease and accuracy.

9.4.2 OpenFOAM© (http://www.openfoam.com)


OpenFOAM is a free, open source CFD software package produced by a commercial company,
OpenCFD Ltd. It has a large user base across most areas of engineering and science, from both
commercial and academic organizations. OpenFOAM has an extensive range of features to solve
anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid
dynamics and electromagnetic.

9.4.3 OpenFlower (http://sourceforge.net/projects/openflower)


OpenFlower is a free and open source CFD code (for Linux and Windows) mainly intended to solve
the turbulent incompressible Navier-Stokes equations with a LES approach. It can deal with arbitrary
complex 3D geometries with its finite volume approach.

9.4.4 FLASH (http://flash.uchicago.edu)


A modular, parallel adaptive-mesh code initially designed for thermonuclear runaway problems but
now capable of a wide variety of astrophysical problems. Includes modules for MHD, nuclear burning,
radioactive cooling, self-gravity, particle dynamics, and cosmological expansion. I can give you the
most help with this code since I am one of the principal authors. FLASH is described in Fryxell et al.
2000, ApJS, 131, 273; extensive current documentation is available at their web site.

9.4.5 GADGET© (http://www.mpa-garching.mpg.de/~volker/gadget)


A parallel N-body tree plus smoothed particle hydrodynamics (SPH) code. Gadget can be used to
address a wide array of astrophysical interesting problems, ranging from colliding and merging
galaxies, to the formation of large-scale structure in the Universe. With the inclusion of additional
149

physical processes such as radioactive cooling and heating, Gadget can also be used to study the
dynamics of the gaseous intergalactic medium or to address star formation and its regulation by
feedback processes. Gadget is described in Springel 2005, MNRAS, 364, 1105 and in documentation
available at its web site.

9.4.6 HYDRA© (http://hydra.mcmaster.ca/hydra)


Adaptive particle-particle-particle-mesh (AP3M) plus smoothed-particle hydrodynamics (SPH) code.
Designed for (but not restricted to) cosmological simulation (includes a cosmological initial
conditions generator).. Current documentation is available with the Hydra source code.

9.4.7 ZEUS-MP (http://lca.ucsd.edu/portal/software)


Parallel, non-adaptive hydro- and magneto hydrodynamics code with self-gravity and radiation.
Zeus-MP is extensively discussed in astro-ph/0005109 and references therein.

9.4.8 ANSYS CFX© (http://www.ansys.com/Products/Simulation+Technology/Fluid+Dynamics)


ANSYS CFX computational fluid dynamics (CFD) software delivers best-in-class technology no matter
what level of CFD is required. Using ANSYS Design Modeler, ANSYS CFX works with your CAD
package. The ANSYS Workbench platform is used through all stages of a complete CFD simulation
providing consistency, persistence of information and a convenient work flow. ANSYS CFX guides the
user through the physics setup process. Post-processing provides graphics and hard numbers as well
as animations that can be used by themselves or in presentations. ANSYS CFX also includes a freely-
distributable 3-D viewer for sharing 3-D designs with colleagues. In addition, the ANSYS CFX suite
contains industry-leading CFD solver capabilities using a unique multi-grid linear solver, essentially
linear parallel CPU scalability and access to a broad set of models that provide accurate answers to
deliver real world results. With ANSYS CFX it is simple to add more functionality while continuing to
seamlessly support and leverage the investments in existing CAE assets. ANSYS CFX delivers the
ability to apply the most powerful and precise CFD technology to virtually every fluid engineering
problem. Explore in depth the technology and advantages of ANSYS CFX using the chart below or
menu on the left.

9.4.9 ANSYS ICEM CFD©(http://www.ansys.com/Products/Other+Products/ANSYS+ICEM+CFD)


From CAD to mesh generation for analysis, ANSYS ICEM CFD provides sophisticated geometry
acquisition, mesh generation, mesh editing, a wide variety of solver outputs and post-processing.
ANSYS ICEM CFD is the only Universal pre-processor for analysis including FEA, CFD and other CAE
applications such as particle transport and computational electro-magnetic. Used for engineering
applications such as computational fluid dynamics and structural analysis, ANSYS ICEM CFD’s mesh
generation tools offer the capability to parametrically create grids from geometry in multi-block
structured, unstructured hexahedral, tetrahedral, hybrid grids consisting of hexahedral, tetrahedral,
pyramidal and prismatic cells; and Cartesian grid formats combined with boundary conditions.
ANSYS ICEM CFD is the Swiss army knife of meshing, our product vision is to provide a variety of
flexible tools that can generate “any” type of mesh on “any” type of geometry for “any” solver or “any”
application.

9.4.10 FLUENT© (http://www.fluent.com)


Replaced by Ansys Workbench. The broad physical modeling capabilities of FLUENT have been
applied to industrial applications ranging from air flow over an aircraft wing to combustion in a
furnace, from bubble columns to glass production, from blood flow to semiconductor manufacturing,
from clean room design to wastewater treatment plants. The ability of the software to model in-
cylinder engines, aero acoustics, turbo machinery, and multiphase systems has served to broaden its
reach.
150

9.4.11 COMSOL Multi-physics© (http://www.comsol.com/products/multiphysics)


COMSOL Multi-physics is a modeling package for the simulation of any physical process you can
describe with partial differential equations (PDEs). It features state-of-the-art solvers that address
complex problems quickly and accurately, while its intuitive structure is designed to provide ease of
use and flexibility. You can easily model most phenomena through predefined modeling templates.
Modifying these to specific applications is possible through equation-based modeling capabilities. To
deal with the increasing demand for realistic representations of the world around us, you can easily
model systems of coupled physics phenomena. COMSOL Multi-physics provides a friendly, fast and
versatile environment for multi-physics modeling. Fast results and unprecedented flexibility make
COMSOL Multi-physics the ideal modeling and simulation software for research, product
development, and education.

9.4.12 CFDRC© (http://www.cfdrc.com)


CFDRC offers unique capabilities for Multiphysics, Multiscale, and Coupled Simulations of fluid,
thermal, chemical, biological, electrical, and mechanical phenomena for real-world applications.
CFDRC’s technologies, products, and services enable better understanding of complex problems, and
lead to better decisions resulting in better concepts, designs, products and systems.

9.4.13 STAR-CD/STAR-CCM+ © (http://www.cd-adapco.com)


The STAR-CD solver provides one of the most effective numerical methodologies available in an
industrial CFD code with the high level of accuracy needed for complex unstructured meshes. This is
delivered with the speed, efficiency and robustness demanded by engineering design and
development cycles. STAR-CD uses state-of-the-art, proprietary numerical schemes to achieve the
highest levels of accuracy in both steady and transient simulations, making this solver one of the least
sensitive to mesh type and quality, including distorted tetrahedral meshes. Remarkably, this has been
achieved without sacrificing efficiency or robustness. So, whatever the choice of mesh or engineering
application, the STAR solver will provide the best solution in the shortest time. A particular feature
of STAR-CD is its fast CPU performance for transient flows. As the first to introduce moving mesh into
a CFD code, we have always been technology leaders in this area. The meshes can not only move and
deform, but they can also slide along non-matching interfaces; furthermore, selected cells or cell
regions can be deleted or added, detached and again attached to the core model.

9.4.14 FLOW3D© (http://www.flow3d.com)


FLOW-3D is a powerful modeling tool that gives engineers valuable insight into many physical flow
processes. With special capabilities for accurately predicting free surface flows, FLOW-3D is the ideal
software to use in your design phase as well as in improving production processes. FLOW-3D is an
all-inclusive package. No special additional modules for meshing or post-processing are needed. An
integrated graphical user interface ties everything together, from problem setup to post-processing.

9.4.15 TACOMA© (http://www.ge.com)


Has been under development at General Electric Global Research for16 years and it been used for
turbomachinery application. It comprises almost 500,000 lines of code, from twenty or more authors.
The equations solved are the steady, Reynolds-averaged Navier-Stokes equations (RANS), or the
unsteady, Reynolds-averaged Navier-Stokes equations (URANS). TACOMA is a density-based, multi
block, time-marching code using the well-established Jameson, Schmidt, Turkel (JST) algorithm.
Available turbulence models include several flavors of Wilcox’s (k, ω) model and Menter’s SST model.
A two-equation transition model due to Menter is available.
151

9.4.16 CONVERGE™ (http://: www.convergecfd.com)


This is a general purpose 3D CFD Code with focus on engine simulation. It claims to be is very efficient
and accurate, where complex geometries and/or moving geometries and chemistry are to be
modeled. Although it is a general purpose CFD tool, but is primarily developed as Internal Combustion
Engine simulations (ICE). There are many and flexible ways to adjust the simulation grid resolution
in space and in time, including using a stationary and orthogonal mesh in the interior of your domain,
whose grid density automatically varies to resolve gradients using Adaptive Mesh Refinement (AMR).
CONVERGE is loaded with the physical models needed to accurately simulate HCCI, Diesel and spark
ignited engines. Included are advanced spray and combustion models, including the SAGE detailed
chemistry solver. Of course, CONVERGE runs well in parallel as well.

9.5 Symbolic Math Packages


9.5.1 Maxima (http://maxima.sourceforge.net)
Open-source symbolic math package based on the classic Macsyma computer algebra system.
9.5.2 Mathematica (http://www.wolfram.com)
Commercial symbolic math package, available on department machines (try man Mathematica). Also
available inexpensively through a UIUC site license.
9.5.3 Maple (http://www.maplesoft.com)
Another commercial symbolic math package.
9.5.4 MatLab (http://www.mathworks.com)
Yet another famous commercial symbolic math package, a bit more geared toward engineering and
numerical work than Mathematica or Maple.

Potrebbero piacerti anche