Form Types of Proxy Functions
How the values of trial and test functions transform from the reference element

Michael Neunteufel

Kaibo Hu

Jay Gopalakrishnan

Joachim Schöberl

NGSolve Technical Note 2026-08 \(\bullet\)  version 2026-11-23

The problem

A proxy function of NGSolve [1] – a trial function, a test function, or one of their derivatives and traces – knows the shape of its values, but used not to know how these values are obtained from the reference element. This knowledge existed only implicitly, inside the differential operators: \(H(\operatorname{curl})\) shape functions are mapped covariantly, \(H(\operatorname{div})\) shape functions by the Piola transformation, HDivDiv stresses by the double Piola transformation [7], HCurlDiv stresses by a mixed one [8].

The transformation type is useful

NGSolve now attaches the transformation type to the differential operators, and shows it in Python as proxy.forms.

Form types

Let \(F\) be the Jacobian of the element mapping \(\Phi : \hat T \to T\), \(J = \det F\), and let \(\hat u\) be the value on the reference element. The differential forms of degree \(0\), \(1\), \(d-1\) and \(d\) have scalar or vector proxies, which transform as in Table 1 [2, 3]. The essential point is how the degree is counted: VERTEX and EDGE count from the bottom (degree \(0\) and \(1\)), FACET and ELEMENT from the top (degree \(d-1\) and \(d\)). The names are the mesh entities which carry the lowest order (Whitney) degrees of freedom.

Table 1: Form types. COMP is a Cartesian component index, it is not transformed.
type degree counted from transformation index typical space
VERTEX \(0\) bottom \(u = \hat u\) – H1
EDGE \(1\) bottom \(u = F^{-T} \hat u\) yes HCurl
FACET \(d-1\) top \(u = J^{-1} F \hat u\) yes HDiv
ELEMENT \(d\) top \(u = J^{-1} \hat u\) – \(\operatorname{div}\) of HDiv
COMP – – \(u = \hat u\) yes component index of VectorH1

Counting from the bottom or from the top, instead of by the degree, makes the types independent of the dimension:

Tensor-valued proxies

A tensor-valued proxy is described by an ordered list of factors, one form type each. Matrix fields with two form factors are double forms, as in the complexes of [4] and the 2-complex of [5]. Factors of type EDGE, FACET and COMP own one tensor index, VERTEX and ELEMENT own none, so the index-carrying factors match the dimensions of shape. The transformation acts factor by factor: an index factor maps its index by \(F^{-T}\), \(J^{-1}F\) or the identity, every ELEMENT factor contributes another \(J^{-1}\). In addition, a proxy may carry an integer detpower: the value is multiplied by \(J^{\mathrm{detpower}}\). It is \(0\) except for the duals of double forms, see Section 5.

Table 2 lists the types NGSolve reports. Every row is checked by tests/pytest/test_forms.py: the values of all shape functions on an affine element, and on a curved one, are compared with the transformation built from proxy.forms.

Table 2: Factors of the proxies, with V, E, F, L, C for VERTEX, EDGE, FACET, ELEMENT, COMP. A \(^*\) marks forms_exact == False: the transformation holds on affine elements only.
space operator factors
H1, L2 value, grad, hesse [V], [E], [E,E]\(^*\)
HCurl value, curl (3D), curl (2D), grad [E], [F], [L], [E,E]\(^*\)
HDiv value, div, grad [F], [L], [E,F]\(^*\)
VectorL2 value [C,V]
VectorL2(piola=True) value, div [F], [L]
VectorL2(covariant=True) value, curl [E], [F]
SurfaceL2 value; with dual_mapping [V]; [L]
L2 dual [L]
HCurlCurl value, curl, inc (3D), inc (2D) [E,E], [E,F]\(^*\), [F,F]\(^*\), [L,L]\(^*\)
HDivDiv value, div [F,F], [F,L]\(^*\)
HCurlDiv value, div [E,F], [E,L]\(^*\)
VectorH1, H1(dim=3) value, Grad, hesse [C,V], [C,E], [C,E,E]\(^*\)
VectorValued(HCurl) value, curl [C,E], [C,F]
MatrixValued(H1) value, Grad [C,C,V], [C,C,E]
H1, HCurl, HCurlCurl Trace() [V], [E], [E,E]
FacetFESpace, TangentialFacetFESpace Trace() [V], [E]
TangentialFacetFESpace, NormalFacetFESpace value on element facets [E], [F]

Observations:

Operations on form types

Exterior derivative. A derivative acts on one factor and raises its degree by one: \[\begin{array}{ll} \text{3D:} & \texttt{VERTEX} \xrightarrow{\ \operatorname{grad}\ } \texttt{EDGE} \xrightarrow{\ \operatorname{curl}\ } \texttt{FACET} \xrightarrow{\ \operatorname{div}\ } \texttt{ELEMENT}, \\[2pt] \text{2D:} & \texttt{VERTEX} \xrightarrow{\ \operatorname{grad}\ } \texttt{EDGE} \xrightarrow{\ \operatorname{curl}\ } \texttt{ELEMENT}, \qquad \texttt{VERTEX} \xrightarrow{\ \operatorname{rot}\ } \texttt{FACET} \xrightarrow{\ \operatorname{div}\ } \texttt{ELEMENT}. \end{array}\] With tensors, \(\operatorname{inc} = \operatorname{curl}\,(\cdot)\operatorname{curl}^T\) maps [E,E] to [F,F], as in the elasticity complex [4].

