Sei sulla pagina 1di 45

Chapter 2

Finite Difference Method

2.1 Classification of Partial Differential


Equations
For analysing the equations for fluid flow problems, it is convenient to consider
the case of a second-order differential equation given in the general form as

∂2φ ∂2φ ∂2φ ∂φ ∂φ


A 2
+B +C 2 +D +E + F φ = G(x, y) (2.1)
∂x ∂x∂y ∂y ∂x ∂y

In the coefficients A, B, C, D, E and F are either constants or functions of only


(x, y) (do not contain φ or its derivatives), it is said to be a linear equation,
otherwise it is a non-linear equation. An important subclass of non-linear equa-
tions is quasilinear equations. In this case, the coefficients may contain φ or its
first derivative but not the second (highest) derivative. If G = 0, the aforesaid
equation is homogeneous, otherwise it is non-homogeneous.
Again for the above mentioned equation

if B 2 − 4AC = 0, the equation is parabolic


if B 2 − 4AC < 0, the equation is elliptic
2
if B − 4AC > 0, the equation is hyperbolic

The unsteady Navier-Stokes equations are elliptic in space and parabolic


in time. At steady-state, the Navier-Stokes equations are elliptic. In elliptic
problems, the boundary conditions must be applied on all confining surfaces.
These are boundary value problems. A physical problem may be steady or
unsteady. In the following text, we shall discuss mathematical aspects of some
of the equations that describe fluid flow and heat transfer problems.
The Laplace equations and the Poisson equations are generally associated
with the steady-state problems. These are elliptic equations and can be written

1
2.2 Computational Fluid Dynamics

respectively as
∂2φ ∂2φ
+ = 0 (2.2)
∂x2 ∂y 2
∂2φ ∂2φ
+ + S = 0 (2.3)
∂x2 ∂y 2
The velocity potential in steady, inviscid, incompressible, and irrotational flows
satisfies the Laplace equation. The temperature distribution for steady-state,
constant-property, two-dimensional conduction satisfies the Laplace equation if
no volumetric heat source is present in the domain of interest and the Poisson
equation if a volumetric heat source is present.

The parabolic equation in conduction heat transfer is of the form


∂φ ∂2φ
=B 2 (2.4)
∂t ∂x
The one-dimensional unsteady conduction problem is governed by this equa-
tion when t and x are identified as the time and space variables, respectively
φ denotes the temperature and B is the thermal diffusivity. The boundary
conditions at the two ends and an initial condition are needed to solve such
equations. The unsteady conduction problem in two- dimensions is governed by
an equation of the form
 2
∂ φ ∂2φ

∂φ
=B + 2 +S (2.5)
∂t ∂x2 ∂y
Here t denotes the time variable, and a source term S is included. By com-
paring the highest derivatives in any two of the independent variables, with
the help of the conditions given earlier, it can be concluded that Eq. (2.5) is
parabolic in time and elliptic in space. An initial condition and two conditions
for the extreme ends in each spacial coordinate is required to solve this equation.

Fluid flow problems generally have nonlinear terms due to the inertia or
acceleration component in the momentum equation. These terms are called
advection terms. The energy equation has nearly similar terms, usually called
the convection terms, which involve the motion of the flow field. For unsteady
two-dimensional problems, the appropriate equations can be represented as
 2
∂ φ ∂2φ

∂φ ∂φ ∂φ
+u +v =B + +S (2.6)
∂t ∂x ∂y ∂x2 ∂y 2
where φ denotes velocity, temperature or some other transported property, u
and v are velocity components, B is the diffusivity for momentum or heat, and
S is a source term. The pressure gradients in the momentum or the volumetric
heating in the energy equation can be appropriately substituted in S. Eq. (2.6)
is parabolic in time and elliptic in space. However, for very high-speed flows,
the terms on the left side dominate, the second-order terms on the right hand
side become trivial, and the equation becomes hyperbolic in time and space.
Finite Difference Method 2.3

2.1.1 Boundary and Initial Conditions


In addition to the governing differential equations, the formulation of the prob-
lem requires a complete specification of the geometry of interest and appropriate
boundary conditions. An arbitrary domain and bounding surfaces are sketched
in Fig. 2.1. The conservation equations are to be applied within the domain.
The number of boundary conditions required is generally determined by the
order of the highest derivatives appearing in each independent variable in the
governing differential equations.

A1

r A2 A3
Surface A
x

Figure 2.1: Schematic sketch of an arbitrary domain.

The unsteady problems governed by a first derivative in time will require


initial condition in order to carry out the time integration. The diffusion terms
require two spatial boundary conditions for each coordinate in which a second
derivative appears.
The spatial boundary conditions in flow and heat transfer problems are of three
general types. They may be stated

φ = φ1 (r) ∈ A1 (2.7)
∂φ
= φ2 (r) ∈ A2 (2.8)
∂n
∂φ
a(r)φ + b(r) = φ3 (r) ∈ A3 (2.9)
∂n
where A1 , A2 and A3 denote three separate zones on the bounding surface in
Fig. 2.1. The boundary conditions on φ in Eqns. (2.7) to (2.9) are usually
referred to as Dirchlet, Neumann and mixed boundary conditions, respectively.
The boundary conditions are linear in the dependant variable φ.
In Eqns. (2.7) to (2.8), ~r = ~r(x, y) is a vector denoting position on the boundary,
2.4 Computational Fluid Dynamics


is the directional derivative normal to the boundary, and φ1 , φ2 , φ3 , a, and
∂n
b are arbitrary functions. The normal derivative may be expressed as

∂φ −
=→
n · ∇φ
∂n  
∂φ ∂φ
= (nx î + ny ĵ) · î + ĵ
∂x ∂y
∂φ ∂φ
= nx + ny (2.10)
∂x ∂y
Here, − →
n is the unit vector normal to the boundary, ∇ is the nabla operator, [·]
denotes the dot product, (nx , ny ) are the direction-cosine components of −

n and
(î, ĵ) are the unit vectors aligned with the (x, y) coordinates.

2.2 Finite Differences


Analytical solutions of partial differential equations provide us with closed-form
expressions which depict the variation of the dependant variables in the domain.
The numerical solutions, based on finite differences, provide us with the values at
discrete points in the domain which are known as grid points. Consider Fig. 2.2,
which shows a domain of calculation in the x − y plane. Let us assume that
the spacing of the grid points in the x−direction is uniform, and given by ∆x.
Likewise, the spacing of the points in the y−direction is also uniform, and given
by ∆y. It is not necessary that ∆x or ∆y be uniform. We could imagine unequal
spacing in both directions, where different values of ∆x between each successive
pairs of grid points are used. The same could be presumed for ∆y as well.
However, often, problems are solved on a grid which involves uniform spacing
in each direction, because this simplifies the programming, and often results
in higher accuracy. In some class of problems, the numerical calculations are
performed on a transformed computational plane which has uniform spacing in
the transformed-independent-variables, but non-uniform spacing in the physical
plane. These typical aspects will be discussed later in the Chapter on grid
generation. In the present chapter we shall consider uniform spacing in each
coordinate direction. According to our consideration, ∆x and ∆y are constants,
but it is not mandatory that ∆x be equal to ∆y.
Let us once again refer to Fig. 2.2. The grid points are identified by an index
i which increases in the positive x-direction, and an index j, which increases in
the positive y-direction. If (i, j) is the index of point P in Fig. 2.2, then the point
immediately to the right is designated as (i + 1, j) and the point immediately to
the left is (i − 1, j). Similarly the point directly above is (i, j + 1), and the point
directly below is (i, j − 1). The basic philosophy of finite difference methods is
to replace the derivatives of the governing equations with algebraic difference
quotients. This will result in a system of algebraic equations which can be solved
for the dependant variables at the discrete grid points in the flow field. Let us
Finite Difference Method 2.5

now look at some of the common algebraic difference quotients in order to be


acquainted with the methods related to discretization of the partial differential
equations.

∆x
i−1,j+1 i,j+1 i+1,j+1

∆y

P
i−1,j i,j i+1,j

i−1,j−1 i,j−1 i+1,j−1

Figure 2.2: Discrete grid points.

2.2.1 Elementary Finite Difference Quotients


Finite difference representations of derivatives are derived from Taylor series
expansions. For example, if ui,j is the x−component of the velocity ui+1,j at
point (i + 1, j) can be expressed in terms of Taylor series expansion about point
(i, j) as
   2  2  3  3
∂u ∂ u (∆x) ∂ u (∆x)
ui+1,j = ui,j + ∆x + + + · · · (2.11)
∂x i,j ∂x2 i,j 2 ∂x3 i,j 6
Mathematically, Eq. (2.11) is an exact expression for ui+1,j if the series con-
verges. In practice, ∆x is small and any higher-order term of ∆x is smaller
than ∆x. Hence, for any function u(x), Eq. (2.11) can be truncated after a
finite number of terms. For example, if terms of magnitude (∆x)3 and higher
order are neglected, Eq. (2.11) becomes
   2  2
∂u ∂ u (∆x)
ui+1,j ≈ ui,j + ∆x + ··· (2.12)
∂x i,j ∂x2 i,j 2
2.6 Computational Fluid Dynamics

Eq. (2.12) is second-order accurate, because terms of order (∆x)3 and higher
have been neglected. If terms of order (∆x)2 and higher are neglected, Eq. (2.12)
is reduced to  
∂u
ui+1,j ≈ ui,j + ∆x (2.13)
∂x i,j
Eq. (2.13) is first-order accurate. In Eqns. (2.12) and (2.13) the neglected higher-
order terms represent the truncation error. Therefore, the truncation errors for
Eqns. (2.12) and (2.13) are

∂nu (∆x)n
X  
=
n=3
∂xn i,j n!

and
∞ n
∂nu
 
X (∆x)
=
n=2
∂xn i,j n!

It is now obvious that the truncation error can be reduced by retaining more
terms in the Taylor series expansion of the corresponding derivative and reducing
the magnitude of ∆x.
Let us once again return to Eq. (2.11) and solve for (∂u/∂x)i,j as:

∂2u ∂3u (∆x)2


     
∂u ui+1,j − ui,j ∆x
= − − + ···
∂x i,j ∆x ∂x2 i,j 2 ∂x3 i,j 6

or  
∂u ui+1,j − ui,j
= + O(∆x) (2.14)
∂x i,j ∆x
In Eq. (2.14) the symbol O(∆x) is a formal mathematical nomenclature which
means “terms of order of ∆x”,expressing the order of magnitude of the trunca-
tion error. The first-order-accurate difference representation for the derivative
(∂u/∂x)i,j expressed by Eq. (2.14) can be identified as a first-order forward
difference. We now consider a Taylor series expansion for ui−1,j , about ui,j
2 3
∂2u ∂ 3u
     
