The FEniCSx tutorial#
Author: Jørgen S. Dokken
These webpages give a concise overview of the functionality of DOLFINx, including a gentle introduction to the finite element method. This webpage started as an adaptation of the FEniCS tutorial [LL16], but has evolved into a larger subset of tutorials.
DOLFINx can be used as either C++ or Python software, but this tutorial will focus on Python programming, as it is the simplest and most effective approach for beginners. After having gone through this tutorial, the reader should familiarize themselves with the DOLFINx documentation, which includes the API and numerous demos.
Comments and corrections to this webpage should be submitted to the issue tracker by going to the relevant page in the tutorial, then click the
-symbol in the top right corner and “open issue”.
Interactive tutorials
As this book has been published as a Jupyter Book, we provide interactive notebooks that can be run in the browser. To start such a notebook click the
-symbol in the top right corner of the relevant tutorial.
import dolfinx
print(
f"DOLFINx version: {dolfinx.__version__} based on GIT commit: {dolfinx.git_commit_hash} of https://github.com/FEniCS/dolfinx/"
)
DOLFINx version: 0.10.0 based on GIT commit: b8375fa9fb932cbfce43005eeb4a3d52293f428b of https://github.com/FEniCS/dolfinx/
Clickable API links#
For the modules imported in the tutorial, you can click any function or class to go to the respective API:
from dolfinx.fem import functionspace # Click `functionspace`
from ufl import div, grad # Click `div` and `grad`
import numpy as np # Click `numpy`
print(functionspace, div, grad, np)
<function functionspace at 0x7f409664ccc0> <function div at 0x7f409690df80> <function grad at 0x7f409690dee0> <module 'numpy' from '/dolfinx-env/lib/python3.12/site-packages/numpy/__init__.py'>
References
Hans Petter Langtangen and Anders Logg. Solving PDEs in Python: The FEniCS Tutorial I. Springer International Publishing, Cham, 2016. ISBN 978-3-319-52462-7. doi:10.1007/978-3-319-52462-7.