Giter VIP home page Giter VIP logo

grosilho / bemi Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 410 KB

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

Home Page: https://github.com/grosilho/BEMI

License: GNU General Public License v3.0

CMake 1.02% Dockerfile 0.13% C++ 74.89% C 13.53% Python 5.21% MATLAB 5.22%
bem boundary-element-method electrophysiology emi extracellular-membrane-intracellular mrkc

bemi's Introduction

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.

bemi's People

Contributors

grosilho avatar

Watchers

 avatar

bemi's Issues

instabilities in visualization

The visualization process creates a mesh for every domain and then evaluates the functions on this mesh employing the boundary data and the green representation formula. For every node in the mesh, the function is evaluated by computing integrals on the boundary.
The problem is that some instabilities are produced for the mesh nodes very close to the boundary, i.e. the first "layer" of nodes at a distance approximatively dx from the boundary. Moreover, it looks like this phenomenon is independent of dx, since it happens only for nodes at a distance dx from the boundary, disregarding the size of dx.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.