1 Introduction

Partial differential equations describing field theories such as electromagnetism and elasticity often admit a natural expression in terms of differential forms. In the past decades, the role of differential forms has increased also in numerical methods and their practical implementations. The growth of their popularity has been accelerated by finite element exterior calculus [1, 3] for the finite element method and by discrete exterior calculus [13, 16] for finite difference kind of methods. For computations, differential forms are approximated in finite-dimensional spaces using a mesh consisting of a finite number of cells. In finite element exterior calculus these finite-dimensional spaces are spanned by suitable finite elements, while discrete exterior calculus is based on cochains (also known as discrete forms) as approximations for differential forms.

Methods based on discrete exterior calculus (DEC) may go by different names, e.g. Yee-like schemes [9, 10], finite integration technique [12], or generalised finite differences [6, 8]. These methods enable one to distinguish the features that depend on metric from those that do not, and in a way they preserve the geometric structure of the continuous model at the discrete level. The methods can typically be made explicit, which enables a very large number of degrees of freedom. In the literature there are many examples where discrete exterior calculus has been successfully applied (see e.g. [17, 22,23,24,25,26, 29]).

Although methods based on cochains have their benefits, there are also some drawbacks. When the solution is given as a cochain, it cannot be evaluated at a given point. In some situations evaluating the solution at a given point is preferable, and then one has to interpolate the cochain somehow. This raises the question: in which space does the interpolant lie? In the case of simplicial meshes, it is well known that Whitney forms [31] can be used to approximate differential forms and interpolate cochains in methods based on discrete exterior calculus. However, this only applies to lowest order Whitney forms. Although higher order Whitney forms have been defined and used elsewhere [4, 5, 7, 11, 15, 21, 27, 28], they have not been used with cochain-based methods. Indeed, these are often considered low-order methods in that they seem to lack natural higher order generalisations.

In this paper, we provide an alternative viewpoint and show how higher order Whitney forms can be used to interpolate cochains in methods based on discrete exterior calculus. As with lowest order Whitney forms, we require a simplicial mesh to begin with. This mesh is refined into smaller simplices which have been used to define higher order Whitney forms in [28]. Cochains on this refined mesh can then be interpolated using higher order Whitney forms, so when we apply methods based on discrete exterior calculus with the refined mesh, the solution can be expressed as a higher order Whitney form.

With this approach, we can reduce the interpolation error without any modifications in the methods themselves; the only changes are in preprocessing (preparing the mesh) and postprocessing (interpolating the cochain) stages. For this reason, we do not focus on any specific method here, but instead provide a framework for interpolating cochains with higher order Whitney forms. This framework can then be applied with any method — our algorithms are applicable whenever the solution is a cochain on a simplicial mesh. They can also be used if one simply wishes to approximate differential forms in finite-dimensional spaces and might be relevant for the finite element method as well, if integrals over small simplices are chosen as degrees of freedom.

Although reducing the interpolation error alone does not lead to higher order DEC methods, it is a necessary step toward them. To obtain higher order convergence, one would also have to improve the accuracy of discrete Hodge operators. This is possible using higher order Whitney forms and the interpolation framework presented here. It would of course require changes in specific methods, and hence, we will study higher order discrete Hodge operators in a future article.

The main novelty of this paper is the systematic implementation strategy that is usable with DEC and yields Whitney forms of all orders with the same code. The idea of using small simplices to construct bases and degrees of freedom for higher order Whitney forms is not new [11, 28]; however, although systematic implementations for more traditional bases and dofs exist, the approach with small simplices still lacks a systematic implementation strategy. The implementation in 3D is a delicate issue. For FEM, it has been studied in [4], but only second- and third-order 1-forms were implemented. Similarly, only second-order forms were implemented in our previous studies for DEC [18, 19]. Without general algorithms, the implementation process has to be repeated separately for each order, while the workload becomes unreasonably laborious very quickly. The systematic implementation strategy of this paper and in particular Algorithms 1–3 are a significant novelty, yielding all orders with the same code. Without such algorithms, the implementation of, for example, 8th-order 1-forms in 3D would be practically impossible using small simplices (to define both basis functions and dofs).

The outline of this paper is as follows. We start with some preliminaries in Section 2. Section 3 covers lowest order Whitney forms, and in Section 4 we recall the small simplices of [28] and use them to define higher order Whitney forms. In Section 5 we give the general idea for interpolating cochains with higher order Whitney forms. The implementation of this idea is discussed in Section 6. This section contains three subsections where we present algorithms for the three required steps: refining the mesh, solving the coefficients of the interpolant, and evaluating the interpolant at a given point. Numerical examples of Section 7 validate the generality of our algorithms — the order of Whitney forms can be given as a parameter, and hence, all cases are covered by the same code.

2 Some preliminary concepts

In this section we recall some prerequisite concepts that are used in this paper. The discussion is brief, but readers unfamiliar with these concepts can consult the given references for more information.

We start by defining a mesh in a domain \({\Omega }\subset \mathbb {R}^{n}\). Bounded and convex p-dimensional polytopes in \(\mathbb {R}^{n}\) are called p-cells for short. Cell complex K is a finite set of cells such that

  • each face of every cell in K is also in K.

  • The intersection of two cells in K is either a common face of theirs or the empty set.

The set of p-cells in K is denoted by Sp(K). A cell complex K is a mesh in Ω if the union of the cells of K is Ω. To enable this we assume that our domain Ω is a bounded polytope in \(\mathbb {R}^{n}\). A cell complex (or mesh) is simplicial if its cells are all simplices. In this case there is a unique barycentric function [31, App. II, §2] corresponding to each 0-simplex xi — this is denoted by λi.

We will also need the concept of orientation [31, App. II, §5]. Recall that p-cell σ is oriented by orienting its plane. If τSp+ 1(K) is oriented and σSp(K) is a face of τ, the orientation of τ induces an orientation on σ; we say that the orientation of σ agrees with that of τ if σ is equipped with the induced orientation. For τSp+ 1(K) and σSp(K), the incidence number \(\text {d}_{\sigma }^{\tau }\) is defined as

