You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Francesco Ballarin a42ffc6a41 Update header for year 2021 1 month ago
docker Update header for year 2021 1 month ago
docs Update README 3 years ago
multiphenics Update header for year 2021 1 month ago
tests/unit Update header for year 2021 1 month ago
tutorials Update header for year 2021 1 month ago
.gitignore Upgrade (if possible) pytest from Dockerfile 2 years ago
.gitlab-ci.yml Temporarily prevent flake8 from importing packages while testing, as this has been broken by new pytest versions 2 years ago
AUTHORS Add Ricardo Ruiz Baier in AUTHORS file 1 year ago
COPYING Add GNU LGPL license file 4 years ago Add script 3 years ago Add tutorial 9 to readme [ci skip] 1 year ago
setup.cfg Ignore new flake8 E741 9 months ago Update header for year 2021 1 month ago

multiphenics -- easy prototyping of multiphysics problems in FEniCS

multiphenics -- easy prototyping of multiphysics problems in FEniCS

0. Introduction

multiphenics is a python library that aims at providing tools in FEniCS for an easy prototyping of multiphysics problems on conforming meshes. In particular, it facilitates the definition of subdomain/boundary restricted variables and enables the definition of the problem by means of a block structure.

1. Prerequisites

multiphenics requires FEniCS (>= 2018.1.0, python 3) with PETSc and SLEPc.

Support for FEniCS-X is available in the fenicsx branch.

2. Installation and usage

Simply clone the multiphenics public repository

git clone

and install the package by typing

python3 install

2.1. multiphenics docker image

If you want to try multiphenics out but do not have FEniCS already installed, you can pull our docker image from Docker Hub. All required dependencies are already installed. multiphenics tutorials and tests are located at


3. Tutorials

Several tutorials are provided in the tutorials subfolder.

  • Tutorial 1: block Poisson test case, to introduce the block notation used in the library.
  • Tutorial 2: Navier-Stokes problem using block matrices.
  • Tutorial 3: weak imposition of Dirichlet boundary conditions by Lagrange multipliers using block matrices and discarding interior degrees of freedom.
  • Tutorial 4: computation of the inf-sup constant for a Stokes problem assembled using block matrices.
  • Tutorial 5: computation of the inf-sup constant for the problem presented in tutorial 3.
  • Tutorial 6: several examples on optimal control problems, with different state equations (elliptic, Stokes, Navier-Stokes), control (distributed or boundary) and observation (distributed or boundary).
  • Tutorial 7: generation of restrictions for meshes obtained from gmsh.
  • Tutorial 8: how to get the list of degrees of freedom associated to a specific restriction, and use it e.g. to perform local modifications to assembled tensors.
  • Tutorial 9: applications of multiphenics to multiphysics problems. We are looking forward to receiving further multiphysics examples from our users!

4. Authors and contributors

multiphenics is currently developed and maintained at SISSA mathLab by Dr. Francesco Ballarin, under the supervision of Prof. Gianluigi Rozza in the framework of the AROMA-CFD ERC CoG project. Please see the AUTHORS file for a list of contributors.

Contact us by email for further information or questions about multiphenics, or open an issue on our issue tracker. multiphenics is at an early development stage, so contributions improving either the code or the documentation are welcome, both as patches or merge requests.

  • Block matrix support in DOLFIN-X, either as MatNest or monolithic matrices. In multiphenics we always assemble block matrices into a monolithic matrix, and also support possible restriction of the unknowns to subdomains and/or boundaries.
  • Mixed dimensional branch in DOLFIN pursues a similar goal to multiphenics. It requires the user the install the corresponding branches of UFL and FFC. In contrast, multiphenics does not require any change to the underlying FEniCS installation.
  • multimesh support in FEniCS, which aims at providing support for problems on non conforming meshes. In multiphenics we are rather interested in conforming meshes, with possible restriction of the unknowns to subdomains and/or boundaries.
  • CutFEM, an unfitted finite element framework for multi-physics problems that relies on the FEniCS project.
  • CBC.Block for the definition of block matrices and vectors in FEniCS.
  • Weak imposition of Dirichlet Dirichlet boundary conditions by Lagrange multipliers is a frequently asked question on FEniCS support forums [1, 2]. Some answers provide possible solutions to the problem (e.g. constraining the useless degrees of freedom by DirichletBC), which however may result in an unnecessarily large system to be solved. multiphenics handles subdomain/boundary restricted variables in an efficient and automatic way.
  • Please contact us by email if you have other related resources.

6. How to cite

If you use multiphenics in your work, please cite the multiphenics website.

7. License

Like all core FEniCS components, multiphenics is freely available under the GNU LGPL, version 3.

Google Analytics