skip to main content
research-article

Unified form language: A domain-specific language for weak formulations of partial differential equations

Published: 05 March 2014 Publication History

Abstract

We present the Unified Form Language (UFL), which is a domain-specific language for representing weak formulations of partial differential equations with a view to numerical approximation. Features of UFL include support for variational forms and functionals, automatic differentiation of forms and expressions, arbitrary function space hierarchies for multifield problems, general differential operators and flexible tensor algebra. With these features, UFL has been used to effortlessly express finite element methods for complex systems of partial differential equations in near-mathematical notation, resulting in compact, intuitive and readable programs. We present in this work the language and its construction. An implementation of UFL is freely available as an open-source software library. The library generates abstract syntax tree representations of variational problems, which are used by other software libraries to generate concrete low-level implementations. Some application examples are presented and libraries that support UFL are highlighted.

References

[1]
C. Abert, L. Exl, G. Selke, A. Drews, and T. Schrefl. 2012. Numerical methods for the strayfield calculation: A comparison of recently developed algorithms. J. Magn. Magn. Mater.
[2]
M. S. Alnæs. 2009. A compiler framework for automatic linearization and efficient discretization of nonlinear partial differential equations. PhD thesis, University of Oslo.
[3]
M. S. Alnæs and K.-A. Mardal. 2010. On the efficiency of symbolic computations combined with code generation for finite element methods. ACM Trans. Math. Softw. 37, 1.
[4]
M. S. Alnæs and K.-A. Mardal. 2012. SyFi and SFC: Symbolic finite elements and form compilation. In Automated Solution of Differential Equations by the Finite Element Method, A. Logg, K.-A. Mardal, and G. N. Wells, Eds., Lecture Notes in Computational Science and Engineering, vol. 84, chapter 15, Springer.
[5]
M. S. Alnæs, A. Logg, K.-A. Mardal, O. Skavhaug, and H. P. Langtangen. 2009. Unified framework for finite element assembly. Int. J. Comput. Sci. Eng. 4, 4, 231--244. http://dx.doi.org/10.1504/IJCSE.2009.029160.
[6]
M. S. Alnæs, A. Logg, and K.-A. Mardal. 2012. UFC: a finite element code generation interface. In Automated Solution of Differential Equations by the Finite Element Method, A. Logg, K.-A. Mardal, and G. N. Wells, Eds., Lecture Notes in Computational Science and Engineering, vol. 84, chapter 16, Springer.
[7]
D. N. Arnold. 1982. An interior penalty finite element method with discontinuous elements. SIAM J. Numer. Anal. 19, 4, 742--760.
[8]
D. N. Arnold, F. Brezzi, and M. Fortin. A stable finite element for the Stokes equations. Calcolo 21, 4, 337--344. http://dx.doi.org/10.1007/BF02576171.
[9]
D. N. Arnold, R. S. Falk, and R. Winther. 2006. Finite element exterior calculus, homological techniques, and applications. Acta Numer. 15, 1--155.
[10]
D. N. Arnold, R. S. Falk, J. Guzmán, and G. Tsogtgerel. 2012. On the consistency of the combinatorial codifferential. arXiv preprint arXiv:1212.4472.
[11]
B. Bagheri and L. R. Scott. About Analysa. 2004. Tech. Rep. TR-2004-09, Department of Computer Science, University of Chicago. http://www.cs.uchicago.edu/research/publications/techreports/TR-2004-09.
[12]
G. Baumgartner, A. Auer, et al. 2005. Synthesis of high-performance parallel programs for a class of ab Initio quantum chemistry models. Proc. IEEE 93, 2, 276--292. http://dx.doi.org/10.1109/JPROC.2004.840311.
[13]
Boost. 2012. Boost C++ libraries, http://www.boost.org/.
[14]
C. Brandenburg, F. Lindemann, M. Ulbrich, and S. Ulbrich. 2012. Advanced numerical methods for pde constrained optimization with application to optimal design in Navier Stokes flow. In Constrained Optimization and Optimal Control for Partial Differential Equations, Springer, 257--275.
[15]
F. Brezzi, J. Douglas, and L. D. Marini. 1985. Two families of mixed elements for second order elliptic problems. Numer. Math. 47, 217--235.
[16]
P. Brunner, C. Clason, M. Freiberger, and H. Scharfetter. 2012. A deterministic approach to the adapted optode placement for illumination of highly scattering tissue. Biomed. Optics Express 3, 7, 1732.
[17]
DOLFIN. 2012. DOLFIN library. http://launchpad.net/dolfin.
[18]
P. E. Farrell, D. A. Ham, S. W. Funke, and M. E. Rognes. 2012. Automated derivation of the adjoint of high-level transient finite element programs. http://arxiv.org/abs/1204.5577.
[19]
S. W. Funke and P. E. Farrell. 2013. A framework for automated pde-constrained optimisation. CoRR, abs/1302.3894.
[20]
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. 1993. Design patterns: Abstraction and reuse of object-oriented design. In Proceedings of the European Conference on Object-Oriented Programming. 406--431.
[21]
A. Griewank. 1989. On automatic differentiation. In Mathematical Programming: Recent Developments and Applications, M. Iri and K. Tanabe, Eds., Kluwer, 83--108.
[22]
J. Hake, A. G. Edwards, Z. Yu, P. M. Kekenes-Huskey, A. P. Michailova, J. A. McCammon, M. J. Holst, M. Hoshijima, and A. D. McCulloch. 2012. Modelling cardiac calcium sparks in a three-dimensional reconstruction of a calcium release unit. J. Physiol. 590, 18, 4403--4422.
[23]
P. Hudak. 1996. Building domain-specific embedded languages. ACM Comput. Surv. 28, 196.
[24]
J. Karczmarczuk. 2001. Functional differentiation of computer programs. Higher-Order and Symbolic Computation, 14, 1, 35--57. http://dx.doi.org/10.1023/A:1011501232197.
[25]
R. C. Kirby and A. Logg. 2006. A compiler for variational forms. ACM Trans. Math. Softw. 32, 3. http://dx.doi.org/10.1145/1163641.1163644.
[26]
R. C. Kirby and A. Logg. 2012. Finite element variational forms. In Automated Solution of Differential Equations by the Finite Element Method, A. Logg, K.-A. Mardal, and G. N. Wells, Eds., Lecture Notes in Computational Science and Engineering, vol. 84, chapter 5, Springer.
[27]
J. Korelc. 1997. Automatic generation of finite-element code by simultaneous optimization of expressions. Theor. Comput. Sci. 187, 1--2, 231--248. http://dx.doi.org/10.1016/S0304-3975(97)00067-4.
[28]
R. J. Labeur and G. N. Wells. 2012. Energy stable and momentum conserving hybrid finite element method for the incompressible Navier--Stokes equations. SIAM J. Sci. Comput. 34, 2, A889--A913. http://dx.doi.org/10.1137/100818583.
[29]
A. Logg and G. N. Wells. 2010. DOLFIN: Automated finite element computing. ACM Trans. Math. Softw. 37, 2, 20:1--20:28. http://dx.doi.org/10.1145/1731022.1731030.
[30]
A. Logg, K.-A. Mardal, and G. N. Wells, Eds. 2012a. Automated Solution of Differential Equations by the Finite Element Method. Lecture Notes in Computational Science and Engineering, vol. 84, Springer.
[31]
A. Logg, K. B. Ølgaard, M. E. Rognes, and G. N. Wells. 2012b. FFC: The FEniCS form compiler. In Automated Solution of Differential Equations by the Finite Element Method, A. Logg, K.-A. Mardal, and G. N. Wells, Eds., Lecture Notes in Computational Science and Engineering, vol. 84, chapter 11, Springer.
[32]
A. Logg, G. N. Wells, and J. Hake. 2012c/ DOLFIN: A C++/Python finite element library. In Automated Solution of Differential Equations by the Finite Element Method, A. Logg, K.-A. Mardal, and G. N. Wells, Eds., Lecture Notes in Computational Science and Engineering, vol. 84, Chapter 10, Springer.
[33]
K. Long, R. Kirby, and B. Van Bloemen Waanders. 2010. Unified embedded parallel finite element computations via software-based Fréchet differentiation. SIAM J. Sci. Comput. 32, 3323--3351.
[34]
M. Maraldi, G. N. Wells, and L. Molari. 2011. Phase field model for coupled displacive and diffusive microstructural processes under thermal loading. J. Mech. Phys. Solids 59, 8, 1596--1612. http://dx.doi.org/10.1016/j.jmps.2011.04.017.
[35]
G. Markall, A. Slemmer, D. Ham, P. Kelly, C. Cantwell, and S. Sherwin. 2012. Finite element assembly strategies on multi-core and many-core architectures. Int. J. Numer. Methods Fluids. http://dx.doi.org/10.1002/fld.3648.
[36]
G. R. Markall, D. A. Ham, and P. H. J. Kelly. 2010. Towards generating optimised finite element solvers for GPUs from high-level specifications. Proc. Comp. Sci. 1, 1, 1815--1823.
[37]
A. Massing, M. G. Larson, A. Logg, and M. E. Rognes. 2012. A stabilized Nitsche fictitious domain method for the Stokes problem. http://arxiv.org/abs/1206. 1933.
[38]
M. Mortensen, H. P. Langtangen, and G. N. Wells. 2011. A FEniCS-based programming framework for modeling turbulent flow by the Reynolds-averaged Navier-Stokes equations. Adv. Water Res. 34, 9, 1082--1101, 2011. http://dx.doi.org/j.advwatres.2011.02.013.
[39]
J. C. Nédélec. 1986. A new family of mixed finite elements in R3. Numer. Math. 50, 1, 57--81.
[40]
M. Nikbakht and G. N. Wells. 2009. Automated modelling of evolving discontinuities. 2, 3, 1008--1030. http://dx.doi.org/10.3390/a2031008.
[41]
K. B. Ølgaard and G. N. Wells. 2010. Optimisations for quadrature representations of finite element tensors through automated code generation. ACM Trans. Math. Softw. 37, 1, 8:1--8:23.
[42]
K. B. Ølgaard, A. Logg, and G. N. Wells. 2008. Automated code generation for discontinuous Galerkin methods. SIAM J. Sci. Comput. 31, 2, 849--864. http://dx.doi.org/10.1137/070710032.
[43]
B. A. Pearlmutter and J. M. Siskind. 2007. Lazy multivariate higher-order forward-mode AD. In Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 155--160. http://dx.doi.org/10.1145/1190216.1190242.
[44]
C. Prud'homme. 2006. A domain specific embedded language in C++ for automatic differentiation, projection, integration and variational formulations. In Scientific Programming 14, 81--110.
[45]
C. Prud'homme. 2011. Feel++. https://forge.imag.fr/projects/life/.
[46]
PyChecker. 2011. PyChecker: A Python source code checking tool. http://pychecker.sourceforge.net.
[47]
M. E. Rognes and A. Logg. 2012. Automated goal-oriented error control I: stationary variational problems. http://arxiv.org/abs/1204.6643.
[48]
M. E. Rognes, R. C. Kirby, and A. Logg. 2009. Efficient assembly of H(div) and H(curl) conforming finite elements. SIAM J. Sci. Comput. 31, 6, 4130--4151. http://dx.doi.org/10.1137/08073901X.
[49]
E. Rosseel and G. N. Wells. 2012. Optimal control with stochastic PDE constraints and uncertain controls. Comput. Meth. Appl. Mech. Eng. 213--216, 152--167. http://dx.doi.org/10.1016/j.cma.2011.11.026.
[50]
J. R. Shewchuk and O. Ghattas. 1993. A compiler for parallel finite element methods with domain-decomposed unstructured meshes. In Proceedings of the 7th International Conference on Domain Decomposition Methods in Scientific and Engineering Computing, D. E. Keyes and J. Xu, Eds., Contemporary Mathematics, volume 180, American Mathematical Society, 445--450.
[51]
J. M. Siskind and B. A. Pearlmutter. 2008. Nesting forward-mode AD in a functional framework. Higher Order Symbol. Comput. 21, 4, 361--376. http://dx.doi.org/10.1007/s10990-008-9037-1.
[52]
C. Taylor and P. Hood. 1973. A numerical solution of the Navier-Stokes equations using the finite element technique. Comput. Fluids. 1, 1, 73--100.
[53]
UFL. Unified Form Language, 2012. http://launchpad.net/ufl.
[54]
P. Wang. 1986. FINGER: A symbolic system for automatic generation of numerical programs in finite element analysis. J. Symbolic Comput. 2, 3, 305--316. http://dx.doi.org/10.1016/S0747-7171(86)80029-3.
[55]
G. N. Wells. 2011. Analysis of an interface stabilised finite element method: The advection-diffusion-reaction equation. SIAM J. Numer. Anal. 49, 1, 87--109. http://dx.doi.org/10.1137/090775464.
[56]
J. Xiong, J. Johnson, R. Johnson, and D. Padua. 2001. SPL: A language and compiler for DSP algorithms. SIGPLAN Not. 36, 298--308. http://dx.doi.org/10.1145/381694.378860.