$$ \begin{array}{@{}rcl@{}} \text{d}_{\sigma}^{\tau} = \left\{\begin{array}{cl} 1 & \textup{if}\ \sigma \ \textup{is a \textit{p}-face of}\ \tau\ \textup{and their orientations agree,}\\ -1 & \textup{if}\ \sigma\ \textup{is a \textit{p}-face of}\ \tau\ \textup{and their orientations do not agree,}\\ 0 & \textup{otherwise}. \end{array}\right. \end{array} $$

In the case of simplices, we denote by x0xp the oriented p-simplex whose vertices are x0,…,xp and whose orientation is implied by this order of vertices.

We assume the reader is familiar with exterior algebra and differential forms (see e.g. [31, I–III] and [1]). Let 〈ω,α〉 denote the action of p-covector ω on p-vector α. Differential p-form in a complex K [31, p. 226] is a set of smooth p-forms ωσ in the cells σ of K satisfying the following patch condition: if τ is a face of σ, then the trace ωσ|τ of ωσ equals ωτ in τ. In other words, 〈ωσ(x),α〉 = 〈ωτ(x),α〉 for all xτ and all p-vectors α in the plane of τ. This enables us to consider the set of p-forms ωσ as single p-form ω such that 〈ω(x),α〉 is well-defined for those p-vectors α that are in the plane of the cell σ for which xσσ. Hence, differential p-forms in K can be integrated over p-cells. Denote by Fp(K) the space of differential p-forms in K. Note that since the exterior derivative d commutes with trace, we have dωFp+ 1(K) if ωFp(K), but the Hodge star ⋆ ω is not necessarily in Fnp(K).

Formal sums \({\sum }_{\sigma _{i}\in S^{p}(K)}a_{i}\sigma _{i}\) of oriented p-cells with real coefficients are called p-chains of K [31, App. II, §6]. These form a vector space Cp(K) for which the p-cells σi constitute a natural basis (here σi = 1σi, the sum in which aj = δij, the Kronecker delta). The elements of the dual space \(C_{p}^{*}(K)\) are p-cochains of K. Following [31], we use σi to denote also the cochain whose value is δij at the chain σj. Then the p-cells σi constitute the dual basis for \(C_{p}^{*}(K)\), and also cochains can be written as formal sums of cells. Negative coefficients indicate change of orientation so that − σ is the cell σ with opposite orientation. For computer implementations, chains and cochains can be considered as vectors consisting of the coefficients ai after a numbering has been chosen for the cells of K.

The boundary τ of a (p + 1)-cell τSp+ 1(K) is the p-chain \({\sum }_{\sigma \in S^{p}(K)}\mathrm {d}_{\sigma }^{\tau }\sigma \). This defines the boundary map : Cp+ 1(K) → Cp(K) for all chains by requiring it be linear. The coboundary map d : \(C_{p}^{*}(K)\rightarrow C_{p+1}^{*}(K)\) for cochains is defined by dX(c) = X(c). We use the same notation d as for the exterior derivative of forms. When cochains are considered as vectors, we can denote by d also the matrix with components d\(_{ij}=\mathrm {d}_{\sigma _{j}}^{\tau _{i}}\) for τiSp+ 1(K) and σjSp(K), since this is the matrix of the coboundary map. This notation is not explicitly needed in this paper, but we mention it so that dX makes sense also when cochain X is considered as a vector.

Since p-forms can be integrated over p-cells, each p-form ω yields a p-cochain whose values on chains are determined by integration of ω. Namely, the de Rham map \(\mathcal {C}:F^{p}(K)\rightarrow C_{p}^{*}(K)\) is the linear map defined by

$$ \mathcal{C}\omega\left( \sum\limits_{\sigma_{i}\in S^{p}(K)}a_{i}\sigma_{i}\right)=\underset{\sum\nolimits_{\sigma_{i}\in S^{p}(K)}a_{i}\sigma_{i}}{\int}\omega=\sum\limits_{\sigma_{i}\in S^{p}(K)}a_{i}{\int}_{\sigma_{i}}\omega, $$

where the second equality is the definition of integration on p-chains. The cochain \(\mathcal {C}\omega \) can be considered as an approximation of ω. In vector presentation, its components are the integrals of ω over the p-cells of K. We remark that Stokes’ theorem implies \(\mathcal {C}\mathrm {d}\omega =\mathrm {d}\mathcal {C}\omega \) for p-forms ω.

We invoke the inner product of \(\mathbb {R}^{n}\) to define norms as follows. If ω is a p-covector, denote by \(\lvert \omega \rvert \) the norm induced by the inner product of \(\mathbb {R}^{n}\) [31, I, §12]. If ω is a p-form, then \(\lvert \omega \rvert \) denotes the function whose value at x is \(\lvert \omega (x)\rvert \). Hence, we may define the L2 norm of the p-form ω as the L2 norm of the function \(\lvert \omega \rvert \). This is denoted by \(\lVert \lvert \omega \rvert \rVert _{L^{2}({\Omega })}\). In other words, \(\lVert \lvert \omega \rvert \rVert _{L^{2}({\Omega })}=({\int \limits }_{\Omega }\lvert \omega (x)\rvert ^{2}dx)^{1/2}\). For p-simplex σ, denote by \(\lvert \sigma \rvert \) its p-dimensional volume and define its fullness Θ(σ) by \({\Theta }(\sigma )=\lvert \sigma \rvert /\text {diam}(\sigma )^{p}\).

Discrete exterior calculus [13, 14, 16] enables a discrete presentation of boundary value problems expressed in terms of differential forms. When differential forms are approximated with cochains, the coboundary operator naturally replaces the exterior derivative. Indeed, if \(\mathcal {C}\omega \) approximates ω, then \(\mathcal {C}\mathrm {d}\omega =\mathrm {d}\mathcal {C}\omega \) suggests that \(\mathrm {d}\mathcal {C}\omega \) is the right approximation for dω. One also has to express the Hodge star operator for cochains. There are several ways to do this, and one typically employs a dual complex so that p-cochains of K are mapped to (np)-cochains of the dual complex. We need not consider any specific approach to deal with the Hodge operator or any specific boundary value problem. The framework we present in this paper can be applied as long as the solution is a cochain on a simplicial mesh which is meant to approximate a differential form — that is, its coefficients correspond to the integrals of the form.

3 Lowest order Whitney forms

In this section, we briefly recall Whitney forms as a tool for interpolating cochains. More information can be found in [20]. Let us henceforth assume that the mesh K is simplicial.

Definition 3.1

The Whitney 0-form corresponding to the 0-simplex xi is the barycentric function \(\mathcal {W} x_{i}=\lambda _{i}\). For p > 0, the Whitney p-form corresponding to the p-simplex x0xp is [31, VII, 11.16]

$$ \mathcal{W}(x_{0}{\ldots} x_{p}) = p!{\sum}_{i=0}^{p}(-1)^{i}\lambda_{i}\text{d}\lambda_{0}\wedge\ldots\wedge\widehat{\text{d}\lambda_{i}}\wedge\ldots\wedge \text{d}\lambda_{p}, $$
(3.1)

where \(\widehat {{\mathrm {d}\lambda _{i}}}\) indicates a term omitted from the product.

For each p, the Whitney map \(\mathcal {W}:C_{p}^{*}(K)\rightarrow F^{p}(K)\) is defined by setting

$$ \mathcal{W}\bigg({\sum}_{\sigma_{i}\in S^{p}(K)}a_{i}\sigma_{i}\bigg) = {\sum}_{\sigma_{i}\in S^{p}(K)}a_{i}\mathcal{W}\sigma_{i}. $$

The image \(\mathcal {W}(C_{p}^{*}(K)) = \text {span}\{\mathcal {W}\sigma \mid \sigma \in S^{p}(K)\} \subset F^{p}(K)\) is the space of Whitney p-forms and denoted by Wp(K).

First, recall that \(\mathcal {C}\mathcal {W} X=X\) for all \(X\in C_{p}^{*}(K)\). Cochains and Whitney forms are in one-to-one correspondence in the simplest possible way, the cochain \(X={\sum }_{\sigma _{i}\in S^{p}(K)}a_{i}\sigma _{i}\in C_{p}^{*}(K)\) corresponding to the p-form \(\mathcal {W} X={\sum }_{\sigma _{i}\in S^{p}(K)}a_{i}\mathcal {W}\sigma _{i}\); we can interpolate X with \(\mathcal {W} X\), and the integrals of this interpolant match with the values of X on p-simplices of K. Further, we can approximate p-form ωFp(K) with the Whitney form \(\mathcal {W}\mathcal {C}\omega \), and the integrals of this approximation match with those of ω on p-simplices of K: \(\mathcal {C}\mathcal {W}\mathcal {C}\omega =\mathcal {C}\omega \). This approximation is exact for elements of Wp(K), including constant p-forms.

For computing derivatives, a useful fact is that d and \(\mathcal {W}\) commute: for \(X\in C_{p}^{*}(K)\), we have \(\mathrm {d}\mathcal {W} X=\mathcal {W} \mathrm {d} X\). Finally, we mention the affine invariance property of Whitney forms. Let σ = x0xn and τ = y0yn be two n-simplices and \(\varphi :\sigma \rightarrow \tau \) the affine map such that φ(xi) = yi. Then \(\mathcal {W}(x_{0}{\ldots } x_{p})\) in σ is the pullback \(\varphi ^{*}(\mathcal {W}(y_{0}{\ldots } y_{p}))\). Because of this property, computations done in a reference simplex transfer to all simplices by affine transformations and hence need be done only once. This will be useful when we consider interpolation with higher order Whitney forms.

4 Small simplices and higher order Whitney forms

Lowest order Whitney forms defined in the previous section include constants and are at most first-order polynomials in each simplex. There are also higher order Whitney forms, or Whitney forms of order k, which include (k − 1)th-order polynomials and are at most k th-order polynomials in each simplex. Higher order Whitney forms can be defined in different ways. We use the so-called small simplices of [28], since this approach enables us to interpolate cochains with higher order Whitney forms.

To define the small simplices, let \(\mathcal {I}(n+1,k)\) denote the set of multi-indices with n + 1 components that sum to k; that is, \(\mathcal {I}(n+1,k)\) consists of arrays k = (k0,k1,…,kn) where the ki are nonnegative integers such that \({\sum }_{i=0}^{n}k_{i}=k\). The cardinality \(\#\mathcal {I}(n+1,k)\) of \(\mathcal {I}(n+1,k)\) is \(\left (\begin {array}{c}n+k\\k \end {array}\right )\) (see Lemma A.1 in Appendix ??). For a fixed n-simplex σ = x0xn, each multi-index \(\mathbf {k}\in \mathcal {I}(n+1,k-1)\) defines a map, which we denote by kσ, from σ to itself such that the point x whose barycentric coordinates are λi maps to the point whose barycentric coordinates are \(\frac {\lambda _{i}+k_{i}}{k}\). In other words, kσ is defined by

$$ \begin{array}{@{}rcl@{}} &\mathbf{k}_{\sigma}: \sigma\rightarrow\sigma, \quad \lambda_{0}x_{0} + {\ldots} + \lambda_{n}x_{n} \mapsto \frac{\lambda_{0}+k_{0}}{k}x_{0} + {\ldots} + \frac{\lambda_{n}+k_{n}}{k}x_{n}. \end{array} $$

For k ≥ 1, the set of k th-order small p-simplices of K is

$$ \begin{array}{@{}rcl@{}} \begin{array}{ll} {S_{k}^{p}}(K)=\{&\mathbf{k}_{\sigma}(\tau) \mid \sigma=x_{0}{\ldots} x_{n}\in S^{n}(K), \\ &\mathbf{k}\in\mathcal{I}(n+1,k-1), \textrm{and $\tau$ is a \textit{p}-face of $\sigma$}\}. \end{array} \end{array} $$
(4.1)

Small simplices are homothetic images of the simplices of K. See Fig. 1 for examples of small simplices.

Fig. 1
figure 1

Second- and third-order small simplices kσ(σ) in the cases when σ is a triangle in two dimensions and a tetrahedron in three dimensions

To each k th-order small p-simplex υ corresponds a k th-order Whitney p-form w(υ) ∈ Fp(K), as given in the following definition. Henceforth, when σ = x0xn is a fixed n-simplex, we denote by \(\lambda ^{\mathbf {k}}_{\sigma }\) the function \({\prod }_{i=0}^{n}(\lambda _{i})^{k_{i}}\).

Definition 4.1

Let σ = x0xnSn(K), \(\mathbf {k}\in \mathcal {I}(n+1,k-1)\), and τ be a p-face of σ. The k th-order Whitney p-form corresponding to the small simplex kσ(τ) is

$$ \begin{array}{@{}rcl@{}} w(\mathbf{k}_{\sigma}(\tau))=\lambda^{\mathbf{k}}_{\sigma}\mathcal{W}\tau. \end{array} $$

The space of k th-order Whitney p-forms is the span of all such forms:

$$ \begin{array}{@{}rcl@{}} {W^{p}_{k}}(K)=\text{span}\{w(\upsilon) \mid \upsilon\in {S_{k}^{p}}(K)\}. \end{array} $$

Since the higher order Whitney forms in the definition above are products of barycentric functions and lowest order Whitney forms, it is immediate that they too are affine invariant and elements of Fp(K). However, it is equally evident that there is no similar correspondence between Whitney forms and cochains of \(C_{p}^{*}(K)\) in the higher order case. Namely, Wp(K) is already isomorphic to \(C_{p}^{*}(K)\), and increasing the order increases the dimension of the space, so there is no way for \({W_{k}^{p}}(K)\) to be isomorphic to \(C_{p}^{*}(K)\). However, it is only natural that higher order approximations require more degrees of freedom, and the spanning higher order forms in Definition 4.1 were given corresponding to small simplices of K. This suggests that instead of \(C_{p}^{*}(K)\) we should concentrate on cochains over the small simplices of K — the next section makes this idea precise.

5 Interpolating with higher order Whitney forms

As can be seen from Fig. 1, the small simplices do not pave Ω, and hence, they do not form a subdivision of K. However, we can always refine the mesh K such that the refinement contains the small simplices as cells. In this section, we consider how to interpolate cochains of this refined mesh with higher order Whitney forms.

Choose k and let Kk denote a refinement of K into k th-order small simplices; more precisely, Kk can be any mesh in Ω that contains the small simplices of order k as cells. Kk is allowed to have also other cells. For instance, between the small simplices of a tetrahedron in three dimensions, there are holes that are either octahedra or inverted tetrahedra (see Fig. 1). The refinement Kk is not unique; the holes can be accepted as cells as such, or one may further divide them into simplices. The only requirements are that Kk is a mesh in Ω (i.e. satisfies the definition of mesh given in Section 2) and contains the small simplices of order k as cells. We can then consider chains Cp(Kk) and cochains \(C_{p}^{*}(K_{k})\) of Kk and the de Rham map \(\mathcal {C}_{k}:F^{p}(K)\to C_{p}^{*}(K_{k})\) (which is well-defined in Fp(Kk), but we restrict the domain to the subset Fp(K)).

To interpolate with higher order Whitney forms, we are looking for some kind of interpolating map \(\mathcal {V}:C_{p}^{*}(K_{k})\to F^{p}(K)\) akin to the Whitney map \(\mathcal {W}\). Since the coefficients ai of the cochain \(X={\sum }_{\sigma _{i}\in S^{p}(K_{k})}a_{i}\sigma _{i}\) can be considered as integrals of some differential form that X is meant to approximate, we would like to find \(\mathcal {V} X\in {W_{k}^{p}}(K)\) such that \({\int \limits }_{\sigma _{i}}\mathcal {V} X=a_{i} \forall \sigma _{i}\in S^{p}(K_{k})\). In other words, we would like to have \(\mathcal {C}_{k}\mathcal {V} X=X\) for all \(X\in C_{p}^{*}(K_{k})\), preserving the property of \(\mathcal {W}\). However, it is evident that this is generally not possible, since the number of cells in Kk is greater than the dimension of \({W_{k}^{p}}(K)\). We will therefore have to relax the condition \({\int \limits }_{\sigma _{i}}\mathcal {V} X=a_{i} \forall \sigma _{i}\in S^{p}(K_{k})\) somehow.

Since the spanning higher order forms in Definition 4.1 were given corresponding to small simplices of K, the first relaxation that comes to mind is to require \({\int \limits }_{\sigma _{i}}\mathcal {V} X=a_{i}\) not for all σiSp(Kk) but for all \(\sigma _{i}\in {S^{p}_{k}}(K)\) — that is, for those cells that are small simplices. However, the spanning forms in Definition 4.1 are not linearly independent, so the dimension of \({W_{k}^{p}}(K)\) is lower than the number of small simplices in Sp(Kk). Hence, we must relax the condition even further.

A simple and feasible way to deal with this linear dependency is to choose a subset \(\hat {S}_{k}^{p}(K)\) of \({S_{k}^{p}}(K)\) such the forms corresponding to small simplices in \(\hat {S}_{k}^{p}(K)\) form a basis for \({W_{k}^{p}}(K)\). The subset \(\hat {S}_{k}^{p}(K)\) of \({S_{k}^{p}}(K)\) is chosen by omitting redundant small simplices. Then those coefficients ai of the cochain \(X={\sum }_{\sigma _{i}\in S^{p}(K_{k})}a_{i}\sigma _{i}\) that correspond to \(\sigma _{i}\in \hat {S}_{k}^{p}(K)\) determine a unique element \(\mathcal {V} X\in {W_{k}^{p}}(K)\) such that \({\int \limits }_{\sigma _{i}}\mathcal {V} X=a_{i} \forall \sigma _{i}\in \hat {S}_{k}^{p}(K)\), defining a linear map \(\mathcal {V}:C_{p}^{*}(K_{k})\to F^{p}(K)\). The map \(\mathcal {V}\) does not satisfy \(\mathcal {C}_{k}\mathcal {V} X=X\) for all \(X\in C_{p}^{*}(K_{k})\) since we do not necessarily have \({\int \limits }_{\sigma _{i}}\mathcal {V} X=a_{i}\) if \(\sigma _{i}\notin \hat {S}_{k}^{p}(K)\). Now we only have \(\mathcal {C}_{k}\mathcal {V} X=X\) for \(X\in \mathcal {C}_{k}({W_{k}^{p}}(K))\). This is how our earlier requirement has been relaxed. To summarise, \(\mathcal {V} X\) has the correct integrals on the chosen subset of small simplices.

To make the above precise, we have to specify some details — namely, how to choose the subset \(\hat {S}_{k}^{p}(K)\) such that the corresponding Whitney forms constitute a basis for \({W_{k}^{p}}(K)\). In the following we give the general idea in n-dimensions; details specific to three dimensions are considered in the next section.

Let σn denote a generic n-simplex considered as a cell complex, and let \(\mathring {W}_{k}^{p}(\sigma ^{n})\) denote the subspace of p-forms in \({W_{k}^{p}}(\sigma ^{n})\) with zero trace on the boundary of σn. We rely on the decomposition [2, Theorem 7.3]

$$ \begin{array}{@{}rcl@{}} {W_{k}^{p}}(\sigma^{n})=\underset{\underset{p\le q\le n}{\sigma^{q}\in S^{q}(\sigma^{n})}}{\bigoplus}\mathring{W}_{k}^{p}(\sigma^{q}), \end{array} $$
(5.1)

where we have extended elements in \({W_{k}^{p}}(\sigma ^{q})\) to elements of \({W_{k}^{p}}(\sigma ^{n})\) using the barycentric extension (see [2, (7.1)]; simply consider all barycentric functions in σn instead of σq), which will henceforth be applied implicitly when appropriate. This implies the global decomposition

$$ \begin{array}{@{}rcl@{}} {W_{k}^{p}}(K)=\underset{\underset{p\le q\le n}{\sigma^{q}\in S^{q}(K)}}{\bigoplus}\mathring{W}_{k}^{p}(\sigma^{q}). \end{array} $$
(5.2)

Hence, it suffices to choose the subset \(\hat {S}_{k}^{p}(\sigma ^{q})\) in a generic q-simplex σq, considering only those small simplices that are not contained in the boundary of σq. The same choice can then be applied throughout the mesh, yielding the required map \(\mathcal {V}:C_{p}^{*}(K_{k})\to F^{p}(K)\).

Let us therefore consider q-simplex σq and let \(\mathring {S}^{p}_{k}(\sigma ^{q})\) denote the set of those small simplices in \({S^{p}_{k}}(\sigma ^{q})\) that are not contained in the boundary of σq. The dimension of \(\mathring {W}_{k}^{p}(\sigma ^{q})\) compares with the cardinality of \(\mathring {S}^{p}_{k}(\sigma ^{q})\) as follows:

$$ \begin{array}{@{}rcl@{}} \dim(\mathring{W}_{k}^{p}(\sigma^{q}))&=\left( \begin{array}{c}q\\p \end{array}\right)\left( \begin{array}{c}p+k-1\\q \end{array}\right), \end{array} $$
$$ \begin{array}{@{}rcl@{}} \#\mathring{S}^{p}_{k}(\sigma^{q})&=\left\{\begin{array}{cc} \left( \begin{array}{c}k-1\\q \end{array}\right), & p=0,\\ \left( \begin{array}{c}q+1\\p+1 \end{array}\right)\left( \begin{array}{c}p+k-1\\q \end{array}\right),& p>0. \end{array}\right. \end{array} $$
(5.3)

The first line has been proved in [1], and the second line is proved as Lemma A.3 in Appendix ??.

These counts determine how many small simplices one must omit before their cardinality matches the dimension of the Whitney forms in each simplex. The omitted simplices can be chosen in many ways, as long as the remaining forms span the same space. For this, let us recall the linear relations between higher order Whitney forms. When σ is a p-face of a (p + 1)-simplex τ, let τσ denote the node of τ that is opposite to σ. Then, for each τSp+ 1(σq) we have (see e.g. [19] for a proof)

$$ \begin{array}{@{}rcl@{}} {\sum}_{\sigma \in S^{p}(\sigma^{q})}\mathrm{d}_{\sigma}^{\tau}\lambda_{\tau-\sigma} \mathcal{W}\sigma=0. \end{array} $$
(5.4)

This shows that second-order p-forms are linearly dependent, and multiplying both sides by \(\lambda _{\sigma ^{q}}^{\mathbf {k}}\) with \(\mathbf {k}\in \mathcal {I}(q+1,k-2)\) gives relations for k th-order p-forms. These relations can be used to ensure that we only omit redundant small simplices and the remaining p-forms still span the same space.

When p = 0 or p = q, (5.3) says \(\dim (\mathring {W}_{k}^{p}(\sigma ^{q}))=\#\mathring {S}^{p}_{k}(\sigma ^{q})\). Thus none of the small simplices will be omitted in that case. When 0 < p < q, we multiply (5.4) applied to each (p + 1)-face τ of σq = x0xq by \(\lambda _{\sigma ^{q}}^{\mathbf {k}}\) with \(\mathbf {k}\in \mathcal {I}(q+1,k-2)\) such that ki≠ 0 if xiτ. (This requirement on k is set to obtain relations specifically for \(\mathring {W}_{k}^{p}(\sigma ^{q})\) instead of \({W_{k}^{p}}(\sigma ^{q})\).) By Lemma A.2 in Appendix ??, the number of such k is \(\left (\begin {array}{c}p+k-1\\q \end {array}\right )\), and hence, we get \(\left (\begin {array}{c}q+1\\p+2 \end {array}\right )\left (\begin {array}{c}p+k-1\\q \end {array}\right )\) relations for \(\mathring {W}_{k}^{p}(\sigma ^{q})\). Notice that the binomial coefficient \(\left (\begin {array}{c}p+k-1\\q \end {array}\right )\) involved in (5.3) appears here too; these formulas have a nice geometric interpretation which will be helpful in implementations. All of this will be clarified in practice in the next section.

We conclude this section with the approximation property of higher order Whitney forms [20] and some remarks.

Theorem 5.1

Let \(\mathcal {V}:C_{p}^{*}(K_{k})\rightarrow F^{p}(K)\) be the linear map obtained with a choice of k th-order small simplices as explained above, and let ω be a smooth p-form in Ω. There exists a constant Cω,k such that

$$ \begin{array}{@{}rcl@{}} \lvert\mathcal{V}\mathcal{C}_{k}\omega(x)-\omega(x)\rvert\le \frac{C_{\omega,k}}{C_{\Theta}^{p}} h^{k} \quad \textup{for all} x\in\tau \textup{in all} \tau \in S^{n}(K) \end{array} $$

whenever h > 0, CΘ > 0, and K is a simplicial mesh in Ω such that diam(σ) ≤ h and Θ(σ) ≥ CΘ for all simplices σ of K.

Remark 5.2

To vary the order of Whitney forms in different subdomains of Ω, one has to divide adjacent elements into small simplices of different orders. This results in a division that is not a mesh in the sense of discrete exterior calculus. The interfaces of such subdomains require special treatment and changes in specific methods.

Remark 5.3

d and \(\mathcal {V}\) commute for 0-cochains, i.e. \(\mathrm {d}\mathcal {V} X=\mathcal {V} \mathrm {d} X\) for \(X\in C_{0}^{*}(K_{k})\). For p > 0, this property cannot be achieved without giving up on other properties. In general \(\mathrm {d}\mathcal {V} X\) is given by \(\mathcal {V} \mathrm {d}\mathcal {C}_{k}\mathcal {V} X\), so the derivative can still be computed after one first corrects the values of X on omitted small simplices.

6 Systematic implementation strategy

Let us next turn our attention to the implementation of the ideas presented in the previous section. For simplicity and due to practical interests, we will henceforth restrict to the three-dimensional case n = 3. Although more work would be required in the case n > 3, it should be visible how the same algorithms generalise to any dimension. In contrast, we will not restrict to any specific order k. Our algorithms enable the implementation of k th-order 0-, 1-, 2-, and 3-forms in \(\mathbb {R}^{3}\) such that the order k can be given as a parameter and the same code covers all orders.

Let us first consider k th-order small simplices and the choice of the subsets \(\hat {S}_{k}^{p}(\sigma ^{q})\) in three dimensions. As explained, we will work in a generic q-simplex σq and consider only those small simplices that are not contained in the boundary of σq. Using (5.3) with 0 ≤ pq ≤ 3, we find that there are three types of small simplices that require attention:

  • \(\mathring {W}_{k}^{1}(\sigma ^{2})\) has dimension \(2\binom {k}{2}\), while \(\#\mathring {S}^{1}_{k}(\sigma ^{2})=3\binom {k}{2}\). This means we have to omit \(\binom {k}{2}\) small 1-simplices in σ2.

  • \(\mathring {W}_{k}^{1}(\sigma ^{3})\) has dimension \(3\binom {k}{3}\), while \(\#\mathring {S}^{1}_{k}(\sigma ^{3})=6\binom {k}{3}\). This means we have to omit \(3\binom {k}{3}\) small 1-simplices in σ3.

  • \(\mathring {W}_{k}^{2}(\sigma ^{3})\) has dimension \(3\binom {k+1}{3}\), while \(\#\mathring {S}^{2}_{k}(\sigma ^{3})=4\binom {k+1}{3}\). This means we have to omit \(\binom {k+1}{3}\) small 2-simplices in σ3.

Our strategy to omit redundant small simplices was inspired by the example with k = 3 given in [11, p. 31]. We make use of the following geometrical observation, illustrated in Fig. 2 (recall also Fig. 1). In σ2, the holes that are not small simplices are inverted triangles and in correspondence to elements of \(\mathcal {I}(3,k-2)\). Their cardinality is \(\binom {k}{2}\), which is also the number of relations we get for \(\mathring {W}_{k}^{1}(\sigma ^{2})\). These relations correspond to the inverted triangles, and we omit one small 1-simplex for each. In σ3, there are two kind of holes: \(\binom {k}{3}\) inverted tetrahedra corresponding to elements of \(\mathcal {I}(4,k-3)\) and \(\binom {k+1}{3}\) octahedra corresponding to elements of \(\mathcal {I}(4,k-2)\). We have \(4\binom {k}{3}\) relations for \(\mathring {W}_{k}^{1}(\sigma ^{3})\); 4 per inverted tetrahedron (one for each of its 2-faces). These relations allow us to omit any 3 of the edges of each inverted tetrahedron to obtain a basis for \(\mathring {W}_{k}^{1}(\sigma ^{3})\). For \(\mathring {W}_{k}^{2}(\sigma ^{3})\), we have one relation per octahedron, and omitting one 2-face for each octahedron yields a basis for \(\mathring {W}_{k}^{2}(\sigma ^{3})\).

Fig. 2
figure 2

Illustration of the holes between k th-order small simplices for k = 4 and k = 5. In σ2, there are \(\binom {k}{2}\) inverted triangles. In σ3, there are \(\binom {k}{3}\) inverted tetrahedra and \(\binom {k+1}{3}\) octahedra

As stated, it suffices to make these choices only once in a generic q-simplex, and the same choice can then be applied throughout the mesh. For other small simplices than the three types covered above, none of the small simplices are omitted. However, we remark that in practice one should exclude duplicate entries from the sets \(\mathring {S}^{0}_{k}(\sigma ^{q})\). Namely, the same small 0-simplex may appear multiple times in (4.1). To handle this, we can choose to always label the small 0-simplices as the images of the first vertex of σq.

Let us denote the chosen subsets of \(\mathring {S}^{p}_{k}(\sigma ^{q})\) by \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\) and choose a numbering for their elements. As explained in the previous section, these subsets determine a map \(\mathcal {V}:C_{p}^{*}(K_{k})\to F^{p}(K)\) which enables us to interpolate cochains of Kk with k th-order Whitney forms. The implementation process can be divided into three steps:

  1. 1.

    Given a simplicial mesh K in Ω, we form a refinement Kk containing the k th-order small simplices as cells.

  2. 2.

    Given a cochain \(X\in C_{p}^{*}(K_{k})\), we solve the coefficients of the interpolant \(\mathcal {V} X\) in the chosen basis.

  3. 3.

    Given the coefficients of the interpolant \(\mathcal {V} X\), we show how to evaluate it at a given point x ∈Ω.

These steps are discussed in detail in the following three subsections.

6.1 Refining the mesh

Suppose we have a three-dimensional simplicial mesh K in Ω. In this subsection, we discuss how the mesh can be refined systematically to obtain a refinement Kk that contains the k th-order small simplices as cells. We make the following assumptions for the mesh as data structure:

  • The p-simplices of K have been indexed, and the positions of the 0-simplices (which are points in Ω) are contained in a list.

  • The vertices of each p-simplex σSp(K) can be accessed in a definite order, and this order determines the orientation of σ.

  • Given a list of vertices x0,…,xp, we have means of finding the p-simplex with these vertices (if one exists).

These can be achieved when, in addition to the position list, we store the indices of the (p − 1)-faces and the parent (p + 1)-simplices of each p-simplex σ.

When refining the mesh, one might wish to store the indices of the small simplices that correspond to the elements of the sets \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\) in each q-simplex σqSq(K). They will be needed when interpolating cochains, and having saved the indices in memory, one need not repeatedly find them for each interpolation. While possible, this is not necessary if new indices are allocated in increasing order, as the indices of the small simplices will then be implied from those of the big simplices. In this case finding them is a very small task, while storing the indices can use a lot of memory. Nevertheless, if desired, the index of each small simplex can be stored right after it is added to Kk, and hence, we need not make this explicit in the rest of this subsection.

The strategy for refining the mesh is as follows. We start with an empty mesh Kk and make it the desired refinement of K by going through the simplices of K in the order of increasing dimension and adding the corresponding small simplices into Kk. With this order, we only have to consider the small simplices that are not in the boundary of the simplices, since those in the boundary have already been covered along with some lower-dimensional simplex. For 2- and 3-simplices, we will also fill the holes that would otherwise be left between the small simplices. Multi-indices are needed to label both small simplices and the holes, and hence, we assume access to the sets \(\mathcal {I}(l,m)\) stored in some data structure.

The first step is straightforward: we copy the 0-simplices of K into Kk. Second, the small 0- and 1-simplices of each 1-simplex of K are added into Kk. Third, we go through the 2-simplices of K and add the corresponding small 0-, 1-, and 2-simplices into K, also filling the inverted triangles in between. Fourth, we add the small 0-, 1-, 2-, and 3-simplices and the holes of each 3-simplex of K into Kk. The holes that are octahedra are the only cells in Kk that are not simplices; however, it is possible to divide them into four tetrahedra. In discrete exterior calculus, it is sometimes desirable that cells are well-centered. In this case one might wish to divide each octahedron into four tetrahedra by adding a 1-simplex of smallest possible length. If this is not uniquely determined, the octahedron can accordingly be divided into two pyramids or kept as it is. The potential division has no effect on the algorithms of this paper.

When adding the small simplices of σq = x0xqSq(K) into Kk, we first add the small 0-simplices that are in the interior of σq. These are obtained as images of x0 through kσ with \(\mathbf {k}\in \mathcal {I}(q,k-1)\) such that ki≠ 0 for i > 0. Each small 0-simplex is covered exactly once, so we do not have to check if another 0-simplex has already been added in the same position. For adding other small simplices (and the holes), we need means of finding the indices of the small 0-simplices corresponding to their vertices (which have already been added into Kk). It is useful to have a function that returns the index of the small 0-simplex kσ(xi) for any k, σ = x0xq, and i ∈{0,…,q}. The indices of the 0-simplices can then be used to add higher-dimensional cells (or find if they exist); these are added in the order of increasing dimension.

The approach is simple on paper and also relatively easy to implement. Algorithm 1 summarises our strategy for refining the mesh.

figure a

6.2 Solving the coefficients of the interpolant

Suppose we have a cochain \(X\in C_{p}^{*}(K_{k})\) on the refined mesh Kk. In this subsection, we discuss how to determine the coefficients of the interpolant \(\mathcal {V} X\) in the chosen basis.

The idea is to first solve the coefficients corresponding to small p-simplices that are in \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{p})\) for some σpSp(K). These can then be used to solve the coefficients corresponding to small p-simplices that are in \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{p+1})\) for some σp+ 1Sp+ 1(K). Continuing in this order, we can solve the coefficients of the interpolant in all simplices.

