Next: An example 1-d diffusion
Up: The diffusion equation
Previous: Introduction
Consider the solution of the diffusion equation in one dimension.
Suppose that
![\begin{displaymath}
\frac{\partial T(x,t)}{\partial t} = D\,\frac{\partial^2 T(x,t)}{\partial x^2},
\end{displaymath}](img842.png) |
(191) |
for
, subject to the mixed spatial boundary conditions
![\begin{displaymath}
\alpha_l(t)\,T(x,t) + \beta_l(t)\,\frac{\partial T(x,t)}{\partial x} = \gamma_l(t),
\end{displaymath}](img843.png) |
(192) |
at
, and
![\begin{displaymath}
\alpha_h(t) \,T(x,t)+ \beta_h(t)\,\frac{\partial T(x,t)}{\partial x} = \gamma_h(t),
\end{displaymath}](img844.png) |
(193) |
at
. Here,
,
, etc., are known functions of time.
Of course,
must be specified at some initial time
.
Equation (191) needs to be discretized in both time and space.
In time, we discretize
on the equally spaced grid
![\begin{displaymath}
t_n = t_0 + n\,\delta t,
\end{displaymath}](img846.png) |
(194) |
where
is the time-step. Adopting a
simple first-order differencing scheme, Eq. (191) becomes
![\begin{displaymath}
\frac{T(x,t_{n+1}) - T(x,t_n)}{\delta t}
= D \,\frac{\partial^2 T(x,t_n)}{\partial x^2}+ O(\delta t).
\end{displaymath}](img848.png) |
(195) |
In space,
we discretize on the usual equally spaced grid-points specified in Eq. (114),
and approximate
via the second-order, central difference scheme
introduced in Eq. (115). The spatial boundary conditions are discretized in a similar
manner to Eqs. (134) and (135). Thus, Eq. (195) yields
![\begin{displaymath}
\frac{T_i^{n+1}-T_i^n}{\delta t} = D\,\frac{T_{i-1}^n-2\,T_i^n+T_{i+1}^n}{(\delta x)^2},
\end{displaymath}](img849.png) |
(196) |
or
![\begin{displaymath}
T_i^{n+1} = T_i^n + C\,\left(T_{i-1}^n-2\,T_i^n+T_{i+1}^n\right)
\end{displaymath}](img850.png) |
(197) |
for
, where
, and
.
The discretized boundary conditions take the form
where
, etc. The discretization scheme outlined above
is termed first-order in time and second-order in space.
Equations (197)-(199) constitute a fairly straightforward iterative scheme which
can be used to evolve the
in time.
Next: An example 1-d diffusion
Up: The diffusion equation
Previous: Introduction
Richard Fitzpatrick
2006-03-29