Professional Documents
Culture Documents
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.