Professional Documents
Culture Documents
Chap2 PDF
Chap2 PDF
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.
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
A1
r A2 A3
Surface A
x
φ = φ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.
∆x
i−1,j+1 i,j+1 i+1,j+1
∆y
P
i−1,j i,j i+1,j
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:
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
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
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
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
∂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
∂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
∂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
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 )
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
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 )
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 )
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
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
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
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)
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:
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 )
ǫ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
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
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)
Thus,
α(∆t) 2 (km ∆x)
4 2 sin ≥0
(∆x) 2
Thus,
4α(∆t) 2 (km ∆x)
2 sin −1≤1
(∆x) 2
α(∆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
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
∂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.
0 0 0
100 C 0 C 100 C
n
i−1 i i+1
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
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
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ζ
+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.
∂ω
Z Z Z
dℜ = − (V · ∇)ωdℜ + ν∇2 ωdℜ (2.83)
ℜ ∂t ℜ ℜ
∂ω ∂
Z Z
dℜ = ω dℜ
ℜ ∂t ∂t ℜ
As because,
Z Z Z
ν (∇ω) · n dA = ν ∇ · (∇ω) dℜ = ν ∇2 ω dℜ
Ao ℜ ℜ
∂
Z Z Z
ω dℜ = − (V ω) · n dA + ν (∇ ω) · n dA (2.84)
∂t ℜ Ao Ao
∂ω ∂
= − (uω) (2.85)
∂t ∂x
" 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
ωin+1 − ωin
n n
ωi+1 − ωi−1
= −uni (2.90)
∆t 2∆x
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
I1 I2
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
∆x ∆x
u
u
i−2 i−1 i i+1 i+2
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.
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
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,
and
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
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
where
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)
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)
ζ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
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
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
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.
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
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.
Problems
1. Consider the nonlinear equation
∂u ∂ 2u
u =µ 2 (2.125)
∂x ∂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
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
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.
∂u ∂2u
=α 2
∂t ∂x
can be written as
Finite Difference Method 2.43
∂ω ∂ω ∂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
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