When σpSp(K), the coefficients corresponding to small p-simplices that are in \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{p})\) are uniquely determined by the values of X on the elements of \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{p})\); let \(X[\hat {\mathring {S}}^{p}_{k}(\sigma ^{p})]\) denote these components of X when it is considered as a vector. To solve the coefficients, observe that if for each p and q we define matrix A(p,q), indexed over \(\upsilon \in \hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\), by

$$ \begin{array}{@{}rcl@{}} A(p,q)_{ij}={\int}_{\upsilon_{i}}w(\upsilon_{j}), \end{array} $$

and define ci as i th component of the vector \(A(p,p)^{-1}X[\hat {\mathring {S}}^{p}_{k}(\sigma ^{p})]\), then the Whitney form \({\sum }_{\upsilon _{i}\in \hat {\mathring {S}}^{p}_{k}(\sigma ^{p})}c_{i}w(\upsilon _{i})\) has the correct integrals on elements of \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{p})\). Hence, the coefficients can be solved using the inverse of the matrix A(p,p).

The same idea works when q > p and σqSq(K), but now we first have to take into account the Whitney forms corresponding to small simplices of the faces of σq whose coefficients have been solved earlier. Therefore we first subtract their integrals over elements of \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\) from the vector \(X[\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})]\). Then multiplying by A(p,q)− 1 yields the correct coefficients corresponding to small p-simplices in \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\).

