Bringing Trimmed Serendipity Methods to Computational Practice in Firedrake
Abstract.
We present an implementation of the trimmed serendipity finite element family, using the open source finite element package Firedrake. The new elements can be used seamlessly within the software suite for problems requiring , , or -conforming elements on meshes of squares or cubes. To test how well trimmed serendipity elements perform in comparison to traditional tensor product elements, we perform a sequence of numerical experiments including the primal Poisson, mixed Poisson, and Maxwell cavity eigenvalue problems. Overall, we find that the trimmed serendipity elements converge, as expected, at the same rate as the respective tensor product elements while being able to offer significant savings in the time or memory required to solve certain problems.
1. Introduction
Over the last 15 years, conforming finite element methods for Hodge-Laplace type problems on simplicial and cubical meshes have been analyzed and categorized using the mathematical theory of Finite Element Exterior Calculus (FEEC) (Arnold et al., 2006, 2010, 2015). While this effort was initially focused on placing related theoretical results under a single, unified mathematical framework, it also exposed the frontier of knowledge and spawned a wealth of spin-off projects that improved awareness, understanding, and implementation of the methods described. Among these follow-on projects was a revisiting of the notion of “serendipity” finite elements, a particular type of finite element method dating back to the 1970s. Named for its seemingly too-good-to-be-true computational benefit, a serendipity finite element method converged to the correct solution of a partial differential equation (PDE) at an equivalent rate but with fewer degrees of freedom than the corresponding tensor product method. The simplest and most well-known serendipity method replaces the quadratic 9-node square element with a “serendipity” 8-node element that has no interior degree of freedom, but still converges at a quadratic rate in the appropriate sense.
The core idea of serendipity elements, i.e. reducing degrees of freedom from tensor product methods without reducing the accuracy of the method, floated around computational engineering communities until it found a resurgence under the FEEC framework. In a seminal work by Arnold and Awanou (Arnold and Awanou, 2011) the scalar-valued serendipity elements were formalized as providing approximation on a space of polynomials that nests between maximum-degree polynomials and tensor product degree polynomials . In a subsequent work (Arnold and Awanou, 2014), this notion was extended using FEEC to introduce “serendipity vector elements” to the literature – analogues of the famous Nédélec elements (Nédélec, 1980, 1986) – which led to the widely circulated Periodic Table of Finite Elements (Arnold and Logg, 2014).
Despite excitement at these developments, implementing serendipity elements and realizing any potential computational benefits proved to be a significant challenge. While creating data structures for “all polynomials up to degree ” is straightforward, simply trying to write down the approximation spaces used by serendipity elements – especially the vector-valued elements – requires a substantial amount of mathematical notation and explanation. As a consequence, the serendipity elements have never been implemented or rigorously studied beyond a few special use cases.
Recent work on a closely related family of methods – called trimmed serendipity elements (Gillette and Kloefkorn, 2019) – has opened the door to potential widespread usage and benefit from the notions of serendipity theory just described. The trimmed serendipity spaces are identical to the serendipity spaces in the scalar-valued cases but are distinct in the vector-valued cases where, notably, they have fewer degrees of freedom than the serendipity elements of the same order. Since the computational motivation for serendipity methods is entirely about reducing degree of freedom count while preserving approximation power, the smaller dimensionality of the trimmed serendipity spaces obviates the need to implement the vector-valued “non-trimmed” serendipity elements.
Implementation of trimmed serendipity spaces is feasible by merging two independent efforts: the systematic definition of computational basis functions for these methods from work by Gillette, Kloefkorn and Sanders (Gillette et al., 2019) and the easily extensible open-source finite element software package Firedrake (Rathgeber et al., 2016). The Unified Form Language (Logg et al., 2012; Alnæs et al., 2014), inspired by FEEC, provides a common backbone for translating the basis functions from their formal statement into a code structure using a well-established, high level interface. We explain the idea of the implementation by walking through the process of discretizing a PDE and selecting a finite element method for approximating its solution.
An example of what a reference RTCF finite element looks like. Dots represent DOFs on the face or edges.
Motivating example
LABEL:lst:mixedPoissonCode provides a snippet of code that a user could write to approximate a solution to the mixed Poisson equation on the domain with boundary . The formal problem statement of the continuous weak form in this case is: find and such that:
(1) |
|
We assume homogeneous Dirichlet boundary conditions so that the Dirichlet data in vanishes on . Solving the discretized version of (1) requires choosing a suitable pair of finite element spaces to create a stable method. On a mesh of squares, the typical stable pair of tensor product finite elements would be RTCF and DQ for and respectively. These elements are visualized in Fig. 1 and are part of the tensor product family of elements. We demonstrate the tensor product pairing in LABEL:lst:mixedPoissonCode, where the order of the vector and scalar elements are offset by 1 in accordance with the theory for optimal convergence rates.
An important strength of Firedrake is its modular structure for both users and developers. For the user, swapping to trimmed serendipity elements to solve the mixed Poisson problem is now only a matter of modifying lines 4–5 in LABEL:lst:mixedPoissonCode to the appropriate identifiers, SminusDiv and DPC inside the FunctionSpace calls that define hDivSpace and l2Space. For developers, implementing a new element type – such as trimmed serendipity – is simply a matter of defining a suitable computational basis and connecting it to the intermediate interfaces in the included libraries.
Accordingly, we have implemented the basis functions from Gillette et al. (2019) using Firedrake’s internal coding conventions and then carried out tests of various use cases in a reliable computational framework. We show in Fig. 2 how the number of degrees of freedom (DOFs) grow in tensor product spaces () versus trimmed serendipity spaces () in various element types, for increasing degree of polynomial approximation order. Seeing how such quick back-of-the-envelope calculations might translate into significant computational savings requires the thorough implementation provided in this paper.
A DOF study for tensor product and trimmed serendipity elements. We consider the case for all of , and .
The main contributions of this paper are as follows:
-
(1)
We explain the implementation of trimmed serendipity elements within the Firedrake software environment and describe how users can easily employ the elements in their own code,
-
(2)
We validate the implementation of the trimmed serendipity finite elements by confirming they attain the theoretical bounds that are predicted in terms of convergence rates, and
-
(3)
We examine the costs and benefits of using trimmed serendipity elements within the confines of typical test problems for numerical analysis by comparing them to tensor product elements.
2. Background and notation for trimmed serendipity elements
Among its many advantages, Finite Element Exterior Calculus (FEEC) (Arnold et al., 2006, 2010, 2015) gives an easy, unified way to notate different element types. The four best known families of elements are denoted , , , and , which are, respectively, the trimmed polynomial, polynomial, tensor product, and serendipity elements of order using -forms. The and spaces are defined over meshes of simplices (triangles, tetrahedra, etc) while the and spaces are defined over meshes of hypercubes (squares, cubes, etc). The optional notation specifies that the space is constructed over the -dimensional cube in , but we will frequently omit this addition if is clear from context.
The mathematical results from FEEC regarding these four families synthesize decades of research into what constitutes a stable finite element, i.e. a numerical method that can be proven to converge to the correct solution of certain PDEs in certain norms at a prescribed rate, indicated by the subscript . In any dimension, the -form spaces provide scalar-valued, -conforming elements. In 2D, -forms can represent both and elements, depending on the orientation of the DOFs defined on the edges of a mesh. In 3D, -forms correspond to elements while -forms correspond to elements. Notably, the serendipity family is the youngest, least implemented, and hence least understood among all these families. In particular, the 1-form and 2-form (regular) serendipity elements in 3D were only characterized in 2014 by Arnold and Awanou (2014), whereas the equivalent tensor product elements were first described more than 30 years earlier in Nédélec (1980, 1986).
8 | 12 | 6 | 1 | |||||
20 | 36 | 21 | 4 | |||||
32 | 66 | 45 | 10 |
2.1. Trimmed Serendipity Elements
The trimmed serendipity family is an even newer addition to this collection that attains a key optimality condition arising from the FEEC framework. Christiansen and Gillette (2016) computed the minimal possible dimensions for an exact sequence of conforming finite element spaces on cubes that contained for each . Gillette and Kloefkorn (2019) identified polynomial differential form spaces with these prescribed dimensions and approximation power, denoting them trimmed serendipity elements with the notation . Thus, trimmed serendipity elements represent the cheapest possible way to get an order conforming finite element method, if cost is only measured in terms of number of degrees of freedom.
In order to test if this benefit translated to computational speedups, Gillette, Kloefkorn and Sanders gave a systematic way to build the computational basis for each of these elements for dimensions , -forms, and arbitrary order (Gillette et al., 2019). These “computational bases” are well-suited for implementation since each basis function is associated to a unique mesh identity - i.e. a specific vertex, edge, face (for cubes) or element interior. The required geometric localization of DOFs is visualized for low orders in 3D in Table 1, arranged equivalently to the Periodic Table of the Finite Elements. We note that neither the particular bases defined in Gillette et al. (2019) nor any other general implementation of trimmed serendipity elements has been attempted prior to this paper.
2.1.1. Scalar Trimmed Serendipity Elements
The scalar-valued trimmed serendipity elements that are represented by -forms are used as the shape functions for an -conforming finite element space. These are denoted by and are identical to the scalar-valued serendipity elements from the Periodic Table of Finite Elements, i.e. for any . Arnold and Awanou provided a simple description of the functions in as the span of all monomials of “superlinear degree” less than or equal to (Arnold and Awanou, 2011).
Likewise, the scalar-valued trimmed serendipity elements that are represented by -forms create -conforming finite element spaces. These are denoted by , and here we have the equality . In terms of the Periodic Table of Finite Elements, these are the dPcr spaces. The shape functions for these spaces are simply the space of order polynomials. Since no inter-element continuity is needed for -conformity, we have the additional equivalence .
2.1.2. Vector-valued Trimmed Serendipity Elements
The trimmed serendipity elements are truly distinct from regular serendipity spaces for values . Here, we will only consider dimensions and , where the -form spaces can be identified as vector-valued finite elements. In 2D, the vector-valued spaces bear close relation to the Arbogast-Correa elements (Arbogast and Correa, 2016), as explained in Gillette and Kloefkorn (2019, Prop 2.2). In 3D, the vector valued spaces and were also characterized by Cockburn and Fu (2017), as explained in Gillette and Kloefkorn (2019, Prop 2.3).
A major reason that the vector trimmed serendipity elements have only recently been considered in the mathematical literature is that their DOF per element count is complicated. As evidenced by Table 1, certain DOFs grow in predictable patterns with . For instance, elements in the 1-form family, , have exactly DOFs per edge of the cube (corresponding to “order ” approximation on edges) and elements in the 2-form family, , have DOFs per face (corresponding to “order ” approximation on faces). However, the 2-form family has the more obscure quantity of DOFs associated to the interior of an element (for ). This growth pattern is recognized as sequence A064808 by the On-line Encyclopedia of Integer Sequences (Sloane, 2018) and is in agreement with the general formulae presented in Gillette and Kloefkorn (2019), but a natural geometric interpretation remains elusive. Equally unexpected patterns are evident in the growth of DOFs on faces and interiors of the family. As we will discuss in the next section, Firedrake makes the creation and incorporation of such unusual DOF growth patterns simple for the developer, and thus opens these elements to numerical testing for the first time.
3. Building capacity for serendipity element types in Firedrake
Firedrake uses FIAT (Kirby, 2004, 2012) to provide finite element basis functions on reference elements. To implement a new element in FIAT, we must provide both rules to tabulate basis functions and their derivatives at reference element points and a data structure that assigns basis functions to particular reference element facets. Said element is then made available in Firedrake by providing a symbolic name (in UFL (Alnæs et al., 2014)) and a translation from symbolic name to concrete implementation in the form compiler TSFC (Homolya et al., 2018). While FIAT initially considered a very wide range of finite elements (Kirby et al., 2012), it would seek to express their bases as linear combinations of orthogonal polynomials. However, for some elements, it is easier to directly describe the basis functions. We follow the construction of Gillette et al. (2019) which provides explicit formulae for the basis functions for each of the trimmed serendipity elements and directly implement tabulation of the basis functions. To provide tabulations of derivatives, we implement the basis functions symbolically with SymPy (Meurer et al., 2017) and compute derivatives symbolically.
We use the decompositions from Gillette et al. (2019) to group the basis functions according to the geometric portions of a reference mesh element (vertices, edges, faces, or cell interiors). For instance, a basis for – the trimmed serendipity -conforming element in 3D – can be decomposed as
(2) |
Subsets in these decompositions denoted with an , , or are defined on edges, faces, and interior, respectively, of the cubical cell in 3D. The subsets and are extra sets of basis functions defined on the faces or the interior that follow a different pattern in their definitions than those of the functions in , , or .
To see how this plays out in the Firedrake implementation, consider the elements for trimmed serendipity at order in dimensions, indicating the space in 3D. The space is defined to be empty for , so there are only two sets of functions to include in this case: one set associated to edges of the reference element (the sum) and one set for the faces of the reference element (the functions). According to Eq. 2, the basis functions can be decomposed as
(3) |
We then implement these in Firedrake as follows. The first step is to determine the number of DOFs we will need on the reference element where we will define the basis functions. To do this, we count the DOFs for each mesh entity on the reference element (vertex, edge, face, and interior). For example, should have no DOFs at the vertices (these only come into play for the -conforming elements), two DOFs on each edge, two DOFs on each face, and no DOFs on the interior. This agrees with Eq. 3, where supplies one DOF to each edge for each , and then supplies two DOFs to each face. An illustration of this can be seen in the second column, second row of Table 1.
With the number of DOFs assigned to each mesh entity in the reference element, we can then define the basis functions. The order of definition is important so that basis functions are matched to the proper mesh entity. Note that Eq. 3 doesn’t explicitly give a way to order the basis functions. Instead, we need to use the properties of the basis functions to determine the correct ordering. This is best illustrated by an example. Two of the “edge” basis functions that are contained in the sum of the sets are and . Notice that these functions have no or portions. Therefore, these function vanish on any edge not parallel to the axis. Further, the polynomial coefficients of these forms indicate that they also vanish on the planes and . Thus, the only edge of the cube on which these functions do not vanish is the edge contained in the line . This edge is shown in blue and labeled with an “e” in Fig. 3.
An illustration of a reference element for trimmed serendipity 1-forms. The dots indicate DOFs on the faces or edges.
This process is what determines the ordering for the basis functions. If, in the first step described above where we are assigning DOFs to mesh entities, we assign the first two DOFs to be on the edge of the reference element where and , then we must define the basis functions and as our first two basis functions.
While the formulas above are taken from Gillette et al. (2019), these monomials have poor conditioning at higher orders. Therefore, we use Legendre polynomials obtained symbolically from SymPy via the legendre function denoted leg. Then we write the differential forms in vector notation. For our examples of and , we get tuple([(leg(j,x_mid)*dz[1]*dy[1],0,0)]), where leg(j, x_mid) is computed at the midpoint between two vertices and used for the or coefficient, and the dy[1] and dz[1] are used for the values of and , respectively. After repeating this process for each of the edges and associated basis functions, we then also do a similar process for the face functions in the set .
This process changes only slightly if we instead had considered the the -forms . In this scenario, we would have the basis functions given by the equation
In this case, one of the basis functions is . The represents a -form, which vanishes on any face not parallel to the plane. This leaves only the faces contained in the planes or as possibilities for association. As in the 1-form example above, the polynomial coefficient of the form indicates that this function will vanish on an additional mesh entity, namely, the face contained in the plane , in this case. Hence, we associate this function with the face contained in (labeled with an “F” in Fig. 3). The rest of the process for defining the -form basis functions is similar to the process for the -form basis functions.
FEEC | UFL name (2D) | UFL name (3D) |
---|---|---|
Lagrange | Lagrange | |
RTCE or RTCF | NCE | |
DQ | NCF | |
- | DQ | |
S | S | |
SminusCurl or SminusDiv | SminusCurl | |
DPC | SminusDiv | |
- | DPC |
The newly supported elements, mapping FEEC spaces onto names in UFL are shown in the lower half of Table 2. Modifying the code from LABEL:lst:mixedPoissonCode to utilize trimmed serendipity spaces rather than tensor product spaces is then simply a case of replacing the element names in the FunctionSpace definitions with appropriate trimmed space names. Concretely, the new FunctionSpace definitions are shown in LABEL:lst:pde_using_trimmed_serendipity, the rest of the code remains unchanged.
4. Experiments
The following experiments show the benefits and costs of using trimmed serendipity elements in comparison to traditional tensor product elements. We first present a basic projection example as a means of confirming approximation properties of our elements. Next, we present results on a primal Poisson problem (to test elements), a mixed Poisson problem (to test and elements), and a cavity resonator problem (to test elements). Since the and elements are only a rotation of the DOFs on the edges of elements in 2D, we do not give an experiment using elements in 2D.
The experiments were performed either on a single cluster compute node with 2x AMD EPYC 7642 48-core (Rome) processors (2.4GHz) and 512GB of memory running CentOS 7 or a similar node with 3TB of memory. The 2D experiments were all done using the 512GB node, while in 3D, the 4th order experiments were run on the 3TB node. Each job was run by submitting a SLURM script that requested one node in isolation to ensure no other jobs were running at the same time. We utilized on-node parallelism by requesting a full node and executing the jobs with mpirun set to use 24 processes, with a few exceptions for smaller cases that will be pointed out later. Timing data was collected after first performing a dry run of the code to warm the cache and then taking the minimum time over three subsequent runs. The timing results presented here depend upon the solver choice, and changing that may give different results illustrating the relative efficiency between and .
For simplicity, our numerical experiments all use a sparse direct solver. We expect the multigrid theory in Arnold et al. (2000, 2006) to carry over from existing spaces to spaces. Optimal smoothers require aggregating degrees of freedom for vertex patches, and we anticipate that the reduction in local dimensionality that trimmed serendipity spaces offer will be beneficial in these contexts as well.
4.1. Projection
We solve an projection problem to give a baseline accuracy test for the elements. Given either the unit square or unit cube as our domain of integration on definite integrals, we compute the projection of into the function space by using a discretization of the problem: find such that
for all . For our experiments, we choose to be spaces for the proper dimension (one of the spaces RTCE, NCE or SminusCurl) and or for two or three dimensions respectively. Recall that the trimmed serendipity elements are denoted with and the tensor product elements with . In Firedrake, the trimmed serendipity elements use the label SminusCurl or SminusDiv for 1-forms in 2D, depending upon the orientation of the edge DOFs, and in 3D, they represent the 1- and 2-forms respectively. The tensor product elements use the labels RTCE (or RTCF) and NCE for 1-forms in 2D and 3D, while the 2-forms in 3D are NCF. To solve the projection problem, we use a Galerkin projection into .
Experimental convergence analysis on a projection problem using tensor product and trimmed serendipity 1-form elements.
The goal of the projection problem is to establish that the elements attain the mathematically expected rates of approximation as mesh size decreases, as well as comparing relative efficiencies of and . For this, we create a mesh on of uniformly sized squares or cubes, where we refine the mesh from squares (or cubes) in each row and column to squares in each row and column (or cubes). This results in a mesh with or squares or cubes respectively. For the following results, we will use since the mesh elements are all uniformly sized. We employ both trimmed serendipity elements and tensor product elements on each mesh and record the error in each case. In Fig. 4, we report the error in terms of the classical measure of maximum edge length () as well as total number of DOFs.
The expectation is that and converge at the same rate with respect to , which is confirmed in the plots by parallel trendlines. These parallel trendlines can be seen in each of the projection plots. The overall results from the projection problem show that tensor product and trimmed serendipity elements give similar levels of error.
For the case, the trimmed serendipity elements achieve a better accuracy while requiring fewer DOFs. Therefore in this low order case, trimmed serendipity elements would be beneficial to use. In the case of the trendlines for are above the trendlines for . However, considering the elements and , we see that requires approximately DOFs and at the same mesh refinement requires DOFs. While attains an error of , the elements attain an error of .
4.2. The Poisson Problem
In this section we discuss results for both the primal formulation and the mixed formulation of the Poisson problem. We solve the primal weak formulation described below on a unit square domain for :
where , yielding the solution . In 3D, we can extend this to with the solution on the unit cube. The primal weak formulation of the Poisson equation is as follows: find such that:
Accordingly, the primal formulation employs elements, using S for and Lagrange for .
The mixed formulation of the Poisson problem introduces an intermediate variable, , which is solved for simultaneously. Formally, this is: find and such that:
In a similar fashion as for the primal formulation, we can create the mixed formulation of the Poisson problem that we saw in Eq. 1.
These equations are discretized and solved using a suitable pair of finite elements – one of type and one of type. We use and for dimensions and . Note that the mathematical notation here calls for to be paired with , but the code notation will require setting the degree of the element one below the degree of the element, and similar with the trimmed serendipity elements. For both the primal Poisson and mixed Poisson problems, we solve the system using MUMPS (Amestoy et al., 2001, 2006) with a sparse direct LU factorization using iterative refinement in order to attain high accuracy in the solvers and allow us to focus on analyzing the elements instead of confounding variables. At high degree and fine mesh resolutions, we noticed that both the tensor product and trimmed serendipity elements would hit a floor in error values that was unexpected. At lower degrees or coarser meshes, this was unnecessary, but we chose to keep the solver parameters the same to be consistent throughout the experiments. The exact details of the MUMPS configuration can be found both in the zenodo link and in the appendix in order for results to be reproducible.
Experimental convergence analysis for the primal and mixed poisson problems using trimmed serendipity and tensor product element. Uses elements for the primal problem and and elements for the mixed problem.
The empirical convergence results for the primal and mixed formulations of the Poisson problems can be seen in Figs. 5(a), 5(b), 5(c) and 5(d). In each of the subfigures of Fig. 5, we see that independent of the performance of each element, the and have parallel trendlines, indicating that they have the same overall convergence rate. For the primal formulation in 2D and 3D, the trimmed serendipity elements perform similar to the tensor product elements for orders . Furthermore, comparing the elements via DOFs as in the projection problem yields another instance where we see that using instead of will attain a higher accuracy for essentially the same number of DOFs.
In Fig. 6 we analyze the timing data for computing the solutions to the primal and mixed formulations using trimmed serendipity and tensor product elements. As in the error vs DOFs graphs, we see good evidence in Figs. 6(a) and 6(b) that the trimmed serendipity and tensor product elements compute solutions at a similar speed based on the number of DOFs. In Fig. 6(b) we see that for a given error level, trimmed serendipity elements require less time. The overall time required being dependent upon on the number of DOFs rather than the element type is seen again in Fig. 6(c). Further evidence of this is seen in Fig. 6(d). Similar to the previous analysis of DOFs vs error for the mixed formulation, the timing data here illustrates that attaining the extra accuracy from using instead of does not invoke a larger time requirement. The sparsity of the matrices involved in the order 4 elements can be seen in Table 3.
Elements | |||
Primal | Primal | Mixed | Mixed |
381,825 | 143,992,308 | 2,096,704 | 989,178,624 |
Elements | |||
Primal | Primal | Mixed | Mixed |
156,625 | 17,148,900 | 848,624 | 107,771,596 |
Some timing results for the primal and mixed poisson problems using trimmed serendipity and tensor product element. Uses elements for the primal problem and and elements for the mixed problem.
4.3. Cavity Resonator
The last numerical experiment that we give here is the cavity resonator problem, making use of the elements in 3D. We a pose a Maxwell eigenvalue problem on the domain with perfectly conducting boundary conditions, yielding an eigenvalue problem where represents a quantity proportional to the frequency squared of the time-harmonic electric field (i.e. eigenvalues) and represents the electric field (i.e. eigenfunctions):
We consider the weak formulation of this problem (similar to Fumio (1987)), where represents the resonances (i.e. eigenvalues) and represents the electric field (i.e. eigenfunctions):
The exact eigenvalues follow the formula
where and no more than one of may be equal to at a time (Rognes et al., 2010).
Elements | ||||
Actual (Count) | N = 4 | N = 8 | N = 16 | N = 32 |
2 (3) | 2.001024 | 2.000066 (3.96) | 2.000004 (4.04) | 2.0000003 (4.00) |
3 (2) | 3.001536 | 3.000098 (3.97) | 3.000006 (4.03) | 3.0000004 (4.02) |
5 (4) | 5.030601 | 5.002081 (3.88) | 5.000133 (3.97) | 5.000008 (4.06) |
6 (3) | 6.031114 | 6.002114 (3.88) | 6.000135 (3.97) | 6.000008 (4.08) |
8 (0) | ||||
DOF | 1944 | 13872 | 104544 | 811200 |
EPS solve time per iteration | 0.01565225 | 0.0743845 | 1.0484236 | 7.6186526 |
Elements | ||||
Actual (Count) | N = 4 | N = 8 | N = 16 | N = 32 |
2 (3) | 2.001092 | 2.000066 (4.05) | 2.000004 (4.04) | 2.000000 (4.00) |
3 (2) | 3.009018 | 3.000586 (3.94) | 3.000037 (3.99) | 3.000002 (4.21) |
5 (3) | 5.032027 | 5.002097 (3.93) | 5.000133 (3.98) | 5.000008 (4.06) |
5 (1) | 5.032027 | 5.002097 (3.93) | 5.000133 (3.98) | |
6 (1) | 6.072012 | 6.004976 (3.86) | 6.000319 (3.96) | 6.000020 (4.00) |
6 (1) | 6.072012 | 6.004976 (3.86) | 6.000319 (3.96) | 6.000024 (3.73) |
6 (1) | 6.00038 | 6.000024 (3.98) | ||
8 (1) | 8.000017 | |||
DOF | 1080 | 7344 | 53856 | 411840 |
EPS solve time per iteration | 0.01288725 | 0.0309768 | 0.401663 | 4.1996873 |
In Table 4, we display the convergence rates of different eigenvalues when computing the eigenvalues with tensor product and trimmed serendipity elements in 3D. The table is split into halves, the top half showing values from using elements while the bottom half shows values from using the corresponding elements. Each half of the table has a row giving the DOFs in the mesh for each refinement level and a row giving the time per iteration that the solver required.
Note that the convergence rates are computed by
Based off earlier eigenvalue works (Boffi, 2010), we expect the rate of convergence to be double the order of the finite element used to solve the problem. This is reflected in the table well for both and elements. The “” entries in the table indicate the eigenvalue solver did not find that specific eigenvalue in the allowed number of iterations; we set the solver to iterate a sufficient number of times to find the first 15 eigenvalue-eigenvector pairs.
The experiment was done by using Firedrake to create the mass and stiffness matrices as petsc4py objects (Balay et al., 2021, 1997; Dalcin et al., 2011), then using slepc4py (Hernandez et al., 2005; Roman et al., 2020) to do the eigenvalue analysis. The eigenvalue analysis was done by computing an inverted shift to a target of , then solving for eigenvalue-eigenvector pairs. The SLEPc solve was done using the default (Krylov-Schur) solver with a tolerance level of . We note that the eigensolver finds a varying number of spurious eigenvalues with value . These exist because Firedrake enforces strong boundary conditions by placing a on the diagonal and zeroing out the rows and columns, not due to the elements that we use or the SLEPc solver that is called. We do not report these eigenvalues.
Since both elements attain the expected convergence rate, we focus on the rest of the results in the table. Investigating the error in the eigenvalues in the chart compared to the exact values, we see that tensor product elements are able to get results that are up to an order of magnitude better near the target eigenvalue. On the other hand, this loss of accuracy from using trimmed serendipity elements is offset by a reduction in required time to solve for the requested eigenvalues. At every mesh refinement level, trimmed serendipity elements have nearly half the DOFs of tensor product elements, and correspondingly, require approximately half the time per iteration to solve for the eigenvalues (outside of the case ). At higher orders, we expect that this will be even more exaggerated.
Continuing the eigenvalue example, we used Firedrake and SLEPc to compute two eigenvalues, and . We computed the eigenvalues at different orders of the elements, from to , and kept the mesh constant at . The timing data was then collected by choosing the largest time required for any of the multiplicities of or that the solver found.
Convergence and timing analysis for the Maxwell cavity eigenvalue problem using trimmed serendipity and tensor product elements.
The error results shown in Fig. 7(a) for the eigenvalue problem indicate that trimmed serendipity elements yield less error in the eigenvalues for the number DOFs required to compute them than the tensor product elements. This is a change from the mixed formulation of the Poisson problem where the DOFs vs Error trendline for trimmed serendipity was generally above the trendline for tensor product elements. The timing results in Fig. 7(b) showed that the timing requirements for both trimmed serendipity and tensor product elements were similar, with trimmed serendipity generally requiring a little bit less time for a given error value.
5. Discussion
This implementation of trimmed serendipity elements gives a new method for computing the solution to a discretized PDE and has been tested on meshes of squares and cubes. Completing the implementation of these elements within Firedrake by using the basis functions defined in Gillette et al. (2019) is an illustration of Firedrake’s modular capabilities for implementing new and unusual finite elements.
The convergence studies done in each of the numerical experiments show that the trimmed serendipity elements can attain the theoretical rates of convergence that they were predicted to achieve. While we only illustrate orders 2, 3, and 4 in 2D and 3D, our implementation of trimmed serendipity elements in Firedrake is designed to work in both 2D and 3D for arbitrary orders .
In comparison to tensor product elements , we make a choice when using trimmed serendipity elements to lower accuracy in return for less computation, both in terms of DOFs and time required. At low orders the choice to use trimmed serendipity elements could actually reduce the error per DOF, as we saw in the primal formulation of the Poisson problem, where the trendlines for DOFs vs Error for trimmed serendipity elements were below the trendlines for the tensor product elements. In the mixed formulation case however, the opposite was true, and the trendlines for the tensor product elements were below the trendlines for the trimmed serendipity elements.
Rather than comparing in terms of approximation order, it can also be beneficial to compare the two elements based off of the DOFs that they require. Consider the 3D mixed formulation of the Poisson problem while focusing on DOFs vs Error given in Fig. 5(d). The tensor product elements required a similar number of DOFs as the trimmed serendipity elements . Compared this way, the trimmed serendipity elements provide an extra order of magnitude of accuracy over the tensor product element. Furthermore, in Fig. 6(d) the time required for and was also approximately equal. Thus while it is helpful to compare and to see that the trimmed serendipity elements have the expected convergence behavior, a more practical computational comparison is between and .
The eigenvalue problem yields another example of comparing the tensor product and trimmed serendipity elements, where instead of refining the mesh, we refined the order of the element used. Just as in the mixed Poisson problem, we again see that Fig. 7(a) shows has a higher error for than . However comparing against where the DOFs are approximately equal leads to a comparison between and . In this scenario, we had that required 104544 DOFs yielding an error of for while required 106896 and achieved an error of for . In this case, we note that the time required for did require more time to solve, using about 2.71 seconds while the required 1.98 seconds.
Our computational findings suggest that trimmed serendipity elements could be particularly beneficial at improving accuracy for compute-bound applications. For any application, there is eventually a mesh resolution and element order for which refining the mesh or increasing the tensor product order is computationally infeasible. In this instance, keeping the mesh but switching to a trimmed serendipity method of one order higher presents a new option to the practitioner that still provides an increase in accuracy without a significant increase to computational cost.
Code availability
All major Firedrake components, as well as the code for the numerical experiments in the paper have been archived on Zenodo (2021).
Acknowledgements.
This work was supported by National Science Foundation (NSF) Collaborative Research Awards DMS-1913094 and DMS-1912653 and by U.S. Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, under Award Number DE-SC-0019039.6. Appendix: Solver Configurations
The solver configurations for the primal and mixed Poisson formulations can be found below.
References
- (1)
- Alnæs et al. (2014) Martin S. Alnæs, Anders Logg, Kristian B. Ølgaard, Marie E. Rognes, and Garth N. Wells. 2014. Unified Form Language: a domain-specific language for weak formulations of partial differential equations. ACM Trans. Math. Software 40, 2 (2014), 1–37. https://doi.org/10.1145/2566630
- Amestoy et al. (2001) Patrrick R. Amestoy, Iain S. Duff, Jean-Yves L’Excellent, and Jacko Koster. 2001. A fully asynchronous multifrontal solver using distributed dynamic scheduling. SIAM J. Matrix Anal. Appl. 23, 1 (2001), 15–41. https://doi.org/10.1137/S0895479899358194
- Amestoy et al. (2006) Patrick R. Amestoy, Abdou Guermouche, Jean-Yves L’Excellent, and Stéphane Pralet. 2006. Hybrid scheduling for the parallel solution of linear systems. Parallel Comput. 32, 2 (2006), 136–156. https://doi.org/10.1016/j.parco.2005.07.004
- Arbogast and Correa (2016) Todd Arbogast and Maicon R. Correa. 2016. Two families of mixed finite elements on quadrilaterals of minimal dimension. SIAM J. Numer. Anal. 54, 6 (2016), 3332–3356. https://doi.org/10.1137/15M1013705
- Arnold and Awanou (2011) Douglas N. Arnold and Gerard Awanou. 2011. The serendipity family of finite elements. Foundations of Computational Mathematics 11, 3 (2011), 337–344. https://doi.org/10.1007/s10208-011-9087-3
- Arnold and Awanou (2014) Douglas N. Arnold and Gerard Awanou. 2014. Finite element differential forms on cubical meshes. Math. Comp. 83, 288 (2014), 1551–1570. https://doi.org/10.1090/S0025-5718-2013-02783-4
- Arnold et al. (2015) Douglas N. Arnold, Daniele Boffi, and Francesca Bonizzoni. 2015. Finite element differential forms on curvilinear cubic meshes and their approximation properties. Numer. Math. 129, 1 (2015), 1–20. https://doi.org/10.1007/s00211-014-0631-3
- Arnold et al. (2000) Douglas N. Arnold, Richard S. Falk, and Ragnar Winther. 2000. Multigrid in and . Numer. Math. 85 (2000), 197–217. https://doi.org/10.1007/PL00005386
- Arnold et al. (2006) Douglas N. Arnold, Richard S. Falk, and Ragnar Winther. 2006. Finite element exterior calculus, homological techniques, and applications. Acta Numerica 15 (2006), 1–155. https://doi.org/10.1017/S0962492906210018
- Arnold et al. (2010) Douglas N. Arnold, Richard S. Falk, and Ragnar Winther. 2010. Finite element exterior calculus: from Hodge theory to numerical stability. Bull. Amer. Math. Soc. 47, 2 (2010), 281–354. https://doi.org/10.1090/S0273-0979-10-01278-4
- Arnold and Logg (2014) Douglas N. Arnold and Anders Logg. 2014. Periodic table of the finite elements. SIAM News 47, 9 (2014), 212. https://sinews.siam.org/Details-Page/periodic-table-of-the-finite-elements
- Balay et al. (2021) Satish Balay, Shrirang Abhyankar, Mark F. Adams, Jed Brown, Peter Brune, Kris Buschelman, Lisandro Dalcin, Victor Eijkhout, William D. Gropp, Dmitry Karpeyev, Dinesh Kaushik, Matthew G. Knepley, Dave A. May, Lois Curfman McInnes, Richard Tran Mills, Todd Munson, Karl Rupp, Patrick Sanan, Barry F. Smith, Stefano Zampini, Hong Zhang, and Hong Zhang. 2021. PETSc Users Manual. Technical Report ANL-95/11 - Revision 3.15. Argonne National Laboratory. https://www.mcs.anl.gov/petsc/petsc-current/docs/manual.pdf
- Balay et al. (1997) Satish Balay, William D. Gropp, Lois Curfman McInnes, and Barry F. Smith. 1997. Efficient Management of Parallelism in Object Oriented Numerical Software Libraries. In Modern Software Tools in Scientific Computing, E. Arge, A. M. Bruaset, and H. P. Langtangen (Eds.). Birkhäuser Press, Boston, MA, 163–202. https://doi.org/10.1007/978-1-4612-1986-6_8
- Boffi (2010) Daniele Boffi. 2010. Finite element approximation of eigenvalue problems. Acta Numerica 19 (2010), 1–120. https://doi.org/10.1017/S0962492910000012
- Christiansen and Gillette (2016) Snorre H. Christiansen and Andrew Gillette. 2016. Constructions of some minimal finite element systems. ESAIM: Mathematical Modelling and Numerical Analysis 50, 3 (2016), 833–850. https://doi.org/10.1051/m2an/2015089
- Cockburn and Fu (2017) Bernardo Cockburn and Guosheng Fu. 2017. A systematic construction of finite element commuting exact sequences. SIAM J. Numer. Anal. 55, 4 (2017), 1650–1688. https://doi.org/10.1137/16M1073352
- Dalcin et al. (2011) Lisandro D. Dalcin, Rodrigo R. Paz, Pablo A. Kler, and Alejandro Cosimo. 2011. Parallel distributed computing using Python. Advances in Water Resources 34, 9 (2011), 1124–1139. https://doi.org/10.1016/j.advwatres.2011.04.013 New Computational Methods and Software Tools.
- Fumio (1987) Kikuchi Fumio. 1987. Mixed and penalty formulations for finite element analysis of an eigenvalue problem in electromagnetism. Computer Methods in Applied Mechanics and Engineering 64, 1-3 (1987), 509–521. https://doi.org/10.1016/0045-7825(87)90053-3
- Gillette and Kloefkorn (2019) Andrew Gillette and Tyler Kloefkorn. 2019. Trimmed serendipity finite element differential forms. Math. Comp. 88, 316 (2019), 583–606. https://doi.org/10.1090/mcom/3354
- Gillette et al. (2019) Andrew Gillette, Tyler Kloefkorn, and Victoria Sanders. 2019. Computational serendipity and tensor product finite element differential forms. The SMAI Journal of Computational Mathematics 5 (2019), 1–21. https://doi.org/10.5802/smai-jcm.41
- Hernandez et al. (2005) Vicente Hernandez, Jose E. Roman, and Vicente Vidal. 2005,. SLEPc: A Scalable and Flexible Toolkit for the Solution of Eigenvalue Problems. ACM Trans. Math. Software 31, 3 (2005,), 351–362. https://doi.org/10.1145/1089014.1089019
- Homolya et al. (2018) Miklós Homolya, Lawrence Mitchell, Fabio Luporini, and David A. Ham. 2018. TSFC: a structure-preserving form compiler. SIAM Journal on Scientific Computing 40, 3 (2018), C401–C428. https://doi.org/10.1137/17M1130642
- Kirby (2004) Robert C. Kirby. 2004. Algorithm 839: FIAT, a new paradigm for computing finite element basis functions. ACM Trans. Math. Software 30, 4 (2004), 502–516. https://doi.org/10.1145/1039813.1039820
- Kirby (2012) Robert C. Kirby. 2012. FIAT: numerical construction of finite element basis functions. See Logg et al. (2012), 247–255. https://doi.org/10.1007/978-3-642-23099-8_13
- Kirby et al. (2012) Robert C Kirby, Anders Logg, Marie E Rognes, and Andy R Terrel. 2012. Common and unusual finite elements. See Logg et al. (2012), 95–119. https://doi.org/10.1007/978-3-642-23099-8_3
- Logg et al. (2012) Anders Logg, Kent-Andre Mardal, and Garth N. Wells (Eds.). 2012. Automated Solution of Differential Equations by the Finite Element Method: the FEniCS Book. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-23099-8
- Meurer et al. (2017) Aaron Meurer, Christopher P. Smith, Mateusz Paprocki, Ondřej Čertík, Sergey B. Kirpichev, Matthew Rocklin, AMiT Kumar, Sergiu Ivanov, Jason K. Moore, Sartaj Singh, Thilina Rathnayake, Sean Vig, Brian E. Granger, Richard P. Muller, Francesco Bonazzi, Harsh Gupta, Shivam Vats, Fredrik Johansson, Fabian Pedregosa, Matthew J. Curry, Andy R. Terrel, Štěpán Roučka, Ashutosh Saboo, Isuru Fernando, Sumith Kulal, Robert Cimrman, and Anthony Scopatz. 2017. SymPy: symbolic computing in Python. PeerJ Computer Science 3 (Jan. 2017), e103. https://doi.org/10.7717/peerj-cs.103
- Moler (1967) Cleve B. Moler. 1967. Iterative refinement in floating point. J. ACM 14, 2 (1967), 316–321. https://doi.org/10.1145/321386.321394
- Nédélec (1980) J.-C. Nédélec. 1980. Mixed finite elements in . Numer. Math. 35, 3 (1980), 315–341. https://doi.org/10.1007/BF01396415
- Nédélec (1986) J.-C. Nédélec. 1986. A new family of mixed finite elements in . Numer. Math. 50, 1 (1986), 57–81. https://doi.org/10.1007/BF01389668
- Rathgeber et al. (2016) Florian Rathgeber, David A. Ham, Lawrence Mitchell, Michael Lange, Fabio Luporini, Andrew T. T. McRae, Gheorghe-Teodor Bercea, Graham R. Markall, and Paul H. J. Kelly. 2016. Firedrake: automating the finite element method by composing abstractions. ACM Trans. Math. Software 43, 3 (2016), 1–27. https://doi.org/10.1145/2998441
- Raviart and Thomas (1977) P. A. Raviart and J. M. Thomas. 1977. A mixed finite element method for 2nd order elliptic problems. In Mathematical aspects of finite element methods. Springer, Berlin, Heidelberg, 292–315. https://doi.org/10.1007/BFb0064470
- Rognes et al. (2010) Marie E. Rognes, Robert C. Kirby, and Anders Logg. 2010. Efficient assembly of and conforming finite elements. SIAM Journal on Scientific Computing 31, 6 (2010), 4130–4151. https://doi.org/10.1137/08073901X
- Roman et al. (2020) Jose E. Roman, Carmen Campos, Lisandro Dalcin, Eloy Romero, and Andrés Tomás. 2020. SLEPc Users Manual. Technical Report DSIC-II/24/02 - Revision 3.15. D. Sistemes Informàtics i Computació, Universitat Politècnica de València. https://slepc.upv.es/documentation/slepc.pdf
- Sloane (2018) Neil J. A. Sloane. 2018. The on-line encyclopedia of integer sequences. Notices of the American Mathematical Society 65, 09 (Oct. 2018), 1. https://doi.org/10.1090/noti1734
- Wilkinson (1994) James Hardy Wilkinson. 1994. Rounding errors in algebraic processes. Courier Corporation, Mineola, NY.
- Zenodo (2021) Zenodo 2021. Software used in ’Bringing Trimmed Serendipity Methods to Computational Practice in Firedrake’. https://doi.org/10.5281/zenodo.4701708