Time-stepping scheme for the diffusion equation , the average of the explicit and implicit schemes:

where:

  • : value at grid point and timestep ,
  • : grid spacing,
  • : timestep,
  • : diffusion coefficient.

Stable for any timestep and second-order accurate in time and space, but long timesteps leave slowly decaying oscillations near sharp gradients. Each timestep is a tridiagonal system, solved with the Thomas algorithm. The explicit scheme is only stable for .