At first glance, this approach might seem inefficient because we have to integrate functions and invert matrices to even solve the coefficients of the interpolant. However, we stress that the integrals of higher order Whitney forms over small simplices are affine invariant quantities, and hence, it suffices to build the matrices A(p,q) only once! Of course, in practice we can use the LU decomposition of A(p,q) to solve the coefficients instead of explicitly computing the inverse; this yields better numerical accuracy. We write A(p,q)− 1 only for notational simplicity.

The integrals of the basis functions corresponding to small simplices of faces of σq over elements of \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\) can also be precomputed. We only have to remember that the vertices of the faces may be in different possible orders, and these yield different integrals. For this, let us define matrices B(p,σq,σr), where σr is an r-face of σq, such that

$$ \begin{array}{@{}rcl@{}} B(p,\sigma^{q},\sigma^{r})_{ij}={\int}_{\upsilon_{i}}w(\upsilon_{j}),\quad \upsilon_{i}\in\hat{\mathring{S}}^{p}_{k}(\sigma^{q}), \upsilon_{j}\in\hat{\mathring{S}}^{p}_{k}(\sigma^{r}). \end{array} $$

This time the matrix B(p,σq,σr) is not the same for all σq and σr since it depends on which face σr is and on the order of its vertices. However, there is only a finite number of possibilities we have to precompute, and then the matrix B(p,σq,σr) will always be one of these. For example, consider B(1,σ3,σ2). There are four 2-faces of σ3, and there are six permutations for the vertices for σ2. Hence, there are 24 possibilities for the matrix B(p,σq,σr). In 3D, the number of possibilities never exceeds 24 (see Table 1).

