From 38985b1746cb73a83ab2ec9024045c4ed2996bd1 Mon Sep 17 00:00:00 2001 From: Jorgen Schartum Dokken Date: Tue, 7 Jul 2026 14:14:41 +0200 Subject: [PATCH 1/7] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 386bf735..45f0e4bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "DOLFINx_Tutorial" -version = "0.11.0" +version = "0.11.1" dependencies = [ "jupyter-book<2.0", "meshio", From 18cb2ebaec4ea8407f375c902c6132d46539449a Mon Sep 17 00:00:00 2001 From: "Ifthakhar A. Riyad" Date: Tue, 4 Aug 2026 10:46:42 +0200 Subject: [PATCH 2/7] Fixed variable names in error computation (#335) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump version * Fix variable names in error computation * Rename variables. Resolve #330 (#331) * Rename variables. Resolve #330 * Bump main version * Update files and cherry-pick fix from main --------- Co-authored-by: Jorgen Schartum Dokken Co-authored-by: Jørgen Schartum Dokken --- chapter1/fundamentals_code.ipynb | 10 +++++----- chapter1/fundamentals_code.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/chapter1/fundamentals_code.ipynb b/chapter1/fundamentals_code.ipynb index 75bb9405..006c32e7 100644 --- a/chapter1/fundamentals_code.ipynb +++ b/chapter1/fundamentals_code.ipynb @@ -390,7 +390,7 @@ "(error-norm)=\n", "## Computing the error\n", "Finally, we want to compute the error to check the accuracy of the solution.\n", - "We do this by comparing the finite element solution `u` with the exact solution.\n", + "We do this by comparing the finite element solution `uh` with the exact solution.\n", "First we interpolate the exact solution into a function space that contains it" ] }, @@ -402,8 +402,8 @@ "outputs": [], "source": [ "V2 = fem.functionspace(domain, (\"Lagrange\", 2))\n", - "uex = fem.Function(V2, name=\"u_exact\")\n", - "uex.interpolate(lambda x: 1 + x[0] ** 2 + 2 * x[1] ** 2)" + "ue = fem.Function(V2, name=\"u_exact\")\n", + "ue.interpolate(lambda x: 1 + x[0] ** 2 + 2 * x[1] ** 2)" ] }, { @@ -412,7 +412,7 @@ "metadata": {}, "source": [ "We compute the error in two different ways.\n", - "First, we compute the $L^2$-norm of the error, defined by $E=\\sqrt{\\int_\\Omega (u_D-u_h)^2\\mathrm{d} x}$.\n", + "First, we compute the $L^2$-norm of the error, defined by $E=\\sqrt{\\int_\\Omega (u_e-u_h)^2\\mathrm{d} x}$.\n", "We use UFL to express the $L^2$-error, and use {py:func}`dolfinx.fem.assemble_scalar` to compute the scalar value.\n", "In DOLFINx, {py:func}`assemble_scalar`\n", "only assembles over the cells on the local process.\n", @@ -428,7 +428,7 @@ "metadata": {}, "outputs": [], "source": [ - "L2_error = fem.form(ufl.inner(uh - uex, uh - uex) * ufl.dx)\n", + "L2_error = fem.form(ufl.inner(uh - ue, uh - ue) * ufl.dx)\n", "error_local = fem.assemble_scalar(L2_error)\n", "error_L2 = numpy.sqrt(domain.comm.allreduce(error_local, op=MPI.SUM))" ] diff --git a/chapter1/fundamentals_code.py b/chapter1/fundamentals_code.py index 4775bb47..029ae9ff 100644 --- a/chapter1/fundamentals_code.py +++ b/chapter1/fundamentals_code.py @@ -268,15 +268,15 @@ # (error-norm)= # ## Computing the error # Finally, we want to compute the error to check the accuracy of the solution. -# We do this by comparing the finite element solution `u` with the exact solution. +# We do this by comparing the finite element solution `uh` with the exact solution. # First we interpolate the exact solution into a function space that contains it V2 = fem.functionspace(domain, ("Lagrange", 2)) -uex = fem.Function(V2, name="u_exact") -uex.interpolate(lambda x: 1 + x[0] ** 2 + 2 * x[1] ** 2) +ue = fem.Function(V2, name="u_exact") +ue.interpolate(lambda x: 1 + x[0] ** 2 + 2 * x[1] ** 2) # We compute the error in two different ways. -# First, we compute the $L^2$-norm of the error, defined by $E=\sqrt{\int_\Omega (u_D-u_h)^2\mathrm{d} x}$. +# First, we compute the $L^2$-norm of the error, defined by $E=\sqrt{\int_\Omega (u_e-u_h)^2\mathrm{d} x}$. # We use UFL to express the $L^2$-error, and use {py:func}`dolfinx.fem.assemble_scalar` to compute the scalar value. # In DOLFINx, {py:func}`assemble_scalar` # only assembles over the cells on the local process. @@ -284,7 +284,7 @@ # we need to accumulate the local contributions to get the global error (on one or all processes). # We can do this with the {py:meth}`Comm.allreduce` function. -L2_error = fem.form(ufl.inner(uh - uex, uh - uex) * ufl.dx) +L2_error = fem.form(ufl.inner(uh - ue, uh - ue) * ufl.dx) error_local = fem.assemble_scalar(L2_error) error_L2 = numpy.sqrt(domain.comm.allreduce(error_local, op=MPI.SUM)) From 11fee1b33b0d11dcafd5d0d46179bc3356af3af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Schartum=20Dokken?= Date: Mon, 3 Aug 2026 13:48:31 +0200 Subject: [PATCH 3/7] Poetry-dynamic-versioning as build dep for ngsPETSc (#334) * Add poetry for ngspetsc install. Use latest ngspetsc version * Add poetry-dynamic-versioning as build dep --- .github/workflows/book_stable.yml | 2 +- .github/workflows/test_stable.yml | 2 +- docker/Dockerfile | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/book_stable.yml b/.github/workflows/book_stable.yml index 57b3b789..01ff9c5a 100644 --- a/.github/workflows/book_stable.yml +++ b/.github/workflows/book_stable.yml @@ -31,7 +31,7 @@ jobs: - name: Install book deps run: | - python3 -m pip install --break-system-packages -U pip setuptools pkgconfig poetry-core + python3 -m pip install --break-system-packages -U pip setuptools pkgconfig poetry-core poetry_dynamic_versioning python3 -m pip install --no-build-isolation --no-binary=h5py .[netgen] - name: Build the book diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml index afd556c7..828d26eb 100644 --- a/.github/workflows/test_stable.yml +++ b/.github/workflows/test_stable.yml @@ -29,7 +29,7 @@ jobs: - name: Install additional deps run: | - python3 -m pip install -U pip setuptools pkgconfig poetry-core + python3 -m pip install -U pip setuptools pkgconfig poetry-core poetry_dynamic_versioning python3 -m pip install --no-binary=h5py --no-build-isolation .[netgen] - name: Test complex notebooks in parallel diff --git a/docker/Dockerfile b/docker/Dockerfile index ee70bfa8..2d77c530 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,6 +41,7 @@ WORKDIR /tmp # As we install netgen from source we don't need the netgen deps here RUN python3 -m pip install --no-cache-dir --no-binary=h5py --no-build-isolation -v . RUN python3 -m pip cache purge +RUN python3 -m pip install poetry_dynamic_versioning poetry-core RUN python3 -m pip install ngsPETSc --no-build-isolation --no-deps ENV PYVISTA_OFF_SCREEN="false" From 033b0c2b773a5cef44620c650265e77ab678b15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Schartum=20Dokken?= Date: Fri, 21 Aug 2026 11:05:59 +0200 Subject: [PATCH 4/7] Remove unused variable reported by @edvardak (#336) --- chapter1/complex_mode.ipynb | 1 - chapter1/complex_mode.py | 1 - 2 files changed, 2 deletions(-) diff --git a/chapter1/complex_mode.ipynb b/chapter1/complex_mode.ipynb index 78a6efbb..15aa2e7d 100644 --- a/chapter1/complex_mode.ipynb +++ b/chapter1/complex_mode.ipynb @@ -273,7 +273,6 @@ "import pyvista\n", "\n", "mesh.topology.create_connectivity(mesh.topology.dim, mesh.topology.dim)\n", - "p_mesh = pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(mesh, mesh.topology.dim))\n", "pyvista_cells, cell_types, geometry = dolfinx.plot.vtk_mesh(V)\n", "grid = pyvista.UnstructuredGrid(pyvista_cells, cell_types, geometry)\n", "grid.point_data[\"u_real\"] = uh.x.array.real\n", diff --git a/chapter1/complex_mode.py b/chapter1/complex_mode.py index 27a80ed6..83e8a2a8 100644 --- a/chapter1/complex_mode.py +++ b/chapter1/complex_mode.py @@ -184,7 +184,6 @@ import pyvista mesh.topology.create_connectivity(mesh.topology.dim, mesh.topology.dim) -p_mesh = pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(mesh, mesh.topology.dim)) pyvista_cells, cell_types, geometry = dolfinx.plot.vtk_mesh(V) grid = pyvista.UnstructuredGrid(pyvista_cells, cell_types, geometry) grid.point_data["u_real"] = uh.x.array.real From 81eb0a9ea328aa13510013e1b0521544155987cd Mon Sep 17 00:00:00 2001 From: Jorgen Schartum Dokken Date: Mon, 24 Aug 2026 09:37:22 +0200 Subject: [PATCH 5/7] Try updating CI to latest images --- .github/workflows/book_stable.yml | 7 ++++++- .github/workflows/test_nightly.yml | 13 ++++++++++--- .github/workflows/test_stable.yml | 8 +++++--- docker/Dockerfile | 12 ++++++++---- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/book_stable.yml b/.github/workflows/book_stable.yml index 01ff9c5a..e45a3223 100644 --- a/.github/workflows/book_stable.yml +++ b/.github/workflows/book_stable.yml @@ -9,7 +9,6 @@ on: branches: ["release"] env: HDF5_MPI: "ON" - HDF5_DIR: "/usr/local/" H5PY_SETUP_REQUIRES: 0 DEB_PYTHON_INSTALL_LAYOUT: deb_system LIBGL_ALWAYS_SOFTWARE: 1 @@ -29,6 +28,12 @@ jobs: - name: Install common packages uses: ./.github/actions/install-dependencies + - name: Configure HDF5 MPI Environment + run: | + # Evaluate architecture dynamically and write to GITHUB_ENV + ARCH_TRIPLET=$(gcc -print-multiarch) + echo "HDF5_LIBDIR=/usr/lib/${ARCH_TRIPLET}/hdf5/openmpi" >> $GITHUB_ENV + - name: Install book deps run: | python3 -m pip install --break-system-packages -U pip setuptools pkgconfig poetry-core poetry_dynamic_versioning diff --git a/.github/workflows/test_nightly.yml b/.github/workflows/test_nightly.yml index d43d0e91..cf453a41 100644 --- a/.github/workflows/test_nightly.yml +++ b/.github/workflows/test_nightly.yml @@ -20,12 +20,13 @@ jobs: container: ghcr.io/fenics/dolfinx/lab:nightly env: - HDF5_MPI: "ON" - H5PY_SETUP_REQUIRES: 0 - HDF5_DIR: "/usr/local/" PYVISTA_OFF_SCREEN: true PYVISTA_JUPYTER_BACKEND: html LIBGL_ALWAYS_SOFTWARE: 1 + CC: "mpicc" + HDF5_MPI: "ON" + HDF5_INCLUDEDIR: "/usr/include/hdf5/openmpi" + H5PY_SETUP_REQUIRES: 0 steps: - uses: actions/checkout@v7 @@ -33,6 +34,12 @@ jobs: - name: Special handling of some installation uses: ./.github/actions/install-dependencies + - name: Configure HDF5 MPI Environment + run: | + # Evaluate architecture dynamically and write to GITHUB_ENV + ARCH_TRIPLET=$(gcc -print-multiarch) + echo "HDF5_LIBDIR=/usr/lib/${ARCH_TRIPLET}/hdf5/openmpi" >> $GITHUB_ENV + - name: Install requirements run: | python3 -m pip install --break-system-packages -U pip setuptools pkgconfig poetry-core diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml index 828d26eb..87d3f7f0 100644 --- a/.github/workflows/test_stable.yml +++ b/.github/workflows/test_stable.yml @@ -11,13 +11,15 @@ jobs: runs-on: ubuntu-latest container: ghcr.io/fenics/dolfinx/lab:stable env: - HDF5_MPI: "ON" - HDF5_DIR: "/usr/local/" - H5PY_SETUP_REQUIRES: "0" + DEB_PYTHON_INSTALL_LAYOUT: deb_system PYVISTA_OFF_SCREEN: true PYVISTA_JUPYTER_BACKEND: html LIBGL_ALWAYS_SOFTWARE: 1 + CC: "mpicc" + HDF5_MPI: "ON" + HDF5_INCLUDEDIR: "/usr/include/hdf5/openmpi" + H5PY_SETUP_REQUIRES: 0 # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/docker/Dockerfile b/docker/Dockerfile index 2d77c530..96282859 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,14 +7,11 @@ ARG TARGETPLATFORM ENV DEB_PYTHON_INSTALL_LAYOUT=deb_system ENV HDF5_MPI="ON" -ENV HDF5_DIR="/usr/local" WORKDIR /tmp/ # Requirements for pyvista (gl1 and render1) and jupyterlab (nodejs and curl) RUN apt-get update && apt-get install -y libgl1-mesa-dev mesa-utils curl -# RUN curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh && \ -# bash nodesource_setup.sh && \ -# apt -y install nodejs + # Install netgen from source RUN apt-get update && \ @@ -36,6 +33,13 @@ ENV PYTHONPATH=$NETGENDIR/../lib/python3.12/site-packages:${PYTHONPATH}:${PYTHON # Install vtk RUN python3 -m pip install vtk +RUN ARCH_TRIPLET=$(gcc -print-multiarch) && \ + export CC="mpicc" && \ + export HDF5_MPI="ON" && \ + export HDF5_INCLUDEDIR="/usr/include/hdf5/openmpi" && \ + export HDF5_LIBDIR="/usr/lib/${ARCH_TRIPLET}/hdf5/openmpi" && \ + pip install --no-binary=h5py h5py --no-build-isolation --no-cache-dir + ADD pyproject.toml /tmp/pyproject.toml WORKDIR /tmp # As we install netgen from source we don't need the netgen deps here From abc467ee0f9843cd12f88598720471a7156af86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Schartum=20Dokken?= Date: Mon, 24 Aug 2026 10:57:12 +0200 Subject: [PATCH 6/7] Remove python version --- .github/workflows/test_nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_nightly.yml b/.github/workflows/test_nightly.yml index e388413a..afc63452 100644 --- a/.github/workflows/test_nightly.yml +++ b/.github/workflows/test_nightly.yml @@ -53,7 +53,7 @@ jobs: run: | export PKG_CONFIG_PATH=/usr/local/dolfinx-complex/lib/pkgconfig:$PKG_CONFIG_PATH export PETSC_ARCH=linux-gnu-complex128-32 - export PYTHONPATH=/usr/local/dolfinx-complex/lib/python3.12/dist-packages:$PYTHONPATH + export PYTHONPATH=/usr/local/dolfinx-complex/lib/python/dist-packages:$PYTHONPATH export LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH python3 complex_mode.py mpirun -n 2 python3 complex_mode.py From 9f10b6db54ef6f866f1ca385a2e474a385cf3f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Schartum=20Dokken?= Date: Mon, 24 Aug 2026 13:28:42 +0200 Subject: [PATCH 7/7] Allow ompi as root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jørgen Schartum Dokken --- .github/workflows/test_nightly.yml | 3 +++ .github/workflows/test_stable.yml | 3 +++ docker/Dockerfile | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/test_nightly.yml b/.github/workflows/test_nightly.yml index afc63452..90027ee4 100644 --- a/.github/workflows/test_nightly.yml +++ b/.github/workflows/test_nightly.yml @@ -27,6 +27,9 @@ jobs: HDF5_MPI: "ON" HDF5_INCLUDEDIR: "/usr/include/hdf5/openmpi" H5PY_SETUP_REQUIRES: 0 + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 + PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml index 87d3f7f0..fed2c402 100644 --- a/.github/workflows/test_stable.yml +++ b/.github/workflows/test_stable.yml @@ -20,6 +20,9 @@ jobs: HDF5_MPI: "ON" HDF5_INCLUDEDIR: "/usr/include/hdf5/openmpi" H5PY_SETUP_REQUIRES: 0 + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 + PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/docker/Dockerfile b/docker/Dockerfile index 96282859..da1f4a9b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,6 +7,9 @@ ARG TARGETPLATFORM ENV DEB_PYTHON_INSTALL_LAYOUT=deb_system ENV HDF5_MPI="ON" +ENV OMPI_ALLOW_RUN_AS_ROOT=1 +ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 +ENV PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe WORKDIR /tmp/ # Requirements for pyvista (gl1 and render1) and jupyterlab (nodejs and curl)