Suppose we wish to solve, ∂θ ∂2θ =α 2 (1) ∂t ∂x in the range 0 ≤ x ≤ L on the uniform grid, xi = iL/N , where δx = L/N is the steplength and N the number of intervals. So the grid points vary between x0 = 0 an xn = L. The timestep is δt. The forward difference method for solving this equation follows from the discretization, h θ n − 2θ n + θ n i θin+1 − θin i+1 i = α i−1 . δt δx2 (2) Here θin is the numerical approximation to θ(xi , tn ) where tn denotes the nth timestep. The method for analyzing the stability of this method is very similar to that for analyzing Euler’s method of solving the ordinary differential equation, dy/dt = −ay, and also owes much to the analytical technique, Separation of Variables, for solving Fourier’s equation. We set, θin = An sin ipπ . N (3) By doing this we are assuming that the boundary conditions for θ at x = 0 and x = L are that θ = 0. The value p is an integer between 1 and N − 1. If one sketches the solution given in Eq. (3) then p = 1 corresponds to a discretely sampled half sine wave. On the other hand, when p = N − 1, then one gets something which is similar to the following, • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • where the bullet points are the values of the function at the grid points. Here I have used N = 50 to illustrate the solution. It reminds me of the posters for the film, Jaws. On substituting Eq. (3) into Eq. (2) we obtain, hA i ipπ An h ipπ (i + 1)pπ i (i − 1)pπ n+1 − An sin = α 2 sin − 2 sin + sin δt N δx N N N i An h ipπ pπ = α 2 2 cos − 2, sin using multiple angle formulae. δx N N Upon rearranging we get, h i δt pπ An+1 = An 1 + 2α 2 cos −1 . δx N 2 On defining r = αδt/δx this becomes, h i pπ An+1 = An 1 + 2r cos −1 . N (4) Solutions to Fourier’s equation decay in time, and therefore the coefficient of An must be less than unity in magnitude. This means that we need, pπ − 1 < 1. (5) −1 < 1 + 2r cos N The right hand inequality is always satisfied because the term in round brackets is always negative. Therefore we need to rearrange the left hand inequality; this gives, r < (1 − cos pπ −1 . N (6) The smallest value of the right hand side of Eq. (6) is when p = N −1, and given that cos((N −1)π/N ) = cos(1/N ), we eventually get, 1 r< (7) 1 + cos(1/N ) as the stability criterion. Clearly if N is large, then this is roughly r < 21 , but the stability boundary is just slightly less restrictive than that. Given that the stability boundary corresponds to p = N − 1, the sign that instability is happening in your computations is that your numerical solution will become just like that shown in the above Figure. In addition, and given that the coefficient of An in Eq. (4) is now negative, your solution will also alternate in sign from timestep to timestep. Although Eq. (7) gives the stability boundary for r, one really needs values which are much smaller than that in practice. One reason is accuracy. The other reason is that, if r is above half the critical value given in (7) but still obeys (7), then your solutions will decay in time, but they will also decay in an oscillatory manner from timestep to timestep. So one needs to be well within this maximum timestep. Finally, the same sort of analysis applies in both 2D and 3D, and it follows easily with θ = 0 boundary conditions. I’ll leave that to you as a form of entertainment!