Code covered by the BSD License
Suraj Shankar (view profile)
10 Sep 2012
The parabolic diffusion equation is simulated in both 1D and 2D
Watch this File
The diffusion equation is simulated using finite differencing methods (both implicit and explicit) in both 1D and 2D domains. In both cases central difference is used for spatial derivatives and an upwind in time.
Those modifications are for the Diffusion_2D.m
These are quite nice visualizations. I found it nice to increase the time step to 100 to see more progression.
For better visualization, I recommend adding the command 'clf' immediately at the beginning of the loop as well as adding these line just before and after drawnow:
pause(0.01) % or 0.1 for slower update
The code is meant to be pedagogical in nature and has been made in line with the 12-steps to Navier-Stokes practical module, for which I would like to credit Lorena Barba and her online course on CFD.