Explict scheme for the diffusion equation in two dimensions
The
2+1 -dimensional diffusion equation, with the diffusion constant
D=1 , is given by
\begin{equation*}
\frac{\partial u}{\partial t}=\left(\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}\right),
\end{equation*}
where we have
u=u(x,y,t) .
We assume that we have a square lattice of length
L with equally
many mesh points in the
x and
y directions.
We discretize again position and time using now
\begin{equation*}
u_{xx}\approx \frac{u(x+h,y,t)-2u(x,y,t)+u(x-h,y,t)}{h^2},
\end{equation*}
which we rewrite as, in its discretized version,
\begin{equation*}
u_{xx}\approx \frac{u^{l}_{i+1,j}-2u^{l}_{i,j}+u^{l}_{i-1,j}}{h^2},
\end{equation*}
where x_i=x_0+ih , y_j=y_0+jh and t_l=t_0+l\Delta t , with h=L/(n+1) and \Delta t the time step.