Skip to content

Commit

Permalink
Render and display tutorials (#3)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhodri Davies <rhodri.davies@anu.edu.au>
  • Loading branch information
angus-g and drhodrid authored Apr 17, 2024
1 parent 04d47cf commit 753c757
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,44 @@ permissions:
id-token: write

jobs:
render:
runs-on: self-hosted
container:
image: firedrakeproject/firedrake:latest
options: --shm-size 2g

env:
OMP_NUM_THREADS: 1

steps:
- uses: actions/checkout@v4
with:
repository: g-adopt/tutorials
ref: angus-g/website-deploy
path: tutorials
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libgl1-mesa-glx xvfb
. /home/firedrake/firedrake/bin/activate
python3 -m pip install nbval pyvista nbconvert
python3 -m pip install gadopt[optimisation]
- name: Convert notebooks
run: |
. /home/firedrake/firedrake/bin/activate
export DISPLAY=:99
export PYVISTA_OFF_SCREEN=true
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
python3 -m jupyter nbconvert --to notebook --execute --output-dir=rendered tutorials/*.ipynb
- uses: actions/upload-artifact@v4
with:
name: notebooks
path: rendered

build:
runs-on: ubuntu-latest
needs: render
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -28,6 +64,10 @@ jobs:
with:
repository: g-adopt/g-adopt
path: g-adopt
- uses: actions/download-artifact@v4
with:
name: notebooks
path: docs/tutorials
- name: Build site
run: |
mkdocs build --clean
Expand Down
18 changes: 17 additions & 1 deletion docs/tutorials.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Tutorials

This is a list of tutorials, gradually introducing the G-ADOPT library.
Here, we work through a series of tutorials that systematically introduce you to
Firedrake and the G-ADOPT library.

One the first tab, we include 5 tutorials from Firedrake.

1. The positive-definite Helmholtz equation.
2. Strong (Dirichlet) boundary conditions.
3. Linear elasticity.
4. A time-dependent problem using Burgers equation.
5. PDE constrained optimisation.

On the second tab, we include 2 tutorials that are specific to G-ADOPT.

1. Idealised 2-D mantle convection in a square box.
2. 2-D annulus case.

We will add to these tutorials over time.
14 changes: 13 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,25 @@ plugins:
members_order: source
import:
- https://fenics.readthedocs.io/projects/ufl/en/latest/objects.inv
- mkdocs-jupyter:
toc_depth: 2
nav:
- Home:
- index.md
- About: about.md
- Install: install.md
- Documentation: documentation.md
- Tutorials: tutorials.md
- Tutorials:
- tutorials.md
- Firedrake:
- Helmholtz: tutorials/01-spd-helmholtz.ipynb
- Poisson: tutorials/02-poisson.ipynb
- Elasticity: tutorials/03-elasticity.ipynb
- "Burgers' Equation": tutorials/04-burgers.ipynb
- PDE Constrained Optimisation: tutorials/05-pde-constrained-optimisation.ipynb
- G-ADOPT:
- Stokes Square Convection: tutorials/06-GD-2D-convection.ipynb
- Stokes Cylindrical Convection: tutorials/07-GD-2D-cylindrical.ipynb
- Benchmarks: benchmarks.md
- Team: team.md
- Funding: funding.md
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ mkdocs~=1.5.3
mkdocs-material~=9.5.8
mkdocs-glightbox~=0.3.7
mkdocstrings[python]~=0.24.0
mkdocs-jupyter~=0.24.7

0 comments on commit 753c757

Please sign in to comment.