NUMERICAL METHODS
Our final example is based upon the one-dimensional diffusion equation for
the temperatureφof a system:
∂φ
∂t
=κ
∂^2 φ
∂x^2
. (27.90)
Ifφi,jstands forφ(x 0 +i∆x, t 0 +j∆t) then a forward difference representation
of the time derivative and a central difference representation for the spatial
derivative lead to the following relationship:
φi,j+1−φi,j
∆t
=κ
φi+1,j− 2 φi,j+φi− 1 ,j
(∆x)^2
. (27.91)
This allows the construction of an explicit scheme for generating the temperature
distribution at later times, given that it is known at some earlier time:
φi,j+1=α(φi+1,j+φi− 1 ,j)+(1− 2 α)φi,j, (27.92)
whereα=κ∆t/(∆x)^2.
Although this scheme is explicit, it is not a good one because of the asymmetric
way in which the differences are formed. However, the effect of this can be
minimised if we study and correct for the errors introduced in the following way.
Taylor’s series for the time variable gives
φi,j+1=φi,j+∆t
∂φi,j
∂t
+
(∆t)^2
2!
∂^2 φi,j
∂t^2
+···, (27.93)
using the same notation as previously. Thus the first correction term to the LHS
of (27.91) is
−
∆t
2
∂^2 φi,j
∂t^2
. (27.94)
The first term omitted on the RHS of the same equation is, by a similar argument,
−κ
2(∆x)^2
4!
∂^4 φi,j
∂x^4
. (27.95)
But, using the fact thatφsatisfies (27.90), we obtain
∂^2 φ
∂t^2
=
∂
∂t
(
κ
∂^2 φ
∂x^2
)
=κ
∂^2
∂x^2
(
∂φ
∂t
)
=κ^2
∂^4 φ
∂x^4
, (27.96)
and so, to this accuracy, the two errors (27.94) and (27.95) can be made to cancel
ifαis chosen such that
−
κ^2 ∆t
2
=−
2 κ(∆x)^2
4!
, i.e.α=
1
6
.