Skip to content

MiroK/emi-book-fem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Numerical examples for FEM chapter in EMI book

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published