Towards Flexible Constitutive Modelling in FEniCSx with External Operators and Automatic Differentiation
Please login to view abstract download link
Many solid mechanics problems rely on constitutive models whose formulation and numerical resolution are difficult to express in variational form. Consequently, implementing solid mechanics problems in automated finite element frameworks such as FEniCSx / DOLFINx [2], which are built around domain-specific languages tailored to expressing variational formulations, can be challenging. We present a general methodology and accompanying open source software framework [4] that enables the seamless integration of complex constitutive models into FEniCSx by coupling variational forms with externally defined operators written in general-purpose programming languages. Our approach [5] is based on the external operator [3] extension to UFL [1], which provides a symbolic bridge between finite element forms and algorithmic implementations of constitutive laws. This allows constitutive models to be expressed using arbitrary control flow and numerical algorithms, while remaining compatible with existing automatic differentiation (AD) and assembly routines. The methodology is illustrated through two representative solid mechanics examples: a von Mises elastoplastic model with isotropic hardening implemented using Numba, and a Mohr–Coulomb elastoplastic model with apex smoothing implemented using JAX with algorithmic AD capabilities to compute the derivatives required for the solution process. This research was funded in whole, or in part, by the Luxembourg National Research Fund (FNR), grant reference PRIDE/21/16747448/MATHCODA. [1] Martin S. Alnæs et al. “Unified Form Language: A Domain-specific Language for Weak Formulations of Partial Differential Equations”. In: ACM Trans. Math. Softw. 40.2 (Mar. 2014), 9:1–9:37. ISSN: 0098-3500. DOI: 10.1145/2566630. [2] Igor A. Baratta et al. DOLFINx: The next generation FEniCS problem solving environment. Dec. 2025. DOI: 10.5281/zenodo.10447665. [3] Nacime Bouziani and David A. Ham. “Escaping the Abstraction: A Foreign Function Interface for the Unified Form Language [UFL]”. In: First Workshop on Differentiable Programming (NeurIPS 2021) (Dec. 13, 2021). 2021. DOI: 10.48550/arXiv.2111.00945. [4] Andrey Latyshev et al. a-latyshev/dolfinx-external-operator: v0.10.0.post1. Dec. 2025. DOI: 10.5281/zenodo.10907417. [5] Andrey Latyshev et al. “Expressing general constitutive models in FEniCSx using external operators and algorithmic automatic differentiation”. In: JTCAM (2025), p. 14449. ISSN: 2726-6141. DOI: 10.46298/jtcam.14449.
