Skip to content

Getting started

William Jussiau edited this page May 27, 2025 · 27 revisions

Installation 🛠️

conda

The conda environment required to run the code can be extracted from the file environment.yml.

The environment file should look like this:

name: fenics
channels:
  - conda-forge
  - defaults
dependencies:
  - python>=3.10,<3.11
  - fenics=2019.1.0
  - meshio=5.3.5
  - scipy=1.14.1
  - pandas=2.2.3
  - control=0.10.1
  - conda-build

The proposed pipeline is:

conda env create -n fenics --file environment.yml
conda-develop src

It is important that python is installed with a version >=3.10 because dataclasses are being used. Also, it is important that the latest version of fenics is used (namely 2019.1.0).

The folder src in the root folder should be appended to the Python system path. To do that, either use conda-develop src from the root, or (manually) create a conda.pth file in <YOUR_ENV_PATH>/lib/python3.xx/site-packages/ containing the absolute paths to the src folder.

Additional path tweaking is sometines required for FEniCS to be found through the dolfin module (see e.g. this problem with PKG_CONFIG).

Docker 🐳

[coming soon]

Run examples

After the conda environment has been set-up correctly, you can test the installation from a Python terminal:

  1. Try importing FEniCS with import dolfin
  2. Run examples from the examples folder:
  • cylinder/run_cylinder_example.py and cavity/run_cavity_example.py with Python for time simulations,
  • mpitest/demo_poisson.py with MPI (e.g. mpirun -np 2 demo_poisson.py) to check that the parallel tools are running smoothly.

⚠️ If you observe that mpirun is excessively slow, you might want to have a look at this thread about MPI and OpenMP.

Clone this wiki locally