# Introduction to CFD Basics

Lance Collins
This is a quick-and-dirty introduction to the basic concepts underlying CFD. The con-
cepts are illustrated by applying them to simple 1D model problems. We’ll invoke these
concepts while performing “case studies” in FLUENT. Happily for us, these model-problem
concepts extend to the more general situations in the case studies in most instances. Since
we’ll keep returning to these concepts while performing the FLUENT case studies, it’s worth
your time to understand and digest these concepts.
We discuss the following topics brieﬂy. These topics are the minimum necessary to
perform and validate the FLUENT calculations to come later.
1. The Need for CFD
2. Applications of CFD
3. The Strategy of CFD
4. Discretization Using the Finite-Diﬀerence Method
5. Discretization Using The Finite-Volume Method
6. Assembly of Discrete System and Application of Boundary Conditions
7. Solution of Discrete System
8. Grid Convergence
9. Dealing with Nonlinearity
10. Direct and Iterative Solvers
11. Iterative Convergence
12. Numerical Stability
13. Turbulence modeling
1
The Need for CFD
Applying the fundamental laws of mechanics to a ﬂuid gives the governing equations for a
ﬂuid. The conservation of mass equation is
∂ρ
∂t
+∇· (ρ

V ) = 0
and the conservation of momentum equation is
ρ

V
∂t
+ ρ(

V · ∇)

V = −∇p + ρg +∇· τ
ij
These equations along with the conservation of energy equation form a set of coupled, non-
linear partial diﬀerential equations. It is not possible to solve these equations analytically
for most engineering problems.
However, it is possible to obtain approximate computer-based solutions to the governing
equations for a variety of engineering problems. This is the subject matter of Computational
Fluid Dynamics (CFD).
Applications of CFD
CFD is useful in a wide variety of applications and here we note a few to give you an idea of
its use in industry. The simulations shown below have been performed using the FLUENT
software.
CFD can be used to simulate the ﬂow over a vehicle. For instance, it can be used to study
the interaction of propellers or rotors with the aircraft fuselage The following ﬁgure shows
the prediction of the pressure ﬁeld induced by the interaction of the rotor with a helicopter
fuselage in forward ﬂight. Rotors and propellers can be represented with models of varying
complexity.
The temperature distribution obtained from a CFD analysis of a mixing manifold is shown
below. This mixing manifold is part of the passenger cabin ventilation system on the Boeing
767. The CFD analysis showed the eﬀectiveness of a simpler manifold design without the
need for ﬁeld testing.
2
Bio-medical engineering is a rapidly growing ﬁeld and uses CFD to study the circulatory and
respiratory systems. The following ﬁgure shows pressure contours and a cutaway view that
reveals velocity vectors in a blood pump that assumes the role of heart in open-heart surgery.
CFD is attractive to industry since it is more cost-eﬀective than physical testing. However,
one must note that complex ﬂow simulations are challenging and error-prone and it takes a
lot of engineering expertise to obtain validated solutions.
The Strategy of CFD
Broadly, the strategy of CFD is to replace the continuous problem domain with a discrete
domain using a grid. In the continuous domain, each ﬂow variable is deﬁned at every point
in the domain. For instance, the pressure p in the continuous 1D domain shown in the ﬁgure
below would be given as
p = p(x), 0 < x < 1
In the discrete domain, each ﬂow variable is deﬁned only at the grid points. So, in the
discrete domain shown below, the pressure would be deﬁned only at the N grid points.
p
i
= p(x
i
), i = 1, 2, . . . , N
Continuous Domain Discrete Domain
x=0
x=1
x
1
x
i

x
N

0 ≤ x ≤ 1 x = x
1
, x
2
, …,x
N

Grid point
Coupled PDEs + boundary
conditions in continuous
variables
Coupled algebraic eqs. in
discrete variables
In a CFD solution, one would directly solve for the relevant ﬂow variables only at the grid
points. The values at other locations are determined by interpolating the values at the grid
points.
The governing partial diﬀerential equations and boundary conditions are deﬁned in terms
of the continuous variables p,

V etc. One can approximate these in the discrete domain in
terms of the discrete variables p
i
,

V
i
etc. The discrete system is a large set of coupled,
algebraic equations in the discrete variables. Setting up the discrete system and solving it
(which is a matrix inversion problem) involves a very large number of repetitive calculations,
a task we humans palm over to the digital computer.
3
This idea can be extended to any general problem domain. The following ﬁgure shows
the grid used for solving the ﬂow over an airfoil. We’ll take a closer look at this airfoil grid
soon while discussing the ﬁnite-volume method.
Discretization Using the Finite-Diﬀerence Method
To keep the details simple, we will illustrate the fundamental ideas underlying CFD by
applying them to the following simple 1D equation:
du
dx
+ u
m
= 0; 0 ≤ x ≤ 1; u(0) = 1 (1)
We’ll ﬁrst consider the case where m = 1 when the equation is linear. We’ll later consider
the m = 2 case when the equation is nonlinear.
We’ll derive a discrete representation of the above equation with m = 1 on the following
grid:
x
1
=0 x
2
=1/3 x
3
=2/3 x
4
=1
∆x=1/3
This grid has four equally-spaced grid points with ∆x being the spacing between successive
points. Since the governing equation is valid at any grid point, we have

du
dx

i
+ u
i
= 0 (2)
where the subscript i represents the value at grid point x
i
. In order to get an expression for
(du/dx)
i
in terms of u at the grid points, we expand u
i−1
in a Taylor’s series:
u
i−1
= u
i
−∆x

du
dx

i
+ O(∆x
2
)
Rearranging gives

du
dx

i
=
u
i
−u
i−1
∆x
+ O(∆x) (3)
4
The error in (du/dx)
i
due to the neglected terms in the Taylor’s series is called the truncation
error. Since the truncation error above is O(∆x), this discrete representation is termed ﬁrst-
order accurate.
Using (3) in (2) and excluding higher-order terms in the Taylor’s series, we get the
following discrete equation:
u
i
−u
i−1
∆x
+ u
i
= 0 (4)
Note that we have gone from a diﬀerential equation to an algebraic equation!
This method of deriving the discrete equation using Taylor’s series expansions is called
the ﬁnite-diﬀerence method. However, most commercial CFD codes use the ﬁnite-volume or
ﬁnite-element methods which are better suited for modeling ﬂow past complex geometries.
For example, the FLUENT code uses the ﬁnite-volume method whereas ANSYS uses the
ﬁnite-element method. We’ll brieﬂy indicate the philosophy of the ﬁnite-volume method
next but will keep using the ﬁnite-diﬀerence approach to illustrate the underlying concepts
which are very similar between the diﬀerent approaches with the ﬁnite-diﬀerence method
being easiest to understand.
Discretization Using The Finite-Volume Method
If you look closely at the airfoil grid shown earlier, you’ll see that it consists of quadrilaterals.
In the ﬁnite-volume method, such a quadrilateral is commonly referred to as a “cell” and a
grid point as a “node”. In 2D, one could also have triangular cells. In 3D, cells are usually
hexahedrals, tetrahedrals, or prisms. In the ﬁnite-volume approach, the integral form of the
conservation equations are applied to the control volume deﬁned by a cell to get the discrete
equations for the cell. The integral form of the continuity equation for steady, incompressible
ﬂow is
S

V· ˆ ndS = 0 (5)
The integration is over the surface S of the control volume and ˆ n is the outward normal
at the surface. Physically, this equation means that the net volume ﬂow into the control
volume is zero.
Consider the rectangular cell shown below.
face 1
(u
1
,v
1
)
face 2
face 3
face 4
(u
2
,v
2
)
(u
3
,v
3
)
(u
4
,v
4
)
Cell center
∆x
x
y
∆y
5
The velocity at face i is taken to be