Table 1 The number of different possibilities for the matrix B(p,σq,σr)

Having precomputed these matrices B(p,σq,σr), we do not have to integrate anything when solving the coefficients. When σr is a face of σq and we wish to take the Whitney forms corresponding to small simplices of σr into account, we use the matrix B(p,σq,σr) (the one appropriate for σq and σr) and the coefficients we have solved in σr earlier. Matrix-vector multiplication yields the integrals over elements of \(\hat {\mathring {S}}^{p}_{k}(\sigma ^{q})\).

The integrals of higher order Whitney forms over small simplices that are needed for the matrices A(p,q) and B(p,σq,σr) can be computed analytically; we elaborate on this in Appendix ??. Another option is to use at least k th-order quadrature formulas for numerical integration. The matrices are formed only once, and hence, we can precompute them in as high numerical precision as desired.

Algorithm 2 summarises our strategy for solving the coefficients of the interpolant.

figure b

6.3 Evaluating the interpolant at a given point

Suppose we have solved the coefficients c[υi] of the interpolant in the chosen basis for \({W_{k}^{p}}(K)\) and we wish to evaluate the interpolant at a given point x ∈Ω. In this subsection, we discuss how to compute the value of \({\sum }_{\upsilon _{i}\in \hat {S}_{k}^{p}(K)}c[\upsilon _{i}]w(\upsilon _{i})\) at x. Note that this is not an entirely trivial task, for we have used the decomposition (5.2) when forming a basis and hence have to accumulate contributions of \(\mathring {W}^{p}_{k}(\sigma ^{q})\) for different σqSq(K), pq ≤ 3.

We assume it is possible to search for a 3-simplex σ3S3(K) that contains x (or one is known in advance). Notice that w(υ) is zero in σ3 if υ is not contained in σ3, and hence, it suffices to consider the basis forms corresponding to small simplices of σ3. If x happens to be in multiple 3-simplices, their intersection is some q-simplex σqSq(K) for q < 3. In this case we may either compute the value in σq (considering only the small simplices of σq) or choose one of them and compute the value there; the trace on σq agrees with the value computed in σq.

Supposing we have found a 3-simplex σ3 containing x, the next step is to compute the barycentric coordinates of x and the values of the lowest order Whitney forms corresponding to p-faces of σ3. These can then be used with the coefficients c[υi] to compute the value of the interpolant. Indeed, since the basis forms are products of barycentric functions and lowest order Whitney forms, we can write the interpolant as

$$ \begin{array}{@{}rcl@{}} {\sum}_{\upsilon_{i}\in\hat{S}_{k}^{p}(\sigma^{3})}c[\upsilon_{i}]w(\upsilon_{i})={\sum}_{{\sigma^{p}_{i}}\subset\sigma^{3}}d_{i}{\mathcal{W}\sigma^{p}_{i}}, \end{array} $$

where the second sum is over p-faces \({\sigma ^{p}_{i}}\) of σ3 and di is a linear combination of products of barycentric functions. To compute di, recall the decomposition (5.1) and accumulate the contributions from all faces of σ3 using the coefficients c[υi]. Taking orientations into account, our strategy for evaluating the interpolant at a given point is formulated in Algorithm 3.

figure c

7 Numerical examples

To show that our algorithms can be implemented in practice, we provide numerical examples with higher order Whitney forms. In all of the test cases, our domain Ω is the rhombic dodecahedron with vertices (± 1,± 1,± 1), (± 2,0,0), (0,± 2,0), and (0,0,± 2). We build a simplicial mesh K in Ω and its refinement Kk. For a p-form ω, the cochain \(\mathcal {C}_{k}\omega \) is obtained by integrating ω using high-order quadrature formulas for p-simplices. Then we can approximate ω with the k th-order Whitney form \(\mathcal {V}\mathcal {C}_{k}\omega \). We compute the L2 norm (again using quadrature formulas) of the error \(\lvert \mathcal {V}\mathcal {C}_{k}\omega -\omega \rvert \). The experiments are performed for k ∈{1,…,12} using several test functions ω. All test functions have L2 norm close to one so that the use of absolute error is appropriate. To study convergence properly before running out of machine accuracy, computations are done in quadruple precision.

First, we confirm that our algorithms work as expected using polynomial test functions on a coarse mesh. The mesh has 24 tetrahedra and the maximum edge length is 2.0. Our test functions ωp,j are (where the label j ∈{1,2,3})

$$ \begin{array}{@{}rcl@{}} &&\omega_{0,1}(x,y,z)=0.25, \omega_{0,2}(x,y,z)=\frac{64}{75}x^{2}y^{2}z-\frac{8}{75}z^{5}, \\ &&\omega_{0,3}(x,y,z)=\frac{32}{11}x^{4}y^{4}z^{2}-\frac{1}{176}z^{10}, \omega_{1,1}(x,y,z) = \frac{30}{128}\mathrm{d} x - \frac{10}{128}\mathrm{d} y + \frac{10}{252}\mathrm{d} z,\\ &&\omega_{1,2}(x,y,z)=x^{2}y^{2}z\mathrm{d} x + x^{2}yz^{2}\mathrm{d} y + xy^{2}z^{2}\mathrm{d} z,\\ &&\omega_{1,3}(x,y,z)=\frac{20}{9}(x^{2}y^{4}z^{4}\mathrm{d} x + x^{4}y^{2}z^{4}\mathrm{d} y + x^{4}y^{4}z^{2}\mathrm{d} z),\\ &&\omega_{2,1}(x,y,z)=\frac{30}{128}\mathrm{d} y\wedge \mathrm{d} z -\frac{10}{128}\mathrm{d} z\wedge \mathrm{d} x + \frac{10}{252}\mathrm{d} x\wedge \mathrm{d} y,\\ &&\omega_{2,2}(x,y,z)=x^{2}y^{2}z\mathrm{d} y\wedge \mathrm{d} z + x^{2}yz^{2}\mathrm{d} z\wedge \mathrm{d} x + xy^{2}z^{2}\mathrm{d} x\wedge \mathrm{d} y,\\ &&\omega_{2,3}(x,y,z)=\frac{20}{9}(x^{2}y^{4}z^{4}\mathrm{d} y\wedge \mathrm{d} z + x^{4}y^{2}z^{4}\mathrm{d} z\wedge \mathrm{d} x + x^{4}y^{4}z^{2}\mathrm{d} x\wedge \mathrm{d} y),\\ &&\omega_{3,1}(x,y,z)=0.25\mathrm{d} x\wedge \mathrm{d} y\wedge \mathrm{d} z, \\&&\omega_{3,2}(x,y,z)=\bigg(\frac{64}{75}x^{2}y^{2}z-\frac{8}{75}z^{5}\bigg)\mathrm{d} x\wedge \mathrm{d} y\wedge \mathrm{d} z,\\ &&\omega_{3,3}(x,y,z)=\bigg(\frac{32}{11}x^{4}y^{4}z^{2}-\frac{1}{176}z^{10}\bigg)\mathrm{d} x\wedge \mathrm{d} y\wedge \mathrm{d} z. \end{array} $$

