Δt/h^{2}
framerate:fps
Diffusion on 512×512 square. Implicit scheme and relaxation
algorithm.

Diffusion equation

For the diffusion equation
∂_{t }u = Δu ,
u|_{t=0} = exp(-(r -
r_{o })^{2}/ a^{2}),
the finite-difference scheme on square grid with the space step h
and time step dt is
u_{x,y}^{t+1} =
u_{x,y}^{t} +
{[u_{x+1,y} + u_{x-1,y} + u_{x,y+1} + u_{x,y-1}]
- 4u_{x,y }} (Δt/h^{2}).
Note that the time superscript is omitted in braces.

Explicit scheme

If we use superscript t in braces we get the simple explicit scheme
(the long term in the square brackets is symbolized as [u^{t}])
u_{x,y}^{t+1} =
u_{x,y}^{t} +
{[u^{t}] - 4u_{x,y}^{t}} (Δt/h^{2}) It is stable only for Δt/h^{2} < 1/4. So for small
h we need to use very small time step.

Implicit scheme and relaxation algorithm

Implicit scheme
u_{x,y}^{t+1} =
u_{x,y}^{t} +
{[u^{t+1}] - 4u_{x,y}^{t+1}} (Δt/h^{2}) is stable for all Δt/h^{2}. We rewrite it as
u_{x,y}^{t+1}(1 + 4Δt/h^{2})
= u_{x,y}^{t} + [u^{t+1}] (Δt/h^{2}) and solve iteratively starting with [u^{t}]. Really the
application above makes only two iterations. Therefore it is not accurate
for large time steps.

Diffusion is not very impressive without convection...