V
i
= u
i
ˆ
i + v
i
ˆ
j. Applying the mass conservation
equation (5) to the control volume deﬁned by the cell gives
−u
1
∆y −v
2
∆x + u
3
∆y + v
4
∆x = 0
This is the discrete form of the continuity equation for the cell. It is equivalent to summing
up the net mass ﬂow into the control volume and setting it to zero. So it ensures that the
net mass ﬂow into the cell is zero i.e. that mass is conserved for the cell. Usually, though not
always, the values at the cell centers are solved for directly by inverting the discrete system.
The face values u
1
, v
2
, etc. are obtained by suitably interpolating the cell-center values at
Similarly, one can obtain discrete equations for the conservation of momentum and energy
for the cell. One can readily extend these ideas to any general cell shape in 2D or 3D and any
conservation equation. Take a few minutes to contrast the discretization in the ﬁnite-volume
approach to that in the ﬁnite-diﬀerence method discussed earlier.
Look back at the airfoil grid. When you are using FLUENT, it’s useful to remind yourself
that the code is ﬁnding a solution such that mass, momentum, energy and other relevant
quantities are being conserved for each cell. Also, the code directly solves for values of
the ﬂow variables at the cell centers; values at other locations are obtained by suitable
interpolation.
Assembly of Discrete System and Application of Boundary Condi-
tions
Recall that the discrete equation that we obtained using the ﬁnite-diﬀerence method was
u
i
−u
i−1
∆x
+ u
i
= 0
Rearranging, we get
−u
i−1
+ (1 + ∆x)u
i
= 0
Applying this equation to the 1D grid shown earlier at grid points i = 2, 3, 4 gives
−u
1
+ (1 + ∆x) u
2
= 0 (i = 2) (6)
−u
2
+ (1 + ∆x) u
3
= 0 (i = 3) (7)
−u
3
+ (1 + ∆x) u
4
= 0 (i = 4) (8)
The discrete equation cannot be applied at the left boundary (i=1) since u
i−1
is not deﬁned
here. Instead, we use the boundary condition to get
u
1
= 1 (9)
Equations (6)-(9) form a system of four simultaneous algebraic equations in the four
unknowns u
1
, u
2
, u
3
and u
4
. It’s convenient to write this system in matrix form:

1 0 0 0
−1 1 + ∆x 0 0
0 −1 1 + ∆x 0
0 0 −1 1 + ∆x
¸
¸
¸
¸
¸

u
1
u
2
u
3
u
4
¸
¸
¸
¸
¸
=

1
0
0
0
¸
¸
¸
¸
¸
(10)
6
In a general situation, one would apply the discrete equations to the grid points (or cells
in the ﬁnite-volume method) in the interior of the domain. For grid points (or cells) at or
near the boundary, one would apply a combination of the discrete equations and boundary
conditions. In the end, one would obtain a system of simultaneous algebraic equations with
the number of equations being equal to the number of independent discrete variables. The
process is essentially the same as for the model equation above with the details being much
more complex.
FLUENT, like other commercial CFD codes, oﬀers a variety of boundary condition op-
tions such as velocity inlet, pressure inlet, pressure outlet, etc. It is very important that
you specify the proper boundary conditions in order to have a well-deﬁned problem. Also,
read through the documentation for a boundary condition option to understand what it
does before you use it (it might not be doing what you expect). A single wrong boundary
condition can give you a totally wrong result.
Solution of Discrete System
The discrete system (10) for our own humble 1D example can be easily inverted to obtain
the unknowns at the grid points. Solving for u
1
, u
2
, u
3
and u
4
in turn and using ∆x = 1/3,
we get
u
1
= 1 u
2
= 3/4 u
3
= 9/16 u
4
= 27/64
The exact solution for the 1D example is easily calculated to be
u
exact
= exp(−x)
The ﬁgure below shows the comparison of the discrete solution obtained on the four-point
grid with the exact solution. The error is largest at the right boundary where it is equal to
14.7%.
0 0.2 0.4 0.6 0.8 1
0.4
0.5
0.6
0.7
0.8
0.9
1
x
u

Numerical solution
Exact solution
In a practical CFD application, one would have thousands to millions of unknowns in
the discrete system and if one uses, say, a Gaussian elimination procedure naively to invert
the matrix, you’d graduate before the computer ﬁnishes the calculation. So a lot of work
goes into optimizing the matrix inversion in order to minimize the CPU time and memory
7
required. The matrix to be inverted is sparse i.e. most of the entries in it are zeros since
the discrete equation at a grid point or cell will contain only quantities at the neighboring
points or cells; verify that this is indeed the case for our matrix system (10). A CFD code
would store only the non-zero values to minimize memory usage. It would also generally use
an iterative procedure to invert the matrix; the longer one iterates, the closer one gets to
the true solution for the matrix inversion.
Grid Convergence
While developing the ﬁnite-diﬀerence approximation for the 1D example, we saw that the
truncation error in our discrete system is O(∆x). So one expects that as the number of grid
points is increased and ∆x is reduced, the error in the numerical solution would decrease
and the agreement between the numerical and exact solutions would get better.
Let’s consider the eﬀect of increasing the number of grid points N on the numerical
solution of the 1D problem. We’ll consider N = 8 and N = 16 in addition to the N = 4
case solved previously. We repeat the above assembly and solution steps on each of these
additional grids. The resulting discrete system was solved using MATLAB. The following
ﬁgure compares the results obtained on the three grids with the exact solution. As expected,
the numerical error decreases as the number of grid points is increased.
0 0.2 0.4 0.6 0.8 1
0.4
0.5
0.6
0.7
0.8
0.9
1
x
u

N=4
N=8
N=16
Exact solution
When the numerical solutions obtained on diﬀerent grids agree to within a level of tolerance
speciﬁed by the user, they are referred to as “grid converged” solutions. The concept of
grid convergence applies to the ﬁnite-volume approach also where the numerical solution, if
correct, becomes independent of the grid as the cell size is reduced. It is very important
that you investigate the eﬀect of grid resolution on the solution in every CFD problem you
solve. Never trust a CFD solution unless you have convinced yourself that the solution is
grid converged to an acceptance level of tolerance (which would be problem dependent).
Dealing with Nonlinearity
The momentum conservation equation for a ﬂuid is nonlinear due to the convection term
(

V · ∇)

V . Phenomena such as turbulence and chemical reaction introduce additional non-
8
linearities. The highly nonlinear nature of the governing equations for a ﬂuid makes it
challenging to obtain accurate numerical solutions for complex ﬂows of practical interest.
We will demonstrate the eﬀect of nonlinearity by setting m = 2 in our simple 1D exam-
ple (1):
du
dx
+ u
2
= 0; 0 ≤ x ≤ 1; u(0) = 1
A ﬁrst-order ﬁnite-diﬀerence approximation to this equation, analogous to that in (4) for
m = 1, is
u
i
−u
i−1
∆x
+ u
2
i
= 0 (11)
This is a nonlinear algebraic equation with the u
2
i
term being the source of the nonlinearity.
The strategy that is adopted to deal with nonlinearity is to linearize the equations about
a guess value of the solution and to iterate until the guess agrees with the solution to a
speciﬁed tolerance level. We’ll illustrate this on the above example. Let u
g
i
be the guess for
u
i
. Deﬁne
∆u
i
= u
i
−u
g
i
Rearranging and squaring this equation gives
u
2
i
= u
2
g
i
+ 2u
g
i
∆u
i
+ (∆u
i
)
2
Assuming that ∆u
i
u
g
i
, we can neglect the ∆u
2
i
term to get
u
2
i
u
2
g
i
+ 2u
g
i
∆u
i
= u
2
g
i
+ 2u
g
i
(u
i
−u
g
i
)
Thus,
u
2
i
2u
g
i
u
i
−u
2
g
i
The ﬁnite-diﬀerence approximation (11) after linearization becomes
u
i
−u
i−1
∆x
+ 2u
g
i
u
i
−u
2
g
i
= 0 (12)
Since the error due to linearization is O(∆u
2
), it tends to zero as u
g
→u.
In order to calculate the ﬁnite-diﬀerence approximation (12), we need guess values u
g
at
the grid points. We start with an initial guess value in the ﬁrst iteration. For each subsequent
iteration, the u value obtained in the previous iteration is used as the guess value.
Iteration 1: u
(1)
g
= Initial guess
Iteration 2: u
(2)
g
= u
(1)
.
.
.
Iteration l: u
(l)
g
= u
(l−1)
The superscript indicates the iteration level. We continue the iterations until they converge.
We’ll defer the discussion on how to evaluate convergence until a little later.
This is essentially the process used in CFD codes to linearize the nonlinear terms in the
conservations equations, with the details varying depending on the code. The important
points to remember are that the linearization is performed about a guess and that it is
necessary to iterate through successive approximations until the iterations converge.
9
Direct and Iterative Solvers
We saw that we need to perform iterations to deal with the nonlinear terms in the governing
equations. We next discuss another factor that makes it necessary to carry out iterations in
practical CFD problems.
Verify that the discrete equation system resulting from the ﬁnite-diﬀerence approxima-
tion (12) on our four-point grid is

