diff --git a/.github/workflows/book_stable.yml b/.github/workflows/book_stable.yml index 631a88b1..170755d2 100644 --- a/.github/workflows/book_stable.yml +++ b/.github/workflows/book_stable.yml @@ -16,7 +16,7 @@ env: jobs: build-book: runs-on: ubuntu-latest - container: ghcr.io/fenics/dolfinx/lab:v0.8.0 + container: ghcr.io/fenics/dolfinx/lab:stable env: PYVISTA_TRAME_SERVER_PROXY_PREFIX: "/proxy/" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cce3e7da..3e467708 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v4 - name: Setup Pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 - name: Download docs artifact uses: actions/download-artifact@v4 diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index 77ffc5f3..753bf033 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -45,7 +45,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . load: true @@ -56,7 +56,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} - name: Build (arm) and push (amd/arm) Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 if: github.event_name == 'push' with: context: . diff --git a/.github/workflows/test_nightly.yml b/.github/workflows/test_nightly.yml index e4f4736e..ed0f52c5 100644 --- a/.github/workflows/test_nightly.yml +++ b/.github/workflows/test_nightly.yml @@ -39,6 +39,9 @@ jobs: - name: Test building the book run: PYVISTA_OFF_SCREEN=false jupyter-book build -W . + - name: Test building the book + run: PYVISTA_OFF_SCREEN=false jupyter-book build -W . + - name: Test complex notebooks in parallel working-directory: chapter1 run: | @@ -67,7 +70,6 @@ jobs: mpirun -n 2 python3 nonlinpoisson_code.py mpirun -n 2 python3 ns_code1.py mpirun -n 2 python3 ns_code2.py - - name: Test chapter 3 working-directory: chapter3 run: | @@ -77,7 +79,6 @@ jobs: mpirun -n 2 python3 robin_neumann_dirichlet.py mpirun -n 2 python3 component_bc.py mpirun -n 2 python3 em.py - - name: Test chapter 4 working-directory: chapter4 run: | diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml index ae7dd271..cb84bc96 100644 --- a/.github/workflows/test_stable.yml +++ b/.github/workflows/test_stable.yml @@ -14,7 +14,7 @@ env: jobs: test: runs-on: ubuntu-latest - container: ghcr.io/fenics/dolfinx/lab:v0.8.0 + container: ghcr.io/fenics/dolfinx/lab:stable env: PYVISTA_OFF_SCREEN: true @@ -33,7 +33,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.10/dist-packages:$PYTHONPATH + export PYTHONPATH=/usr/local/dolfinx-complex/lib/python3.12/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 diff --git a/Changelog.md b/Changelog.md index 2817a0bb..7c79cc03 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,10 @@ # Changelog +## v0.9.0 + +- `scale` in `apply_lifting` has been renamed to `alpha` +- Use `dolfinx.fem.Function.x.petsc_vec` as opposed to `dolfinx.fem.Function.vector` + ## v0.8.0 - Replace all `ufl.FiniteElement` and `ufl.VectorElement` with the appropriate `basix.ufl.element` diff --git a/chapter1/fundamentals_code.ipynb b/chapter1/fundamentals_code.ipynb index a9c0c12e..37d118ed 100644 --- a/chapter1/fundamentals_code.ipynb +++ b/chapter1/fundamentals_code.ipynb @@ -85,8 +85,8 @@ "id": "3", "metadata": {}, "source": [ - "Note that in addition to give how many elements we would like to have in each direction. \n", - "We also have to supply the _MPI-communicator_. \n", + "Note that in addition to giving how many elements we would like to have in each direction, \n", + "we also have to supply the _MPI-communicator_. \n", "This is to specify how we would like the program to behave in parallel. \n", "If we supply `MPI.COMM_WORLD` we create a single mesh, whose data is distributed over the number of processors we \n", "would like to use. We can for instance run the program in parallel on two processors by using `mpirun`, as: \n", @@ -284,7 +284,7 @@ "This is the key strength of FEniCSx: the formulas in the variational formulation translate directly to very similar Python code, a feature that makes it easy to specify and solve complicated PDE problems.\n", "\n", "## Expressing inner products\n", - "The inner product $\\int_\\Omega \\nabla u \\cdot \\nabla v ~\\mathrm{d} x$ can be expressed in various ways in UFL. We have used the notation `ufl.dot(ufl.grad(u), ufl.grad(v))*ufl.dx`. The dot product in UFL computes the sum (contraction) over the last index of the first factor and first index of the second factor. In this case, both factors are tensors of rank one (vectors) and so the sum is just over the single index of both $\\nabla u$ and $\\nabla v$. To compute an inner product of matrices (with two indices), one must instead of `ufl.dot` use the function `ufl.inner`. For vectors, `ufl.dot` and `ufl.inner` are equivalent.\n", + "The inner product $\\int_\\Omega \\nabla u \\cdot \\nabla v ~\\mathrm{d} x$ can be expressed in various ways in UFL. We have used the notation `ufl.dot(ufl.grad(u), ufl.grad(v))*ufl.dx`. The dot product in UFL computes the sum (contraction) over the last index of the first factor and first index of the second factor. In this case, both factors are tensors of rank one (vectors) and so the sum is just over the single index of both $\\nabla u$ and $\\nabla v$. To compute an inner product of matrices (with two indices), one must use the function `ufl.inner` instead of `ufl.dot`. For vectors, `ufl.dot` and `ufl.inner` are equivalent.\n", "\n", "```{admonition} Complex numbers\n", "In DOLFINx, one can solve complex number problems by using an installation of PETSc using complex numbers.\n", @@ -296,8 +296,8 @@ "\n", "## Forming and solving the linear system\n", "\n", - "Having defined the finite element variational problem and boundary condition, we can create our `dolfinx.fem.petsc.LinearProblem`, as class for solving \n", - "the variational problem: Find $u_h\\in V$ such that $a(u_h, v)==L(v) \\quad \\forall v \\in \\hat{V}$. We will use PETSc as our linear algebra backend, using a direct solver (LU-factorization).\n", + "Having defined the finite element variational problem and boundary condition, we can create our `dolfinx.fem.petsc.LinearProblem`, a class for solving \n", + "the variational problem: Find $u_h\\in V$ such that $a(u_h, v)=L(v) \\quad \\forall v \\in \\hat{V}$. We will use PETSc as our linear algebra backend, using a direct solver (LU-factorization).\n", "See the [PETSc-documentation](https://petsc.org/main/docs/manual/ksp/?highlight=ksp#ksp-linear-system-solvers) of the method for more information.\n", "PETSc is not a required dependency of DOLFINx, and therefore we explicitly import the DOLFINx wrapper for interfacing with PETSc." ] diff --git a/chapter2/ns_code2.ipynb b/chapter2/ns_code2.ipynb index d894cf5e..237dca40 100644 --- a/chapter2/ns_code2.ipynb +++ b/chapter2/ns_code2.ipynb @@ -651,6 +651,7 @@ " if pressure is not None:\n", " p_diff[i] -= pressure[0]\n", " break\n", + "progress.close()\n", "vtx_u.close()\n", "vtx_p.close()" ] diff --git a/chapter2/ns_code2.py b/chapter2/ns_code2.py index 12062c89..1c0be052 100644 --- a/chapter2/ns_code2.py +++ b/chapter2/ns_code2.py @@ -478,6 +478,7 @@ def __call__(self, x): if pressure is not None: p_diff[i] -= pressure[0] break +progress.close() vtx_u.close() vtx_p.close() diff --git a/chapter4/compiler_parameters.ipynb b/chapter4/compiler_parameters.ipynb index 77e42ab6..c067f1f7 100644 --- a/chapter4/compiler_parameters.ipynb +++ b/chapter4/compiler_parameters.ipynb @@ -50,7 +50,7 @@ "id": "2", "metadata": {}, "source": [ - "Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.Form` to compile the variational form. For codes using `dolfinx.LinearProblem`, you can supply `jit_options` as a keyword argument." + "Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.form` to compile the variational form. For codes using `dolfinx.fem.petsc.LinearProblem`, you can supply `jit_options` as a keyword argument." ] }, { diff --git a/chapter4/compiler_parameters.py b/chapter4/compiler_parameters.py index e5811c4d..25366121 100644 --- a/chapter4/compiler_parameters.py +++ b/chapter4/compiler_parameters.py @@ -46,7 +46,7 @@ print(f"Directory to put C files in: {cache_dir}") # - -# Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.Form` to compile the variational form. For codes using `dolfinx.LinearProblem`, you can supply `jit_options` as a keyword argument. +# Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.form` to compile the variational form. For codes using `dolfinx.fem.petsc.LinearProblem`, you can supply `jit_options` as a keyword argument. # + diff --git a/fem.md b/fem.md index f2f86710..14ad6afd 100644 --- a/fem.md +++ b/fem.md @@ -40,13 +40,13 @@ The tutorial uses several dependencies for meshing, plotting and timings. A comp To use the notebooks in this tutorial with DOLFINx on your own computer, you should use the docker image obtained using the following command: ```bash - docker run --init -p 8888:8888 -v "$(pwd)":/root/shared ghcr.io/jorgensd/dolfinx-tutorial:v0.7.2 + docker run --init -p 8888:8888 -v "$(pwd)":/root/shared ghcr.io/jorgensd/dolfinx-tutorial:release ``` This image can also be used as a normal docker container by adding: ```bash - docker run --ti -v "$(pwd)":/root/shared --entrypoint="/bin/bash" ghcr.io/jorgensd/dolfinx-tutorial:v0.7.2 + docker run --ti -v "$(pwd)":/root/shared --entrypoint="/bin/bash" ghcr.io/jorgensd/dolfinx-tutorial:release ``` The tutorials can also be exported as an IPython notebook or PDF by clicking the ![Download](save.png)-symbol in the top right corner of the relevant tutorial. The notebook can in turn be used with a Python kernel which has DOLFINx. @@ -58,7 +58,7 @@ The [Dockerfile](https://github.com/FEniCS/dolfinx/blob/main/docker/Dockerfile) provides a definitive build recipe. As the DOLFINx docker images are hosted at Docker-hub, one can directly access the image using: ```bash -docker run dolfinx/dolfinx:v0.8.0 +docker run dolfinx/dolfinx:stable ``` There are several ways of customizing a docker container, such as mounting volumes/sharing folder, setting a working directory, sharing graphical interfaces etc. See `docker run --help` for an extensive list.