A Python implementation of the exponential multirate Runge-Kutta-Chebychev (emRKC) method with applications to the monodomain model in cardiac electrophysiology. This code has been developed and used to produce the numerical results in
Rosilho De Souza, G. R., Grote, M. J., Pezzuto, S., & Krause, R. (2024). Explicit stabilized multirate methods for the monodomain model in cardiac electrophysiology. ESAIM: Mathematical Modelling and Numerical Analysis (in press). http://arxiv.org/abs/2401.01745
The emRKC method combines multirate explicit stabilized methods and exponential integration. It is a first-order accurate fully explicit method without step size restrictions. In numerical experiments it has shown higher performance than the popular and efficient IMEX Rush-Larsen method1.
emRKC solves ODEs of the type
A particular and important application case reducing to such ODE is the semi-discrete monodomain equation, where
emRKC is an extension of the multirate Runge-Kutta-Chebychev (mRKC) method2 3 where the terms
The modified equation.
More specifically, emRKC can be seen as a Runge-Kutta-Chebyshev (RKC) method applied to the modified equation
The auxiliary problem.
The averaged right-hand side
The code implements the emRKC, mRKC and the baseline IMEX Rush-Larsen method. As spatial discretization we offer finite differences evaluated with discrete cosine transforms (DCT) and the finite element method (FEM). For FEM we employ the FEniCSx package.
For runnning simulations using the DCT spatial discretization a simple conda or venv environment is enough. The environment.yml/requirements.txt files are provided in /etc
. After setting up the environment, the C++ ionic models must be compiled. On linux do:
cd problem_classes/ionicmodels/cpp
c++ -O3 -Wall -shared -std=c++11 -fPIC -fvisibility=hidden $(python3 -m pybind11 --includes) bindings_definitions.cpp -o ionicmodels$(python3-config --extension-suffix)
On MacOS use the compilation command provided in problem_classes/ionicmodels/cpp/compilation_commands.txt
.
Then, for running a simulation execute:
python3 Solve_Monodomain.py --space_disc DCT --o_freq 10 --end_time 10 --domain_name cuboid_2D_very_small --refinements 2 --order 4
For other command line options and their explanation, see
python3 Solve_Monodomain.py --help
The solution can be visualized with the visualization/plot_DCT_sol.py
script.
For the FEM spatial discretization FEniCSx is needed. However, due to specific code for loading the fibers generated by lifex-fiber4, a specific version of FEniCSx and adios4dolfinx are needed. Therefore, we suggest to work in a Docker container.
Pull the Docker image:
docker pull rosilho/emrkc_dolfinx
docker tag rosilho/emrkc_dolfinx emrkc
From the root folder of the emRKC repository, build the ionic models for the docker containers
docker run --rm -ti -v "$(pwd)":/src -w /src/problem_classes/ionicmodels/cpp emrkc bash
c++ -O3 -Wall -shared -std=c++11 -fPIC -fvisibility=hidden $(python3 -m pybind11 --includes) bindings_definitions.cpp -o ionicmodels$(python3-config --extension-suffix)
exit
Then run a simulation
docker run --rm -ti -v "$(pwd)":/src emrkc mpirun -n 4 python3 Solve_Monodomain.py --space_disc FEM --o_freq 1 --end_time 10 --domain_name 03_fastl_LA --order 1 --fibrosis
Results are visualized with Paraview.
Footnotes
-
Lindner, L. P., Gerach, T., Jahnke, T., Loewe, A., Weiss, D., & Wieners, C. (2023). Efficient time splitting schemes for the monodomain equation in cardiac electrophysiology. International Journal for Numerical Methods in Biomedical Engineering, 39(2), e3666. https://doi.org/10.1002/cnm.3666 ↩
-
Abdulle, A., Grote, M. J., & Rosilho de Souza, G. (2022). Explicit stabilized multirate method for stiff differential equations. Mathematics of Computation, 91(338), 2681–2714. https://doi.org/10.1090/mcom/3753 ↩
-
Rosilho De Souza, G. (2022). mRKC: a multirate Runge—Kutta—Chebyshev code. https://github.com/grosilho/mRKC ↩
-
Africa, P. C., Piersanti, R., & Fedele, M. (2022). lifex-fiber: an open tool for myofibers generation in cardiac computational models (1.4.0). Zenodo. https://doi.org/10.5281/zenodo.7622070 ↩