The diffusion equation is a partial differential equation that relates the time rate of change of temperature at a point to the temperature of the surrounding points. In two dimensional form, the diffusion equation is as follows:
As it may appear to you, solving this equation mathematically is not usually an easy process. For that reason, we use a computer. Diffuse! uses both the forward time centered space algorithm and the Dufort-Frankel algorithm to solve the diffusion equation. Both the FTCS and Dufort-Frankel schemes uses the discretized form of the first time derivative and the second space derivative to find the temperature at time n.
The FTCS scheme is easily derived given the discretized form of the derivatives involved. The first time derivative is given by the equation
Similarly, the second space derivative in two dimensions is given by the equation
Combing these discrete forms in the manner indicated by the diffusion equation and solving for Tn+1 gives the form of the diffusion equation used in the forward time centered space algorithm.
The FTCS scheme is not stable under all conditions. The product of the diffusion constant and the time step divided by the square of the space separation of the points must be less than one half for the algorithm to sustain stable solutions.
The Dufort-Frankel scheme uses a similar discretized form that depends on the temperature at both time n and time n-1. The discretized diffusion equation for 2 dimensions used in the Dufort-Frankel scheme looks like the following:
The Dufort-Frankel scheme is stable under all conditions. However, since it relies on the temperature at the two previous time steps, it is not self starting. For this reason, Diffuse! uses the FTCS scheme for the first iteration of the diffusion equation and the Dufort-Frankel scheme for subsequent iterations.