Automated dimensional analysis for PDEs
Michal Habera, Andreas Zilian
TL;DR
This work embeds dimensional analysis into the Unified Form Language to automatically nondimensionalize PDE variational forms and verify dimensional consistency. By introducing a Quantity class and a graph-based unit transformation with homogeneous factorization and normalization, the framework behaves as a physics-aware diagonal preconditioner (Full Operator Preconditioning) applied at the form level, not just after assembly. Demonstrations on Poisson, incompressible Navier–Stokes, Neo–Hooke elasticity, and Poisson–Nernst–Planck illustrate how dimensionless groups emerge and guide conditioning and coupling insights. The approach is implemented in the Dolfiny package for FEniCSx but is designed to be transferable to other UFL-based libraries, with broad implications for robustness and efficiency in multiphysics simulations.
Abstract
Physical units are fundamental to scientific computing. However, many finite element frameworks lack built-in support for dimensional analysis. In this work, we present a systematic framework for integrating physical units into the Unified Form Language (UFL). We implement a symbolic Quantity class to track units within variational forms. The implementation exploits the abelian group structure of physical dimensions. We represent them as vectors in $\mathbb{Q}^n$ to simplify operations and improve performance. A graph-based visitor pattern traverses the expression tree to automate consistency checks and factorization. We demonstrate that this automated nondimensionalization functions as the simplest form of Full Operator Preconditioning. It acts as a physics-aware diagonal preconditioner that equilibrates linear systems prior to assembly. Numerical experiments with the Navier--Stokes equations show that this improves the condition number of the saddle-point matrix. Analysis of Neo-Hooke hyperelasticity highlights the detection of floating-point cancellation errors in small deformation regimes. Finally, the Poisson--Nernst--Planck system example illustrates the handling of coupled multiphysics problems with derived scaling parameters. Although the implementation targets the FEniCSx framework, the concepts are general and easily adaptable to other finite element libraries using UFL, such as Firedrake or DUNE.
