Skip to content

Fix typos on fundamental_code.ipynb #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
80d08db
Improve workflow handling (#118)
jorgensd Mar 22, 2023
da48de6
Merge branch 'main' into release
jorgensd Mar 22, 2023
625293c
Merge branch 'main' into release
jorgensd Mar 22, 2023
6b2db88
Dokken/update fspace and wmtgs (#127)
jorgensd Apr 19, 2023
8bcf5f9
Update petsc arches
jorgensd Jun 21, 2023
10a4939
Fix bounding boxes and more (#135)
jorgensd Jul 4, 2023
8eb2770
PETSc python API update (#137)
jorgensd Jul 5, 2023
dd30b8a
Make sure all notebooks run. Change to pathlib in some examples
jorgensd Aug 12, 2023
9e30cab
Api changes related to: https://github.com/FEniCS/dolfinx/pull/2763 (…
jorgensd Sep 23, 2023
662b8b2
Bump version numbers
jorgensd Oct 12, 2023
fb8e738
Bump version numbers (#149)
jorgensd Oct 12, 2023
d9a02c0
Merge branch 'main' into release
jorgensd Oct 12, 2023
b9c7990
Fix petsc arch
jorgensd Oct 12, 2023
8db8b94
Merge branch 'dokken/prepare-v0.7.0' into release
jorgensd Oct 12, 2023
ffe997e
Merge branch 'main' into release
jorgensd Oct 28, 2023
ecd6994
Prepare v0.7.1 (#154)
jorgensd Oct 28, 2023
26ad6bf
Merge branch 'main' into release
jorgensd Oct 28, 2023
69bf939
Updates compatible with nightly branch of DOLFINx (#156)
jorgensd Dec 7, 2023
1a885f2
Fix wrong link
jorgensd Jan 28, 2024
a36ae80
Fix typo in changelog
jorgensd Jan 28, 2024
b4c4a0c
Merge main into release (#189)
jorgensd Apr 30, 2024
f2775eb
Merge branch 'main' into release
jorgensd May 5, 2024
e32797a
add missing checkout (#191)
jorgensd May 5, 2024
45ea6bf
Remove unused import
jorgensd May 5, 2024
fb40ada
Update text to resolve #194 (#195)
jorgensd May 13, 2024
6a67d30
Dokken/update nonlin options (#203)
jorgensd Aug 12, 2024
50b0aad
Update python file as well
jorgensd Aug 12, 2024
4d19c14
Update config ptr (#207)
jorgensd Sep 26, 2024
bf06975
Pressure correction equation fix (#196)
jorgensd Sep 26, 2024
4706eef
Update fundamentals.md (#199)
rossbm1 Sep 26, 2024
1f872e5
Change from vector to petsc_vec (#206)
jorgensd Sep 26, 2024
adf0314
dolfinx.fem.Form changed to dolfinx.fem.form (#213)
MPenaR Oct 2, 2024
aa4ef09
Merge branch 'main' into release
jorgensd Oct 14, 2024
1fcb776
Update book_stable.yml
jorgensd Oct 14, 2024
336a89a
Update test_stable.yml
jorgensd Oct 14, 2024
94447f3
Fix python path in test
jorgensd Oct 14, 2024
ea69c78
Merge branch 'release'
jorgensd Oct 15, 2024
7b2ccb0
Merge branch 'main' into release
jorgensd Oct 15, 2024
0b3745e
Merge branch 'main' into release
jorgensd Oct 15, 2024
3138242
Fix CI (#227)
jorgensd Nov 19, 2024
6cb36dd
Update fundamentals_code.ipynb
MattFerraro Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/book_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: .
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand All @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
10 changes: 5 additions & 5 deletions chapter1/fundamentals_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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."
]
Expand Down
1 change: 1 addition & 0 deletions chapter2/ns_code2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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()"
]
Expand Down
1 change: 1 addition & 0 deletions chapter2/ns_code2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion chapter4/compiler_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion chapter4/compiler_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

# +

Expand Down
6 changes: 3 additions & 3 deletions fem.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down