Exactness on curved elements. The derivative of a factor is exact if and only if it is an exterior derivative and all other factors are of type COMP or VERTEX, since only then no derivatives of \(F\) appear. Thus Grad of VectorH1 is exact, while grad of HDiv is exact only up to terms with \(\nabla F\). In particular, derivatives of double forms have no algebraic transformation: inc of HCurlCurl and hesse of H1 need the second derivatives of \(\Phi\) on curved elements, and their types describe only the leading term. Across element interfaces these second-order operators are understood in the distributional sense, as in the 2-complex of [5]. For the nonlinear second-order operator on Regge metrics, the Riemann curvature, the generalization of [6] combines the angle defect with jumps of the second fundamental form.

Pairings. In an integral \(\int_T u \cdot v\,dx\) with all indices contracted, an EDGE index contracted with a FACET index, or COMP with COMP, leaves no \(F\): \((F^{-T}\hat u)\cdot(F\hat v) = \hat u\cdot\hat v\). What remains is a power of \(J\): \(-1\) for every factor counted from the top, plus the detpower of \(u\) and \(v\), plus \(1\) from \(dx\). The integral is independent of the geometry if all contractions are of this kind and the total power is \(0\). \(\int \operatorname{div} u\,q\,dx\) with [L] and [V], and \(\int u\cdot e\,dx\) with [F] and [E], are geometry-free. \(\int \sigma : \varepsilon\,dx\) with HDivDiv [F,F] and HCurlCurl [E,E] contracts without \(F\), but leaves \(J^{-1}\). For a kernel: the index types decide whether \(F\) is needed, the count of top factors the power of \(J\).

Traces. The trace keeps the degree. Factors counted from the bottom keep their type: the tangential trace of HCurl is EDGE on the boundary element. A factor counted from the top moves up one step: the normal component of an HDiv function is a density of the boundary element. NGSolve returns the HDiv trace as this density times the unit normal vector; this product is not a list of form factors, and the trace reports no types.

Dual operators

The dual operators provide the functionals of the degrees of freedom, \(\psi(u) = \int_T u \cdot q\,dx\). Interpolation commutes with the pullback if these integrals are geometry-free. For a single form this makes the dual the Hodge star of the primal type.

For a double form, the Hodge star on both factors gives two densities, but the integral has room for only one: the double-sided Piola transformation of the HCurlCurl dual is one volume form off. The commuting duals are therefore the Hodge star on every factor, multiplied by \(J\) once for every factor beyond the first. This extra \(J\) is the detpower of the proxy:

Table 3: Types of the dual operators. All rows are checked on affine tetrahedra. The dual is evaluated on elements of every co-dimension, and the types are relative to that element; the H1, HCurl and HCurlCurl duals are also checked on boundary faces.
space primal dual detpower transformation of the dual
H1, L2 [V] [L] 0 \(J^{-1}\hat q\)
HCurl [E] [F] 0 \(J^{-1}F\hat q\)
HDiv [F] [E] 0 \(F^{-T}\hat q\)
VectorH1 [C,V] [C,L] 0 \(J^{-1}\hat q\)
HCurlCurl [E,E] [F,F] 1 \(J^{-1} F \hat q F^T\)
HDivDiv [F,F] [E,E] 1 \(J F^{-T} \hat q F^{-1}\)
HCurlDiv [E,F] [F,E] 1 \(F \hat q F^{-1}\)

With the counting rule for pairings, \(\int u : q\,dx\) of a primal proxy and its dual has total power \(0\), and all index contractions are EDGE with FACET: the functionals are geometry-free. Since the dual operators contain no derivatives, this holds on curved elements as well.

Python interface

The form types are the enumeration FORM. A proxy reports its factors in forms, in the order of its tensor indices:

u = HCurlCurl(mesh, order=2).TrialFunction()
print (u.shape, u.forms)              # (3, 3) (FORM.EDGE, FORM.EDGE)
v = HDiv(mesh, order=2).TestFunction()
print (div(v).forms)                  # (FORM.ELEMENT,)
w = VectorH1(mesh, order=2).TrialFunction()
print (Grad(w).forms, Grad(w).forms_exact)   # (FORM.COMP, FORM.EDGE) True
print (w.Operator("hesse").forms_exact)      # False
s = HCurlCurl(mesh, order=2).TestFunction().Operator("dual")
print (s.forms, s.forms_detpower)     # (FORM.FACET, FORM.FACET) 1

Implementation

Open points

References

  1. J. Schöberl. C++11 implementation of finite elements in NGSolve. ASC Report 30/2014, TU Wien, 2014.

  2. D. N. Arnold, R. S. Falk and R. Winther. Finite element exterior calculus, homological techniques, and applications. Acta Numer. 15:1–155, 2006.

  3. A. Bossavit. Whitney forms: a class of finite elements for three-dimensional computations in electromagnetism. IEE Proc. A 135(8):493–500, 1988.

  4. D. N. Arnold and K. Hu. Complexes from complexes. Found. Comput. Math. 21:1739–1774, 2021.

  5. J. Gopalakrishnan, K. Hu and J. Schöberl. A 2-complex containing Sobolev spaces of matrix fields. arXiv:2507.11869, 2025.

  6. J. Gopalakrishnan, M. Neunteufel, J. Schöberl and M. Wardetzky. Generalizing Riemann curvature to Regge metrics. arXiv:2311.01603, 2023.

  7. A. Pechstein and J. Schöberl. Tangential-displacement and normal-normal-stress continuous mixed finite elements for elasticity. Math. Models Methods Appl. Sci. 21(8):1761–1782, 2011.

  8. J. Gopalakrishnan, P. L. Lederer and J. Schöberl. A mass conserving mixed stress formulation for the Stokes equations. IMA J. Numer. Anal. 40(3):1838–1874, 2020.