GithubHelp home page GithubHelp logo

emi-book-fem's Introduction

Solving the EMI equations using finite element methods

This repository contains source codes and an environment used to produce results of the FEM chapter in the EMI book EMI: CELL BASED MATHEMATICAL MODEL OF EXCITABLE CELLS.

Installation

Obtaining the image

The environment is provided as a docker container built on top of FEniCS 2017.2.0 official docker image. Note that we use python 2 in the code base.

The container can be built and run locally by executing

git clone https://github.com/MiroK/emi-book-fem.git
cd emi-book-fem
docker build --no-cache -t emi_book_fem .
docker run -it -v $(pwd):/home/fenics/shared emi_book_fem

Alternatively, pull and run the image built in the cloud

docker run -it -v $(pwd):/home/fenics/shared mirok/emi-book-fem

Testing

Having lauched the container navigate to the source folder and launch the test shell script

# You are inside docker shell
# fenics@268200ea18c2:~$ pwd
# /home/fenics

cd emi-book-fem
cd emi
sh test.sh

If You are all set message appears everything is good to go.

Usage

Results of the chapter can be obtained by running convergence studies of the different formulations. Below, the single-dimensional primal formulation is used

fenics@268200ea18c2:~/emi-book-fem/emi$ python check_sanity.py fem/prime_single.py -ncases 4 -param_kappa 1 -param_eps 1E-2

with 4 refinements, conductivity value 1, and time step parameter 0.01. A succesfull run results in a result file sanity_fem.prime_single_standard_kappa1_eps0.01.txt located in /home/fenics/emi-book-fem/emi/results. The file contains details of the refinement study in particular the columns of mesh sizes (h) and different errors as specified in the setup_error_monitor function of prime_single.py module. In the example below a header file of the result script can be seen.

# ('plot', 0), ('ncases', 1), ('save_dir', './results'), ('case0', 0), ('problem', 'fem/prime_single.py'), ('norm', 'standard')
# kappa1_eps1
# ndofs h e[|u|_1] r[|u|_1] e[|u|_0] r[|u|_0] e[|v|_0] r[|v|_0] subspaces

Therefore, extracting the first and third columns from the file a convergence of the global potential in the (broken) $H^1$ norm can be plotted.

Implementation of the four finite element formulations of the EMI model discussed in the chapter can be found as modules in the ./emi/fem folder

Troubleshooting

Please use the GitHub issue tracker for reporting issues, discussing code contributions or requesting assistance.

Citing

This code is based on several other packages in addition to FEniCS.

  1. FEniCS_ii is used to perform assembly of the multiscale varitional forms
  2. cbc.block is used to represent the discrete operators
  3. ulfy is used to generate manufactured solutions
  4. quadpy is a dependency of 1.

These can be cited as

  1. Kuchta, Miroslav. "Assembly of multiscale linear PDE operators." arXiv preprint arXiv:1912.09319 (2019).
  2. Mardal, Kent-Andre, and Joachim Berdal Haga. "Block preconditioning of systems of PDEs." Automated solution of differential equations by the finite element method. Springer, Berlin, Heidelberg, 2012. 643-655.

emi-book-fem's People

Contributors

mirok avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

barbara-ge

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.