Cited By

View all
  • (2025)Reconstructing the Magnetic Field in an Arbitrary Domain via Data-Driven Bayesian Methods and Numerical SimulationsComputation10.3390/computation1302003713:2(37)Online publication date: 5-Feb-2025
  • (2025)Engineering mechanical resonances of magnetoelectric transducersApplied Physics Letters10.1063/5.0249464126:5Online publication date: 4-Feb-2025
  • (2025) Grain-Boundary Corrosion in UO 2+δ from a Defect Chemical Perspective: A Case Study of the Σ5(310)[001] Grain Boundary ACS Applied Materials & Interfaces10.1021/acsami.4c2068817:5(7906-7915)Online publication date: 24-Jan-2025
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Mathematical Software
ACM Transactions on Mathematical Software  Volume 40, Issue 2
February 2014
161 pages
ISSN:0098-3500
EISSN:1557-7295
DOI:10.1145/2594412
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 05 March 2014
Accepted: 01 April 2013
Revised: 01 April 2013
Received: 01 November 2012
Published in TOMS Volume 40, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. AD
  2. DSEL
  3. DSL
  4. FEM
  5. PDE
  6. algorithmic differentiation
  7. automatic functional differentiation
  8. discretization
  9. domain specific language
  10. einstein notation
  11. embedded language
  12. finite element method
  13. functional
  14. implicit summation
  15. index notation
  16. mixed element
  17. partial differential equation
  18. symbolic differentiation
  19. tensor algebra
  20. weak form
  21. weak formulation

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • Norges Forskningsråd
  • Center of Excellence grant awarded to the Center for Biomedical Computing at Simula Research Laboratory

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)185
  • Downloads (Last 6 weeks)18
