Skip to content

Updates compatible with nightly branch of DOLFINx #156

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

Merged
merged 14 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/book_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ env:
jobs:
build-book:
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/lab:v0.7.1
container: ghcr.io/fenics/dolfinx/lab:v0.7.2

env:
PYVISTA_TRAME_SERVER_PROXY_PREFIX: "/proxy/"
PYVISTA_TRAME_SERVER_PROXY_ENABLED: "True"
PYVISTA_OFF_SCREEN: false
PYVISTA_JUPYTER_BACKEND: "panel"
PYVISTA_JUPYTER_BACKEND: "html"

steps:
- uses: actions/checkout@v4
Expand All @@ -30,7 +30,7 @@ jobs:
uses: ./.github/actions/install-dependencies

- name: Install book deps
run: python3 -m pip install -r docker/requirements.txt
run: python3 -m pip install --no-binary=h5py .

- name: Build the book
run: jupyter-book build . -W
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@v4

- name: Download docs artifact
uses: actions/download-artifact@v3
Expand All @@ -53,10 +53,10 @@ jobs:
path: "./public"

- name: Upload page artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v2
with:
path: "./public"

- name: Deploy coverage report to GH Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v3
2 changes: 1 addition & 1 deletion .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./docker
context: .
push: true
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
test-nightly:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/lab:v0.7.1
container: ghcr.io/fenics/dolfinx/lab:nightly

env:
HDF5_MPI: "ON"
PYVISTA_OFF_SCREEN: true
DISPLAY: ":99.0"
PYVISTA_JUPYTER_BACKEND: panel
PYVISTA_JUPYTER_BACKEND: html

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -42,7 +42,10 @@ jobs:
uses: ./.github/actions/install-dependencies

- name: Install requirements
run: python3 -m pip install --no-cache-dir -r docker/requirements.txt --upgrade
run: python3 -m pip install --no-cache-dir --no-binary=h5py . --upgrade

- name: Test building the book
run: PYVISTA_OFF_SCREEN=false jupyter-book build -W .

- name: Test complex notebooks in parallel
run: |
Expand Down Expand Up @@ -82,9 +85,6 @@ jobs:
mpirun -n 2 python3 compiler_parameters.py
mpirun -n 2 python3 newton-solver.py

- name: Test building the book
run: PYVISTA_OFF_SCREEN=false jupyter-book build -W .

- uses: actions/upload-artifact@v3
with:
name: webpage
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 @@ -20,7 +20,7 @@ jobs:
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/lab:v0.7.1
container: ghcr.io/fenics/dolfinx/lab:v0.7.2
env:
PYVISTA_OFF_SCREEN: true

Expand All @@ -32,7 +32,7 @@ jobs:

- name: Install additional deps
run: |
python3 -m pip install -r docker/requirements.txt
python3 -m pip install --no-binary=h5py .

- name: Test complex notebooks in parallel
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ _build
**/.cache
*.png
*.pvtu
*.msh
*.msh
*.bp
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Release
- Replace all `ufl.FiniteElement` and `ufl.VectorElement` with the appropriate `basix.ufl.element`
- Replace `dolfinx.fem.FunctionSpace` with `dolfinx.fem.functionspace`

## v0.7.2
- Change pyvista backend to `html`, using Pyvista main branch
- Using DOLFINx v0.7.2 https://github.com/FEniCS/dolfinx/releases/tag/v0.7.2 as base

## v0.7.1
- No API changes, release due to various bug-fixes from the 0.7.0 release, see:
https://github.com/FEniCS/dolfinx/releases/tag/v0.7.1 for more information
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/jorgensd/dolfinx-tutorial:v0.7.1
FROM ghcr.io/jorgensd/dolfinx-tutorial:v0.7.2

# create user with a home directory
ARG NB_USER=jovyan
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ Any code added to the tutorial should work in parallel.

Alternatively, if you want to add a separate chapter, a Jupyter notebook can be added to a pull request, without integrating it into the tutorial. If so, the notebook will be reviewed and modified to be included in the tutorial.

Note that every chapter is written as an IPython notebook and a Python file. These are kept in sync by jupytext. See [their notes](https://jupytext.readthedocs.io/en/latest/install.html#jupytext-commands-in-jupyterlab) on how to keep them in sync.

## Dependencies
It is adviced to use a pre-installed version of DOLFINx, for instance through conda or docker. Remaining dependencies can be installed with
```bash
python3 -m pip install --no-binary=h5py -e .
```

# Docker images
Docker images for this tutorial can be found in the [packages tab](https://github.com/jorgensd/dolfinx-tutorial/pkgs/container/dolfinx-tutorial)

Additional requirements on top of the `dolfinx/lab:nightly` images can be found at [Dockerfile](docker/Dockerfile) and [requirements.txt](docker/requirements.txt)
Additional requirements on top of the `dolfinx/lab:nightly` images can be found at [Dockerfile](docker/Dockerfile) and [pyproject.toml](./pyproject.toml)

##
An image building DOLFINx, Basix, UFL and FFCx from source can be built using:
```bash
cd docker
docker build -f LocalDockerfile -t local_lab_env .
docker build -f ./docker/Dockerfile -t local_lab_env .
```
and run
from the root of this repository, and run
```bash
docker run --rm -ti -v $(pwd):/root/shared -w /root/shared --init -p 8888:8888 local_lab_env
```
Expand Down
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ sphinx:

# To avoid warning about default changing due to
# https://github.com/pydata/pydata-sphinx-theme/issues/1492
html_theme_options:
navigation_with_keys: false
# html_theme_options:
# navigation_with_keys: false
parse:
myst_enable_extensions:
- "amsmath"
Expand Down
328 changes: 26 additions & 302 deletions chapter1/complex_mode.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions chapter1/complex_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.7
# jupytext_version: 1.15.2
# kernelspec:
# display_name: Python 3 (DOLFINx complex)
# language: python
Expand Down Expand Up @@ -47,7 +47,7 @@
from mpi4py import MPI
import numpy as np
mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u_r = dolfinx.fem.Function(V, dtype=np.float64)
u_r.interpolate(lambda x: x[0])
u_c = dolfinx.fem.Function(V, dtype=np.complex128)
Expand Down
2 changes: 1 addition & 1 deletion chapter1/fundamentals.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Authors: Hans Petter Langtangen, Anders Logg

Adapted to FEniCSx by Jørgen S. Dokken

The goal of this tutorial is to solve one of the most basic PDEs, the Poisson equations, with a few lines of code in FEniCSx. We start by introducing the most fundamental FEniCSx objects, such as `Function`, `FunctionSpace`, `TrialFunction` and `TestFunction`, and learn how to write a basic PDE solver.
The goal of this tutorial is to solve one of the most basic PDEs, the Poisson equations, with a few lines of code in FEniCSx. We start by introducing the most fundamental FEniCSx objects, such as `Function`, `functionspace`, `TrialFunction` and `TestFunction`, and learn how to write a basic PDE solver.
This will include:
- How to formulate a mathematical variational problem
- How to apply boundary conditions
Expand Down
Loading