1 0 0 0
−1 1 + 2∆xu
g
2
0 0
0 −1 1 + 2∆xu
g
3
0
0 0 −1 1 + 2∆xu
g
4
¸
¸
¸
¸
¸

u
1
u
2
u
3
u
4
¸
¸
¸
¸
¸
=

1
∆xu
2
g
2
∆xu
2
g
3
∆xu
2
g
4
¸
¸
¸
¸
¸
(13)
In a practical problem, one would usually have thousands to millions of grid points or cells
so that each dimension of the above matrix would be of the order of a million (with most of
the elements being zeros). Inverting such a matrix directly would take a prohibitively large
amount of memory. So instead, the matrix is inverted using an iterative scheme as discussed
below.
Rearrange the ﬁnite-diﬀerence approximation (12) at grid point i so that u
i
is expressed
in terms of the values at the neighboring grid points and the guess values:
u
i
=
u
i−1
+ ∆xu
2
g
i
1 + 2 ∆xu
g
i
If a neighboring value at the current iteration level is not available, we use the guess value
for it. Let’s say that we sweep from right to left on our grid i.e. we update u
4
, then u
3
and
ﬁnally u
2
in each iteration. In the m
th
iteration, u
(l)
i−1
is not available while updating u
m
i
and
so we use the guess value u
(l)
g
i−1
u
(l)
i
=
u
(l)
g
i−1
+ ∆xu
(l)
2
g
i
1 + 2 ∆xu
(l)
g
i
(14)
Since we are using the guess values at neighboring points, we are eﬀectively obtaining only
an approximate solution for the matrix inversion in (13) during each iteration but in the
process have greatly reduced the memory required for the inversion. This tradeoﬀ is good
strategy since it doesn’t make sense to expend a great deal of resources to do an exact matrix
inversion when the matrix elements depend on guess values which are continuously being
reﬁned. In an act of cleverness, we have combined the iteration to handle nonlinear terms
with the iteration for matrix inversion into a single iteration process. Most importantly, as
the iterations converge and u
g
→u, the approximate solution for the matrix inversion tends
towards the exact solution for the inversion since the error introduced by using u
g
of u in (14) also tends to zero.
Thus, iteration serves two purposes:
1. It allows for eﬃcient matrix inversion with greatly reduced memory requirements.
2. It is necessary to solve nonlinear equations.
In steady problems, a common and eﬀective strategy used in CFD codes is to solve the
unsteady form of the governing equations and “march” the solution in time until the solution
converges to a steady value. In this case, each time step is eﬀectively an iteration, with the
the guess value at any time level being given by the solution at the previous time level.
10
Iterative Convergence
Recall that as u
g
→ u, the linearization and matrix inversion errors tends to zero. So we
continue the iteration process until some selected measure of the diﬀerence between u
g
and
u, refered to as the residual, is “small enough”. We could, for instance, deﬁne the residual
R as the RMS value of the diﬀerence between u and u
g
on the grid:
R ≡

N
¸
i=1
(u
i
−u
g
i
)
2
N
It’s useful to scale this residual with the average value of u in the domain. An unscaled
residual of, say, 0.01 would be relatively small if the average value of u in the domain is 5000
but would be relatively large if the average value is 0.1. Scaling ensures that the residual is
a relative rather than an absolute measure. Scaling the above residual by dividing by the
average value of u gives
R =

¸
¸
¸
¸
¸
¸
¸

N
¸
i=1
(u
i
−u
g
i
)
2
N
¸

¸
¸
¸
¸
¸
¸
N
N
¸
i=1
u
i
¸

=

N
N
¸
i=1
(u
i
−u
g
i
)
2
N
¸
i=1
u
i
(15)
For the nonlinear 1D example, we’ll take the initial guess at all grid points to be equal
to the value at the left boundary i.e. u
(1)
g
= 1. In each iteration, we update u
g
, sweep
from right to left on the grid updating, in turn, u
4
, u
3
and u
2
using (14) and calculate
the residual using (15). We’ll terminate the iterations when the residual falls below 10
−9
(which is referred to as the convergence criterion). Take a few minutes to implement this
procedure in MATLAB which will help you gain some familiarity with the mechanics of the
implementation. The variation of the residual with iterations obtained from MATLAB is
shown below. Note that logarithmic scale is used for the ordinate. The iterative process
converges to a level smaller than 10
−9
in just 6 iterations. In more complex problems, a lot
more iterations would be necessary for achieving convergence.
1 2 3 4 5 6
10
−10
10
−8
10
−6
10
−4
10
−2
10
0
Iteration number
R
e
s
i
d
u
a
l
11
The solution after 2,4 and 6 iterations and the exact solution are shown below. It can
easily be veriﬁed that the exact solution is given by
u
exact
=
1
x + 1
The solutions for iterations 4 and 6 are indistinguishable on the graph. This is another
indication that the solution has converged. The converged solution doesn’t agree well with
the exact solution because we are using a coarse grid for which the truncation error is
relatively large. The iterative convergence error, which is of order 10
−9
, is swamped out
by the truncation error of order 10
−1
. So driving the residual down to 10
−9
when the
truncation error is of order 10
−1
is a waste of computing resources. In a good calculation,
both errors would be of comparable level and less than a tolerance level chosen by the user.
The agreement between the numerical and exact solutions should get much better on reﬁning
the grid as was the case for m = 1.
0 0.2 0.4 0.6 0.8 1
0.5
0.6
0.7
0.8
0.9
1
x
u

Iteration 2
Iteration 4
Iteration 6
Exact
Some points to note:
1. Diﬀerent codes use slightly diﬀerent deﬁnitions for the residual. Read the documenta-
tion to understand how the residual is calculated.
2. In the FLUENT code, residuals are reported for each conservation equation. A discrete
conservation equation at any cell can be written in the form LHS = 0. For any iteration,
if one uses the current solution to compute the LHS, it won’t be exactly equal to
zero, with the deviation from zero being a mesaure of how far one is from achieving
convergence. So FLUENT calculates the residual as the (scaled) mean of the absolute
value of the LHS over all cells.
3. The convergence criterion you choose for each conservation equation is problem- and
code-dependent. It’s a good idea to start with the default values in the code. One may
then have to tweak these values.
12
Numerical Stability
In our previous 1D example, the iterations converged very rapidly with the residual falling
below the convergence criterion of 10
−9
in just 6 iterations. In more complex problems, the
iterations converge more slowly and in some instances, may even diverge. One would like
to know a priori the conditions under which a given numerical scheme converges. This is
determined by performing a stability analysis of the numerical scheme. A numerical method
is referred to as being stable when the iterative process converges and as being unstable
when it diverges. It is not possible to carry out an exact stability analysis for the Euler or
Navier-Stokes equations. But a stability analysis of simpler, model equations provides useful
insight and approximate conditions for stability. A common strategy used in CFD codes
for steady problems is to solve the unsteady equations and march the solution in time until
it converges to a steady state. A stability analysis is usually performed in the context of
time-marching.
While using time-marching to a steady state, we are only interested in accurately obtain-
ing the asymptotic behavior at large times. So we would like to take as large a time-step
∆t as possible to reach the steady state in the least number of time-steps. There is usually
a maximum allowable time-step ∆t
max
beyond which the numerical scheme is unstable. If
∆t > ∆t
max
, the numerical errors will grow exponentially in time causing the solution to
diverge from the steady-state result. The value of ∆t
max
depends on the numerical dis-
cretization scheme used. There are two classes of numerical shemes, explicit and implicit,
with very diﬀerent stability characteristics as we’ll brieﬂy discuss next.
Explicit and Implicit Schemes
The diﬀerence between explicit and implicit schemes can be most easily illustrated by ap-
plying them to the wave equation
∂u
∂t
+ c
∂u
∂x
= 0
where c is the wavespeed. One possible way to discretize this equation at grid point i and
time-level n is
u
n
i
−u
n−1
i
∆t
+ c
u
n−1
i
−u
n−1
i−1
∆x
= O(∆t, ∆x) (16)
The crucial thing to note here is that the spatial derivative is evaluated at the n−1 time-level.
Solving for u
n
i
gives
u
n
i
=
¸
1 −