∂u (−∆x) (−∆x)
ui−1,j = ui,j + (−∆x) + + + ···
∂x i,j ∂x2 i,j 2 ∂x3 i,j 6

or
2 3
∂ 2u
     3 
∂u (∆x) ∂ u (∆x)
ui−1,j = ui,j − (∆x) + − + · · · (2.15)
∂x i,j ∂x2 i,j 2 ∂x3 i,j 6

Solving for (∂u/∂x)i,j , we obtain


 
∂u ui,j − ui−1,j
= + O(∆x) (2.16)
∂x i,j ∆x
Finite Difference Method 2.7

Eq. (2.16) is a first-order backward expression for the derivative (∂u/∂x) at


grid point (i, j).
Subtracting Eq. (2.15) from ( 2.11)
   3  3
∂u ∂ u (∆x)
ui+1,j − ui−1,j = 2 (∆x) + + ··· (2.17)
∂x i,j ∂x3 i,j 3
and solving for (∂u/∂x)i,j from Eq. (2.17) we obtain
 
∂u ui+1,j − ui−1,j
= + O(∆x)2 (2.18)
∂x i,j 2∆x
Eq. (2.18) is a second-order central difference for the derivative (∂u/∂x) at
grid point (i, j).
In order to obtain a finite-difference for the second-order partial derivative
(∂ 2 u/∂x2 )i,j , add Eq. (2.11) and (2.15). This produces
 2   4  4
∂ u 2 ∂ u (∆x)
ui+1,j + ui−1,j = 2ui,j + (∆x) + + ··· (2.19)
∂x2 i,j ∂x4 i,j 12

Solving Eq. (2.19) for (∂ 2 u/∂x2 )i,j , we obtain


 2 
∂ u ui+1,j − 2ui,j + ui−1,j
= + O(∆x)2 (2.20)
∂x2 i,j (∆x)2

Eq. (2.20) is a second-order central difference form for the derivative (∂ 2 u/∂x2 )
at grid point (i, j).
Difference quotients for the y-derivatives are obtained in exactly the similar
way. The results are analogous to the expressions for the x-derivatives.
 
∂u ui,j+1 − ui,j
= + O(∆y) [Forward difference]
∂y i,j ∆y
 
∂u ui,j − ui,j−1
= + O(∆y) [Backward difference]
∂y i,j ∆y
 
∂u ui,j+1 − ui,j−1
= + O(∆y)2 [Central difference]
∂y i,j 2∆y
 2 
∂ u ui,j+1 − 2ui,j + ui,j−1
= + O(∆y)2 [Central difference of second
∂y 2 i,j (∆y)2
derivative]
It is interesting to note that the central difference given by Eq. (2.20) can be
interpreted as a forward difference of the first order derivatives, with backward
differences in terms of dependent variables for the first-order derivatives. This
is because
∂u ∂u
 
∂x i+1,j − ∂x i,j
 2    
∂ u ∂ ∂u
= =
∂x2 i,j ∂x ∂x i,j ∆x
2.8 Computational Fluid Dynamics

or
∂2u
     
ui+1,j − ui,j ui,j − ui−1,j 1
= −
∂x2 i,j ∆x ∆x ∆x
or
∂2u
 
ui+1,j − 2ui,j + ui−1,j
=
∂x2 i,j (∆x)2
The same approach can be made to generate a finite difference quotient for the
mixed derivative (∂ 2 u/∂x∂y) at grid point (i, j). For example,

∂ 2u
 
∂ ∂u
= (2.21)
∂x∂y ∂x ∂y

In Eq. (2.21), if we write the x−derivative as a central difference of y-derivatives,


and further make use of central differences to find out the y−derivatives, we
obtain    
∂u ∂u

∂2u
 
∂ ∂u ∂y i+1,j ∂y i−1,j
= =
∂x∂y ∂x ∂y 2(∆x)
 2     
∂ u ui+1,j+1 − ui+1,j−1 ui−1,j+1 − ui−1,j−1 1
= −
∂x∂y 2(∆y) 2(∆y) 2(∆x)
 2 
∂ u 1
= (ui+1,j+1 +ui−1,j−1 −ui+1,j−1 −ui−1,j+1 )+O[(∆x)2 , (∆y)2 ]
∂x∂y 4∆x∆y
(2.22)
Combinations of such finite difference quotients for partial derivatives form finite
difference expressions for the partial differential equations. For example, the
Laplace equation ∇2 u = 0 in two dimensions, becomes
ui+1,j − 2ui,j + ui−1,j ui,j+1 − 2ui,j + ui,j−1
+ =0
(∆x)2 (∆y)2
or

ui+1,j + ui−1,j + λ2 (ui,j+1 + ui,j−1 ) − 2(1 + λ2 )ui,j = 0 (2.23)

where λ is the mesh aspect ratio (∆x)/(∆y). If we solve the Laplace equation
on a domain given by Fig. 2.2, the value of ui,j will be

ui+1,j + ui−1,j + λ2 (ui,j+1 + ui,j−1 )


ui,j = (2.24)
2(1 + λ2 )
It can be said that many other forms of difference approximations can be ob-
tained for the derivatives which constitute the governing equations for fluid flow
and heat transfer. The basic procedure, however, remains the same. In order to
appreciate some more finite difference representations see Tables 2.1 and 2.2.
Interested readers are referred to Anderson, Tannehill and Pletcher (1984) for
more insight into different kind of discretization methods.
Finite Difference Method 2.9

2.3 Basic Aspects of Finite-Difference Equations


Here we shall look into some of the basic aspects of difference equations. Con-
sider the following one dimensional unsteady state heat conduction equation.
The dependent variable u (temperature) is a function of x and t (time) and α
is a constant known as thermal diffusivity.
∂u ∂2u
=α 2 (2.25)
∂t ∂x
It is to be noted that Eq. (2.25) is classified as a parabolic partial differential
equation.
If we substitute the time derivative in Eq. (2.25) with a forward difference,
and a spatial derivative with a central difference (usually called FTCS, Forward
Time Central Space method of discretization), we obtain
un+1
 n
− uni u − 2uni + uni−1

i
= α i+1 (2.26)
∆t (∆x2 )
In Eq. (2.26), the index for time appears as a superscript, where n denotes
conditions at time t, (n + 1) denotes conditions at time (t + ∆t), and so on. The
subscript denotes the grid point in the spatial dimension.
However, there must be a truncation error for the equation because each one
of the finite-difference quotients has been taken from a truncated series. Con-
sidering Eqns. (2.25) and (2.26), and looking at the truncation errors associated
with the difference quotients we can write
∂u ∂2u un+1 − uni un − 2uni + uni−1
−α 2 = i − α i+1
∂t ∂x ∆t (∆x2 )
  2 n  4 n
(∆x)2

∂ u (∆t) ∂ u
+ − +α + ··· (2.27)
∂t2 i 2 ∂x4 i 12

In Eq. (2.27), the terms in the square brackets represent truncation error
for the complete equation. It is evident that the truncation error (TE) for this
representation is O[∆t,(∆x)2 ].
With respect to Eq. (2.27), it can be said that as ∆x → 0 and ∆t → 0,
the truncation error approaches zero. Hence, in the limiting case, the difference
equation also approaches the original differential equation. Under such circum-
stances, the finite difference representation of the partial differential equation is
said to be consistent.

2.3.1 Consistency
A finite difference representation of a partial differential equation (PDE) is said
to be consistent if we can show that the difference between the PDE and its
finite difference (FDE) representation vanishes as the mesh is refined, i.e,
lim (P DE − F DE) = lim (T E) = 0
mesh→0 mesh→0
2.10 Computational Fluid Dynamics

Table 2.1: Difference Approximations for Derivatives

∂3u
 
ui+2,j − 2 ui+1,j + 2 ui−1,j − ui−2,j
= + O(h2 )
∂x3 i,j 2 h3
4
 
∂ u ui+2,j − 4 ui+1,j + 6 ui,j − 4 ui−1,j + ui−2,j
= + O(h2 )
∂x4 i,j h4
∂2u
 
−ui+3,j + 4 ui+2,j − 5 ui+1,j + 2 ui,j
= + O(h2 )
∂x2 i,j h2
 
∂u −ui+2,j + 8 ui+1,j − 8 ui−1,j + ui−2,j
= + O(h4 )
∂x i,j 12 h
 2 
∂ u −ui+2,j + 16 ui+1,j − 30 ui,j + 16 ui−1,j − ui−2,j
= + O(h4 )
∂x2 i,j 12 h2
h = grid spacing in x-direction

Table 2.2: Difference Approximations for Mixed Partial Derivatives

∂2u
   
1 ui+1,j − ui+1,j−1 ui,j − ui,j−1
= − + O(∆x, ∆y)
∂x∂y i,j ∆x ∆y ∆y
∂2u
   
1 ui,j+1 − ui,j ui−1,j+1 − ui−1,j
= − + O(∆x, ∆y)
∂x∂y i,j ∆x ∆y ∆y
∂2u
   
1 ui+1,j+1 − ui+1,j−1 ui,j+1 − ui,j−1
= − + O[(∆x), (∆y)2 ]
∂x∂y i,j ∆x 2∆y 2∆y
∂2u
   
1 ui+1,j+1 − ui+1,j−1 ui−1,j+1 − ui−1,j−1
= − + O[(∆x)2 , (∆y)2 ]
∂x∂y i,j 2 ∆x 2∆y 2∆y
∂2u
   
1 ui+1,j − ui+1,j−1 ui−1,j − ui−1,j−1
= − + O[(∆x)2 , (∆y)]
∂x∂y i,j 2 ∆x ∆y ∆y
Finite Difference Method 2.11

A questionable scheme would be one for which the truncation error is O(∆t/∆x)
and not explicitly O(∆t) or O(∆x) or higher orders. In such cases the scheme
would not be formally consistent unless the mesh were refined in a manner
such that (∆t/∆x) → 0. Let us take Eq. (2.25) and the Dufort-Frankel (1953)
differencing scheme. The FDE is
" #
un+1
i − uin−1 uni+1 − un+1
i − uin−1 + uni−1
=α (2.28)
2∆t (∆x2 )

Now the leading terms of truncated series form the truncation error for the
complete equation:
n n  2 n
∂4u ∂2u ∂3u
  
α ∆t 1
(∆x)2 − α − (∆t)2
12 ∂x4 i ∂t2 i ∆x 6 ∂t3 i

