Skip to content

Tutorials for HyperFEM 0.3 and HyperFEMKernels 0.2.6 - #2

Merged
jmartfrut merged 4 commits into
mainfrom
tutorials-refresh
Nov 23, 2026
Merged

jmartfrut merged 4 commits into
mainfrom
tutorials-refresh

Conversation

@jmartfrut

Copy link
Copy Markdown
Member

Tutorials for HyperFEM 0.3 and HyperFEMKernels 0.2.6

Rewrites the tutorials against the registered HyperFEM 0.3.0 and HyperFEMKernels 0.2.6 (Gridap 0.20.8) and turns
the repository into a minimal package, HyperFEMTutorials, with tests, documentation and CI.

Tutorials

Eighteen self-contained Literate scripts in src/ (number 07, topology optimisation with HyperShape, is reserved):

Nº Tutorial
01 Poisson equation
02 Uniaxial stretch of a hyperelastic bar
03 Fibre-reinforced cylinder under internal pressure
04 Electro-mechanics of a dielectric elastomer
05 Anisotropic electro-mechanics
06 Third-medium contact
08 Magneto-mechanical hMRE beam
09 hMRE beam in vacuum: staggered solution
10 Stokes flow around a cylinder
11 Transient Navier–Stokes flow around a cylinder
12 Pulsatile blood flow in a patient aorta
13 Linear solvers for large problems (LU, MUMPS, AMG, GAMG, BoomerAMG)
14 Geometric h- and p-multigrid
15 Elastodynamics: free vibration of a cantilever
16 Visco-electro-mechanics: creep of a dielectric bimorph
17 Thermo-mechanics: transient heat conduction and thermal expansion
18 Explicit dynamics: wave propagation in a bar
19 Constitutive models: energies, stresses and tangents

Every tutorial uses the compiled backend of HyperFEMKernels, reports measured times and dofs in its header, and ends
with quantitative checks (exact solutions, published benchmarks, invariants, regression values with their origin)
that are also the test suite. Each has a reduced case (HYPERFEM_TUTORIALS_FAST=1) used by the tests.

Repository

  • Removed: the old E1–E8 scripts, src/Fluids, meshes and dependencies no longer used (DrWatson, HyperShape,
    GridapSolvers, …). data/models/README.md gives the provenance of every mesh.
  • test/runtests.jl runs every tutorial in its reduced case, by group (HYPERFEM_TUTORIALS_GROUP), and checks that the
    list of tutorials, the scripts, the README and the documentation index agree.
  • docs/make.jl builds one page and one Jupyter notebook per tutorial with Literate (code not executed); the
    notebooks are not versioned.
  • CI: one job per group (Julia 1 and 1.12 for basics), a non-blocking job with the PETSc parts, weekly runs;
    documentation deployed to GitHub Pages.

Verification

On a Mac M5 Max (Julia 1.13.0, 4 threads, 4 BLAS threads): all 18 tutorials pass in the reduced and in the full case;
the documentation builds with 18 pages and 18 notebooks whose code cells all parse. Each tutorial was reviewed
independently (physics, checks, efficiency, text) and the findings were fixed. The CI has not run on Linux yet: the
regression values were measured on macOS arm64 (rtol 1e-5), and the first Linux run may need adjustments.

Notes

  • Library issues found while writing the tutorials (HyperFEM and HyperFEMKernels) are collected separately for their
    own PRs; the tutorials work around them and say so where it matters.
  • The aorta mesh (E12) comes from the MultiSimO Lab hemodynamics project (same file as HyperFEMKernels'
    examples/aorta_cfd).

@jmartfrut @miguelmaso

The repository becomes a minimal package, HyperFEMTutorials (not registered), so that the
test suite, the documentation and the README share one list of tutorials:

- src/HyperFEMTutorials.jl: TUTORIALS, tutorial_path, run_tutorial(n; fast).
- test/runtests.jl: runs every tutorial in its reduced case (HYPERFEM_TUTORIALS_FAST=1) in a
  fresh module; groups and selection through environment variables.
- docs/: Documenter + Literate; one page and one Jupyter notebook (not executed) per tutorial.
- Project.toml: HyperFEM 0.3 and HyperFEMKernels 0.2.5 from the General registry, Gridap 0.20.8,
  PETSc_jll 3.22.1; DrWatson, LazyArrays and HyperShape removed.
- E02 (uniaxial stretch of a hyperelastic bar) rewritten with the HyperFEM 0.3 API and checked
  against the closed-form force–stretch curve.
Eighteen self-contained Literate tutorials (E01-E19; 07 reserved for topology
optimisation), written against the registered HyperFEM 0.3.0 and HyperFEMKernels
0.2.6 with the compiled backend, each ending with quantitative checks (exact
solutions, published benchmarks, invariants, regression values with their origin)
that are also the test suite.

- Rewritten: Poisson, hyperelastic stretch, fibre-reinforced cylinder,
  electro-mechanics (isotropic and anisotropic), hMRE beam.
- New: third-medium contact, hMRE beam in vacuum (staggered), Stokes and transient
  Navier-Stokes (DFG benchmarks), pulsatile aorta flow with Windkessel outlets,
  linear solvers (LU, MUMPS, AMG, GAMG, BoomerAMG), h- and p-multigrid,
  elastodynamics, visco-electro-mechanics, thermo-mechanics with hand-written weak
  forms, explicit wave propagation, constitutive models.
- Removed: the old E1-E8 scripts, src/Fluids, unused meshes and dependencies.
- data/models/README.md with the provenance of every mesh.
- README and documentation index list all tutorials; docs/make.jl builds one page
  and one Jupyter notebook per tutorial; a test checks that the list of tutorials,
  the scripts, the README and the documentation index agree, and fails when a
  selection is empty.
- CI without coverage instrumentation and with check_bounds=auto.
@jmartfrut
jmartfrut merged commit b9a5f59 into main Nov 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant