next up previous
Next: 2-d problem with Neumann Up: The diffusion equation Previous: An improved 1-d solution

2-d problem with Dirichlet boundary conditions

Let us consider the solution of the diffusion equation in two dimensions. Suppose that
\begin{displaymath}
\frac{\partial T(x,y,t)}{\partial t} = D\,\frac{\partial^2 T...
...)}{\partial x^2}+D\,\frac{\partial^2 T(x,y,t)}
{\partial y^2},
\end{displaymath} (214)

for $x_l\leq x\leq x_h$, and $0\leq y \leq L$. Suppose that $T(x,y,t)$ satisfies mixed boundary conditions in the $x$-direction:
\begin{displaymath}
\alpha_l(t)\,T(x,y,t) + \beta_l(t)\,\frac{\partial T(x,y,t)}{\partial x} = \gamma_l(y,t),
\end{displaymath} (215)

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

at $x=x_h$. Here, $\alpha_l$, $\beta_l$, etc., are known functions of $t$, whereas $\gamma_l$, $\gamma_h$ are known functions of $y$ and $t$. Furthermore, suppose that $T(x,y,t)$ satisfies the following simple Dirichlet boundary conditions in the $y$-direction:
\begin{displaymath}
T(x,0,t) = T(x,L,t) = 0.
\end{displaymath} (217)

As before, we discretize in time on the uniform grid $t_n=t_0+n\,\delta t$, for $n=0,1,2,\cdots$. Furthermore, in the $x$-direction, we discretize on the uniform grid $x_i = x_l + i\,\delta x$, for $i=0,N+1$, where $\delta x = (x_h-x_l)/(N+1)$. Finally, in the $y$-direction, we discretize on the uniform grid $y_j = j\,\delta y$, for $j=0,J$, where $\delta y = L/J$. Adopting the Crank-Nicholson temporal differencing scheme discussed in Sect. 6.6, and the second-order spatial differencing scheme outlined in Sect. 5.2, Eq. (214) yields

$\displaystyle \frac{T_{i,j}^{n+1}-T_{i,j}^n}{\delta t} - \frac{D}{2}\,
\frac{T_...
... x)^2}
- \frac{D}{2}\left(\frac{\partial^2 T}{\partial y^2}\right)_{i,j}^{n+1}=$      
$\displaystyle \frac{D}{2}\,
\frac{T_{i-1,j}^{n}-2\,T_{i,j}^{n}+T_{i+1,j}^{n}}{(...
...ta x)^2} +
\frac{D}{2}\left(\frac{\partial^2 T}{\partial y^2}\right)_{i,j}^{n},$     (218)

where $T_{i,j}^n\equiv T(x_i,y_j,t_n)$. The discretized boundary conditions take the form
$\displaystyle T_{0,j}^n$ $\textstyle =$ $\displaystyle \frac{\gamma_{l\,j}^n\,\delta x-\beta_l^n\,T_{1,j}^n}{\alpha_l^n\,\delta x -\beta_l^n},$ (219)
$\displaystyle T_{N+1,j}^n$ $\textstyle =$ $\displaystyle \frac{\gamma_{h\,j}^n\,\delta x + \beta_h^n\,T_{N,j}^n}{\alpha_h^n\,\delta x +\beta_h^n},$ (220)

plus
\begin{displaymath}
T_{i,0}^n = T_{i,J}^n = 0.
\end{displaymath} (221)

Here, $\alpha_l^n\equiv \alpha_l(t_n)$, etc., and $\gamma_{l\,j}^n\equiv
\gamma_l(y_j,t_n)$, etc.

Adopting the Fourier method introduced in Sect. 5.7, we write the $T_{i,j}^n$ in terms of their Fourier-sine harmonics:

\begin{displaymath}
T_{i,j}^n = \sum_{k=0}^{J} \hat{T}_{i,k}^n\,\sin(j\,k\,\pi/J),
\end{displaymath} (222)

which automatically satisfies the boundary conditions (221). The above expression can be inverted to give (see Sect. 5.9)
\begin{displaymath}
\hat{T}_{i,j}^n = \frac{2}{J}\sum_{k=0}^{J} T_{i,k}^n\,\sin(j\,k\,\pi/J).
\end{displaymath} (223)

When Eq. (218) is written in terms of the $\hat{T}_{i,j}^n$, it reduces to
$\displaystyle -\frac{C}{2}\,\hat{T}_{i-1,j}^{n+1} + \left\{1+C\,(1+j^2\,\kappa^2/2)\right\}\,
\hat{T}_{i,j}^{n+1}-\frac{C}{2}\,\hat{T}_{i+1,j}^{n+1}
=$      
$\displaystyle \frac{C}{2}\,\hat{T}_{i-1,j}^{n} + \left\{1-C\,(1+j^2\,\kappa^2/2)\right\}\,
\hat{T}_{i,j}^{n}+\frac{C}{2}\,\hat{T}_{i+1,j}^{n},$     (224)

for $i=1,N$, and $j=0,J$. Here, $C= D\,\delta t/(\delta x)^2$, and $\kappa = \pi\,\delta x/L$. Moreover, the boundary conditions (219) and (220) yield
$\displaystyle \hat{T}_{0,j}^n$ $\textstyle =$ $\displaystyle \frac{\Gamma_{l\,j}^n\,\delta x-\beta_l^n\,\hat{T}_{1,j}^n}{\alpha_l^n\,\delta x -\beta_l^n},$ (225)
$\displaystyle \hat{T}_{N+1,j}^n$ $\textstyle =$ $\displaystyle \frac{\Gamma_{h\,j}^n\,\delta x + \beta_h^n\,\hat{T}_{N,j}^n}{\alpha_h^n\,\delta x +\beta_h^n},$ (226)

where
\begin{displaymath}
\hat{\Gamma}_{l\,j}^n = \frac{2}{J}\sum_{k=0}^{J} \gamma_{l,k}^n\,\sin(j\,k\,\pi/J),
\end{displaymath} (227)

etc. Equations (224)--(226) constitute a set of $J+1$ uncoupled tridiagonal matrix equations for the $\hat{T}_{i,j}^{n+1}$, with one equation for each separate value of $j$.

In order to advance our solution by one time-step, we first Fourier transform the $T_{i,j}^n$ and the boundary conditions, according to Eqs. (223) and (227). Next, we invert the $J+1$ tridiagonal equations (224)--(226) to obtain the $\hat{T}_{i,j}^{n+1}$. Finally, we reconstruct the $T_{i,j}^n$ via Eq. (222).


next up previous
Next: 2-d problem with Neumann Up: The diffusion equation Previous: An improved 1-d solution
Richard Fitzpatrick 2006-03-29