c∆t
∆x

u
n−1
i
+

c∆t
∆x

u
n−1
i−1
(17)
This is an explicit expression i.e. the value of u
n
i
at any grid point can be calculated directly
from this expression without the need for any matrix inversion. The scheme in (16) is known
as an explicit scheme. Since u
n
i
at each grid point can be updated independently, these
schemes are easy to implement on the computer. On the downside, it turns out that this
scheme is stable only when
C ≡
c∆t
∆x
≤ 1
where C is called the Courant number. This condition is refered to as the Courant-Friedrichs-
Lewy or CFL condition. While a detailed derivation of the CFL condition through stability
analysis is outside the scope of the current discussion, it can seen that the coeﬃcient of u
n−1
i
13
in (17) changes sign depending on whether C > 1 or C < 1 leading to very diﬀerent behavior
in the two cases. The CFL condition places a rather severe limitation on ∆t
max
.
In an implicit scheme, the spatial derivative term is evaluated at the n time-level:
u
n
i
−u
n−1
i
∆t
+ c
u
n
i
−u
n
i−1
∆x
= O(∆t, ∆x)
In this case, we can’t update u
n
i
at each grid point independently. We instead need to solve a
system of algebraic equations in order to calculate the values at all grid points simultaneously.
It can be shown that this scheme is unconditionally stable for the wave equation so that the
numerical errors will be damped out irrespective of how large the time-step is.
The stability limits discussed above apply speciﬁcally to the wave equation. In general,
explicit schemes applied to the Euler or Navier-Stokes equations have the same restriction
that the Courant number needs to be less than or equal to one. Implicit schemes are not
unconditonally stable for the Euler or Navier-Stokes equations since the nonlinearities in
the governing equations often limit stability. However, they allow a much larger Courant
number than explicit schemes. The speciﬁc value of the maximum allowable Courant number
is problem dependent.
Some points to note:
1. CFD codes will allow you to set the Courant number (which is also referred to as
the CFL number) when using time-stepping. Taking larger time-steps leads to faster
convergence to the steady state, so it is advantageous to set the Courant number as
large as possible, within the limits of stability, for steady problems.
2. You may ﬁnd that a lower Courant number is required during startup when changes
in the solution are highly nonlinear but it can be increased as the solution progresses.
Turbulence Modeling
There are two radically diﬀerent states of ﬂows that are easily identiﬁed and distinguished:
laminar ﬂow and turbulent ﬂow. Laminar ﬂows are characterized by smoothly varying ve-
locity ﬁelds in space and time in which individual “laminae” (sheets) move past one another
without generating cross currents. These ﬂows arise when the ﬂuid viscosity is suﬃciently
large to damp out any perturbations to the ﬂow that may occur due to boundary imperfec-
tions or other irregularities. These ﬂows occur at low-to-moderate values of the Reynolds
number. In contrast, turbulent ﬂows are characterized by large, nearly random ﬂuctuations
in velocity and pressure in both space and time. These ﬂuctuations arise from instabilities
that grow until nonlinear interactions cause them to break down into ﬁner and ﬁner whirls
that eventually are dissipated (into heat) by the action of viscosity. Turbulent ﬂows occur
in the opposite limit of high Reynolds numbers.
A typical time history of the ﬂow variable u at a ﬁxed point in space is shown in Fig. 1(a).
The dashed line through the curve indicates the “average” velocity. We can deﬁne three types
of averages:
1. Time average
2. Volume average
3. Ensemble average
14
2.3
2.2
2.1
2.0
1.9
1.8
1.7

100 80 60 40 20 0

(a)
uvu
utime
-0.4
-0.2
0.0
0.2

100 80 60 40 20 0

(b)
uvu'

utime
0.12
0.10
0.08
0.06
0.04
0.02
0.00

