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/4] 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 3d86a62060c8857079fdc8c56c9518eb97f59eb6 Mon Sep 17 00:00:00 2001 From: "Ifthakhar A. Riyad" Date: Thu, 30 Jul 2026 23:14:48 +0200 Subject: [PATCH 2/4] Fix variable names in error computation --- chapter1/fundamentals_code.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter1/fundamentals_code.ipynb b/chapter1/fundamentals_code.ipynb index 75bb9405..0ed647ea 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" ] }, @@ -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", From f61124e57300249882a822e15dfc1992aa3246c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Schartum=20Dokken?= Date: Thu, 9 Jul 2026 13:43:55 +0200 Subject: [PATCH 3/4] Rename variables. Resolve #330 (#331) * Rename variables. Resolve #330 * Bump main version --- chapter1/fundamentals_code.ipynb | 6 +++--- chapter1/fundamentals_code.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/chapter1/fundamentals_code.ipynb b/chapter1/fundamentals_code.ipynb index 0ed647ea..c8717323 100644 --- a/chapter1/fundamentals_code.ipynb +++ b/chapter1/fundamentals_code.ipynb @@ -458,11 +458,11 @@ "metadata": {}, "outputs": [], "source": [ - "error_max = numpy.max(numpy.abs(uD.x.array - uh.x.array))\n", - "vertex_max = domain.comm.allreduce(error_max, op=MPI.MAX)\n", + "local_L_infty = numpy.max(numpy.abs(uD.x.array - uh.x.array))\n", + "L_infty = domain.comm.allreduce(local_L_infty, op=MPI.MAX)\n", "if domain.comm.rank == 0: # Only print the error on one process\n", " print(f\"Error_L2 : {error_L2:.2e}\")\n", - " print(f\"Error_max : {error_max:.2e}\")" + " print(f\"Error_max : {L_infty:.2e}\")" ] }, { diff --git a/chapter1/fundamentals_code.py b/chapter1/fundamentals_code.py index 4775bb47..8bf0dd88 100644 --- a/chapter1/fundamentals_code.py +++ b/chapter1/fundamentals_code.py @@ -300,11 +300,11 @@ # As we already have interpolated the exact solution into the first order space when creating the boundary condition, # we can compare the maximum values at any degree of freedom of the approximation space. -error_max = numpy.max(numpy.abs(uD.x.array - uh.x.array)) -vertex_max = domain.comm.allreduce(error_max, op=MPI.MAX) +local_L_infty = numpy.max(numpy.abs(uD.x.array - uh.x.array)) +L_infty = domain.comm.allreduce(local_L_infty, op=MPI.MAX) if domain.comm.rank == 0: # Only print the error on one process print(f"Error_L2 : {error_L2:.2e}") - print(f"Error_max : {vertex_max:.2e}") + print(f"Error_max : {L_infty:.2e}") # ## Plotting the mesh using pyvista # We will visualizing the mesh using [pyvista](https://docs.pyvista.org/), an interface to the VTK toolkit. From 46ac32d2e7479c22d5a7b201e88b6096381fd49f Mon Sep 17 00:00:00 2001 From: Joergen Schartum Dokken Date: Mon, 3 Aug 2026 12:02:26 +0000 Subject: [PATCH 4/4] Update files and cherry-pick fix from main --- chapter1/fundamentals_code.ipynb | 6 +++--- chapter1/fundamentals_code.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chapter1/fundamentals_code.ipynb b/chapter1/fundamentals_code.ipynb index c8717323..3d7d96e2 100644 --- a/chapter1/fundamentals_code.ipynb +++ b/chapter1/fundamentals_code.ipynb @@ -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)" ] }, { @@ -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 8bf0dd88..4707befa 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))