diffusion_ftcs_pde, a MATLAB code which solves the diffusion PDE dudt - mu * d2udx2 = 0 in one spatial dimension, with a constant diffusion coefficient mu, and periodic boundary conditions, using FTCS, the forward time difference, centered space difference method.
We solve for u(x,t), the solution of the constant-velocity diffusion equation in 1D,
du/dt - mu d2u/dx2 = 0over the interval:
0.0 <= x <= 1.0with constant diffusion coefficient:
c = 0.5with periodic boundary conditions:
u(0,t) = u(1,t) for all tand initial condition
u(x,0) = (10x-6)^2 (8-10x)^2 for 0.6 <= x <= 0.8 = 0 elsewhere.
We use a method known as FTCS (forward time, centered space):
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
Plots: