Δt/h2 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 - ro )2/ a2),
the finite-difference scheme on square grid with the space step h and time step dt is
    ux,yt+1 = ux,yt + {[ux+1,y + ux-1,y + ux,y+1 + ux,y-1] - 4ux,y } (Δt/h2).
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 [ut])
    ux,yt+1 = ux,yt + {[ut] - 4ux,yt} (Δt/h2)
It is stable only for Δt/h2 < 1/4. So for small h we need to use very small time step.

Implicit scheme and relaxation algorithm

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

Diffusion is not very impressive without convection...


Simulations on GPU
updated 1 May 2011