Skip to content

Composable multiscale methods

PyMHM

Composable Multiscale Hybrid Mixed
finite element methods in Python

PyMHM — Composable Multiscale Hybrid Mixed finite element methods in Python PyMHM — Composable Multiscale Hybrid Mixed finite element methods in Python

pymhm is a Python package for Multiscale Hybrid Mixed (MHM) finite element methods and related hybrid formulations. It lets you write the local and global variational equations, choose their approximation spaces, and then assemble, solve and reconstruct the physical fields.

What is MHM?

Multiscale Hybrid Mixed (MHM) methods are derived from hybrid variational formulations on a coarse partition of the domain into macroelements. A decomposition of the space of element-wise fields gives an equivalent global–local formulation: independent local problems and a coupled global problem for interface multipliers and the field components in the local operator kernels, when present. See Harder, Paredes and Valentin (2013) and Harder and Valentin (2016) for further details.

In PyMHM, implementing a method means choosing the macro, skeleton and local approximation spaces, writing its local and global variational equations, and supplying a local solver. The package handles shared interface numbering and geometric orientation, assembles the contributions, and reconstructs the fields after the global solve. Local discretizations, solvers and execution settings are separate choices. The Methods catalogue identifies the available constructions and their primary references; the Tutorials translate them into code step by step.

The reference implementation uses NumPy, SciPy and Basix. The optional FEniCS interface assembles user-defined scalar, vector, mixed and H(div) local forms with UFL/DOLFINx. Meshing connects Gmsh, Netgen and meshio.

The Windows guide covers the portable core, SciPy/PyPardiso, spawn workers and installed-wheel verification, with the native FEM scope stated separately.

Start with the API overview tutorial and the notebook catalogue for scalar and vector formulations and interchangeable local providers. Use the Gallery for applications with problem data, variational formulations, implementations and computed fields.

Follow meshes → spaces → local equations → global equations → assembly → solution → physical fields and errors. The API overview implements this workflow with UFL. Mesh binding connects the local and global approximation spaces; a custom interface provides explicit control of interface bases and maps when needed.

Local discretization, skeleton approximation and linear solvers are separate choices. A provider can use another simulation library, or a local operator can itself be another multiscale problem. The provider guide explains how to connect these solvers.

Available Methods

The package includes MHM formulations and related multiscale constructions. Consult Methods for the catalogue and the cited publications for their mathematical definitions and assumptions. Cite the publications for every method and strategy used, together with the PyMHM version.

Formulation Reference
Primal MHM Harder, Paredes and Valentin (2013)
Mixed H(div) MHM Durán et al. (2019)
Petrov–Galerkin MHM Fernando et al. (2023)
Scalar RAD MHM Harder et al. (2015); Araya et al. (2024)
Stokes–Brinkman MHM Araya et al. (2017)
Oseen MHM Araya et al. (2021)
Primal elasticity MHM Harder, Madureira and Valentin (2016)
GaLS elasticity MHM Gomes, Pereira and Valentin (2024, preprint v1)
Mixed elasticity MHM Devloo et al. (2021)
Elastodynamic MHM Gomes et al. (2017)
Helmholtz MHM Chaumont-Frelet and Valentin (2020)
Maxwell MHM Lanteri et al. (2018)
Robin Multiscale Hybrid method (MH) Barrenechea, Gomes and Paredes (2024)
Three-field Multiscale Method (MH²M) de Barros, Madureira and Valentin (2026, preprint v3)
Multiscale Hybrid High-Order method (MsHHO) Cicuttin, Ern and Lemaire (2019); Chaumont-Frelet et al. (2022)

Complementary strategies:

Strategy Reference
MHM-USFEM: stabilized reaction–diffusion local problems Martins, Pacazuca and Valentin (CILAMCE 2025)
Independent skeletal refinement Paredes, Valentin and Versieux (2024)
Unfitted macro meshes with material-fitted skeletal partitions Chaumont-Frelet, Paredes and Valentin (2026)
Flux reconstruction and associated estimators Barrenechea et al. (2026)
Residual estimators and adaptive refinement Araya et al. (2013); Araya, Rebolledo and Valentin (2021)

Transient scalar integration and nested local/global providers are also available as software capabilities.

Executable formulations

Write local and global equations through the shared variational API, then assemble, solve and evaluate the resulting fields. The feature overview introduces that workflow; the API documents the available scalar, vector and mixed operators and their accepted inputs.

Mesh generation and exchange, local providers and solver selection are configured separately. Choose the geometry and approximation spaces supported by the formulation you intend to implement.

Reproducible examples

Application pages link to notebooks, material data and numerical records. The download guide explains how to obtain those inputs and run the examples with an installed PyMHM. Method tutorials include refinement plots for their stated approximation spaces. Detailed verification studies and performance reports are available under Development.

This is version 1.3.2, an official release of PyMHM. The installation guide explains package installation through pip, optional backends and the locked environments used for reproducible studies.

Figure reuse and attribution

Original figures and diagrams are © IPES Research Group and licensed under CC BY 4.0. Commercial reuse and adaptations require attribution; see figure reuse and attribution.

Institutional Support

PyMHM is developed by the Innovative Parallel numErical Solvers (IPES) research group and receives institutional support from the Laboratório Nacional de Computação Científica (LNCC), a research unit of the Ministério da Ciência, Tecnologia e Inovação (MCTI), Brazil.