Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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
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.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
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
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).
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.
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,
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
1. Solution exists
2. Solution is unique
3. Solution depends continuously on the data
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
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)".
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
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.
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
Navier Stokes
and Family
Viscous
Boundary
Layer
Steady State Incompressible Turbulent
Euler
Flow Field
Transient Compressible Laminar Velocity
Potentials
Invscid Laplace
Bernouli
Elementry
Flows
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,
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
2 2 2 κ
A B C D E F G(x, y) (4.1)
x 2
xy 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
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.
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:
Figure 7 Domain and boundaries for the solution of hyperbolic equations (unsteady)
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.
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.
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.
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
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
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 )/ )
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
2
a 2 (4.6)
t x x
(x, t) exp( kxt) sin(kx at) where k constant and (x) sin(kx) [0,1]
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
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
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.
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.
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.
( A λI) v 0 (4.13)
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]=[Λ].
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
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.
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.
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
29 M. Giles, “Non-Reflecting Boundary Conditions for the Euler Equations”, CFDL-TR-88-1, Feb. 1988.
34
This is called the dispersion relation and is a polynomial of degree N in each ω, k, and l. The right
eigenvectors requires that
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
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
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)
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.
n
bi a ij x kj 1
a x
j1
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
n
a ii a ij (4.23)
j1
ji
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.
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
*
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
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.
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:
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.
[ 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
Which is repeated iteratively. Step 1 consists simply of a forward substation. This is followed by the
backward substitution of Step 2.
33 Grétar Tryggvason, “Numerical Methods for Elliptic Equations-III”, lecture slides, spring 2013.
39
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.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.
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
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.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.
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
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
37 David Houcque, “Introduction To Matlab For Engineering Students”, Northwestern University, (version 1.2,
August 2005).
38 Introduction to MATLAB.
46
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.
u u u i u i u i 1 u i 1 u i 1
i 1 (5.1)
x i Δx Δx
2x
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.
u 2 u (x) 2
u(x Δx, y) u(x, y) Δx 2 ...... (5.6)
x x 2!
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
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)
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:
Under certain conditions FD and FV schemes yields the same results. An example would be a 2D
steady state conduction with Dirichlet boundaries.
t Ω
U dΩ . F dΩ 0 (.)
Ω
t Ω
U dΩ F. n dΓ 0 where Fk is numerical flux (.)
Ω
Fk .n k
faces
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 Fi1 G j1 G j1 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
(.)
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.
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 Γ
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
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.
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
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
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.
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:
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
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
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:
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.
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.
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.
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.
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.
1
nx nx
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):
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.
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.
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
N
T(x, y,z, t) T0 (x, y,z, t) a j (t) j (x, y,z) (.)
j1
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
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.
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.
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.
(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.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.
Evidently, this practice will sometimes involve some trial-and-error adjustments for optimal results.
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 Lj1/2 u j u j u j1 1 k u j1 u j (5.16)
4 4
1 k
u Rj1/2 u j1 u j1 u j 1 k u j2 u j1
4 4
1
k -1 Second order k Third order
3
k 0 Fromm' s scheme k 1 Centeral
1
k QUICK
2
(ρ )
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.
t
t Δt
φ dt f φ t Δt (1 f) φ t Δt (5.19)
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.
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
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.
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.
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
j1
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:
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.
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 j1
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.
67 “Steady-State or Unsteady CFD Simulation?” Symscape, Computational Fluid Dynamics Software for All.
79
(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
68 “Steady-State or Unsteady CFD Simulation?” Symscape, Computational Fluid Dynamics Software for All.
80
(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
ρ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
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.
70Diskin, Boris; Thomas, James: “Comparison of Node-Centered and Cell-Centered Unstructured Finite-Volume
Discretizations: Inviscid Fluxes,” AIAA Journal 2010.
84
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.
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
θ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,
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
u u ui
u u i 1 i 1 (6.2)
x Δx
Which of course non-linear.
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.
u i 1 u i ε where 1 (6.4)
Which is now linear. The carrot denotes an evaluation of variables from previous iteration.
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
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.
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 An Bn U n 1
2 x y
n
Δt
I An Bn 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
An I Δt Bn U n 1
2 x 2 y
n
I
Δt
An I Δt Bn 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.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.
81 See Previous.
82 Introduction to ANSYS Fluent, 2010.
83 Georgia Tech Computational Fluid Dynamics, “Solution Methods for Navier Stokes Equations”, Spring 2007.
91
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 )
u u 1 P 2u 1
-u ν 2 SF
t x ρ x x ρ
T T T
2
2
-u α 2 ST -u k 2 SG (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 SG
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.
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 Hh (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
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.
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.
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.
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”,
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 Rw ε Δ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.
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.
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
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.
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
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
Lallemand M, Steve H, Dervieux A., “Unstructured multi gridding by volume agglomeration: current status”,
110
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
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
β β
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
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.
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
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
ρ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 Fin11 (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.
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
2x
[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
2x
[A j ] I
Δt
2x
Δ[A j ] ΔU nj
Δt
Δx
E ΔE (7.15)
I
Δt
[A j ] ΔUj
Δt
Δx
E ΔE
2 x
Δt
I Δ[A j ] ΔU nj ΔUj
2x
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.
U U E
[ A] where [ A] (7.16)
t x U
U
TV dx U j1 U j subject to TVU n 1 TVU 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.
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
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 ) - (Fin1/2,j,k - Fin-1/2,j,k ) (G i,n j1/2,k - G i,n j1/2,k )
Q /
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.
λ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.
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.
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
uv uv
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.
( 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
ρU ρV
ξ η 0 (7.22)
J i 1, j J i, j1
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, j1 i 1, j1 i, j1 i, j1 )
4
1
V i, j1/2 (A 3 ) i, j1/2 (i, j1 i, j ) (A 2 ) i, j1/2 (i 1, j1 i 1, j1 i 1, j i 1, j )
4
U ρV
ξ ~ ρi η 0
J i 1/2,j J i, j1
2
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
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.
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.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
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.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
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.
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.
θ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.
λΔ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.
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
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
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.
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.
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
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
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
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
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.
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 Ev ) η y (Fi Fv ) ηz (G i G v )
J
1
G 3 ζ x (Ei Ev ) ζ y (Fi Fv ) ζ z (G i Gv )
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
qx -k( xT xT ) , qy -k( yT yT ) , qz -k( zT zT )
Bear in mind that for many applications, the thin–layer approximation can also be applied to the PNS
equations.
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 Ei 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 ix
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
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
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
ρ 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
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
140Anderson, Dale A; Tannehill, John C; Plecher Richard H; 1984,”Computational Fluid Mechanics and Heat
Transfer”, Hemisphere Publishing Corporation.
135
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 ,k11
layer equations differs only in
z i , j 2z
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:
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
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.
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.
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.
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
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
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
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.
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
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.
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.
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.