Page 121 - Computational Fluid Dynamics for Engineers
P. 121
4.4 Finite-Difference Methods for Parabolic Equations 107
Tn^ = n _ (Z\x)T 0 n (4.4.16a)
T
2
and
T n+i = T n+i _ 2(Z\ x )T 0 n+1 (4.4.16b)
The last two equations permit T™ x and T^f 1 to be eliminated from the equation
obtained by setting i — 0 in Eq. (4.4.13); the resulting equation can be written
in a form similar to Eq. (4.4.15a),
(bo - a 02Ax)T^ 1 + (a 0 + c^T^ 1 = r 0 (4.4.16c)
The boundary condition at i = / can be dealt in the same way, although in
this problem it is easier to make use of the symmetry with respect to x = 1/2.
The errors in this carefully centered Crank-Nicolson scheme are of order
2
Ax 2 + At , but At need not be related to Ax for stability purposes. The scheme
is unconditionally stable, and second-order accuracy may be achieved with uni-
form x spacing. On the other hand, the unknown value of T is expressed in
terms of / other values of T with two of them known; as a consequence, the
computational arithmetic is more extensive than for an explicit method. How-
ever, the solution of Eqs. (4.4.13) to (4.4.15) can be obtained easily as in the
case when the boundary conditions correspond to those given by Eq. (4.4.4).
In vector notation, Eqs. (4.4.13) and (4.4.15) may be written as
AT = r (4.4.17)
where the (I — l)-dimensional vectors are
Ti rl
T 2 T2
T = r = (4.4.18)
Tj-2 ri-2
7/_i r / - i
and the (/ — l)-order matrix with nonzero elements on only three diagonals
(called the tridiagonal matrix) is
h ci 0
CL2 &2 C2
A = (4.4.19)
G j - 2 k / - 2 C / _ 2
0 a/_i &/_!
Then the solution of Eq. (4.4.19) can be obtained by the Thomas algorithm,
which has two sweeps. In the so-called forward sweep, we compute
/ ? 1 = & 1 , 51 = 7"!