10176

# 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.

### 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:

### PERMANENT CITATION

 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 » Download Demonstration as CDF » Download Author Code »(preview ») Files require Wolfram CDF Player or Mathematica.

#### Related Topics

 RELATED RESOURCES
 The #1 tool for creating Demonstrations and anything technical. Explore anything with the first computational knowledge engine. The web's most extensive mathematics resource. An app for every course—right in the palm of your hand. Read our views on math,science, and technology. The format that makes Demonstrations (and any information) easy to share and interact with. Programs & resources for educators, schools & students. Join the initiative for modernizing math education. Walk through homework problems one step at a time, with hints to help along the way. Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet. Knowledge-based programming for everyone.
 © 2015 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS
 Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX Download or upgrade to Mathematica Player 7EX I already have Mathematica Player or Mathematica 7+