diffusion_ftcs_pde


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 = 0
      
over the interval:
        0.0 <= x <= 1.0
      
with constant diffusion coefficient:
        c = 0.5
      
with periodic boundary conditions:
        u(0,t) = u(1,t) for all t
      
and 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):

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

References:

  1. Willem Hundsdorfer, Jan Verwer,
    Numerical solution of time-dependent diffusion-diffusion-reaction equations,
    Springer, 2003
    ISBN: 978-3-662-09017-6

Source Code:

Plots:


Last revised on 27 January 2021.