Reflects downloads up to 16 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Reconstructing the Magnetic Field in an Arbitrary Domain via Data-Driven Bayesian Methods and Numerical SimulationsComputation10.3390/computation1302003713:2(37)Online publication date: 5-Feb-2025
  • (2025)Engineering mechanical resonances of magnetoelectric transducersApplied Physics Letters10.1063/5.0249464126:5Online publication date: 4-Feb-2025
  • (2025) Grain-Boundary Corrosion in UO 2+δ from a Defect Chemical Perspective: A Case Study of the Σ5(310)[001] Grain Boundary ACS Applied Materials & Interfaces10.1021/acsami.4c2068817:5(7906-7915)Online publication date: 24-Jan-2025
  • (2025)On the approximation of operator-valued Riccati equations in Hilbert spacesJournal of Mathematical Analysis and Applications10.1016/j.jmaa.2025.129250547:1(129250)Online publication date: Jul-2025
  • (2025)An adaptive mesh refinement algorithm for stress-based phase field fracture models for heterogeneous media: Application using FEniCS to ice-rock cliff failuresFinite Elements in Analysis and Design10.1016/j.finel.2024.104311244(104311)Online publication date: Feb-2025
  • (2025)An inverse design framework for optimizing tensile strength of composite materials based on a CNN surrogate for the phase field fracture modelComposites Part A: Applied Science and Manufacturing10.1016/j.compositesa.2025.108758192(108758)Online publication date: May-2025
  • (2025)MicroSim: A high-performance phase-field solver based on CPU and GPU implementationsComputational Materials Science10.1016/j.commatsci.2024.113438246(113438)Online publication date: Jan-2025
  • (2025)Multiphysics simulation of crystal growth with moving boundaries in FEniCSComputer Methods in Applied Mechanics and Engineering10.1016/j.cma.2025.117783437(117783)Online publication date: Mar-2025
  • (2025)A Bayesian framework for constitutive model identification via use of full field measurements, with application to heterogeneous materialsComputer Methods in Applied Mechanics and Engineering10.1016/j.cma.2024.117489433(117489)Online publication date: Jan-2025
  • (2025)A software benchmark for cardiac elastodynamicsComputer Methods in Applied Mechanics and Engineering10.1016/j.cma.2024.117485435(117485)Online publication date: Feb-2025
  • Show More Cited By

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media