Rodin

Modern C++20 finite element method and shape optimization framework.

What is Rodin?

Rodin is a lightweight and modular C++20 finite element framework designed for solving partial differential equations (PDEs) and performing shape and topology optimization. It provides a compositional form language that lets you express variational problems in C++ code that closely mirrors the mathematical notation:

Mesh mesh;
mesh = mesh.UniformGrid(Polytope::Type::Triangle, {16, 16});
mesh.getConnectivity().compute(1, 2);

P1 Vh(mesh);
TrialFunction u(Vh);
TestFunction  v(Vh);

Problem problem(u, v);
problem = Integral(Grad(u), Grad(v))
        - Integral(f, v)
        + DirichletBC(u, Zero());

Solver::CG(problem).solve();
Image

It is named after the French sculptor Auguste Rodin, considered the founder of modern sculpture.

Architecture

Rodin is organized as a set of orthogonal modules that remain composable:

ModuleResponsibility
GeometryMeshes, polytopes, connectivity, geometric transformations
VariationalFinite element spaces (P0, P1, H1), trial/test functions, forms, and problem composition
AssemblyLow-level assembly of stiffness matrices and load vectors
SolverDirect solvers (SparseLU, UMFPack) and iterative solvers (CG, GMRES)
QFQuadrature formulas (Gauss–Legendre, Grundmann–Möller)
IOI/O in MFEM, MEDIT, HDF5, and XDMF (ParaView) formats
FormLanguageExpression template infrastructure for the variational form language
MathMathematical constants, dense vector/matrix types, common functions

Optional extension modules add capabilities without replacing core functionality:

ExtensionPurpose
MMGMesh adaptation and optimization via the Mmg Platform
PETScDistributed solvers (KSP, SNES) and PETSc-backed variational forms for large-scale problems
MPIDistributed mesh partitioning, sharding, and parallel assembly via Boost.MPI
SolidHyperelastic solid mechanics: NeoHookean, SaintVenantKirchhoff, MooneyRivlin constitutive laws
AdvectionSemi-Lagrangian transport via characteristic tracing

| Eikonal | Fast Marching Method for the Eikonal equation $ |\nabla u| = F $ | | Distance | Distance function computation (Eikonal, Poisson, level-set normalization) |

Download and build

git clone --recursive https://github.com/cbritopacheco/rodin
cd rodin
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4

See the Installation guide for detailed instructions, dependency lists, and platform-specific notes.

Where to start?

Philosophy behind Rodin

From its inception, Rodin was built with a "batteries included, but screws not glued in" philosophy. The design principles are:

  • Compositional: Users build problems explicitly by composing trial/test functions, integrals, boundary conditions, and solvers. Nothing is hidden behind opaque orchestration objects.
  • Mathematically transparent: The C++ form language mirrors the mathematical notation. Integral(Grad(u), Grad(v)) corresponds directly to $ \int_\Omega \nabla u \cdot \nabla v \, dx $ .
  • Modular: Each module (Geometry, Variational, Solver, etc.) has a well-defined responsibility. New functionality extends existing abstractions rather than duplicating them.
  • Readable: Code should be well documented and stick very close to the mathematical notation it represents.

Development Status

The library is currently in very active development! Some interfaces are likely to change. However, a lot of the functionality is already implemented with various extension points. Contributors are always welcome! Currently it is maintained (and primarily used) by Carlos Brito-Pacheco.