next up previous
Next: An example 1-d diffusion Up: The diffusion equation Previous: Introduction

1-d problem with mixed boundary conditions

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} (191)

for $x_l\leq x\leq x_h$, 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} (192)

at $x=x_l$, and
\begin{displaymath}
\alpha_h(t) \,T(x,t)+ \beta_h(t)\,\frac{\partial T(x,t)}{\partial x} = \gamma_h(t),
\end{displaymath} (193)

at $x=x_h$. Here, $\alpha_l$, $\beta_l$, etc., are known functions of time. Of course, $T(x,t_0)$ must be specified at some initial time $t_0$.

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} (194)

where $\delta t$ 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} (195)

In space, we discretize on the usual equally spaced grid-points specified in Eq. (114), and approximate $d^2/dx^2$ 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} (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} (197)

for $i=1,N$, where $T_i^n \equiv T(x_i,t_n)$, and $C= D\,\delta t/(\delta x)^2$. The discretized boundary conditions take the form
$\displaystyle T_0^n$ $\textstyle =$ $\displaystyle \frac{\gamma_l^n\,\delta x-\beta_l^n\,T_1^n}{\alpha_l^n\,\delta x -\beta_l^n},$ (198)
$\displaystyle T_{N+1}^n$ $\textstyle =$ $\displaystyle \frac{\gamma_h^n\,\delta x + \beta_h^n\,T_N^n}{\alpha_h^n\,\delta x +\beta_h^n},$ (199)

where $\gamma_l^n\equiv \gamma_l(t_n)$, 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 $T(x,t)$ in time.


next up previous
Next: An example 1-d diffusion Up: The diffusion equation Previous: Introduction
Richard Fitzpatrick 2006-03-29