Solving the Diffusion-Advection-Reaction Equation in 1D Using Finite Differences

This Demonstration shows the solution of the diffusion-advection-reaction partial differential equation (PDE) in one dimension. The domain is discretized in space and for each time step the solution at time is found by solving for from . The boundary conditions supported are periodic, Dirichlet, and Neumann. The solution can be viewed in 3D as well as in 2D. You can select the source term and the initial conditions from the menus in the main display. Selected preconfigured test cases are available from the dropdown menu. In the above PDE represents the diffusion, represents the advection, and the reaction.

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

The discretized system can be formulated by the matrix equation . The matrices and and the vector take different forms depending on the boundary conditions. The following equations show the full expression of the above equation for the five possible combinations of the boundary conditions: periodic boundary conditions, Dirichlet on both sides of the domain, Dirichlet on the left side and Neumann on the right side, Neumann on the left side and Dirichlet on the right side, and finally Neumann on both sides. The following four variables are used to simplify the writing of expressions shown below in the matrix equation
The left boundary condition is given by and the right boundary conditions by . For example, if the left side has Dirichlet boundary conditions then , while if it has Neumann boundary conditions then , and similarly for the right side. For periodic boundary conditions where is the first node on the left side and is the last node on the right side. is the time step and is the grid spacing. and are the parameters of the PDE itself taken from .
Periodic boundary conditions:
Dirichlet boundary conditions on both ends:
Dirichlet boundary conditions on the left side and Neumann boundary conditions on the right side:
Dirichlet boundary conditions on the right side and Neumann boundary conditions on the left side:
Neumann boundary conditions on both sides:
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.