FEniCS Project
The FEniCS Project is an open-source computing platform designed for solving partial differential equations (PDEs) using the finite element method (FEM), enabling automated translation of mathematical models into efficient numerical code.[1][2] Originating in 2003 at Chalmers University of Technology in Sweden, it was initiated by researchers Anders Logg and Johan Hoffman to automate computational mathematical modeling and simplify PDE discretizations through high-level domain-specific languages.[2] Legacy key components include DOLFIN, a C++ library for managing meshes, solvers, and forms; FIAT for constructing finite element bases; FFC, a form compiler that generates optimized code; and UFL, the Unified Form Language for symbolically describing PDEs in Python. The current FEniCSx uses DOLFINx, Basix, FFCx, and UFL.[2][3] The project supports both Python and C++ interfaces, facilitating use from laptops to high-performance computing clusters, and integrates with libraries like PETSc and Trilinos for advanced solvers.[2][4] Developed and maintained by a global community of scientists and software developers under the NumFOCUS umbrella, FEniCS has evolved into FEniCSx, with its latest stable release (version 0.1) in October 2025, while the legacy FEniCS version remains at 2019.1.0.[5][3] Widely applied in fields such as fluid mechanics, biomedical engineering, and geoscience, it offers high productivity for both beginners and experts by handling complex 2D/3D simulations with parallel computing capabilities and minimal low-level coding.[4]
Introduction
Overview
The FEniCS Project is an open-source computing platform designed for solving partial differential equations (PDEs) using the finite element method (FEM). It enables users to translate scientific models into efficient finite element code through high-level Python and C++ interfaces, making it accessible to both beginners and experienced programmers. The platform supports computations ranging from laptops to high-performance computing clusters and is collaboratively developed by researchers worldwide.[1]
Initiated in 2003 by Anders Logg and Johan Hoffman at the Chalmers University of Technology, with contributions from Ridgway Scott based on prior work like the Analysa system, FEniCS aims to automate the process of computational mathematical modeling, particularly for finite element discretizations of PDEs. Its philosophy emphasizes intuitive, efficient, and flexible tools that allow high-level descriptions of mathematical structures, reducing error-prone low-level coding. Key components include DOLFINx, a high-performance C++ library for meshes, function spaces, and assembly; the Unified Form Language (UFL) for variational formulations; FFCx, a form compiler; and Basix for basis functions.[6][2]
FEniCS has significantly impacted fields such as biomedical computing, including simulations of blood flow and cardiac mechanics at institutions like Simula Research Laboratory. The project received the 2015 Wilkinson Prize for Numerical Software through its collaboration on dolfin-adjoint, highlighting its contributions to automatic differentiation in PDE solvers. It continues to evolve, with its stable release, FEniCSx version 0.1 in October 2025, representing the latest iteration and offering improved support for diverse cell types and integration with libraries like PETSc for scalable solvers.[2][6][3]
Goals and Philosophy
The FEniCS Project aims to establish a new standard in computational mathematical modeling (CMM) by automating the solution of partial differential equations (PDEs) using the finite element method (FEM), emphasizing generality, efficiency, and simplicity in both methodology and implementation.[7] This automation encompasses key stages of the FEM workflow, including the generation of finite element discretizations, evaluation of variational forms, mesh adaptation, assembly of discrete systems, and error control, enabling users to translate mathematical models into efficient code with minimal manual intervention.[8] By providing high-level interfaces in Python and C++, the project targets scientists and engineers, from novices to experts, facilitating rapid prototyping on diverse platforms ranging from laptops to high-performance computing systems.[1]
Philosophically, FEniCS draws inspiration from Gottfried Wilhelm Leibniz's principle of the "best possible of worlds," seeking maximal generality in problem-solving through minimal foundational principles, akin to natural selection in computational tools.[7] The project views automation as essential for advancing scientific discovery and societal progress, reducing environmental impact by optimizing simulations and democratizing access to advanced numerical methods via open-source licensing under the GNU Lesser General Public License (LGPL) version 3.[7][9] This commitment to openness fosters international collaboration among institutions such as the University of Chicago, Chalmers University of Technology, and Simula Research Laboratory, under the fiscal sponsorship of NumFOCUS, promoting reusable components and community-driven development.[8][10]
Core to its design is a balance of simplicity and power: users express problems in a high-level, intuitive domain-specific language, while underlying compilers like the Form Compiler (FFC) generate optimized, low-level code for efficiency, such as reducing operations in tensor contractions from 16 to 11 in non-trivial cases.[8] The project prioritizes correctness through adaptive error estimation and automatic verification, ensuring reliable results without exhaustive manual tuning, and supports extensions like parallelization and optimization of cost functionals to handle complex, real-world applications.[7] Overall, FEniCS seeks to transform FEM from a labor-intensive craft into an automated, accessible science, impacting both academic research and industrial simulations.[1]
History
Founding and Early Development
The FEniCS Project was founded in 2003 as a collaborative effort to develop open-source software for the automated solution of partial differential equations using the finite element method. The initiative brought together researchers from Chalmers University of Technology in Sweden, the University of Chicago, and the Toyota Technological Institute at Chicago, with key founders including Todd Dupont, Johan Hoffman, Claes Johnson, Robert Kirby, Mats Larson, Anders Logg, and Ridgway Scott. This partnership built on earlier prototypes, notably the DOLFIN library initiated in 2002 at Chalmers by Logg and collaborators to provide an adaptive finite element computation platform, and FIAT, developed by Kirby at the University of Chicago for automatic tabulation of finite element basis functions. The project's vision emphasized generality, efficiency, and simplicity in computational mathematical modeling, aiming to bridge the gap between mathematical formulation and efficient code generation.[7][11][2]
Early development focused on integrating these initial components to create a unified framework for automating finite element computations. DOLFIN served as the computational kernel, handling mesh generation, assembly, and solving, while FIAT provided the basis function computations necessary for variational formulations. An additional prototype, Analysa—a Scheme-based problem-solving environment for PDEs—was incorporated to support high-level scripting. By 2005, the project had advanced to include the Form Compiler (FFC), which automated the generation of efficient code from variational forms, and the Unified Form Language (UFL), a domain-specific language for expressing weak forms of PDEs. These additions enabled users to specify mathematical models declaratively, with the software handling discretization and optimization automatically. Workshops, such as the 2005 FEniCS event at the Toyota Technological Institute, facilitated collaboration and refinement among developers.[7][2][12]
The project's open-source philosophy, adopted from the outset, encouraged contributions from a growing international community, leading to rapid iterations in the mid-2000s. Initial releases, including version 0.9 around 2005, demonstrated the framework's potential through benchmarks on standard PDE problems like Poisson's equation, showcasing performance comparable to hand-coded solvers while reducing development time. By 2008, FEniCS had evolved to support complex multiphysics simulations, with publications highlighting its role in advancing automated scientific computing. This period solidified FEniCS as a foundational tool in computational science, influencing subsequent tools like Firedrake.[2][13][14]
Key Milestones and Evolution
Early development accelerated with the introduction of key technologies, including the Unified Form Language (UFL) in 2005 for high-level expression of variational forms and the FEniCS Form Compiler (FFC) for just-in-time code generation. The first FEniCS conference was held in 2005, marking the project's growing community engagement with 15 participants. FEniCS 1.0 was released in 2011, followed by the publication of the seminal book Automated Solution of Differential Equations by the Finite Element Method in 2012, which documented the project's philosophy and components like DOLFIN, FFC, FIAT, Instant, UFC, and UFL. In 2015, version 1.5 enhanced parallel performance and mixed finite element support, enabling scalable simulations on distributed systems. The project became affiliated with NumFOCUS in 2016, providing fiscal sponsorship to support open-source sustainability.[15][16][17][10]
The project's evolution culminated in the legacy series' final release, 2019.1.0, in April 2019, which incorporated improvements in linear algebra backends and just-in-time compilation. Recognizing limitations in the original architecture, such as dependencies on outdated technologies, development shifted in 2021 to FEniCSx, a complete redevelopment emphasizing modularity, performance, and modern standards like C++17 and PETSc 3.15+. FEniCSx introduced components like DOLFINx for core functionality, Basix for element definition, and FFCx for form compilation, supporting advanced features such as mixed-dimensional problems and GPU acceleration. An alpha release, version 0.9.0, was issued in October 2024, featuring native Windows compatibility, data-independent form compilation, and enhanced MPI support. The first stable release of FEniCSx, version 0.1, followed in October 2025, further improving modularity and integration with contemporary high-performance computing applications. This transition ensures long-term maintainability while preserving the project's core goal of automating finite element computations.[18][19][20][3]
Design and Architecture
Core Design Principles
The FEniCS Project is founded on the vision of automating computational mathematical modeling (CMM) to achieve generality, efficiency, and simplicity in solving partial differential equations (PDEs) via the finite element method (FEM). Generality is pursued through support for arbitrary PDEs, meshes, finite elements, and open-standard input/output formats, enabling broad applicability without restricting users to specific problem classes. Efficiency is emphasized via adaptive discretization, optimization techniques, and parallelization, reflecting a principle of selecting the most effective computational strategies akin to natural selection. Simplicity is realized through a modular structure and an intuitive application programming interface (API), including a high-level scripting language that abstracts complex implementation details.[7]
Correctness forms another cornerstone, ensured by adaptive error control mechanisms and automated code generation that minimizes human-induced errors in FEM implementations. The project adopts an open-source ethos under the GNU General Public License, promoting stability, community-driven improvements, and widespread dissemination of tools for scientific computing. These principles guide the automation of key CMM steps, from problem formulation in variational form to code generation and solution assembly.[7]
In its evolution to FEniCSx, the core library—DOLFINx—refines these foundations with a data-oriented and functional-style design, prioritizing pure functions over heavy object-oriented encapsulation to enhance performance, parallel consistency, and hardware adaptability, such as GPU acceleration. This approach reduces the public API surface while maintaining extensibility, allowing custom kernels and user-injected functions without core modifications. Modularity is amplified through separation of concerns, with components like the Unified Form Language (UFL) for abstractions, FFCx for just-in-time (JIT) kernel generation, and Basix for basis function evaluation, resulting in a compact codebase under 30,000 lines of C++ that supports multiple linear algebra backends (e.g., PETSc, Eigen) and language interfaces (C++20 and Python via NumPy/Numba). The design ensures high-level mathematical abstractions coexist with low-level control for optimized, scalable simulations, as demonstrated in benchmarks scaling to 412 billion cells on 131,072 cores.[21][22][19]
The Unified Form Language (UFL) is a domain-specific language designed for the declarative representation of finite element discretizations of variational forms and functionals in the solution of partial differential equations (PDEs).[23] It enables users to express weak formulations in a syntax closely resembling mathematical notation, facilitating the automated generation of efficient finite element code without requiring low-level implementation details.[24] Developed as a core component of the FEniCS Project, UFL was introduced to improve the expressiveness and portability of variational problem descriptions across different finite element libraries and compilers.[23]
UFL's design emphasizes simplicity, generality, and extensibility, allowing for the specification of complex PDE systems involving multi-field function spaces, differential operators, tensor algebra, and automatic differentiation.[23] Key features include support for a wide range of finite element families (such as Lagrange, discontinuous Galerkin, and Raviart-Thomas elements), mixed and tensor-valued function spaces, and integration over cells, boundaries, and interior facets.[25] The language processes expressions into abstract syntax trees, which are then compiled by tools like the FEniCS Form Compiler (FFC) into Unified Form-assembly Code (UFC) for runtime assembly in solvers such as DOLFIN.[24] This separation of form definition from assembly ensures that UFL remains independent of specific numerical implementations, promoting reuse and optimization.[23]
In UFL, variational forms are constructed using atomic expressions and operators imported from the UFL Python module (from ufl import *). Finite element spaces are defined via elements like FiniteElement("Lagrange", [triangle](/page/Triangle), 1) for scalar fields or VectorElement("Lagrange", [triangle](/page/Triangle), 1) for vectors, with mixed spaces formed by * (e.g., V * Q).[25] Trial and test functions are declared as u = TrialFunction(V) and v = TestFunction(V), while coefficients represent known functions or data. Common operators include inner(a, b) for tensor inner products, grad(u) for gradients, div(u) for divergence, and curl(u) for curls in 3D. Integrals are specified with measures such as dx for cell volumes, ds for boundaries, and dS for interior facets, often with restrictions like v('+') for positive facets in discontinuous Galerkin methods.[25] Indexing supports component extraction (e.g., u[i]), and implicit summation follows Einstein convention for repeated indices.[25]
Representative examples illustrate UFL's application to standard PDEs. For the Poisson equation -\Delta u = f on a domain \Omega with Dirichlet boundary conditions, the bilinear form is a = inner(grad(u), grad(v)) * dx and the linear form is L = f * v * dx, where u and v are trial and test functions on a Lagrange space V.[26] In linear elasticity, the strain tensor \epsilon(u) = \frac{1}{2}(\nabla u + (\nabla u)^T) yields a bilinear form a = inner(epsilon(u), epsilon(v)) * dx on a vector space.[26] For time-dependent problems like the heat equation \partial_t u - \nabla \cdot (k \nabla u) = f, UFL supports forms such as a = v * u1 * dx + inner(grad(v), k * grad(u1)) * dx (bilinear) and L = v * u0 * dx + v * f * dx (linear), where u0 and u1 denote previous and current time steps.[26] These forms are assembled into matrices and vectors within FEniCSx, the modern iteration of FEniCS, enabling scalable solutions on parallel architectures.[24]
UFL's algorithms handle form manipulation, including symbolic differentiation for nonlinear problems (e.g., via derivative(a, u, du)), expression tree optimization, and estimation of computational costs for code generation.[27] Initially proposed in 2012 by Alnæs, Logg, Ølgaard, Rognes, and Wells, UFL has evolved through ongoing development in the open-source FEniCS ecosystem, with versions like 2025.2.0 (as of October 2025) supporting advanced features such as custom elements and facet-oriented integrals.[23][28] Its adoption extends beyond FEniCS to other projects, underscoring its role in democratizing high-performance finite element computing.[23]
Components
Legacy Components
The legacy components of the FEniCS Project form the foundational software stack of the original FEniCS releases, culminating in version 2019.1.0, which was made available in April 2019 and remains installable for backward compatibility, though it receives no further updates or maintenance.[3] These components—DOLFIN, FFC, FIAT, and the legacy version of UFL—collaborate to automate the finite element solution of partial differential equations (PDEs), enabling users to define problems at a high mathematical level while generating optimized low-level code for computation.[29] Their design emphasizes modularity, with UFL handling problem specification, FFC performing compilation, FIAT supplying basis function data, and DOLFIN managing numerical execution, thus streamlining the workflow from variational formulation to solved systems.[30]
DOLFIN functions as the central problem-solving environment and computational backend, implemented primarily in C++ with Python bindings for accessibility. It processes unstructured meshes, constructs finite element function spaces, assembles discrete variational forms into linear systems, and solves them using a range of sparse linear algebra backends, such as PETSc or Trilinos, supporting both stationary and time-dependent problems.[31] This component abstracts complex numerical operations, allowing seamless integration of mesh generation tools like mshr and visualization via libraries such as Paraview, while providing interfaces for boundary conditions, subdomains, and adaptive refinement.
FFC, or the FEniCS Form Compiler, is a just-in-time compiler that translates abstract variational forms from UFL into performant, element-specific C++ code for assembly within DOLFIN. By analyzing the mathematical structure of forms—such as bilinear forms for stiffness matrices or linear forms for load vectors—it applies optimizations like tensor representation and quadrature rule selection to minimize computational overhead, supporting arbitrary-order elements and mixed finite element spaces.[32] This compilation step ensures that the generated code is tailored to the problem's geometry and discretization, avoiding generic implementations that could sacrifice efficiency.[33]
FIAT, the Finite element Automatic Tabulator, is a Python library dedicated to the symbolic and numerical generation of finite element basis functions and their derivatives for diverse families, including Lagrange, discontinuous Galerkin, and vector elements like Raviart-Thomas or Nédélec, on simplicial cells in one, two, or three dimensions. It computes tabulations of basis values at quadrature points and supports high-order polynomials, providing essential data to FFC during form compilation without requiring manual derivation of these functions.[34] FIAT's extensibility allows for the inclusion of new element types through algebraic definitions, enhancing the project's adaptability to specialized applications in electromagnetics or fluid dynamics.[35]
The legacy UFL, or Unified Form Language, serves as the high-level interface for expressing PDE weak formulations in a syntax resembling mathematical notation, embedded within Python scripts. Users define trial and test function spaces over meshes, specify integrals over domains and boundaries using symbolic operations like dot products or gradients, and incorporate coefficients or material properties, all of which are parsed to ensure mathematical consistency before compilation.[36] Compatible only with the legacy FEniCS stack due to API changes in later versions, UFL legacy facilitates rapid prototyping by abstracting finite element details, such as degree-of-freedom mapping, into concise code.[37]
Together, these components enable a streamlined pipeline: a variational problem authored in UFL is parsed and compiled by FFC, which queries FIAT for basis evaluations, producing assembly kernels executed in DOLFIN to yield numerical solutions. This architecture, while superseded by the FEniCSx suite for modern hardware and parallel computing, continues to support legacy codes in research and education, particularly for problems in solid mechanics, heat transfer, and electromagnetism.[30]
FEniCSx Components
FEniCSx represents the next-generation implementation of the FEniCS project, designed as a collection of modular, high-performance libraries that enable the automated solution of partial differential equations (PDEs) using the finite element method (FEM). Unlike its predecessor, FEniCSx emphasizes modern programming practices, parallel computing support, and improved efficiency through just-in-time compilation. It comprises four core libraries—UFL, Basix, FFCx, and DOLFINx—that work in tandem to handle everything from variational form definition to numerical assembly and solving.[6][3]
The Unified Form Language (UFL) serves as the high-level interface for specifying variational formulations of PDEs. It provides a symbolic, math-like syntax that allows users to define integrals, function spaces, and operators in a concise and intuitive manner, abstracting away low-level implementation details. For instance, a user can express the weak form of the Poisson equation using expressions like inner(grad(u), grad(v)) * [dx](/page/DX), where u and v are trial and test functions, respectively. UFL is implemented in Python and supports extensions for custom operators, making it extensible for advanced users while remaining accessible for beginners. Its role is pivotal as it acts as the input layer for the entire FEniCSx pipeline, translating mathematical intent into compilable code.[6][3]
Basix functions as the finite element backend, responsible for generating and tabulating basis functions, degrees of freedom, and quadrature rules for a wide range of finite element families, including Lagrange, Nédélec, Raviart-Thomas, and discontinuous Galerkin elements. Written primarily in C++ for performance, Basix precomputes reference element data and supports dynamic loading of element tables, enabling efficient runtime evaluation without redundant calculations. This library ensures numerical accuracy and flexibility in mesh adaptations, such as handling mixed or hybrid elements in complex geometries. By decoupling basis function computations from the rest of the system, Basix allows FEniCSx to scale across different element types and dimensions seamlessly.[38][6]
FFCx is the form compiler that transforms UFL expressions into optimized, low-level C code for finite element assembly. It performs just-in-time (JIT) compilation using tools like TSFC (a domain-specific compiler) to generate kernel code tailored to the specific variational form, incorporating optimizations such as loop unrolling, expression simplification, and tensor contraction. This process minimizes overhead in assembling stiffness matrices and load vectors, particularly for nonlinear problems or multiphysics simulations. FFCx supports parallel assembly and integrates with external libraries for further code generation, ensuring that the compiled kernels are executable on both CPU and GPU architectures where applicable. Its efficiency is demonstrated in benchmarks where assembly times are reduced by orders of magnitude compared to interpretive methods.[6][3]
DOLFINx forms the computational core of FEniCSx, implementing the high-level problem-solving environment in both C++ and Python. It manages mesh generation, function spaces, and discretization; performs finite element assembly by integrating FFCx-generated kernels; and solves the resulting linear or nonlinear systems via interfaces to libraries like PETSc, SLEPc, and Hypre for scalable linear algebra. DOLFINx supports distributed-memory parallelism through MPI, adaptive mesh refinement, and I/O operations compatible with formats like XDMF and VTK. For example, it can handle multiphysics couplings by composing multiple UFL forms into a unified solver. This library's design prioritizes modularity, allowing users to extend functionality for custom boundary conditions or multigrid preconditioners while maintaining high performance on large-scale HPC systems.[6][39]
Applications and Usage
Typical Use Cases
The FEniCS Project is primarily employed for solving partial differential equations (PDEs) in various scientific and engineering domains through the finite element method (FEM), enabling rapid prototyping and high-performance simulations.[1] Typical applications span linear elliptic problems, time-dependent diffusion equations, and nonlinear systems, often integrated with multiphysics modeling to simulate coupled phenomena.[6] Researchers and engineers use FEniCS to translate mathematical formulations directly into code, facilitating studies in fields like mechanics, electromagnetics, and fluid dynamics without low-level implementation details.[40]
In solid mechanics, FEniCS is commonly applied to elasticity problems, such as modeling the deformation of a clamped beam under gravitational load in three dimensions, which demonstrates linear elasticity PDEs with Dirichlet and Neumann boundary conditions. More advanced uses include elastodynamic simulations for non-destructive evaluation, like ultrasound wave propagation in materials, leveraging time-dependent wave equations solved via FEniCSx.[41] Structural analysis examples also encompass stress prediction in perforated plates, combining FEM with machine learning for efficient engineering design.[41]
Fluid dynamics represents another key area, where FEniCS supports the solution of the Navier-Stokes equations for incompressible flows, including nonlinear time-dependent cases like blood flow in patient-specific brain aneurysms with slip boundary conditions.[6][41] Applications extend to computational fluid dynamics (CFD) for environmental engineering, such as simulating tidal turbine wakes using arbitrary Lagrangian-Eulerian methods on moving domains.[42]
Electromagnetics simulations utilize FEniCS for solving Maxwell's equations, particularly in device design and nanophotonics, where custom boundary conditions enable modeling of waveguides and scattering problems.[41] In heat transfer and diffusion, the heat equation serves as a foundational example, applied to transient thermal problems across materials.[6]
Biomedical and geophysical applications highlight FEniCS's versatility in multiphysics contexts. For instance, continuum models of brain tumor growth incorporate reaction-diffusion PDEs coupled with tissue mechanics, using patient-specific MRI data for personalized simulations.[41] In nuclear fusion research, FEniCS-based tools like FESTIM model hydrogen isotope transport in reactor blankets via diffusion-reaction equations.[41] These cases underscore FEniCS's role in high-impact, interdisciplinary research, often scalable to high-performance computing environments.[43]
Integration and Examples
FEniCS integrates with the broader Python ecosystem to facilitate efficient scientific computing workflows. In the legacy FEniCS, components like DOLFIN rely on NumPy for array manipulations, such as extracting vertex values for error computations, and SymPy for symbolic differentiation in manufactured solution verification.[44] FEniCSx extends this by incorporating mpi4py for parallel computing via MPI, enabling distributed simulations across multiple processes, and petsc4py for interfacing with PETSc's linear algebra backends, which handle assembly and solution of sparse systems.[45] Variational forms are defined using UFL, which compiles to efficient code via FFCx, ensuring high-performance evaluation without manual kernel implementation.
For mesh generation, FEniCS supports built-in functions like create_unit_square in DOLFINx for simple domains, while complex geometries are handled through integration with Gmsh via the dolfinx.io.gmshio module, allowing import of tagged meshes for boundary conditions and multiphysics problems. Visualization options include Matplotlib for 2D plots in legacy versions, such as contour plots of solutions, and pyvista in FEniCSx for interactive 3D rendering of function data on meshes.[44] Outputs are commonly saved in XDMF format for post-processing in ParaView, supporting time-dependent visualizations and scalar/vector field rendering.[45]
Solvers in FEniCS leverage PETSc for both linear and nonlinear problems, with options for preconditioners like hypre_amg or lu decomposition specified via PETSc parameters.[45] Nonlinear solvers, such as Newton's method, are automated through high-level interfaces like NonlinearProblem, integrating seamlessly with PETSc's SNES for convergence control. For eigenvalue problems, SLEPc provides spectral solvers, often used in modal analysis.
A representative example is the solution of the Poisson equation -\Delta u = f in a rectangular domain with Dirichlet boundary conditions, demonstrating core integration of meshing, form assembly, and solving in FEniCSx. The following code creates a triangular mesh, defines a Lagrange function space, assembles the bilinear form a(u, v) = \int \nabla u \cdot \nabla v \, dx and linear form L(v) = \int f v \, dx + \int g v \, ds, applies boundary conditions using topological location, and solves via PETSc's LinearProblem:
python
from mpi4py import MPI
from petsc4py.PETSc import ScalarType
import [numpy](/page/NumPy) as np
import ufl
from dolfinx import fem, io, [mesh](/page/Mesh)
from dolfinx.fem.petsc import LinearProblem
msh = [mesh](/page/Mesh).create_rectangle(comm=MPI.COMM_WORLD, points=((0.0, 0.0), (2.0, 1.0)), n=(32, 16),
cell_type=[mesh](/page/Mesh).CellType.[triangle](/page/Triangle))
V = fem.FunctionSpace(msh, ("Lagrange", 1))
facets = [mesh](/page/Mesh).locate_entities_boundary(msh, dim=(msh.[topology](/page/Topology).dim - 1),
marker=lambda x: np.isclose(x[0], 0.0) | np.isclose(x[0], 2.0))
dofs = fem.locate_dofs_topological(V=V, entity_dim=1, entities=facets)
bc = fem.dirichletbc(value=ScalarType(0), dofs=dofs, V=V)
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
x = ufl.SpatialCoordinate(msh)
f = 10 * ufl.exp(-((x[0] - 0.5)**2 + (x[1] - 0.5)**2) / 0.02)
g = ufl.sin(5 * x[0])
a = ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx
L = ufl.inner(f, v) * ufl.dx + ufl.inner(g, v) * ufl.ds
problem = LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()
with io.XDMFFile(msh.comm, "poisson.xdmf", "w") as file:
file.write_mesh(msh)
file.write_function(uh)
from mpi4py import MPI
from petsc4py.PETSc import ScalarType
import [numpy](/page/NumPy) as np
import ufl
from dolfinx import fem, io, [mesh](/page/Mesh)
from dolfinx.fem.petsc import LinearProblem
msh = [mesh](/page/Mesh).create_rectangle(comm=MPI.COMM_WORLD, points=((0.0, 0.0), (2.0, 1.0)), n=(32, 16),
cell_type=[mesh](/page/Mesh).CellType.[triangle](/page/Triangle))
V = fem.FunctionSpace(msh, ("Lagrange", 1))
facets = [mesh](/page/Mesh).locate_entities_boundary(msh, dim=(msh.[topology](/page/Topology).dim - 1),
marker=lambda x: np.isclose(x[0], 0.0) | np.isclose(x[0], 2.0))
dofs = fem.locate_dofs_topological(V=V, entity_dim=1, entities=facets)
bc = fem.dirichletbc(value=ScalarType(0), dofs=dofs, V=V)
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
x = ufl.SpatialCoordinate(msh)
f = 10 * ufl.exp(-((x[0] - 0.5)**2 + (x[1] - 0.5)**2) / 0.02)
g = ufl.sin(5 * x[0])
a = ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx
L = ufl.inner(f, v) * ufl.dx + ufl.inner(g, v) * ufl.ds
problem = LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()
with io.XDMFFile(msh.comm, "poisson.xdmf", "w") as file:
file.write_mesh(msh)
file.write_function(uh)
The solution uh is visualized using pyvista, which maps function values to a VTK grid for warping and scalar plotting, or exported to XDMF for ParaView analysis.[45]
Another common application is linear elasticity, modeling the displacement field in a 3D domain under body forces, as in the cantilever beam problem. In FEniCSx, this involves a vector function space, definition of the strain tensor \epsilon(u) = \frac{1}{2}(\nabla u + (\nabla u)^T), stress \sigma = 2\mu \epsilon + \lambda \mathrm{tr}(\epsilon) I, and variational form a(u, v) = \int \sigma : \epsilon(v) \, dx, solved with PETSc's CG solver and GAMG preconditioner for efficiency on unstructured meshes. Boundary conditions fix displacements on one face, and post-processing computes derived quantities like von Mises stress using dolfinx.fem.Expression. The solution is saved to XDMF, with pyvista enabling visualization of displacement vectors and stress contours. This example highlights integration with PETSc for scalable solving and Gmsh for importing refined 3D meshes if needed.[46]
Community and Development
Open Source Ecosystem
The FEniCS Project operates as a collaborative open-source initiative, comprising multiple interconnected software components designed for automated finite element analysis of partial differential equations. These components, including DOLFINx, UFL, FFCx, and Basix, are hosted on GitHub under the FEniCS organization, which maintains 18 repositories with collective engagement metrics such as 995 stars for DOLFINx, reflecting widespread adoption in scientific computing.[47][39] The project's ecosystem emphasizes accessibility, enabling contributions from a diverse global user base that spans academics, engineers, students, and hobbyists, all united by the goal of advancing high-performance PDE solvers.[48]
Licensing across FEniCS components adheres to permissive open-source standards to facilitate reuse and integration. Core libraries like DOLFINx are distributed under the GNU Lesser General Public License version 3.0 (LGPL-3.0) or later, allowing linking with proprietary software while requiring derivative works to remain open source; accompanying GPL-3.0 elements ensure compatibility for extensions.[39] Individual repositories include dedicated LICENSE files, and institutional contributors sign consent forms aligning with Open Source Initiative-approved licenses to maintain project integrity.[49] This dual-licensing approach supports both research collaboration and commercial applications, with no warranties provided as per standard GNU terms.[50]
The community drives development through transparent, inclusive practices, fostering contributions via GitHub pull requests, issue trackers, and detailed guidelines outlined in CONTRIBUTING.md files.[51] Primary communication channels include the FEniCS Discourse forum for discussions and support, a dedicated Slack workspace for real-time collaboration, and the fenics-dev Google Group for developer coordination.[52][53][54] Annual conferences, such as FEniCS 2025 in Groningen, Netherlands, facilitate networking, tutorials, and presentations, drawing participants worldwide to share innovations and roadmap updates.[55] Notable contributors, including figures like Jørgen S. Dokken and Garth N. Wells, exemplify the project's academic roots, while programs like Google Summer of Code (GSoC) since 2018 have onboarded new developers through mentored projects.[56][48]
Sustainability within the ecosystem is bolstered by fiscal sponsorship from NumFOCUS, a nonprofit dedicated to open-source scientific software, providing administrative, legal, and fundraising support since 2017.[10][57] Donations channeled through NumFOCUS fund maintenance and enhancements, enabling the project to scale from laptops to high-performance computing environments.[1] This affiliation integrates FEniCS into a broader network of tools like NumPy and Jupyter, promoting interoperability; for instance, FEniCSx leverages PETSc for linear algebra and MPI for parallelization, enhancing its role in the scientific open-source landscape.[58] Overall, the ecosystem prioritizes long-term viability through community governance documents and ethical development practices, ensuring FEniCS remains a freely available platform for PDE research.[59][13]
Future Directions
The FEniCS Project is advancing through the maturation of FEniCSx, its rewritten core libraries designed for enhanced performance, modularity, and parallelism. Following the alpha release of FEniCSx version 0.9 in October 2024, the project issued DOLFINx version 0.10.0 in October 2025, incorporating new capabilities like integration over vertices and ridges, uniform mesh refinement across all supported cell types, and branching meshes where facets connect to more than two cells.[19][60] These updates also streamlined the PETSc interface for assemblers and solvers, improved the GMSH mesh import functionality, and simplified APIs for blocked and mixed-dimensional problems.[60]
Short-term priorities focus on expanding input/output options with ADIOS2 support, implementing PointSource functionality for boundary conditions, broadening finite element types to include serendipity elements, and enabling FunctionSpaces defined on facets.[19] Longer-term objectives include adapting to heterogeneous computing platforms such as GPUs and mixed-precision arithmetic, as well as supporting hybrid meshes that combine different geometric elements like quadrilaterals with triangles or hexahedra with prisms.[19]
The project emphasizes a compact, extensible core architecture with stable public interfaces and proper namespacing to facilitate contributions.[19] Integration of modern Python just-in-time (JIT) compilation tools, such as Numba, aims to accelerate code generation and execution.[19] Community-driven initiatives, including the 2024 Google Summer of Code project developing multigrid solvers for FEniCSx, underscore ongoing efforts to enhance scalable numerical methods.[61] The annual FEniCS 2025 conference, held in June, provided a platform to discuss these advancements and outline collaborative paths forward.[55]