Diffusion in multi-dimensions#
Sometimes it can be useful to mix explicit and implicit methods. In 1D, the Crank-Nicholson method is
where on the right-hand side we take the average of the explicit and implicit updates. This method is described as semi-implicit. Also stable for any
The alternating-direction implicit scheme is a way to solve the 2D diffusion equation
The idea is to split the update into two half timesteps:
In the first step we treat the
Exercise: 2D diffusion
Implement this scheme to solve for the time evolution of the temperature profile in a 2D square box that is at