100 80 60 40 20 0
(c)
utime
u (u')
2

Figure 1: Example of a time history of a component of a ﬂuctuating velocity at a point in
a turbulent ﬂow. (a) Shows the velocity, (b) shows the ﬂuctuating component of velocity
u

≡ u −u and (c) shows the square of the ﬂuctuating velocity. Dashed lines in (a) and (c)
indicate the time averages.
The most mathematically general average is the ensemble average, in which you repeat a
given experiment a large number of times and average the quantity of interest (say velocity)
at the same position and time in each experiment. For practical reasons, this is rarely done.
Instead, a time or volume average (or combination of the two) is made with the assumption
that they are equivalent to the ensemble average. For the sake of this discussion, let us deﬁne
the time average for a stationary ﬂow
1
as
u(y) ≡ lim
τ→∞
1

τ
−τ
u(y, t)dt (18)
The deviation of the velocity from the mean value is called the ﬂuctuation and is usually
deﬁned as
u

≡ u −u (19)
Note that by deﬁnition u

= 0 (the average of the ﬂuctuation is zero). Consequently, a
better measure of the strength of the ﬂuctuation is the average of the square of a ﬂuctuating
1
A stationary ﬂow is deﬁned as one whose statistics are not changing in time. An example of a stationary
ﬂow is steady ﬂow in a channel or pipe.
15
variable. Figures 1(b) and 1(c) show the time evolution of the velocity ﬂuctuation, u

, and
the square of that quantity, u
2
. Notice that the latter quantity is always greater than zero
as is its average.
The equations governing a turbulent ﬂow are precisely the same as for a laminar ﬂow;
however, the solution is clearly much more complicated in this regime. The approaches to
solving the ﬂow equations for a turbulent ﬂow ﬁeld can be roughly divided into two classes.
Direct numerical simulations (DNS) use the speed of modern computers to numerically
integrate the Navier Stokes equations, resolving all of the spatial and temporal ﬂuctuations,
without resorting to modeling. In essence, the solution procedure is the same as for laminar
ﬂow, except the numerics must contend with resolving all of the ﬂuctuations in the velocity
and pressure. DNS remains limited to very simple geometries (e.g., channel ﬂows, jets and
boundary layers) and is extremely expensive to run.
2
The alternative to DNS found in
most CFD packages (including FLUENT) is to solve the Reynolds Averaged Navier Stokes
(RANS) equations. RANS equations govern the mean velocity and pressure. Because these
quantities vary smoothly in space and time, they are much easier to solve; however, as will
be shown below, they require modeling to “close” the equations and these models introduce
signiﬁcant error into the calculation.
To demonstrate the closure problem, we consider fully developed turbulent ﬂow in a
channel of height 2H. Recall that with RANS we are interested in solving for the mean
velocity u(y) only. If we formally average the Navier Stokes equations and simplify for this
geometry we arrive at the following
du

v

dy
+
1
ρ
dp
dx
= ν
d
2
u(y)
dy
2
(20)
subject to the boundary conditions
y = 0
du
dy
= 0 , (21)
y = H u = 0 , (22)
The kinematic viscosity ν=µ/ρ. The quantity u

v

, known as the Reynolds stress,
3
is a higher-
order moment that must be modeled in terms of the knowns (i.e., u(y) and its derivatives).
This is referred to as the “closure” approximation. The quality of the modeling of this term
will determine the reliability of the computations.
4
Turbulence modeling is a rather broad discipline and an in-depth discussion is beyond
the scope of this introduction. Here we simply note that the Reynolds stress is modeled in
terms of two turbulence parameters, the turbulent kinetic energy k and the turbulent energy
dissipation rate deﬁned below
k ≡
1
2

u
2
+ v
2
+ w
2

(23)
≡ ν

∂u

∂x

2
+

∂u

∂y

2
+

∂u

∂z

2
+

∂v

∂x

2
+

∂v

∂y

2
+

∂v

∂z

2
2
The largest DNS to date was recently published by Kaneda et al., Phys. Fluids 15(2):L21–L24 (2003);
they used 4096
3
grid point, which corresponds roughly to 0.5 terabytes of memory per variable!
3
Name after the same Osborne Reynolds from which we get the Reynolds number.
4
Notice that if we neglect the Reynolds stress the equations reduce to the equations for laminar ﬂow;
thus, the Reynolds stress is solely responsible for the diﬀerence in the mean proﬁle for laminar (parabolic)
and turbulent (blunted) ﬂows.
16
+

∂w

∂x

2
+

∂w

∂y

2
+

∂w

∂z

2
¸
¸
(24)
where (u

, v

, w

) is the ﬂuctuating velocity vector. The kinetic energy is zero for laminar
ﬂow and can be as large as 5% of the kinetic energy of the mean ﬂow in a highly turbulent
case. The family of models is generally known as k– and they form the basis of most CFD
packages (including FLUENT). We will revisit turbulence modeling towards the end of the
semester.
17

2 . CFD can be used to simulate the ﬂow over a vehicle. This mixing manifold is part of the passenger cabin ventilation system on the Boeing 767. This is the subject matter of Computational Fluid Dynamics (CFD). it is possible to obtain approximate computer-based solutions to the governing equations for a variety of engineering problems. The CFD analysis showed the eﬀectiveness of a simpler manifold design without the need for ﬁeld testing. it can be used to study the interaction of propellers or rotors with the aircraft fuselage The following ﬁgure shows the prediction of the pressure ﬁeld induced by the interaction of the rotor with a helicopter fuselage in forward ﬂight. The conservation of mass equation is ∂ρ + · (ρV ) = 0 ∂t and the conservation of momentum equation is ∂V + ρ(V · )V = − p + ρg + · τij ∂t These equations along with the conservation of energy equation form a set of coupled. ρ Applications of CFD CFD is useful in a wide variety of applications and here we note a few to give you an idea of its use in industry. The temperature distribution obtained from a CFD analysis of a mixing manifold is shown below.The Need for CFD Applying the fundamental laws of mechanics to a ﬂuid gives the governing equations for a ﬂuid. Rotors and propellers can be represented with models of varying complexity. It is not possible to solve these equations analytically for most engineering problems. However. The simulations shown below have been performed using the FLUENT software. For instance. nonlinear partial diﬀerential equations.

N Continuous Domain 0≤x≤1 x=0 x=1 Discrete Domain x = x1. in the discrete domain shown below. one would directly solve for the relevant ﬂow variables only at the grid points. 2. Vi etc. pi = p(xi ). the pressure p in the continuous 1D domain shown in the ﬁgure below would be given as p = p(x).xN x1 xi xN Coupled PDEs + boundary conditions in continuous variables Grid point Coupled algebraic eqs.Bio-medical engineering is a rapidly growing ﬁeld and uses CFD to study the circulatory and respiratory systems. 3 . One can approximate these in the discrete domain in terms of the discrete variables pi . The Strategy of CFD Broadly. one must note that complex ﬂow simulations are challenging and error-prone and it takes a lot of engineering expertise to obtain validated solutions. each ﬂow variable is deﬁned only at the grid points. . V etc. algebraic equations in the discrete variables. 0 < x < 1 In the discrete domain. in discrete variables In a CFD solution. the pressure would be deﬁned only at the N grid points. So. . each ﬂow variable is deﬁned at every point in the domain. CFD is attractive to industry since it is more cost-eﬀective than physical testing. x2. . Setting up the discrete system and solving it (which is a matrix inversion problem) involves a very large number of repetitive calculations. The following ﬁgure shows pressure contours and a cutaway view that reveals velocity vectors in a blood pump that assumes the role of heart in open-heart surgery. The discrete system is a large set of coupled. i = 1. However. For instance. the strategy of CFD is to replace the continuous problem domain with a discrete domain using a grid. In the continuous domain. . The values at other locations are determined by interpolating the values at the grid points. …. a task we humans palm over to the digital computer. The governing partial diﬀerential equations and boundary conditions are deﬁned in terms of the continuous variables p.

Discretization Using the Finite-Diﬀerence Method To keep the details simple. We’ll later consider the m = 2 case when the equation is nonlinear. we expand ui−1 in a Taylor’s series: ui−1 = ui − ∆x Rearranging gives du dx = i du dx + O(∆x2 ) i ui − ui−1 + O(∆x) ∆x 4 (3) . We’ll take a closer look at this airfoil grid soon while discussing the ﬁnite-volume method. we have du dx + ui = 0 i (2) where the subscript i represents the value at grid point xi .This idea can be extended to any general problem domain. In order to get an expression for (du/dx)i in terms of u at the grid points. u(0) = 1 (1) dx We’ll ﬁrst consider the case where m = 1 when the equation is linear. 0 ≤ x ≤ 1. The following ﬁgure shows the grid used for solving the ﬂow over an airfoil. We’ll derive a discrete representation of the above equation with m = 1 on the following grid: ∆x=1/3 x1=0 x2=1/3 x3=2/3 x4=1 This grid has four equally-spaced grid points with ∆x being the spacing between successive points. we will illustrate the fundamental ideas underlying CFD by applying them to the following simple 1D equation: du + um = 0. Since the governing equation is valid at any grid point.

Discretization Using The Finite-Volume Method If you look closely at the airfoil grid shown earlier. we get the following discrete equation: ui − ui−1 + ui = 0 (4) ∆x Note that we have gone from a diﬀerential equation to an algebraic equation! This method of deriving the discrete equation using Taylor’s series expansions is called the ﬁnite-diﬀerence method. most commercial CFD codes use the ﬁnite-volume or ﬁnite-element methods which are better suited for modeling ﬂow past complex geometries. However. Since the truncation error above is O(∆x). the FLUENT code uses the ﬁnite-volume method whereas ANSYS uses the ﬁnite-element method. We’ll brieﬂy indicate the philosophy of the ﬁnite-volume method next but will keep using the ﬁnite-diﬀerence approach to illustrate the underlying concepts which are very similar between the diﬀerent approaches with the ﬁnite-diﬀerence method being easiest to understand. ∆x (u4. you’ll see that it consists of quadrilaterals. The integral form of the continuity equation for steady.v4) face 4 ∆y face 1 (u1. the integral form of the conservation equations are applied to the control volume deﬁned by a cell to get the discrete equations for the cell. In the ﬁnite-volume method. or prisms.v2) face 3 (u3. this equation means that the net volume ﬂow into the control volume is zero. Using (3) in (2) and excluding higher-order terms in the Taylor’s series. For example.v1) y x face 2 (u2. incompressible ﬂow is ˆ V · n dS = 0 (5) S ˆ The integration is over the surface S of the control volume and n is the outward normal at the surface. cells are usually hexahedrals.v3) Cell center 5 . In the ﬁnite-volume approach. this discrete representation is termed ﬁrstorder accurate.The error in (du/dx)i due to the neglected terms in the Taylor’s series is called the truncation error. In 3D. such a quadrilateral is commonly referred to as a “cell” and a grid point as a “node”. In 2D. Physically. one could also have triangular cells. Consider the rectangular cell shown below. tetrahedrals.

u3 and u4 . Also. The face values u1 .The velocity at face i is taken to be Vi = ui ˆ + vi ˆ Applying the mass conservation i j. Assembly of Discrete System and Application of Boundary Conditions Recall that the discrete equation that we obtained using the ﬁnite-diﬀerence method was ui − ui−1 + ui = 0 ∆x Rearranging. momentum. the code directly solves for values of the ﬂow variables at the cell centers. u2 . equation (5) to the control volume deﬁned by the cell gives −u1 ∆y − v2 ∆x + u3 ∆y + v4 ∆x = 0 This is the discrete form of the continuity equation for the cell. one can obtain discrete equations for the conservation of momentum and energy for the cell. When you are using FLUENT. energy and other relevant quantities are being conserved for each cell. So it ensures that the net mass ﬂow into the cell is zero i. 3. One can readily extend these ideas to any general cell shape in 2D or 3D and any conservation equation. we use the boundary condition to get u1 = 1 (9) Equations (6)-(9) form a system of four simultaneous algebraic equations in the four unknowns u1 . Instead. it’s useful to remind yourself that the code is ﬁnding a solution such that mass. Usually. the values at the cell centers are solved for directly by inverting the discrete system. It’s convenient to write this system in matrix form:      1 0 0 0 −1 1 + ∆x 0 0 0 −1 1 + ∆x 0 0 0 −1 1 + ∆x 6      u1 u2 u3 u4       =   1 0 0 0      (10) .e. values at other locations are obtained by suitable interpolation. v2 . Similarly. It is equivalent to summing up the net mass ﬂow into the control volume and setting it to zero. that mass is conserved for the cell. Look back at the airfoil grid. we get −ui−1 + (1 + ∆x)ui = 0 Applying this equation to the 1D grid shown earlier at grid points i = 2. though not always. are obtained by suitably interpolating the cell-center values at adjacent cells. 4 gives −u1 + (1 + ∆x) u2 = 0 −u2 + (1 + ∆x) u3 = 0 −u3 + (1 + ∆x) u4 = 0 (i = 2) (i = 3) (i = 4) (6) (7) (8) The discrete equation cannot be applied at the left boundary (i=1) since ui−1 is not deﬁned here. etc. Take a few minutes to contrast the discretization in the ﬁnite-volume approach to that in the ﬁnite-diﬀerence method discussed earlier.

In a general situation.6 0.7 u 0.2 0. Solving for u1 .5 0. FLUENT. one would obtain a system of simultaneous algebraic equations with the number of equations being equal to the number of independent discrete variables. etc. It is very important that you specify the proper boundary conditions in order to have a well-deﬁned problem. So a lot of work goes into optimizing the matrix inversion in order to minimize the CPU time and memory 7 . a Gaussian elimination procedure naively to invert the matrix.6 0. pressure outlet. say.8 0.7%. pressure inlet. For grid points (or cells) at or near the boundary. Solution of Discrete System The discrete system (10) for our own humble 1D example can be easily inverted to obtain the unknowns at the grid points. one would apply a combination of the discrete equations and boundary conditions. Also. u3 and u4 in turn and using ∆x = 1/3. u2 . In the end. we get u1 = 1 u2 = 3/4 u3 = 9/16 u4 = 27/64 The exact solution for the 1D example is easily calculated to be uexact = exp(−x) The ﬁgure below shows the comparison of the discrete solution obtained on the four-point grid with the exact solution. The error is largest at the right boundary where it is equal to 14.4 x 0.4 0 0. one would have thousands to millions of unknowns in the discrete system and if one uses.8 1 Numerical solution Exact solution In a practical CFD application. read through the documentation for a boundary condition option to understand what it does before you use it (it might not be doing what you expect). oﬀers a variety of boundary condition options such as velocity inlet. A single wrong boundary condition can give you a totally wrong result. like other commercial CFD codes. The process is essentially the same as for the model equation above with the details being much more complex. 1 0. you’d graduate before the computer ﬁnishes the calculation.9 0. one would apply the discrete equations to the grid points (or cells in the ﬁnite-volume method) in the interior of the domain.

9 0. the closer one gets to the true solution for the matrix inversion. As expected. verify that this is indeed the case for our matrix system (10). We’ll consider N = 8 and N = 16 in addition to the N = 4 case solved previously.6 0. the error in the numerical solution would decrease and the agreement between the numerical and exact solutions would get better.8 0. It is very important that you investigate the eﬀect of grid resolution on the solution in every CFD problem you solve. if correct. The resulting discrete system was solved using MATLAB. The concept of grid convergence applies to the ﬁnite-volume approach also where the numerical solution.8 1 N=4 N=8 N=16 Exact solution When the numerical solutions obtained on diﬀerent grids agree to within a level of tolerance speciﬁed by the user. we saw that the truncation error in our discrete system is O(∆x). The matrix to be inverted is sparse i.4 x 0.e. Dealing with Nonlinearity The momentum conservation equation for a ﬂuid is nonlinear due to the convection term (V · )V . the numerical error decreases as the number of grid points is increased. they are referred to as “grid converged” solutions. Never trust a CFD solution unless you have convinced yourself that the solution is grid converged to an acceptance level of tolerance (which would be problem dependent). Grid Convergence While developing the ﬁnite-diﬀerence approximation for the 1D example. Phenomena such as turbulence and chemical reaction introduce additional non8 .5 0. becomes independent of the grid as the cell size is reduced.6 0. So one expects that as the number of grid points is increased and ∆x is reduced.required.7 u 0. the longer one iterates. 1 0. It would also generally use an iterative procedure to invert the matrix. The following ﬁgure compares the results obtained on the three grids with the exact solution. most of the entries in it are zeros since the discrete equation at a grid point or cell will contain only quantities at the neighboring points or cells. We repeat the above assembly and solution steps on each of these additional grids. A CFD code would store only the non-zero values to minimize memory usage. Let’s consider the eﬀect of increasing the number of grid points N on the numerical solution of the 1D problem.4 0 0.2 0.

with the details varying depending on the code.linearities. We’ll illustrate this on the above example. For each subsequent iteration. it tends to zero as ug → u. we can neglect the ∆u2 term to get i u2 i Thus. Deﬁne ∆ui = ui − ugi Rearranging and squaring this equation gives u2 = u2i + 2ugi ∆ui + (∆ui )2 i g Assuming that ∆ui ugi . This is essentially the process used in CFD codes to linearize the nonlinear terms in the conservations equations. is ui − ui−1 + u2 = 0 (11) i ∆x This is a nonlinear algebraic equation with the u2 term being the source of the nonlinearity. analogous to that in (4) for m = 1. . We continue the iterations until they converge. The highly nonlinear nature of the governing equations for a ﬂuid makes it challenging to obtain accurate numerical solutions for complex ﬂows of practical interest. u2 i 2ugi ui − u2i g The ﬁnite-diﬀerence approximation (11) after linearization becomes ui − ui−1 + 2ugi ui − u2i = 0 g ∆x (12) u2i + 2ugi ∆ui = u2i + 2ugi (ui − ugi ) g g Since the error due to linearization is O(∆u2 ). u(0) = 1 dx A ﬁrst-order ﬁnite-diﬀerence approximation to this equation. We will demonstrate the eﬀect of nonlinearity by setting m = 2 in our simple 1D example (1): du + u2 = 0. In order to calculate the ﬁnite-diﬀerence approximation (12). We start with an initial guess value in the ﬁrst iteration. Iteration 1: u(1) = Initial guess g Iteration 2: u(2) = u(1) g . 9 . . i The strategy that is adopted to deal with nonlinearity is to linearize the equations about a guess value of the solution and to iterate until the guess agrees with the solution to a speciﬁed tolerance level. The important points to remember are that the linearization is performed about a guess and that it is necessary to iterate through successive approximations until the iterations converge. we need guess values ug at the grid points. Iteration l: u(l) = u(l−1) g The superscript indicates the iteration level. We’ll defer the discussion on how to evaluate convergence until a little later. the u value obtained in the previous iteration is used as the guess value. 0 ≤ x ≤ 1. Let ugi be the guess for ui .

2. as the iterations converge and ug → u. we use the guess value for it. It is necessary to solve nonlinear equations. Verify that the discrete equation system resulting from the ﬁnite-diﬀerence approximation (12) on our four-point grid is      1 0 0 0 −1 1 + 2∆x ug2 0 0 0 −1 1 + 2∆x ug3 0 0 0 −1 1 + 2∆x ug4      u1 u2 u3 u4       =   1 ∆x u22 g ∆x u23 g ∆x u24 g      (13) In a practical problem. Most importantly. In this case. one would usually have thousands to millions of grid points or cells so that each dimension of the above matrix would be of the order of a million (with most of the elements being zeros).Direct and Iterative Solvers We saw that we need to perform iterations to deal with the nonlinear terms in the governing equations. Rearrange the ﬁnite-diﬀerence approximation (12) at grid point i so that ui is expressed in terms of the values at the neighboring grid points and the guess values: ui−1 + ∆x u2i g ui = 1 + 2 ∆x ugi If a neighboring value at the current iteration level is not available. Let’s say that we sweep from right to left on our grid i. ui−1 is not available while updating um and i so we use the guess value u(l) for it instead: gi−1 (l) ui = u(l) + ∆x u(l) gi−1 gi 1 + 2 ∆x ugi (l) 2 (14) Since we are using the guess values at neighboring points. 10 . iteration serves two purposes: 1. This tradeoﬀ is good strategy since it doesn’t make sense to expend a great deal of resources to do an exact matrix inversion when the matrix elements depend on guess values which are continuously being reﬁned. So instead. we update u4 . each time step is eﬀectively an iteration. a common and eﬀective strategy used in CFD codes is to solve the unsteady form of the governing equations and “march” the solution in time until the solution converges to a steady value. In steady problems. In the mth iteration. Thus. Inverting such a matrix directly would take a prohibitively large amount of memory. we are eﬀectively obtaining only an approximate solution for the matrix inversion in (13) during each iteration but in the process have greatly reduced the memory required for the inversion. In an act of cleverness.e. the matrix is inverted using an iterative scheme as discussed below. then u3 and (l) ﬁnally u2 in each iteration. with the the guess value at any time level being given by the solution at the previous time level. the approximate solution for the matrix inversion tends towards the exact solution for the inversion since the error introduced by using ug instead of u in (14) also tends to zero. We next discuss another factor that makes it necessary to carry out iterations in practical CFD problems. we have combined the iteration to handle nonlinear terms with the iteration for matrix inversion into a single iteration process. It allows for eﬃcient matrix inversion with greatly reduced memory requirements.

Take a few minutes to implement this procedure in MATLAB which will help you gain some familiarity with the mechanics of the implementation. deﬁne the residual R as the RMS value of the diﬀerence between u and ug on the grid: N (ui − ugi )2 N R≡ i=1 It’s useful to scale this residual with the average value of u in the domain. sweep g from right to left on the grid updating. is “small enough”. a lot more iterations would be necessary for achieving convergence. the linearization and matrix inversion errors tends to zero. u(1) = 1. 10 0 10 −2 Residual 10 −4 10 −6 10 −8 10 −10 1 2 3 4 Iteration number 5 6 11 . 0. u4 . say. In more complex problems.1. in turn. The variation of the residual with iterations obtained from MATLAB is shown below. Scaling ensures that the residual is a relative rather than an absolute measure. refered to as the residual.01 would be relatively small if the average value of u in the domain is 5000 but would be relatively large if the average value is 0.Iterative Convergence Recall that as ug → u. Scaling the above residual by dividing by the average value of u gives     R=      (ui − ugi )2       N i=1     N N    N i=1     =   N N (ui − ugi )2 (15) ui i=1 i=1 N ui For the nonlinear 1D example.e. for instance. The iterative process converges to a level smaller than 10−9 in just 6 iterations. We’ll terminate the iterations when the residual falls below 10−9 (which is referred to as the convergence criterion). So we continue the iteration process until some selected measure of the diﬀerence between ug and u. we’ll take the initial guess at all grid points to be equal to the value at the left boundary i. Note that logarithmic scale is used for the ordinate. u3 and u2 using (14) and calculate the residual using (15). We could. we update ug . In each iteration. An unscaled residual of.

12 .and code-dependent. Read the documentation to understand how the residual is calculated. 2.7 0. it won’t be exactly equal to zero. In the FLUENT code.2 0. So FLUENT calculates the residual as the (scaled) mean of the absolute value of the LHS over all cells. A discrete conservation equation at any cell can be written in the form LHS = 0.The solution after 2.6 0.5 0 0. It’s a good idea to start with the default values in the code. with the deviation from zero being a mesaure of how far one is from achieving convergence. 1 Iteration 2 Iteration 4 Iteration 6 Exact 0. One may then have to tweak these values. The convergence criterion you choose for each conservation equation is problem.8 u 0.4 x 0.4 and 6 iterations and the exact solution are shown below. For any iteration. 3.9 0. It can easily be veriﬁed that the exact solution is given by uexact = 1 x+1 The solutions for iterations 4 and 6 are indistinguishable on the graph. So driving the residual down to 10−9 when the truncation error is of order 10−1 is a waste of computing resources. which is of order 10−9 . The converged solution doesn’t agree well with the exact solution because we are using a coarse grid for which the truncation error is relatively large. The iterative convergence error. In a good calculation. Diﬀerent codes use slightly diﬀerent deﬁnitions for the residual. both errors would be of comparable level and less than a tolerance level chosen by the user. if one uses the current solution to compute the LHS.8 1 Some points to note: 1. residuals are reported for each conservation equation. This is another indication that the solution has converged. is swamped out by the truncation error of order 10−1 .6 0. The agreement between the numerical and exact solutions should get much better on reﬁning the grid as was the case for m = 1.

One possible way to discretize this equation at grid point i and time-level n is un − un−1 un−1 − un−1 i−1 i i +c i = O(∆t. One would like to know a priori the conditions under which a given numerical scheme converges. If ∆t > ∆tmax . the iterations converge more slowly and in some instances. Solving for un gives i c∆t n−1 c∆t un−1 + ui−1 (17) un = 1 − i i ∆x ∆x This is an explicit expression i. model equations provides useful insight and approximate conditions for stability. the numerical errors will grow exponentially in time causing the solution to diverge from the steady-state result. This condition is refered to as the Courant-FriedrichsLewy or CFL condition. This is determined by performing a stability analysis of the numerical scheme. A common strategy used in CFD codes for steady problems is to solve the unsteady equations and march the solution in time until it converges to a steady state. It is not possible to carry out an exact stability analysis for the Euler or Navier-Stokes equations. A stability analysis is usually performed in the context of time-marching. may even diverge. it can seen that the coeﬃcient of ui 13 . ∆x) (16) ∆t ∆x The crucial thing to note here is that the spatial derivative is evaluated at the n−1 time-level. While a detailed derivation of the CFL condition through stability n−1 analysis is outside the scope of the current discussion. The scheme in (16) is known as an explicit scheme. There are two classes of numerical shemes. So we would like to take as large a time-step ∆t as possible to reach the steady state in the least number of time-steps. But a stability analysis of simpler. Explicit and Implicit Schemes The diﬀerence between explicit and implicit schemes can be most easily illustrated by applying them to the wave equation ∂u ∂u +c =0 ∂t ∂x where c is the wavespeed.e. these i schemes are easy to implement on the computer. There is usually a maximum allowable time-step ∆tmax beyond which the numerical scheme is unstable. the iterations converged very rapidly with the residual falling below the convergence criterion of 10−9 in just 6 iterations. it turns out that this scheme is stable only when c∆t ≤1 C≡ ∆x where C is called the Courant number. The value of ∆tmax depends on the numerical discretization scheme used. In more complex problems. the value of un at any grid point can be calculated directly i from this expression without the need for any matrix inversion. While using time-marching to a steady state. with very diﬀerent stability characteristics as we’ll brieﬂy discuss next. explicit and implicit.Numerical Stability In our previous 1D example. we are only interested in accurately obtaining the asymptotic behavior at large times. A numerical method is referred to as being stable when the iterative process converges and as being unstable when it diverges. Since un at each grid point can be updated independently. On the downside.

It can be shown that this scheme is unconditionally stable for the wave equation so that the numerical errors will be damped out irrespective of how large the time-step is. These ﬂows occur at low-to-moderate values of the Reynolds number. In general. However. The dashed line through the curve indicates the “average” velocity. Turbulent ﬂows occur in the opposite limit of high Reynolds numbers. we can’t update un at each grid point independently. These ﬂows arise when the ﬂuid viscosity is suﬃciently large to damp out any perturbations to the ﬂow that may occur due to boundary imperfections or other irregularities. The CFL condition places a rather severe limitation on ∆tmax . so it is advantageous to set the Courant number as large as possible. Ensemble average 14 . CFD codes will allow you to set the Courant number (which is also referred to as the CFL number) when using time-stepping. These ﬂuctuations arise from instabilities that grow until nonlinear interactions cause them to break down into ﬁner and ﬁner whirls that eventually are dissipated (into heat) by the action of viscosity. turbulent ﬂows are characterized by large. We can deﬁne three types of averages: 1. Time average 2. Laminar ﬂows are characterized by smoothly varying velocity ﬁelds in space and time in which individual “laminae” (sheets) move past one another without generating cross currents. Implicit schemes are not unconditonally stable for the Euler or Navier-Stokes equations since the nonlinearities in the governing equations often limit stability. the spatial derivative term is evaluated at the n time-level: un − un un − un−1 i i−1 i +c i = O(∆t. 1(a). Volume average 3. The stability limits discussed above apply speciﬁcally to the wave equation. nearly random ﬂuctuations in velocity and pressure in both space and time. In an implicit scheme. 2. explicit schemes applied to the Euler or Navier-Stokes equations have the same restriction that the Courant number needs to be less than or equal to one. Taking larger time-steps leads to faster convergence to the steady state. The speciﬁc value of the maximum allowable Courant number is problem dependent. within the limits of stability. Some points to note: 1. ∆x) ∆t ∆x In this case. We instead need to solve a i system of algebraic equations in order to calculate the values at all grid points simultaneously. A typical time history of the ﬂow variable u at a ﬁxed point in space is shown in Fig. In contrast.in (17) changes sign depending on whether C > 1 or C < 1 leading to very diﬀerent behavior in the two cases. they allow a much larger Courant number than explicit schemes. Turbulence Modeling There are two radically diﬀerent states of ﬂows that are easily identiﬁed and distinguished: laminar ﬂow and turbulent ﬂow. You may ﬁnd that a lower Courant number is required during startup when changes in the solution are highly nonlinear but it can be increased as the solution progresses. for steady problems.

8 -0.2 1. a better measure of the strength of the ﬂuctuation is the average of the square of a ﬂuctuating A stationary ﬂow is deﬁned as one whose statistics are not changing in time.10 0.08 u (u') 2 0.4 0 20 40 60 80 100 0 20 40 60 80 100 utime 0. Instead.1 u vu 2. For the sake of this discussion. t)dt (18) The deviation of the velocity from the mean value is called the ﬂuctuation and is usually deﬁned as u ≡u−u (19) Note that by deﬁnition u = 0 (the average of the ﬂuctuation is zero).12 utime (c) 0. Consequently.0 1. in which you repeat a given experiment a large number of times and average the quantity of interest (say velocity) at the same position and time in each experiment.2 0. (b) shows the ﬂuctuating component of velocity u ≡ u − u and (c) shows the square of the ﬂuctuating velocity.02 0.7 -0. 1 15 . Dashed lines in (a) and (c) indicate the time averages.04 0. let us deﬁne the time average for a stationary ﬂow1 as u(y) ≡ lim 1 τ →∞ 2τ τ −τ u(y. For practical reasons. The most mathematically general average is the ensemble average. (a) Shows the velocity.00 0 20 40 60 80 100 utime Figure 1: Example of a time history of a component of a ﬂuctuating velocity at a point in a turbulent ﬂow. An example of a stationary ﬂow is steady ﬂow in a channel or pipe.06 0. this is rarely done. a time or volume average (or combination of the two) is made with the assumption that they are equivalent to the ensemble average.2.0 u 1.9 vu' 0.3 (a) (b) 2.2 2.

they require modeling to “close” the equations and these models introduce signiﬁcant error into the calculation. u . u(y) and its derivatives).variable. Notice that the latter quantity is always greater than zero as is its average. however. as will be shown below. and the square of that quantity.e.4 Turbulence modeling is a rather broad discipline and an in-depth discussion is beyond the scope of this introduction. To demonstrate the closure problem. The approaches to solving the ﬂow equations for a turbulent ﬂow ﬁeld can be roughly divided into two classes. the solution procedure is the same as for laminar ﬂow.3 is a higherorder moment that must be modeled in terms of the knowns (i. 2 16 . which corresponds roughly to 0. Figures 1(b) and 1(c) show the time evolution of the velocity ﬂuctuation. This is referred to as the “closure” approximation. Because these quantities vary smoothly in space and time. DNS remains limited to very simple geometries (e. we consider fully developed turbulent ﬂow in a channel of height 2H.. y = 0 (21) (22) (20) The kinematic viscosity ν=µ/ρ.g. Recall that with RANS we are interested in solving for the mean velocity u(y) only. Here we simply note that the Reynolds stress is modeled in terms of two turbulence parameters. they used 40963 grid point. they are much easier to solve. however. The quantity u v . the solution is clearly much more complicated in this regime.. If we formally average the Navier Stokes equations and simplify for this geometry we arrive at the following du v 1 dp d2 u(y) + =ν dy ρ dx dy 2 subject to the boundary conditions du =0. channel ﬂows. The quality of the modeling of this term will determine the reliability of the computations. u 2 . dy y = H u=0. In essence.2 The alternative to DNS found in most CFD packages (including FLUENT) is to solve the Reynolds Averaged Navier Stokes (RANS) equations. Phys. 4 Notice that if we neglect the Reynolds stress the equations reduce to the equations for laminar ﬂow. resolving all of the spatial and temporal ﬂuctuations. Fluids 15(2):L21–L24 (2003).5 terabytes of memory per variable! 3 Name after the same Osborne Reynolds from which we get the Reynolds number. The equations governing a turbulent ﬂow are precisely the same as for a laminar ﬂow. thus. the turbulent kinetic energy k and the turbulent energy dissipation rate deﬁned below k ≡ 1 u2 +v2 +w2 2 2 ∂u ∂u  ≡ ν + ∂x ∂y (23) 2 ∂u + ∂z 2 ∂v + ∂x 2 ∂v + ∂y 2 ∂v + ∂z 2 The largest DNS to date was recently published by Kaneda et al. RANS equations govern the mean velocity and pressure. known as the Reynolds stress. jets and boundary layers) and is extremely expensive to run.. without resorting to modeling. except the numerics must contend with resolving all of the ﬂuctuations in the velocity and pressure. the Reynolds stress is solely responsible for the diﬀerence in the mean proﬁle for laminar (parabolic) and turbulent (blunted) ﬂows. Direct numerical simulations (DNS) use the speed of modern computers to numerically integrate the Navier Stokes equations.

+ ∂w ∂x 2 ∂w + ∂y 2 ∂w + ∂z 2   (24) where (u . We will revisit turbulence modeling towards the end of the semester. w ) is the ﬂuctuating velocity vector. v . The family of models is generally known as k– and they form the basis of most CFD packages (including FLUENT). The kinetic energy is zero for laminar ﬂow and can be as large as 5% of the kinetic energy of the mean ﬂow in a highly turbulent case. 17 .