The above expression for truncation error is meaningful if (∆t/∆x) → 0 together


with ∆t → 0 and ∆x → 0. However, (∆t) and (∆x) may individually approach
zero in such a way that (∆t/∆x) = β. Then if we reconstitute the PDE from
FDE and TE, we shall obtain
 2 
∂ u
lim (P DE − F DE) = lim (T E) = −αβ 2
∆t,∆x→0 mesh→0 ∂t2

and finally PDE becomes

∂u ∂2u ∂2u
+ αβ 2 2 = α 2
∂t ∂t ∂x
We started with a parabolic one and ended with a hyperbolic one!
So, DuFort-Frankel scheme is not consistent for the 1D unsteady state heat
conduction equation unless (∆t/∆x) → 0 together with ∆t → 0 and ∆x → 0.

2.3.2 Convergence
A solution of the algebraic equations that approximate a partial differential
equation (PDE) is convergent if the approximate solution approaches the exact
solution of the PDE for each value of the independent variable as the grid spacing
tends to zero. The requirement is

uni = ū(xi , tn ) as ∆x, ∆t → 0

where, ū(xi , tn ) is the solution of the system of algebraic equations.

2.3.3 Explicit and Implicit Methods


The solution of Eq. (2.26) takes the form of a “marching” procedure (or scheme)
in steps of time. We know the dependent variable at all x at a time level
2.12 Computational Fluid Dynamics

from given initial conditions. Examining Eq. (2.26) we see that it contains
one unknown, namely un+1i . Thus, the dependent variable at time (t + ∆t) is
obtained directly from the known values of uni+1 , uni and uni−1 .
un+1
 n
− uni u − 2uni + uni−1

i
= α i+1 (2.29)
∆t (∆x2 )
This is a typical example of an explicit finite difference method.
Let us now attempt a different discretization of the original partial differential
equation given by Eq. (2.25) . Here we express the spatial differences on the
right-hand side in terms of averages between n and (n + 1) time level
" #
n+1 n+1 n+1
un+1
i − uni α ui+1 + uni+1 − 2ui − 2uni + ui−1 + uni−1
= (2.30)
∆t 2 (∆x2 )

The differencing shown in Eq. (2.30) is known as the Crank-Nicolson implicit


scheme. The unknown un+1 i is not only expressed in terms of the known quan-
tities at time level n, but also in terms of unknown quantities at time level
(n + 1). Hence Eq. (2.30) at a given grid point i, cannot itself result in a so-
lution of un+1
i . Eq. (2.30) has to be written at all grid points, resulting in a
system of algebraic equations from which the unknowns un+1 i for all i can be
solved simultaneously. This is a typical example of an implicit finite-difference
solution (Fig. 2.3). Since they deal with the solution of large systems of simulta-
neous linear algebraic equations, implicit methods usually require the handling
of large matrices.
Generally, the following steps are followed in order to obtain a solution.
Eq. (2.30) can be rewritten as
r
un+1
i − uni = [un+1 + uni+1 − 2un+1 − 2uni + un+1 n
i−1 + ui−1 ] (2.31)
2 i+1 i

where r = α(∆t)/(∆x)2 or
−r un+1 n+1
i−1 + (2 + 2r)ui − r un+1 n n n
i+1 = rui−1 + (2 − 2r)ui + rui+1

or
   
2 + 2r 2 − 2r
−un+1
i−1 + un+1
i − un+1 n
i+1 = ui−1 + uni + uni+1 (2.32)
r r
Eq. (2.32) has to be applied at all grid points, i.e., from i = 1 to i = k + 1. A
system of algebraic equations will result (refer to Fig. 2.3).
at i = 2 − A + B(1)un+1
2 − un+1
3 = C(1)
at i = 3 − un+1
2 + B(2)un+1
3 − un+1
4 = C(2)
at i = 4 − un+1
3 + B(3)un+1
4 − un+1
5 = C(3)
.. ..
. .
at i = k − un+1 n+1
k−1 + B(k − 1)uk − D = C(k − 1)
Finite Difference Method 2.13

n+2

n+1

n x
i=1 i=k+1

BC u = A at BC u = D at
x=0 x=L

Figure 2.3: Crank Nicolson implicit scheme.

Finally the equations will be of the form:

un+1 (C(1) + A)n


    
B(1) −1 0 0 ... 0 2
 −1 B(2) −1 0 ... 0  un+1 C(2)n
  3n+1  
  
n
 
 0 −1 B(3) −1 ... 0  u C(3)
 4  = 
  
 .. .

 .  

 .   ..   .. 

n+1 n
0 0 0 . . . −1 B(k − 1) uk (C(k − 1) + D)
(2.33)
Here, we express the system of equations in the form of Ax = C, where C is
the right-hand side column vector (known), A the tridiagonal coefficient matrix
(known) and x the solution vector (to be determined). Note that the boundary
values at i = 1 and i = k + 1 are transferred to the known right-hand side.

For such a tridiagonal system, different solution procedures are available. In


order to derive advantage of the zeros in the coefficient-matrix, the well known
Thomas algorithm (1949) can be used (see appendix).
2.14 Computational Fluid Dynamics

2.3.4 Explicit and Implicit Methods for Two-Dimensional


Heat Conduction Equation
The two-dimensional conduction equation is given by
 2
∂ u ∂2u

∂u
=α + 2 (2.34)
∂t ∂x2 ∂y

Here, the dependent variable, u (temperature) is a function of space (x, y) and


time (t) and α is the thermal diffusivity. If we apply the simple explicit method
to the heat conduction equation, the following algorithm results

un+1 n  n
i,j − ui,j ui+1,j − 2uni,j + uni−1,j uni,j+1 − 2uni,j + uni,j−1

=α + (2.35)
∆t (∆x2 ) (∆y 2 )

When we apply the Crank-Nicolson scheme to the two-dimensional heat con-


duction equation, we obtain

un+1 n
i,j − ui,j α
= (δx2 + δy2 )(un+1 n
i,j + ui,j ) (2.36)
∆t 2
where the central difference operators δx2 and δy2 in two different spatial directions
are defined by
uni+1,j − 2uni,j + uni−1,j
δx2 [uni,j ] =
(∆x2 )
u,j+1 − 2uni,j + uni,j−1
n
δy2 [uni,j ] = (2.37)
(∆y 2 )

The resulting system of linear algebraic equations is not tridiagonal because of


the five unknowns un+1 n+1 n+1 n+1 n+1
i,j , ui+1,j , ui−1,j , ui,j+1 and ui,j−1 . In order to examine
this further, let us rewrite Eq. (2.36) as

a un+1 n+1 n+1 n+1 n+1 n


i,j−1 + b ui−1,j + d ui,j + b ui+1,j + a ui,j+1 = ci,j (2.38)

where
α∆t 1
a=− 2
= − Py
2(∆y) 2
α∆t 1
b=− = − Px
2(∆x)2 2
d = 1 + Px + Py
α∆t 2
cni,j = uni,j + (δx + δy2 )uni,j
2
Eq. (2.38) can be applied to the two-dimensional (6 × 6) computational grid
shown in Fig. 2.4. A system of 16 linear algebraic equations have to be solved
Finite Difference Method 2.15

y
jmax

u = ub 4 u = u b = boundary value
3
2

j=1 x
i= 1 2 3 4 5 imax

Figure 2.4: Two-dimensional grid on the (x-y) plane.

at (n + 1) time level, in order to get the temperature distribution inside the


domain. The matrix equation will be as the following:
 ′′′ 
   c2,2
d b 0 0 a 0 0 u2,2  c′ 
b d b a  u3,2   ′3,2 

c4,2 
   
0 b d b a  u4,2    ′′′ 

0 b d b a
 
 u5,2   c5,2 
  ′′ 
 u2,3  c2,3 
 
a 0 d b a


c3,3 
  
0 a b d b a  u3,3    
c4,3 
  

 a 0 b d b a  u4,3  
   ′′ 

 a b d 0 a  u5,3   c 5,3
 u2,4  = 
    
′′ 

 a 0 d b a    c 2,4 
a b d b a  u3,4   

    c 3,4 

 a b d b a 0  u4,4  c 
  4,4 
 a b d 0 a  u5,4    c
′′ 

   5,4 
 a 0 d b 0  u2,5   ′′′
    c2,5 
a b d b 0  u3,5   
  c′ 
 
 
a b d b  u4,5   ′3,5 
 
c4,5 
a b d u5,5 ′′′
c5,5
(2.39)
where

c = c − a ub
′′
c = c − b ub
′′′
c = c − (a + b) ub

The system of equations, described by Eq. (2.39) requires substantially more


computer time as compared to a tridiagonal system. The equations of this type
2.16 Computational Fluid Dynamics

are usually solved by iterative methods. These methods will be described in a


subsequent section. The quantity ub is the boundary value.

2.3.5 ADI Method


The difficulties described in the earlier section, which occur when solving the
two-dimensional equation by conventional algorithms, can be removed by alter-
nating direction implicit (ADI) methods. The usual ADI method is a two-step
scheme given by

n+1/2
ui,j − uni,j n+1/2
= α(δx2 ui,j + δy2 uni,j ) (2.40)
∆t/2

and
n+1/2
un+1
i,j − ui,j n+1/2
= α(δx2 ui,j + δy2 un+1
i,j ) (2.41)
∆t/2

The effect of splitting the time step culminates in two sets of systems of linear
algebraic equations. During step 1, we get the following
n+1/2
"( n+1/2 n+1/2 n+1/2
)  #
ui,j − uni,j ui+1,j − 2ui,j + ui−1,j uni,j+1 − 2uni,j + uni,j−1
=α +
(∆t/2) (∆x2 ) (∆y 2 )

or

[b ui−1,j + (1 − 2b) ui,j + b ui+1,j ]n+1/2 = uni,j − a [ui,j+1 − 2ui,j + ui,j−1 ]n

Now for each “j” rows (j = 2, 3...), we can formulate a tridiagonal matrix, for
the varying i index and obtain the values from i = 2 to (imax − 1) at (n + 1/2)
level Fig. 2.5(a). Similarly, in step-2, we get

n+1/2 n+1/2 n+1/2 n+1/2


un+1 un+1 n+1 n+1
"( ) ( )#
i,j − ui,j ui+1,j − 2ui,j + ui−1,j i,j+1 − 2ui,j + ui,j−1
=α 2
+
(∆t/2) (∆x ) (∆y 2 )

or

