Finite Element Method

The finite element method is a general discretization technique that can utilize unstructured grids to approximate the solutions of many partial differential equations (PDEs).

There is a large body of literature on finite elements, including the following excellent books:

The MFEM library is designed to be lightweight, general and highly scalable finite element toolkit that provides the building blocks for developing finite element algorithms in a manner similar to that of MATLAB for linear algebra methods.

Some of the C++ classes for the finite element realizations of these PDE-level concepts in MFEM are described below.

Primal and Dual Vectors

The finite element method uses vectors of data in a variety of ways and the differences can be subtle. MFEM defines GridFunction, LinearForm, and Vector classes which help to distinguish the different roles that vectors of data can play.

Bilinear Form Integrators

Bilinear form integrators are at the heart of any finite element method, they are used to compute the integrals of products of basis functions over individual mesh elements (or sometimes over edges or faces). The BilinearForm class adds several BilinearFormIntegrators together to build the global sparse finite element matrix.

Linear Form Integrators

Linear form integrators are used to compute the integrals of products of a basis function with a given source function over individual mesh elements (or sometimes over edges or faces). The LinearForm class adds several LinearFormIntegrators together to build the global right-hand side for the finite element linear system.


This page offers guidance on writing custom Bilinear Form or Linear Form Integrators.


The Coefficient objects in MFEM are general functions on continuous level that are used to represent the PDE coefficients of linear and bilinear forms, as well as to specify initial conditions, boundary conditions, exact solutions, etc.

Nonlinear Form Integrators

Nonlinear form integrators are used to express the local action of a general nonlinear finite element operator. In addition, they may provide the capability to assemble the local gradient operator and to compute the local energy.

Linear Interpolators

Unlike Bilinear and Linear forms, Linear Interpolators do not perform integrations, but project one basis function (or a linear function of a basis function) onto another basis function. The DiscreteLinearOperator class adds one or more LinearInterpolators together to build a global sparse matrix representation of the linear operator.

Weak Formulations

Weak formulations are at the heart of the finite element method. Finite element approximations are almost always less smooth than the solutions we hope to approximate. Weak formulations provide a means of approximating derivatives of non-differentiable functions.

Boundary Conditions

The types of available boundary conditions and how to apply them depend on the discretizations being used. This page describes how to enforce various boundary conditions for certain classes of problems.