Skip to content
/ BEMI Public

A boundary element method (BEM) code for solving the extracellular-membrane-intracellular (EMI) model.

License

Notifications You must be signed in to change notification settings

grosilho/BEMI

Repository files navigation

BEMI

BEMI is a C++ implementation of a boundary element method (BEM) for solving the extracellular-membrane-intracellular (EMI) model in two dimensions.

The EMI model

The EMI model (a.k.a the Cell-by-Cell model) for cardiac electrophysiology is a system of reaction-diffusion equations describing the evolution of the electric potential within each cell. The model has a time derivative only on the transmembrane boundary and has algebraic conditions elsewhere, i.e. it reduces to a differential algebraic equation.

The BEM method

Employing a boundary integral formulation we recast the EMI model to an ordinary differential equation living only on the transmembrane boundary. Thanks to the boundary element method only the transmembrane boundary is discretized (not the cellular or extra-cellular domains) and therefore the number of degrees of freedom is drastically reduced.

Time integration

For the time integration, we employed the mRKC1 method and employed the already available code.

References

This code has been used for the numerical experiments presented in:

  • Rosilho de Souza, G., Pezzuto, S., & Krause, R. (2023). Boundary Integral Formulation of the Cell-by-Cell Model of Cardiac Electrophysiology. Submitted to Engineering Analysis with Boundary Elements, arXiv: 2302.05281.
  • Rosilho de Souza, G., Pezzuto, S., & Krause, R. (2023). Effect of Gap Junction Distribution, Size, and Shape on the Conduction Velocity in a Cell-by-Cell Model for Electrophysiology. Functional Imaging and Modeling of the Heart, 117–126, https://doi.org/10.1007/978-3-031-35302-4_12.

Install and Run

The easiest way to run the code is by creating a Docker image from the Dockerfile provided here and running the code within a container. Otherwise, one could install the dependencies and compile the code as usual.

Docker

To create the Docker image, from the root directory of the repository, run:

docker build -t bemi .

For running the code, execute:

docker run --rm -ti -v "$(pwd)/results":/bemi/results bemi ARGS_LIST

For the ARGS_LIST, see below.

Compile

Before compiling the code install the dependencies: eigen, gmsh, and fftw3. Then, compile2 the code running:

mkdir build && cd build && cmake -S .. -B . && make

Run the code from the build directory as

./bemi ARGS_LIST

For the ARGS_LIST, see the next section.

Command line arguments

For the full list of arguments use the --help option or check out the ARGS_LIST.md file, here we just provide an example.

To run a simulation

  • with step size $\Delta t=0.01 ms$ and mesh size $\Delta x=10\mu m=1e\text{-}3cm$: -dt 1e-2 -dG 1e-3,
  • for a duration of $10ms$: -tend 10,
  • with output in .vtk format every 10 time steps: -vtk true -ofreq 10,
  • on a block of 2x10 cells: -nx 10 -ny 2,
  • with cells of length $c_l=100\mu m=0.01 cm$ and width $c_w=20\mu m=0.002 cm$: -cl 1e-2 -cw 2e-3,
  • both leftmost cells are stimulated: -nic 2,
  • with vertical gap junctions having a wave shape with amplitude $1\mu m=1e\text{-}4 cm$, frequency $2$ and being smooth: -va 1e-4 -vf 2 -vs true,
  • with horizontal gap junctions having a wave shape with amplitude $2\mu m=2e\text{-}4 cm$, length $30\mu m=0.003 cm$ and being squared: -ha 2e-4 -hl 3e-3 -hs false,
  • with horizontal gap junctions randomly placed along the horizontal cell side and their permeability being zero with probability 30% : -halt 2 -hprob 0.3,

execute:

./bemi -dt 1e-2 -dG 1e-3 -tend 10 -vtk true -ofreq 10 -nx 10 -ny 2 -cl 1e-2 
-cw 2e-3 -nic 2 -va 1e-4 -vf 2 -vs true -ha 2e-4 -hl 3e-3 -hs false -halt 2 
-hprob 0.3

The output is stored in the results folder.

Acknowledgements

This work was supported by the European High-Performance Computing Joint Undertaking EuroHPC under grant agreement No 955495 (MICROCARD) co-funded by the Horizon 2020 programme of the European Union (EU) and the Swiss State Secretariat for Education, Research and Innovation.

We are also thankful to Michael Multerer for sharing a starting BEM code.

Footnotes

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

  2. If cmake doesn't find the fftw3 library, we suggest to compile fftw3 using cmake (instead of the traditional ./configure). Check out the Dockerfile to see the commands that we used.

About

A boundary element method (BEM) code for solving the extracellular-membrane-intracellular (EMI) model.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published