n+1/2
[a ui,j−1 + (1 − 2a) ui,j + a ui,j+1 ]n+1 = ui,j − b[ui+1,j − 2ui,j + ui−1,j ]n+1/2

Now for each “i” rows (i = 2, 3....), we can formulate another tridiagonal matrix
for the varying j index and obtain the values from j = 2 to (jmax − 1) at nth
level Figure 2.5(b).
With a little more effort, it can be shown that the ADI method is also second-
Finite Difference Method 2.17

t t
IMPLICIT

n+ 1
− n+1
2 y = j ∆.y
4 IMPLICIT
3
2 1
n n+ −
x = i ∆x 2 2 3 45 . . . . i

(a) (b)

Figure 2.5: Schematic representation of ADI scheme.

n+1/2
order accurate in time. If we use Taylor series expansion around ui,j on
either direction, we shall obtain
  2   3
1 ∂2u 1 ∂3u
    
n+1 n+1/2 ∂u ∆t ∆t ∆t
ui,j = ui,j + + + + ···
∂t 2 2! ∂t2 2 3! ∂t3 2

and
2 3
∂2u ∂3u
      
n+1/2 ∂u ∆t 1 ∆t 1 ∆t
uni,j = ui,j − + − + ···
∂t 2 2! ∂t2 2 3! ∂t3 2
Subtracting the latter from the former, one obtains
  3
2 ∂3u
  
∂u ∆t
un+1
i,j − u n
i,j = (∆t) + 3
+ ···
∂t 3! ∂t 2
or

un+1 n 2
i,j − ui,j ∂3u
 
∂u 1 ∆t
= − + ···
∂t ∆t 3! ∂t3 2
The procedure above reveals that the ADI method is second-order accurate with
a truncation error of O [(∆t)2 , (∆x)2 , (∆y)2 ].
The major advantages and disadvantages of explicit and implicit methods
are summarized as follows:

Explicit:
• Advantage: The solution algorithm is simple to set up.
• Disadvantage: For a given ∆x, ∆t must be less than a specific limit im-
posed by stability constraints. This requires many time steps to carry out
the calculations over a given interval of t.
2.18 Computational Fluid Dynamics

Implicit:
• Advantage: Stability can be maintained over much larger values of ∆t.
Fewer time steps are needed to carry out the calculations over a given
interval.

• Disadvantages:

- More involved procedure is needed for setting up the solution algo-


rithm than that for explicit method.
- Since matrix manipulations are usually required at each time step,
the computer time per time step is larger than that of the explicit
approach.
- Since larger ∆t can be taken, the truncation error is often large, and
the exact transients (time variations of the dependant variable for
unsteady flow simulation) may not be captured accurately by the
implicit scheme as compared to an explicit scheme.

Apparently finite-difference solutions seem to be straightforward. The over-


all procedure is to replace the partial derivatives in the governing equations with
finite difference approximations and then finding out the numerical value of the
dependant variables at each grid point. However, this impression is indeed in-
correct! For any given application, there is no assurance that such calculations
will be accurate or even stable! Let us now discuss about accuracy and stability.

2.4 Errors and Stability Analysis


2.4.1 Introduction
There is a formal way of examining the accuracy and stability of linear equations,
and this idea provides guidance for the behavior of more complex non-linear
equations which are governing the equations for flow fields.
Consider a partial differential equation, such as Eq. (2.25). The numerical
solution of this equation is influenced by the following two sources of error.