The results are displayed in Table 2. As expected, the approximation becomes exact as soon as the test function is in the space of k th-order Whitney forms.

Table 2 Values of \(\lVert \lvert \mathcal {V}\mathcal {C}_{k}\omega _{p,j}-\omega _{p,j}\rvert \rVert _{L^{2}({\Omega })}\) for polynomial test functions ωp,j

We also study the convergence of the approximations with respect to the maximum edge length h of the initial mesh K. Our test function is the 1-form

$$ \begin{array}{@{}rcl@{}} \omega(x,y,z)=\frac14\bigg(&&\sin(2y)\cos(2z)e^{x^{2}/4}\mathrm{d} x + \sin(2z)\cos(2x)e^{y^{2}/4}\mathrm{d} y \\ &&+ \sin(2x)\cos(2y)e^{z^{2}/4}\mathrm{d} z\bigg). \end{array} $$

We approximate ω using four meshes that have 24, 192, 1536, and 12288 tetrahedra with maximum edge lengths 2.0, 1.0, 0.5, and 0.25 respectively. The results are displayed in Table 3 and illustrated in Fig. 3 (in log–log scale). We conclude that higher order convergence as predicted theoretically by Theorem 5.1 can also be attained in practice with the help of our algorithms.

Table 3 Values of \(\lVert \lvert \mathcal {V}\mathcal {C}_{k}\omega -\omega \rvert \rVert _{L^{2}({\Omega })}\) using four meshes with maximum edge length h
Fig. 3
figure 3

Illustration of the results displayed in Table 3