Examples and tutorials
Examples utilizing the Rodin library.
Gallery
For a visual overview of what Rodin can do, visit the Gallery.
Variational methods and weak formulations
The Variational module is used when dealing with variational problems of the form:
See the variational formulations guide for the mathematical background, the notation reference for the symbols used, and the solvers guide for choosing a solver.
Solving PDEs
Rodin can be used to solve partial differential equations of many types. To start solving PDEs with Rodin, we recommend taking a look at the simplest example which is how to solve the Poisson equation.
Input/Output
Rodin supports several I/O formats for meshes, grid functions, and simulation data. The supported formats are MFEM, MEDIT, and HDF5. The XDMF format is recommended for exporting results for visualization in ParaView:
Mesh Geometry
The Geometry module provides mesh creation, topological connectivity, and geometric operations:
Working with MMG
The MMG module has a wide variety of uses which ranges from optimization of the mesh, to implicit domain meshing. It provides many C++ wrappers to execute the functionality of the Mmg Platform:
Density optimization examples
Shape optimization examples
Solid Mechanics
The Solid module provides hyperelastic constitutive laws and nonlinear integrators for large-deformation solid mechanics. The LinearElasticityIntegral covers the small-deformation (linearized) case, while the Solid module handles finite-strain problems with constitutive laws such as NeoHookean, Saint-Venant-Kirchhoff, and Mooney-Rivlin:
| Problem | Constitutive Law | Example |
|---|---|---|
| Linear cantilever beam | Solving the elasticity equation | |
| Hyperelastic cantilever (NeoHookean, transient) | examples/Solid/CantileverBeam.cpp |
Distance and Eikonal
The Eikonal module solves via the Fast Marching Method, and the Distance module wraps several distance-function computation strategies:
| Method | Description | Example |
|---|---|---|
| FMM | Exact distance on unstructured meshes | examples/Models/Eikonal/FMM.cpp |
| Spalding-Tucker | Boundary-layer wall distance | examples/Models/Distance/SpaldingTucker.cpp |
PETSc Examples
The PETSc module enables distributed solvers and multi-field block systems. Examples include:
| Problem | Description | Example |
|---|---|---|
| Sequential Poisson | PETSc CG solver on local mesh | examples/PETSc/PDEs/Seq_Poisson.cpp |
| MPI Poisson | Distributed mesh + PETSc KSP | examples/PETSc/PDEs/MPI_Poisson.cpp |
| Sequential Stokes | Multi-field (velocity-pressure-Lagrange) | examples/PETSc/PDEs/Seq_Stokes.cpp |
| Oseen flow | Transient Picard/Oseen linearization | examples/PETSc/PDEs/Seq_OseenFlow.cpp |
| Oseen lid-driven cavity | Transient cavity with Picard/Oseen linearization | examples/PETSc/PDEs/Seq_OseenLidDrivenCavity.cpp |
| Navier-Stokes | Transient nonlinear lid-driven cavity with PETSc SNES | examples/PETSc/PDEs/Seq_NavierStokes.cpp |
Discontinuous Galerkin
The DG example solves the Poisson equation using the Symmetric Interior Penalty (SIP) method with DG-specific operators (Jump, Average, FaceIntegral, InterfaceIntegral):
| Equation | Method | Example |
|---|---|---|
| SIP-DG | examples/DG/Poisson.cpp |
Integral Equations
The Potential operator enables integral equation formulations (boundary element methods). The kernel is convolved with the solution on the mesh:
| Problem | Kernel | Example |
|---|---|---|
| Newtonian potential | examples/IntegralEquations/NewtonianPotential.cpp | |
| Elastic distribution | Navier 3×3 kernel | examples/IntegralEquations/ElasticDistribution.cpp |
Surface Evolution
The surface evolution examples demonstrate conormal advection — moving domain boundaries along their outward normal direction using level-set methods with MMG implicit-domain meshing:
| Problem | Description | Example |
|---|---|---|
| Conormal advection | Move boundary along conormal | examples/SurfaceEvolution/ConormalAdvection/Main.cpp |
| Convergence study | Parametric sweep over resolution and CFL | examples/SurfaceEvolution/ConormalAdvection/Test.cpp |
| Plane evolution | Planar surface motion | examples/SurfaceEvolution/ConormalAdvection/Plane.cpp |
Boundary Optimization
Advanced shape and topology optimization examples that combine complex-valued PDE solvers, adjoint methods, Hilbert space regularization, and MMG remeshing:
| Problem | Description | Example |
|---|---|---|
| Acoustic cloaking | Complex Helmholtz + adjoint-based shape gradient + conormal advection | examples/BoundaryOptimization/AcousticCloaking.cpp |