This repository contains course materials for an advanced finite-element methods course with an emphasis on matrix-free techniques, sum-factorization, subspace correction, and multigrid — implemented and demonstrated using Python and JAX.
lectures/— lecture notes, exercises, and solution files.examples/— runnable Python examples using JAX / NumPy.
To produce printable notes from markdown files (.md) run:
pandoc -V geometry:margin=0.5in -o your_output_file.pdf AXX_Lecture_note_file.md- Einstein summation, Kronecker products. Split Kronecker product by dimension.
- Sum factorization: evaluation of the Laplace operator on a single Cartesian cell.
- Fast diagonalization (exercise).
- Introduction to subspace correction (rebase, prolongation/restriction, Richardson, Jacobi, Gauss–Seidel).
- Motivation for multigrid and convergence properties of simple smoothers.
- Two-level method as subspace correction.
- Multilevel methods and practical implementation.
- To be planned:
- Elasticity: Automatic Differentiation,
- Stokes: LBB,
- Stokes: Block solvers
- Stokes: multigrid, constrained smoothers, patch smoothers.
We recommend creating an isolated Python environment for the course.
Example (POSIX shells):
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pipInstall JAX:
- CPU-only (simple):
pip install jax jaxlib- GPU support: choose the release matching your CUDA/cuDNN version. See the JAX CUDA releases page for the correct wheel selector. Example (choose the exact tag appropriate for your GPU/CUDA):
pip install --upgrade pip
pip install "jax[cuda12]"Or
# Example only — check https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
pip install --upgrade pip
pip install "jax[cuda12]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.htmlNote: replace cuda12 with the CUDA/cuDNN variant that matches your system. JAX also works on AMD hardware.
If unsure, use the CPU install above.
After activating the virtualenv and installing JAX, try a small example:
python examples/A01_einsum.py- Lecture 1: lectures/A01_Kronecker_and_Einstein.md
- Examples: examples/