Discretization:
This is the difference between the exact analytical solution of the partial dif-
ferential Eq. (2.25) and the exact (round-off free) solution of the correspond-
ing finite-difference equation (for example, Eq. (2.26). The discretization error
for the finite-difference equation is simply the truncation error for the finite-
difference equation plus any errors introduced by the numerical treatment of
the boundary conditions.
Finite Difference Method 2.19

Round-off:
This is the numerical error introduced for a repetitive number of calculations in
which the computer is constantly rounding the number to some decimal points.
If A = analytical solution of the partial differential equation.
D = exact solution of the finite-difference equation
N = numerical solution from a real computer with finite accuracy
Then, Discretization error = A - D = Truncation error + error introduced due
to treatment of boundary condition
Round-off error = ǫ = N - D
or,
N =D+ǫ (2.42)
where, ǫ is the round-off error, which henceforth will be called “error” for con-
venience. The numerical solution N must satisfy the finite difference equation.
Hence from Eq. (2.26)

Din+1 + ǫn+1
 n
− Din − ǫni Di+1 + ǫni+1 − 2Din − 2ǫni + Di−1
n
+ ǫni−1

i

∆t (∆x2 )
(2.43)
By definition, D is the exact solution of the finite difference equation, hence it
exactly satisfies

Din+1 − Din
 n
Di+1 − 2Din + Di−1 n 
=α (2.44)
∆t (∆x2 )

Subtracting Eq. (2.44) from Eq. (2.43)

ǫn+1
 n
− ǫni ǫ − 2ǫni + ǫni−1

i
= α i+1 (2.45)
∆t (∆x2 )

From Equation 2.45, we see that the error ǫ also satisfies the difference equation.
If errors ǫi are already present at some stage of the solution of this equation,
then the solution will be stable if the ǫi ’s shrink, or at least stay the same, as
the solution progresses in the marching direction, i.e from step n to n + 1. If
the ǫi ’s grow larger during the progression of the solution from step n to n + 1,
then the solution is unstable. Finally, it stands to reason that for a solution to
be stable, the mandatory condition is
n+1
ǫi
ǫn ≤ 1 (2.46)

i

For Eq. (2.26), let us examine under what circumstances Eq. (2.46) holds good.
Assume that the distribution of errors along the x−axis is given by a Fourier
series in x, and the time-wise distribution is exponential in t, i.e,
X
ǫ(x, t) = eat eIkm x (2.47)
m
2.20 Computational Fluid Dynamics

where I is the unit complex number and k the wave number 1 Since the difference
is linear, when Eq. (2.47) is substituted into Eq. (2.45), the behaviour of each
term of the series is the same as the series itself. Hence, let us deal with just
one term of the series, and write

ǫm (x, t) = eat eIkm x (2.48)

Substitute Eq. (2.48) into ( 2.45) to get

ea(t+∆t) eIkm x − eat eIkm x


 at Ikm (x+∆x)
− 2eat eIkm x + eat eIkm (x−∆x)

e e

∆t (∆x)2
(2.49)
Divide Eq. (2.49) by eat eIkm x

ea∆t − 1
 Ikm ∆x
− 2 + e−Ikm ∆x

e

∆t (∆x)2
or,
α(∆t)
ea∆t = 1 + eIkm ∆x + e−Ikm ∆x − 2

2 (2.50)
(∆x)
Recalling the identity

eIkm ∆x + e−Ikm ∆x
cos(km ∆x) =
2
Eq. (2.50) can be written as

α(2∆t)
ea∆t = 1 + (cos(km ∆x) − 1)
(∆x)2
or,
α(∆t)
ea∆t = 1 − 4 2 sin2 [(km ∆x)/2] (2.51)
(∆x)
From Eq. (2.48), we can write

ǫn+1 ea(t+∆t) eIkm x


i
n = = ea∆t (2.52)
ǫi eat eIkm x

Combining Eqns. (2.51),(2.52) and (2.46), we have


n+1  
ǫi a∆t
α(∆t) 2 (km ∆x)
ǫn = |e | = 1 − 4 (∆x)2 sin ≤1 (2.53)

i 2

1
Let a wave travel with a velocity v. The time period “T ′′ is the time required for the
wave to travel a distance of one wave length λ, so that λ=vT . Wave number k is defined by
k = 2π/λ.
Finite Difference Method 2.21

Eq. (2.53) must be satisfied to have a stable solution. In Eq. (2.53) the factor
 
α(∆t) 2 (km ∆x)
1 − 4 2 sin

2

(∆x)

is called the amplification factor and is denoted by G.


Evaluating the inequality in Eq. (2.53) , the two possible situations which
must hold simultaneously are
(a)
 
α(∆t) (km ∆x)
1−4 2 sin2 ≤1
(∆x) 2

Thus,
 
α(∆t) 2 (km ∆x)
4 2 sin ≥0
(∆x) 2

Since α(∆t)/(∆x)2 is always positive, this condition always holds.


(b)
 
α(∆t) 2 (km ∆x)
1−4 2 sin ≥ −1
(∆x) 2

Thus,
 
4α(∆t) 2 (km ∆x)
2 sin −1≤1
(∆x) 2

For the above condition to hold

α(∆t) 1
2 ≤ (2.54)
(∆x) 2

Eq. (2.54) gives the stability requirement for which the solution of the difference
Eq. (2.26) will be stable. It can be said that for a given ∆x the allowed value
of ∆t must be small enough to satisfy Eq. (2.54). For α(∆t)/(∆x)2 ≤ (1/2) the
error will not grow in subsequent time marching steps in t, and the numerical
2
solution will proceed in a stable manner. On the contrary, if α(∆t)/(∆x) >
(1/2), then the error will progressively become larger and the calculation will
be useless.
The above mentioned analysis using Fourier series is called as the Von Neu-
mann stability analysis.
2.22 Computational Fluid Dynamics

2.4.2 First-Order Wave Equation


Before we proceed further, let us look at the system of first-order equations
which are frequently encountered in a class of fluid flow problems. Consider the
second-order wave equation
∂2u 2
2∂ u
= c (2.55)
∂t2 ∂x2
Here c is the wave speed and u is the wave amplitude. This can be written as
a system of two first-order equations. If v = ∂u/∂t and w = c(∂u/∂x), then we
may write ∂v/∂t = c(∂w/∂x) and ∂w/∂t = c(∂v/∂x).
Rather, the system of equations may be written as
∂U ∂U
+ [A] =0
∂t ∂x
which is a first-order equation.
It is implicit that U = { wv } and A = −c
 0 −c 
0 . The eigenvalues λ of the [A]
matrix are found by
det [A − λI] = 0, or λ2 − c2 = 0
Roots of the characteristic equation are λ1 = +c and λ2 = −c, representing two
travelling waves with speeds given by
   
dx dx
= c and = −c
dt 1 dt 2
The system of equations in this example is hyperbolic and it has also been seen
that the eigenvalues of the A matrix represent the characteristic differential
representation of the wave equation. Euler’s equation may be treated as a
system of first-order wave equations. For Euler’s equations, in two dimensions,
we can write a system of first order as
∂E ∂E ∂E
+ [A] + [B] = [S] (2.56)
∂t ∂x ∂y
where
   
u 0 u
E= , A= ,
v u 0
1 ∂p
 
  −
v 0
B= and S =  ρ1 ∂x
 
0 v ∂p 

ρ ∂y

2.4.3 Stability of Hyperbolic and Elliptic Equations


Let us examine the characteristics of the first-order wave equation given by
∂u ∂u
+c =0 (2.57)
∂t ∂x
Finite Difference Method 2.23

Here we shall represent the spatial derivative by the central difference form

∂u un − uni−1
= i+1 (2.58)
∂x 2∆x
We shall replace the time derivative with a first-order difference , where u(t) is
represented by an average value between grid points (i + 1) and (i − 1), i.e
1 n
u(t) = (u + uni−1 )
2 i+1
Then
∂u un+1 − 21 (uni+1 + uni−1 )
= i (2.59)
∂t ∆t
Substituting Eqns. (2.58) and (2.59) into (2.57), we have

uni+1 + uni−1 ∆t (uni+1 − uni−1 )


un+1
i = −c (2.60)
2 ∆x 2
The time derivative is called Lax method of discretization, after the well known
mathematician Peter Lax who first proposed it. If we once again assume an
error of the form
ǫm (x, t) = eat eIkm x (2.61)
as done previously, and substitute this form into Eq. (2.60), following the same
arguments as applied to the analysis of Eq. (2.26), the amplification factor
becomes
ea∆t = cos(km ∆x) − IC sin(km ∆x)
where C = c(∆t/∆x). The stability requirement is |ea∆t | ≤ 1. Finally the
condition culminates in
∆t
C=c ≤1 (2.62)
∆x
In Eq. (2.62), C is the Courant number. This equation restricts ∆t ≤ ∆x/c for
the solution of Eq. (2.62) to be stable. The condition posed by Eq. (2.62) is
called the Courant-Friedrichs-Lewy condition, generally referred to as the CFL
condition.

Physical Example of Unstable Calculation


Let us take the heat conduction once again,

∂u ∂2u
=α 2 (2.63)
∂t ∂x
Applying FTCS discretization scheme depicts simple explicit representation
as
un+1
 n
− uni ui+1 − 2uni + uni−1

i
=α (2.64)
∆t (∆x2 )
2.24 Computational Fluid Dynamics

or
un+1
i = r (uni+1 + uni−1 ) + (1 − 2r) uni , where r = α∆t/(∆x2 ) (2.65)
This is stable only if r ≤ 1/2.
Let us consider a case when r > 1/2. For r = 1 (which is greater than the
stability restriction), we get un+1
i = 1 · (100 + 100) + (1 − 2) · 0 = 200o C, (which
is impossible). The values of u are shown in Fig. 2.6.

Next, an example demonstrating the application of Von Neumann method


0
200 C
n+1 t+ ∆ t

0 0 0
100 C 0 C 100 C
n
i−1 i i+1

Figure 2.6: Physical violations resulting from r=1.

to multidimensional elliptic problems is taken up. Let us take the vorticity


transport equation:
 2
∂ ω ∂2ω

∂ω ∂ω ∂ω
+u +v =ν + (2.66)
∂t ∂x ∂y ∂x2 ∂y 2
We shall extend the Von Neumann stability analysis for this equation, assum-
ing u and v as constant coefficients (within the framework of linear stability
analysis). Using FTCS scheme
n+1 n  n n  n n
ωi,j − ωi,j ωi+1,j − ωi−1,j ωi,j+1 − ωi,j−1
 
=−u −v
∆t 2∆x 2∆y
 n n n
ωi+1,j − 2ωi,j + ωi−1,j


(∆x2 )
 n n n
ωi,j+1 − 2ωi,j + ωi,j−1

+ν (2.67)
(∆y 2 )
Let us consider N = D + ǫ with
X
ǫ(x, y, t) = eat e(Ikm x+Ikm y) (2.68)
m

where N is the numerical solution obtained from computer, D the exact solution
of the FDE and ǫ error. Substituting Eq. (2.68) into Eq. (2.67) and using the
trignometric identities, we finally obtain
ǫn+1
i,j ea(t+∆t) eIkm (x+y)
n = = ea∆t = G
ǫi,j eat eIkm (x+y)
Finite Difference Method 2.25

where

G =1 − 2(dx + dy ) + 2dx cos(km ∆x) + 2dy cos(km ∆y)


− I[Cx sin(km ∆x) + Cy sin(km ∆y)]

where
ν∆t ν∆t u∆t v∆t
dx = 2, dy = 2, Cx = , Cy =
(∆x) (∆y) ∆x ∆y
The obvious stability condition |G| ≤ 1, finally leads to

1
dx + dy ≤ , Cx + Cy ≤ 1 (2.69)
2
when
1
dx = dy = d (for ∆x = ∆y), d≤
4
which means
ν∆t 1
2 ≤
(∆x) 4
This is twice as restrictive as the one-dimensional diffusive limitation (compare
with Eq. (2.54). Again for the special case (u = v and ∆x = ∆y)

1
Cx = Cy = C, hence C ≤
2
which is also twice as restrictive as one dimensional convective limitation (com-
pare with Eq. (2.62).
Finally, let us look at the stability requirements for the second-order wave
equation given by
∂2u ∂2u
2
= c2 2
∂t ∂x
We replace both the spatial and time derivatives with central difference scheme
(which is second-order accurate)
" #
un+1
i − 2uni + uin−1 n n n
2 ui+1 − 2ui + ui−1
2 =c 2 (2.70)
(∆t) (∆x)

Again assume
N =D+ǫ (2.71)
and
ǫni = eat eIkm x (2.72)
Substituting Eq. (2.72) and (2.71) in (2.70) and dividing both sides by eat eIkm x ,
we get
ea∆t − 2 + e−a∆t = C 2 eIkm ∆x + e−Ikm ∆x − 2
 
(2.73)
2.26 Computational Fluid Dynamics

where
c(∆t)
C, the Courant number = (2.74)
∆x
From Eq. (2.73), using trignometric identities, we get
 
km ∆x
ea∆t + e−a∆t = 2 − 4C 2 sin2 (2.75)
2

and, the amplification factor


n+1
ǫ
G = i n = |ea∆t |

(2.76)
ǫi

However, from Eq. (2.75) we arrive at


  
km ∆x
e2a∆t − 2 1 − 2C 2 sin2 ea∆t + 1 = 0 (2.77)
2

which is a quadratic equation for ea∆t . This equation, quite obviously, has two
roots, and the product of the roots is equal to +1. Thus, it follows that the
magnitude of one of the roots (value of ea∆t ) must exceed 1 unless both the
roots are equal to unity.
But ea∆t is the magnification factor. If its value exceeds 1, the error will grow
exponentially which will lead to an unstable situation. All these possibilities
mean that Eq (2.77) should possess complex roots in order that both have the
values of ea∆t equal to unity. This implies that the discriminant of Eq. (2.77)
should be negative.
  2
km ∆x
1 − 2C 2 sin2 −1<0 (2.78)
2
or
1
C2 < (2.79)
sin2 km ∆x

2

which is always true if C < 1. Hence CFL condition (C < 1), must again be
satisfied for the stability of second-order hyperbolic equations.
In light of the above discussion, we can say that a finite-difference procedure
will be unstable if for that procedure, the solution becomes unbounded, i.e the
error grows exponentially as the calculation progresses in the marching direction.
In order to have a stable calculation, we pose different conditions based on
stability analysis. Here we have discussed the Von Neumann stability analysis
which is indeed a linear stability analysis.
However, situations may arise where the amplification factor is always less
than unity. These conditions are referred to as unconditionally stable. In a
similar way for some procedures, we may get an amplification factor which is
always greater than unity. Such methods are unconditionally unstable.
Finite Difference Method 2.27

Over and above, it should be realized that such stability analysis are not
really adequate for practical complex problems. In actual fluid flow problems,
the stability restrictions are applied locally. The mesh is scanned for the most
restrictive value of the stability limitations and the resulting minimum ∆t is used
throughout the mesh. For variable coefficients, the Von Neumann condition is
only necessary but not sufficient. As such, stability criterion of a procedure is not
defined by its universal applicability. For nonlinear problems we need numerical
experimentation in order to obtain stable solutions wherein the routine stability
analysis will provide the initial clues to practical stability. In other words, it
will give tutorial guidance only.

2.5 Fundamentals of Fluid Flow Modeling


We have discussed the finite-difference methods with respect to the solution of
linear problems such as heat conduction. The problems of fluid mechanics are
more complex in character. The governing partial differential equations form
a nonlinear system which must be solved for the unknown pressures, densities,
temperatures and velocities.
Before entering into the domain of actual flow modeling, we shall discuss
some subtle points of fluid flow equations with the help of a model equation.
The model equation should have convective, diffusive and time-dependent terms.
Burgers (1948) introduced a simple nonlinear equation which meets the aforesaid
requirements (Burger’s equation).

∂ζ ∂ζ ∂ 2ζ
+u =ν (2.80)
∂t ∂x ∂x2
Here, u is the velocity, ν is the coefficient of diffusivity and ζ is any property
which can be transported and diffused. If the viscous term (diffusive term) on
the right-hand side is neglected, the remaining equation may be viewed as a
simple analog of Euler’s equation.

∂ζ ∂ζ
+u =0 (2.81)
∂t ∂x
Now we shall see the behavior of Burger’s equations for different kinds of dis-
cretization methods. In particular, we shall study their influence on conservative
and transportive property, and artificial viscosity.

2.5.1 Conservative Property


A finite-difference equation possesses conservative property if it preserves in-
tegral conservation relations of the continuum. Let us consider the vorticity
transport equation
∂ω
= −(V · ∇) ω + ν ∇2 ω (2.82)
∂t
2.28 Computational Fluid Dynamics

where ∇ is nabla or differential operator, V the fluid velocity and ω the


vorticity. If we integrate this over some fixed space region ℜ, we get

∂ω
Z Z Z
dℜ = − (V · ∇)ωdℜ + ν∇2 ωdℜ (2.83)
ℜ ∂t ℜ ℜ

The first term of the Eq. (2.83) can be written as

∂ω ∂
Z Z
dℜ = ω dℜ
ℜ ∂t ∂t ℜ

The second term of the Eq.( (2.83)) may be expressed as


Z Z Z
− (V · ∇)ω dℜ = − ∇ · (V ω) dℜ = − (V ω) · n dA
ℜ ℜ Ao

Ao is the boundary of ℜ, n is unit normal vector and dA is the differential


element of Ao . The remaining term of Eq. (2.83) may be written as
Z Z
ν ∇2 ω dℜ = ν (∇ω) · n dA
ℜ Ao

As because,
Z Z Z
ν (∇ω) · n dA = ν ∇ · (∇ω) dℜ = ν ∇2 ω dℜ
Ao ℜ ℜ

Finally, we can write


Z Z Z
ω dℜ = − (V ω) · n dA + ν (∇ ω) · n dA (2.84)
∂t ℜ Ao Ao

which implies that the time rate of accumulation of ω in ℜ is equal to net


advective flux rate of ω across Ao into ℜ plus net diffusive flux rate of ω across
Ao into ℜ. The concept of conservative property is to maintain this integral
relation in finite difference representation.
For clarity , again let us consider inviscid Burger’s equation ((2.81)). This time
we let ζ = ω = vorticity, which means

∂ω ∂
= − (uω) (2.85)
∂t ∂x

The finite difference analog is given by FTCS method as

ωin+1 − ωin uni+1 ωi+1


n
− uni−1 ωi−1
n
=− (2.86)
∆t 2∆x
Finite Difference Method 2.29

Let us consider a region ℜ running from i = I1 to i = I2 see (Figure 2.7). We


I2
1 X
evaluate the the integral ω ∆x as
∆t
i=I1
" I i=I
# I2
1 X 2
n+1
X2
n
X (uni+1 ωi+1
n
) − (uni−1 ωi−1
n
)
ωi ∆x − ωi ∆x = −
∆t 2
i=I1 i=I1 i=I1
i=I
1 X2
= [(u ω)ni−1 − (u ω)ni+1 ] (2.87)
2
i=I1

Summation of the right hand side (running i from I1 to I2 ) finally gives

" I I2
#
2
1 X n+1
X
n 1
(u ω)nI1 −1 + (u ω)nI1

ωi ∆x − ωi ∆x =
∆t 2
i=I1 i=I1

1
(u ω)nI2 + (u ω)nI2 +1


2
= (u ω)nI1 − 1 − (u ω)nI2 + 1 (2.88)
2 2

Eq. (2.88) states that the rate of accumulation of ωi in ℜ is identically equal


to the net advective flux rate across the boundary of ℜ running from i = I1 to
i = I2 . Thus the FDE analogous to inviscid part of the integral Eq. (2.86) has
preserved the conservative property. As such, conservative property depends on
the form of the continuum equation used. Let us take non-conservative form of
inviscid Burger’s equation (2.81) as
∂ω ∂ω
= −u (2.89)
∂t ∂x
Using FTCS differencing technique as before, we can write

ωin+1 − ωin
 n n 
ωi+1 − ωi−1
= −uni (2.90)
∆t 2∆x

Now, the integration over ℜ running from i = I1 to i = I2 , yields


" I i=I
# I2
1 X 2 X2 (ω n − ωi−1 n
)
−uni i+1
X
n+1 n
ωi ∆x − ωi ∆x =
∆t 2
i=I1 i=I1 i=I1
I2
1X
= [uni ωi−1
n
− uni ωi+1
n
] (2.91)
2
i=I1

While performing the summation of the right-hand side of Eq. (2.91), it can
be observed that terms corresponding to inner cell fluxes do not cancel out.
2.30 Computational Fluid Dynamics

Consequently an expression in terms of fluxes at the inlet and outlet section, as


it was found earlier, could not be obtained. Hence the finite-difference analog
Eq. (2.90) has failed to preserve the integral Gauss-divergence property, i,e., the
conservative property of the continuum.
The quality of preserving the conservative property is of special importance

I1 I2

Figure 2.7: Domine running from i = I1 to i = I2 .

with regards to the methods involving finite-volume approach(a special form


of finite-difference equation). The use of conservative form depicts that the
1
advective flux rate of ω out of a control volume at the interface i = I2 + is
2
exactly equal to flux rate of ω in to the next control volume and so on. The
meaning of calling Eq. (2.85)as “conservative form” is now clearly understood.
However, the conservative form of advective part is of prime importance for
modeling fluid flow and is often referred to as weak conservative form. For the
incompressible flow in Cartesian coordinate system this form is :

∂u ∂u2 ∂uv ∂uw 1 ∂p


+ + + = − + ν∇2 u
∂t ∂x ∂y ∂z ρ ∂x
∂v ∂uv ∂v 2 ∂vw 1 ∂p
+ + + = − + ν∇2 v
∂t ∂x ∂y ∂z ρ ∂y
∂w ∂uw ∂vw ∂w2 1 ∂p
+ + + = − + ν∇2 w (2.92)
∂t ∂x ∂y ∂z ρ ∂z

If all the terms in the flow equation are recast in the form of first- order deriva-
tives of x, y, z and t , the equations are said to be in strong“ conservative
form”. We shall write the strong conservation form of Navier-Stokes equation
in Cartesian coordinate system:

∂u ∂ 2 p ∂u ∂ ∂u ∂ ∂u
+ (u + − ν ) + (uv − ν ) + (uw − ν ) =0
∂t ∂x ρ ∂x ∂y ∂y ∂z ∂z
∂v ∂ ∂u ∂ 2 p ∂v ∂ ∂v
+ (uv − ν ) + (v + − ν ) + (vw − ν ) =0
∂t ∂x ∂x ∂y ρ ∂y ∂z ∂z
∂w ∂ ∂w ∂ ∂w ∂ p ∂w
+ (uw − ν )+ (wv − ν )+ (w2 + − ν ) = 0 (2.93)
∂t ∂x ∂x ∂y ∂y ∂z ρ ∂z
Finite Difference Method 2.31

2.5.2 The Upwind Scheme


Once again,we shall start with the inviscid Burger’s equation. (2.81). Regarding
discretization, we can think about the following formulations
ζin+1 − ζin ζ n − ζin
+ u i+1 =0 (2.94)
∆t ∆x
ζin+1 − ζin ζ n − ζi−1
n
+ u i+1 =0 (2.95)
∆t 2 ∆x
If Von Neumann’s stability analysis is applied to these schemes, we find that
both are unconditionally unstable.
A well known remedy for the difficulties encountered in such formulations is
the upwind scheme which is described by Gentry, Martin and Daly (1966) and
Runchal and Wolfshtein (1969). Eq. (2.94) can be made stable by substituting
the forward space difference by a backward space difference scheme, provided
that the carrier velocity u is positive. If u is negative, a forward difference
scheme must be used to assure stability. For full Burger’s equation. (2.80), the
formulation of the diffusion term remains unchanged and only the convective
term (in conservative form) is calculated in the following way (Figure 2.8):
ζin+1 − ζin u ζ n − u ζi−1
n
=− i + viscous term, for u > 0 (2.96)
∆t ∆x
ζin+1 − ζin u ζ n − u ζin
= − i+1 + viscous term, for u < 0 (2.97)
∆t ∆x
It is also well known that upwind method of discretization is very much necessary
in convection (advection) dominated flows in order to obtain numerically stable
results. As such, upwind bias retains transprotative property of flow equation.
Let us have a closer look at the transportative property and related upwind
bias.

∆x ∆x
u
u
i−2 i−1 i i+1 i+2

Figure 2.8: The Upwind Scheme.

2.5.3 Transportive Property


A finite-difference formulation of a flow equation possesses the transportive
property if the effect of a perturbation is convected (advected) only in the di-
rection of the velocity.
2.32 Computational Fluid Dynamics

Consider the model Burger’s equation in conservative form


∂ζ ∂u ζ
=− (2.98)
∂t ∂x
Let us examine a method which is central in space. Using FTCS we get
ζin+1 − ζin u ζ n − u ζi−1
n
= − i+1 (2.99)
∆t 2∆x
Consider a perturbation ǫm = δ in ζ. A perturbation will spread in all directions
due to diffusion. We are taking an inviscid model equation and we want the
perturbation to be carried along only in the direction of the velocity. So, for
u > 0, ǫm = δ (perturbation at mth space location), all other ǫ = 0. Therefore,
at a point (m + 1) downstream of the perturbation
n+1 n
ζm+1 − ζm+1 0−uδ uδ
=− =+
∆t 2∆x 2∆x
which is acceptable. However, at the point of perturbation (i = m),
n+1 n
ζm − ζm 0−0
=− =0
∆t 2∆x
which is not very reasonable. But at the upstream station (i = m − 1) we
observe
n+1 n
ζm−1 − ζm−1 uδ −0 uδ
=− =−
∆t 2∆x 2∆x
which indicates that the transportive property is violated.
On the contrary, let us see what happens when an upwind scheme is used.
We know that for u > 0
ζin+1 − ζin u ζ n − u ζi−1
n
=− i (2.100)
∆t ∆x
Then for ǫm = δ at the downstream location (m + 1)
n+1 n
ζm+1 − ζm+1 0−uδ uδ
=− =+
∆t ∆x ∆x
which follows the rationale for the transport property.
At point m of the disturbance
n+1 n
ζm − ζm uδ −0 uδ
=− =−
∆t ∆x ∆x
which means that the perturbation is being transported out of the affected
region.
Finally, at (m − 1) station, we observe that
n+1 n
ζm−1 − ζm−1 0−0
=− =0
∆t ∆x
Finite Difference Method 2.33

This signifies that no perturbation effect is carried upstream. In other words, the
upwind method maintains unidirectional flow of information. In conclusion, it
can be said that while space centred differences are more accurate than upwind
differences, as indicated by the Taylor series expansion, the whole system is not
more accurate if the criteria for accuracy includes the transportive property as
well.

2.5.4 Upwind Differencing and Artificial Viscosity


Consider the model Burger’s equation. (2.80) and focus the attention on the
inertia terms
∂ζ ∂ζ ∂2ζ
+u =ν 2
∂t ∂x ∂x
As seen, the simple upwind scheme gives

ζin+1 − ζin u ζ n − u ζi−1


n
=− i + ··· for u > 0
∆t ∆x
ζin+1 − ζin u ζ n − u ζin
= − i+1 + ··· for u < 0
∆t ∆x
From Taylor series expansion, we can write
n 2 n
∂ζ (∆t) ∂ 2 ζ
ζin+1 = ζin + ∆t + + ··· (2.101)
∂t i 2 ∂t2 i
n 2 n
n n ∂ζ (∆x) ∂ 2 ζ
ζi±1 = ζi ± ∆x + ± ··· (2.102)
∂x i 2 ∂x2 i

Substituting Eqns. (2.101) and (2.102) into (2.96) gives (dropping the subscript
i and superscript n)
" #
2
1 ∂ζ (∆t) ∂ 2 ζ
∆t + + O(∆t)3
∆t ∂t 2 ∂t2
" #
u ∂ζ (∆x)2 ∂ 2 ζ 3
=− ∆x − + O(∆x) + [Diffusive term]
∆x ∂x 2 ∂x2

or  2
∂2ζ
 
∂ζ ∂ζ 1 u ∆t ∂ ζ
= −u + u ∆x 1 − + ν + O(∆x)2
∂t ∂x 2 ∆x ∂x2 ∂x2
which may be rewritten as

∂ζ ∂ζ ∂2ζ ∂2ζ
= −u + ν 2 + νe 2 + higher-order terms (2.103)
∂t ∂x ∂x ∂x
where
1 u ∆t
νe = [u ∆x (1 − C)], C (Courant number) =
2 ∆x
2.34 Computational Fluid Dynamics

In deriving Eq. (2.103), ∂ 2 ζ/∂t2 was taken as u2 ∂ 2 ζ/∂x2 . However, the non-
physical coefficient νe leads to a diffusion like term which is dependent on the
discretization procedure. This νe is known as the numerical or artificial viscosity.
Let us look at the expression.
1
νe =[u ∆x (1 − C)] for u > 0 (2.104)
2
somewhat more critically. On one hand we have considered that u > 0 and
on the other CFL condition demands that C < 1 (so that the algorithm can
work). As a consequence, νe is always a positive non-zero quantity (so that the
algorithm can work). If, instead of analysing the transient equation, we put
∂ζ/∂t = 0 in Eq. (2.96) and expand it in Taylor series, we obtain
1
νe = u ∆x (2.105)
2
Let us now consider a two-dimensional convective-diffusive equation with viscous
diffusion in both directions(Eq. (2.67) but with ω = ζ). For ui , vi > 0, upwind
differencing gives
n+1 n n n n n
ζi,j − ζi,j u ζi,j − u ζi−1,j v ζi,j − v ζi,j−1
=− −
∆t ∆x ∆y
 n n n
ζi+1,j − 2ζi,j + ζi−1,j

(∆x)2
n n n
ζi,j+1 − 2ζi,j + ζi,j−1

+ (2.106)
(∆y)2
The Taylor series procedure as was done for Eq. (2.103) will produce
∂ζ ∂ζ ∂ζ ∂2ζ ∂2ζ
= −u −v + (ν + νex ) 2 + (ν + νey ) 2 (2.107)
∂t ∂x ∂y ∂x ∂y
where
1
νex = [u ∆x(1 − Cx )],
2
1 u ∆t v ∆t
νey = [v ∆y(1 − Cy )]; with Cx = , Cy =
2 ∆x ∆y
As such for u ≈ v and ∆x = ∆y, CFL condition is Cx = Cy ≤ (1/2). This
indicates that for a stable calculation, artificial viscosity will necessarily be
present. However, for a steady-state analysis, we get
1 1
νex = u ∆x; νey = v ∆y (2.108)
2 2
We have observed that some amount of upwind effect is indeed necessary to
maintain transportive property of flow equations while the computations based
on upwind differencing often suffer from false diffusion (inaccuracy!). One of
the plausible improvements is the usage of higher-order upwind method of dif-
ferencing. Next subsection discusses this aspect of improving accuracy.
Finite Difference Method 2.35

2.5.5 Second Upwind Differencing or Hybrid Scheme


According to the second upwind differencing, if u is the velocity in x direction
and ζ is any property which can be convected or diffused, then

∂(uζ) uR ζR − uL ζL
= (2.109)
∂x i,j ∆x

One point to be carefully observed from Eq. (2.109) is that the second upwind
should be written in conservative form. However, the definition of uR and uL
are (see Fig. 2.9):
ui,j + ui+1,j ui,j + ui−1,j
uR = ; uL = (2.110)
2 2
Now,

ζR = ζi,j for uR > 0 ; ζR = ζi+1,j for uR < 0 (2.111)

and

ζL = ζi−1,j for uL > 0 ; ζL = ζi,j for uL < 0 (2.112)

Finally, for uR > 0 and uL > 0, we get


    
∂(uζ) 1 ui,j + ui+1,j ui,j + ui−1,j
= ζi,j − ζi−1,j (2.113)
∂x ∆x 2 2

Let us discretize the second term of the convection part of unsteady x-direction
momentum equation. We have chosen this in order to cite a meaningful example
of second upwind differencing. Using Eq. (2.113), we can write

∂u2
    
1 ui,j + ui+1,j ui,j + ui−1,j
= u i,j − u i−1,j
∂x i,j ∆x 2 2
  
1 ui,j + ui+1,j ui,j + ui+1,j + ui,j − ui+1,j
=
∆x 2 2
  
ui,j + ui−1,j ui−1,j + ui,j + ui−1,j − ui,j

2 2
1
= [(ui,j + ui+1,j )[(ui,j + ui+1,j ) + (ui,j − ui+1,j )]
4∆x
− (ui−1,j + ui,j )[(ui−1,j + ui,j ) + (ui−1,j − ui,j )]]

1
= (ui,j + ui+1,j )2 + (u2i,j − u2i+1,j )
4∆x

− (ui−1,j + ui,j )2 − (u2i−1,j − u2i,j )
(2.114)
2.36 Computational Fluid Dynamics

uL uR

i−2,j i−1,j i,j i+1,j i+2,j

Figure 2.9: Definition of uR and uL .

Here we introduce a factor η which can express Eq. (2.114) as a weighted


average of central and upwind differencing. Invoking this weighted average
concept in Eq. (2.114), we obtain
∂u2

1
= = (ui,j + ui+1,j )2 + η|(ui,j + ui+1,j )|(ui,j − ui+1,j )
∂x i,j 4∆x

2
− (ui−1,j + ui,j ) − η|(ui−1,j + ui,j )|(ui−1,j − ui,j )
(2.115)
where 0 < η < 1. For η = 0, Eq. (2.115) becomes centred in space and for η = 1
it becomes full upwind. So η brings about the upwind bias in the difference
quotient. If η is small, Eq. (2.115) tend towards centred in space. This upwind
method was first introduced by Gentry, Martin and Daly (1966). Some more
stimulating discussions on the need of upwinding and its minimization has been
discussed by Roache (1972) who has also pointed out that the second upwind-
formulation possesses both the conservative and transportive property provided
the upwind factor (formally called donorcell factor) is not too large. In principle,
the weighted average differencing scheme can as well be called as hybrid scheme
(see Raithby and Torrence, 1974) and the accuracy of the scheme can always be
increased by a suitable adjustment of η value.

2.5.6 Some More Suggestions for Improvements


Several researchers have tried to resolve the difficulty associated with the dis-
cretization of the first-order terms which need some amount of artificial viscosity
for stability. Substantial progress has been made on the development of higher-
order schemes which are suitable over a large range of velocities. However, none
of these prescriptions are universal. Depending on the nature of the flow and
geometry one can always go for the best suited algorithm. Now we shall discuss
one such algorithm which has been proposed by Khosla and Rubin (1974).
Consider the Burger’s equation. (2.80) once again. The derivatives in this
equation are discretized in the following way.
Finite Difference Method 2.37

For u > 0

∂ζ ζ n+1 − ζin
= i (Forward time)
∂t ∆t
n+1 n+1
∂ζ ζ − ζi−1 ζ n − 2ζin + ζi−1
n
= i + i+1
∂x ∆x 2∆x

This is modified central difference in space, which for a converged solution


(ζin+1 = ζin ) reduces to space centred scheme. Now, consider the diffusion
term
n+1
∂2ζ ζi+1 − 2ζin+1 + ζi−1
n+1
=
∂x2 (∆x)2
This is central difference in space. Substituting the above quotients in Eq. (2.80),
one finds
n+1
−Aζi+1 + Bζin+1 − Cζi−1
n+1
= Di (2.116)

where

ν∆t u∆t ν∆t u∆t ν∆t


A= , C= + , B =1+ +2
(∆x)2 ∆x (∆x)2 ∆x (∆x)2

and
 
u∆t u∆t n
Di = 1+ ζin − (ζ n
+ ζi−1 ) (2.117)
∆x 2∆x i+1

For ui > 0, Ai , Bi and Ci > 0 and Bi > Ai + Ci . The system of equations pro-
duced from Eq. (2.116) is always diagonally dominant and capable of providing
a stable solution. As the solution progresses (i.e. uni → un+1 i ), the convective
term approaches second-order accuracy. This method of implementing higher-
order upwind is known as the “deferred correction procedure”.
Another widely suggested improvement is known as third-order upwind dif-
ferencing (see Kawamura et al. 1986). The following example illustrates the
essence of this discretization scheme.
   
∂u −ui+2,j + 8 (ui+1,j − ui−1,j ) + ui−2,j
u = ui,j
∂x i,j 12 ∆x
 
ui+2,j − 4 ui+1,j + 6 ui,j − 4 ui−1,j + ui−2,j
+ |ui,j |
4 ∆x (2.118)

Higher order upwinding is an emerging area of research in Computational Fluid


Dynamics. However, so far no unique suggestion has been evolved as an opti-
mal method for a wide variety of problems. Interested readers are referred to
2.38 Computational Fluid Dynamics

Vanka (1987), Fletcher (1988) and Rai and Moin (1991) for more stimulating
information on related topics.
One of the most widely used higher order schemes is known as QUICK
(Leonard, 1979). The QUICK scheme may be written in a compact manner in
the following way
 
∂u ui−2 − 8 ui−1 + 8 ui+1 − ui+2
f = fi
∂x i 12 ∆x
2
  
(∆x) −ui−2 + 2 ui−1 − 2 ui+1 + ui+2
+ fi
24 (∆x)3
3
  
(∆x) ui−2 − 4 ui−1 + 6 ui − 4 ui+1 + ui+2
+ |fi |
16 (∆x)4 (2.119)

The fifth-order upwind scheme (Rai and Moin, 1991) uses seven points stencil
along with a sixth-order dissipation. The scheme is expressed as
 
∂u ui+3 − 9 ui+2 + 45 ui+1 − 45 ui−1 + 9 ui−2 − ui−3
f = f i
∂x i 60 ∆x
 
ui+3 − 6 ui+2 + 15 ui+1 − 20 ui + 15 ui−1 − 6 ui−2 + ui−3
− α|fi |
60 ∆x
(2.120)

2.6 Some Non-Trivial Problems with Discretized


Equations
The discussion in this section is based upon some ideas indicated by Hirt (1968)
which are applied to model Burger’s equation as

ζin+1 − ζin n n  n
ζi+1 − ζi−1 ζi+1 − 2 ζin + ζi−1
n 
+u =ν (2.121)
∆t 2∆x (∆x)2

From this, the modified equation becomes[vide Art.2.5.4]

u2 ∆t
 
∂ζ
+ u ζx = ν− ζxx (2.122)
∂t 2

We define
ν(∆t) u∆t
r= ; C= = Courant number
(∆x)2 ∆x

It is interesting to note that the values r = 1/2 and C = 1 (which are extreme
conditions of Von Neumannn stability analysis) unfortunately eliminates viscous
diffusion completely in Eq. (2.122) and produce a solution from Eq. (2.121)
Finite Difference Method 2.39

directly as ζin+1 = ζi−1


n
which is unacceptable. From Eq. (2.122) it is clear that
in order to obtain a solution for convection diffusion equation, we should have

u2 ∆t
ν− >0
2
For meaningful physical result in the case of inviscid flow we require
u2 ∆t
ν− =0
2
Combining these two criteria, for a meaningful solution

u2 ∆t
ν− ≥0
2
or  
1 u ∆t u ∆x
ν 1− · ≥0 (2.123)
2 ∆x ν
Here we define the mesh Reynolds-number or cell-peclet number as
u∆x
Re∆x = = P e∆x
ν
So, we get  
1
ν 1 − C · Re∆x ≥ 0
2
or
2
Re∆x ≤ (2.124)
C
The plot of C vs Re∆x is shown in Fig. 2.10 to describe the significance of
Eq. (2.124). From the CFL condition, we know that the stability requirement is
C ≤ 1. Under such a restriction, below Re∆x = 2, the calculation is always sta-
ble. The interesting information is that it is possible to cross the cell Reynolds
number of 2 if C is made less than unity.

References
1. Anderson, D.A., Tannehill, J.C, and Pletcher, R.H., Computaional Fluid
Mechanics and Heat Transfer, Hemisphere Publishing Corporation, New
York, USA, 1984.
2. Burgers, J.M., A Mathematical Model Illustrating the Theory of Turbu-
lence, Adv. Appl. Mech., Vol. 1, pp. 171-199, 1948.
3. DuFort, E.C. and Frankel, S.P., Stability Conditions in the Numerical
Treatment of Parabolic Differential Equations, Mathematical Tables and
Others Aids to Computation, Vol. 7, pp. 135-152, 1953.
2.40 Computational Fluid Dynamics

1 CFL
restriction

0
2 4 6 8
Re∆ x

2
Figure 2.10: Limiting Line (Re∆x ≤ ).
C

4. Fletcher, C.A.J., Computational Techniques for Fluid Dynamics, Vol. 1


(Fundamentals and General Techniques), Springer Verlag, 1988.

5. Gentry, R.A., Martin, R.E. and Daly, B.J., An Eulerian Differencing


Method for Unsteady Compressible Flow Problems, J. Comput. Phys.,
Vol. 1, pp. 87-118, 1966.

6. Hirt, C.W., Heuristic Stability Theory of Finite Difference Equation, J.


Comput. Phys., Vol. 2, pp. 339-355, 1968.

7. Kawamura, T., Takami, H. and Kuwahara, K., Computation of High


Reynolds Number Flow around a Circular Cylinder with Surface Rough-
ness, Fluid Dynamics Research, Vol. 1, pp. 145-162, 1986.

8. Khosla, P.K. and Rubin, S.G., A Diagonally Dominant Second Order Ac-
curate Implicit Scheme, Computers and Fluids, Vol. 2, pp. 207-209, 1974.

9. Lax, P.D. and Wendroff, B. Systems of Conservation Laws, Pure Appl.


Math, Vol. 13, pp. 217-237, 1960.

10. Leonard, B.P., A Stable and Accurate Convective Modelling Procedure


based on Quadratic Upstream Interpolation, Comp. Methods Appl. Mech.
Engr., Vol. 19, pp. 59-98, 1979.

11. Rai, M.M. and Moin, P., Direct Simulations of Turbulent Flow Using
Finite Difference Schemes, J. Comput. Phys., Vol. 96, pp. 15-53, 1991.
Finite Difference Method 2.41

12. Raithby, G.D. and Torrance, K.E., Upstream-weighted Differencing Schemes


and Their Applications to Elliptic Problems Involving Fluid Flow, Com-
puters and Fluids, Vol. 2, pp. 191-206, 1974.

13. Roache, P.J., Computational Fluid Dynamics, Hermosa, Albuquerque,


New Mexico, 1972 (revised pritning 1985).

14. Runchal, A.K. and Wolfshtein, M., Numerical Integration Procedure for
the Steady State Navier-Stokes Equations, J. Mech. Engg. Sci., Vol. 11,
pp. 445-452, 1969.

15. Thomas, L.H., Elliptic Problems in Linear Difference Equations Over a


Network, Watson Sci. Comput. Lab. Rept., Columbia University, New
York, 1949.

16. Vanka, S.P., Second-Order Upwind Differencing in a Recirculating Flow,


AIAA J., Vol. 25, pp. 1435-1441, 1987.

Problems
1. Consider the nonlinear equation

∂u ∂ 2u
u =µ 2 (2.125)
∂x ∂y

where µ is a constant and u the x component of velocity. The normal


direction is y.
(a)Is this equation in conservative form? If not, suggest a conservative
form of the equation.
(b) Consider a domain in x (x = 0 to x = L) and y (y = 0 to y = H)
and assume that all the values of the dependent variable are known at
x = 0 (along y = 0 to y = H at every ∆y interval). Develop an implicit
expression for determining u at all the points along (y = 0 to y = H) and
the next (x + ∆x)

2. Establish the truncation error of the following finite-difference approxima-


tion to ∂T /∂y at the point (i, j) for a uniform mesh

∂T −3 Ti,j + 4 Ti,j+1 − Ti,j+2


=
∂y 2 (∆y)

What is the order of the truncation error? If you want to apply a second
-order-accurate boundary condition for ∂T /∂y = 0 at the boundary (refer
to Fig. 2.11), can you make use of the above mentioned expression? If
yes, what should be the expression for Ti,j at the boundary?
2.42 Computational Fluid Dynamics

∆y

∆y

1 Boundary

Figure 2.11: Grid points at a boundary.

3. The Lax-Wendroff finite difference scheme (Lax and Wendroff , 1960) can
be derived from a Taylor series expansion in the following manner:

1
un+1
i = uni + ∆t ut + (∆t)2 utt + O[(∆t)3 ]
2
Using the wave equations

ut = −c ux
utt = c2 uxx

the Taylor series expansion may be written as

c ∆t c2 (∆t)2 n
un+1 = uni − (uni+1 − uni−1 ) + (u − 2uni + uni−1 )
i
2 (∆x) 2 (∆x)2 i+1

Prove that the CFL condition is the stability requirement for the above
discretization scheme.

4. A three-level explicit discretization of

∂u ∂2u
=α 2
∂t ∂x
can be written as
Finite Difference Method 2.43

0.5 Tin−1 − 2 Tin + 1.5 Tin+1 (1 + d) (Ti−1 − 2 Ti + Ti+1 )n



= α
∆t (∆x)2
d (Ti−1 − 2 Ti + Ti+1 )n−1


(∆x)2

Expand each term as a Taylor series to determine the truncation error of


the complete equation for arbitrary values of d. Suggest the general tech-
nique where for a functional relationship between d and r[= α∆t/(∆x)2 ]
the scheme will be fourth-order accurate in ∆x.

5. Consider the equation


 2
∂2T

∂T ∂T ∂T ∂ T
+u +v =α +
∂t ∂x ∂y ∂x2 ∂y 2

where T is the dependent variable which is convected and diffused. The


independent variables , x and y, are in space while t is the time (evolution)
coordinate. The coefficient u, v and α can be treated as constant. Em-
ploying forward difference for the first-order derivatives and central-second
difference for the second derivatives, obtain the finite-difference equation.
What is the physical significance of the difference between the above equa-
tion and the equation actually being solved? Suggest any method to over-
come this difference.
Write down the expression for the Finite Difference Quotient for the con-
vective term of the Burgers Equation given by

∂ω ∂ω ∂2ω
+u =ν 2 (2.126)
∂t ∂x ∂x
Use upwind differencing on a weak conservative form of the equation.
The upwind differencing is known to retain the transportive property.
Show that the formulation preserves the conservative property of the con-
tinuum as well [you are allowed to exclude the diffusive term from the
analysis].
6. In order to investigate and analyze the properties of numerical schemes,
often the following scalar (one-dimensional) convection equation is con-
sidered:
∂ω ∂ω
+λ =0
∂t ∂x
Here ω is any scalar parameter. The spatial derivative is approximated by
a central difference scheme on an equidistant grid with ∆x = Constant.
Please explain the following time-marching schemes based on the scalar
transport equation:
2.44 Computational Fluid Dynamics

A: explicit Euler scheme


B: implicit Euler scheme
C: three-point backward scheme (implicit)
D: Lax-Keller scheme (explicit)
E: Lax-Wendroff scheme (explicit)
F: Mac Cormack scheme (predictor-corrector, explicit)
G: Low-storage Runge-Kutta scheme (3 sub-steps, explicit)

Appendix
Thomas algorithm
We have already seen in Chapter2 that in Crank Nicolson solution procedure,
we get a system of algebric equations which assumes the form of a tridiagonal
matrix problem. Here we shall discuss a very well known solution procedure
known as Thomas algorithm(1949) which utilizes efficiently the advantage of
the tridiagonal form. A tridiagonal system is:
    
d1 a1 0 0 ... ... 0 x1 c1
 b2 d2 a2 0 0 .   x2   c2 
    
 0 b3 d3 a3 0 0 .   x3   c3 
   

0 0 b4 d4 a4 0 0   x4  =  c4 
   

. 0 0  .    . 
   

0 aN −1   .   . 
0 . . . . . . . . . 0 bN dN xN cN
The Thomas Algorithm is a modified Gaussian matrix-solver applied to a tridaig-
onal system. The idea is to transform the coefficient matrix into a upper trian-
gular form. The intermediate steps that solve for x1 , x2 ...xN :
Change di and ci arrays as
 old
bi
dnew
i = d old
i − a i−1 , i = 2, 3 . . . N
di−1
and

dnew
1 = dold
1

Similarly

 old
bi
cnew
i = cold
i − ci−1 , i = 2, 3 . . . N
di−1
and

cnew
1 = cold
1
Finite Difference Method 2.45

At this stage the matrix in upper triangular form. The solution is then obtained
by back substitution as
cN
xN =
dN
and

ck − ak xk+1
xk = , k = N − 1, N − 2, N − 3, . . . 1
dk

Potrebbero piacerti anche