Author: Jørgen S. Dokken
This is the source code for the dolfinx-tutorial webpage. If you have any comments, corrections or questions, please submit an issue in the issue tracker.
If you want to contribute to this tutorial, please make a fork of the repository, make your changes, and test that the CI passes.
Alternatively, if you want to add a separate chapter, a Jupyter notebook can be added to a pull request, without integrating it into the tutorial. If so, the notebook will be reviewed and modified to be included in the tutorial.
Any code added to the tutorial should work in parallel. If any changes are made to ipynb files, please ensure that these changes are reflected in the corresponding py files by using jupytext:
The book is built using jupyterbook. The following environment variables should be set if you want to build the book
PYVISTA_OFF_SCREEN=false
PYVISTA_JUPYTER_BACKEND="html"
JUPYTER_EXTENSION_ENABLED=true
LIBGL_ALWAYS_SOFTWARE=1If you run the tutorial using jupyter-lab, for instance through conda, one should set the following environment variables
PYVISTA_OFF_SCREEN=false
PYVISTA_JUPYTER_BACKEND="trame"
JUPYTER_EXTENSION_ENABLED=true
LIBGL_ALWAYS_SOFTWARE=1If you use docker to run your code, you should set the following variables:
docker run -ti -e DISPLAY=$DISPLAY -e LIBGL_ALWAYS_SOFTWARE=1 -e PYVISTA_OFF_SCREEN=false -e PYVISTA_JUPYTER_BACKEND="trame" -e JUPYTER_EXTENSION_ENABLED=true --network=host -v $(pwd):/root/shared -w /root/shared ....To run python scripts, either choose PYVISTA_OFF_SCREEN=True to get screenshots, or render interactive plots with PYVISTA_OFF_SCREEN=False
python3 -m jupytext --sync */*.ipynb --set-formats ipynb,py:lightor
python3 -m jupytext --sync */*.py --set-formats ipynb,py:lightAny code added to the tutorial should work in parallel.
To strip notebook output, one can use pre-commit.
pre-commit run --all-filesIt is adviced to use a pre-installed version of DOLFINx, for instance through conda or docker. Remaining dependencies can be installed with
python3 -m pip install --no-binary=h5py -e .Docker images for this tutorial can be found in the packages tab
Additional requirements on top of the dolfinx/lab:nightly images can be found at Dockerfile and pyproject.toml
An image building DOLFINx, Basix, UFL and FFCx from source can be built using:
docker build -f ./docker/Dockerfile -t local_lab_env .from the root of this repository, and run
docker run --rm -ti -v $(pwd):/root/shared -w /root/shared --init -p 8888:8888 local_lab_envfrom the main directory.