Implementing network models in FEniCS
The graphnics
library solves network models using the finite element method. This is facilitated via the FenicsGraph
class which is an extension of the DiGraph
class in networkx
.
Demos
- Introduction to
Graphnics
. - Pulsatile flow in rat tumour vasculature
- Vasomotion in arterial trees
- Solving coupled 3d-1d network models using
fenics_ii
Runtimes
The library fenics_ii
has been used for the implementation as it provides rapid and robust assembly of mixed-dimensional problems. The runtimes for the most computationally expensive model is shown here:
Dependencies and installation
The core functionality of graphnics
is provided by the following libraries:
Some of the network flow models require mixed-dimensional assembly, which is provided by the following libraries:
Installation
Provided that these dependencies are installed, graphnics
can be pip-installed via
git clone https://github.com/IngeborgGjerde/graphnics/ && cd graphnics
python3 -m pip install .
Should you have trouble installing these dependencies, we recommend you use the below docker image.
Docker image
The full environment for graphnics
, along with demos, is provided as a docker container. The container can be built and run locally by executing
git clone https://github.com/IngeborgGjerde/graphnics/
cd graphnics/docker
docker build --no-cache -t graphnics . # build docker image
cd ..
# make container
docker run --name graphnics-container -v "$(pwd):/home/fenics/shared" -d -p 127.0.0.1:8888:8888 graphnics 'jupyter-notebook --ip=0.0.0.0'
The directory you run the above command from will then be shared with the docker container.
In order to run the jupyter notebook demos, execute
docker logs graphnics-container
in the terminal. This will print a link to the jupyter notebook. Copy the link and paste it into your browser.
To run scripts natively in the container, you can enter the container by running
docker exec -it graphnics-container /bin/bash
and access the shared directory by running
cd shared
Citation
You can cite the repo using arxiv preprint
@article{graphnics2022gjerde,
author = {{Gjerde}, Ingeborg G.},
title = "{Graphnics: Combining FEniCS and NetworkX to simulate flow in complex networks}",
journal = {arXiv e-prints},
year = 2022,
month = dec,
archivePrefix = {arXiv},
eprint = {2212.02916}}