Solving a 1D Reaction Diffusion Equation with operator splitting (strang) and where the reaction is defined in CellML
This example solves the weak form of the one-dimensional reaction-diffusion equation using the Galerkin finite element method. The classical form of the governing partial differential equation (PDE) in three-dimension is given by,
where is a scalar dependent variable (e.g. concentration of a chemical species), is a rank-two diffusion tensor, is the reaction term (function of the dependent variable ) and and are spatial coordinates and time respectively.
The reaction term is obtained by solving the following ordinary differential equation (ODE).
where is a constant. Here two different time steps are used for the time integration of PDE and ODE and this approach is known as the 'splitting' method.
This example can be downloaded using git clone:
git clone https://github.com/OpenCMISS-Examples/cellml_split_reaction_diffusion_equation
The python is immediately executable, but the Fortran executable needs to be built first
The fortran version of the example can be configured and built with CMake:
mkdir cellml_split_reaction_diffusion_equation-build cd cellml_split_reaction_diffusion_equation-build cmake -DOpenCMISSLibs_DIR=/path/to/opencmisslib/install ../cellml_split_reaction_diffusion_equation make
This will create the example executable "cellml_split_reaction_diffusion_equation" in ./src/fortran/ directory.
Python version:
cd ./src/python/ python cellml_split_reaction_diffusion_equation.py
Fortran version:
cd ./src/fortran/ ./cellml_split_reaction_diffusion_equation
Results can be visualised by running visualise.cmgui with the Cmgui visualiser.
The following figure shows the one-dimensional computational domain and solution of the primary variable, .
Figure 1. (a) One-dimensional finite element mesh (b) Primary variable solution
The expected results from this example are available in expected_results folder.
The ODE that determines the source/reaction term is solved using CellML and the ODE model is input via constant_rate.xml.
License applicable to this example is described in LICENSE.