NGSolve Technical Note 2026-08 \(\bullet\) version 2026-11-23
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
to decide whether an integrand needs the Jacobian \(F\) at all, or only its determinant, or nothing – the basis of reference-element and matrix-free kernels;
to check pairings and spaces for compatibility, for example whether \(\operatorname{div}\) of an \(H(\operatorname{div})\) function and an \(L^2\) function form a commuting pair on curved elements;
to translate between NGSolve and other form languages without per-space tables.
NGSolve now attaches the transformation type to the differential
operators, and shows it in Python as proxy.forms.
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.
| 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:
In two dimensions EDGE and FACET are
both 1-forms, but their vector proxies differ by a rotation: they are
\(H(\operatorname{curl})\) and \(H(\operatorname{div})\). The degree alone
cannot distinguish them.
A type counted from the top is a density: it carries \(J^{-1}\), and its index is a Piola index
instead of a covariant one. The Hodge star swaps bottom and top:
VERTEX \(\leftrightarrow\)
ELEMENT, EDGE \(\leftrightarrow\)
FACET.
On a boundary element the same rules apply with \(d\) the dimension of the element, \(F\) its rectangular Jacobian, \(F^{-T}\) its pseudo-inverse and \(J = \sqrt{\det F^TF}\) its measure.
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.
| 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:
SurfaceL2 with dual_mapping is mapped
like \(\operatorname{div}\) of
HDiv, as a density. The scalar L2 space maps
by the identity, as a function. On curved elements the types [V] and [L]
differ: \(\operatorname{div}
H(\operatorname{div}) \subset L^2\) holds exactly on affine
elements only.
The operator grad of HDiv puts the
derivative index first, [E,F], while Grad of
VectorL2(piola=True) gives [F,E].
Double forms with both factors counted from the top carry \(J^{-2}\): inc of a 2D Regge
field is [L,L], and so would be \(\operatorname{div}\operatorname{div}\) of
HDivDiv.
The mixed transformation of HCurlDiv preserves the
trace, \(\operatorname{tr}(F^{-T}\hat\sigma
F^T) = \operatorname{tr}\hat\sigma\). This is why the deviatoric
stresses of the MCS method [8] stay deviatoric
on every element.
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.
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:
| 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.
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
FORM has the members VERTEX,
EDGE, FACET, ELEMENT,
COMP, each with the properties from_top,
offset (distance of the degree from \(0\) or \(d\)), has_index,
star, and the method degree(dim).
forms is a tuple of FORM values,
forms_detpower the integer power of \(J\), forms_exact tells whether
the transformation holds on curved elements, or only up to terms with
\(\nabla F\). All are None
for operators without types.
Wrapper spaces keep the types of the base space.
VectorValued, H1(dim=...) and
VectorL2 prepend COMP,
MatrixValued prepends two. Components of product spaces
keep their types.
fem/differentialoperator.hpp defines the enum
FORM_TYPE, the struct FormSignature (factors,
the flag exact and the integer detpower) and
the virtual DifferentialOperator::Forms(), which returns
nullopt by default.
A DiffOp class declares its types by a static
member, T_DifferentialOperator forwards it:
static FormSignature Forms() { return { { FORM_EDGE, FORM_FACET }, true }; }The wrappers (Block, BlockTrans,
Vector, Matrix, SymMatrix,
SymDevMatrix, SkewMatrix,
Compound) combine the types of the base operator with their
COMP indices.
VectorDifferentialOperator no longer flattens the
indices of the base operator: VectorValued(HCurlCurl) has
shape \((3,3,3)\), as does
hesse of VectorH1. A contraction of the first
index with the normal vector reads H[n,:,:].
The boundary and surface variants of the dual operators
(dualbnd of HCurlCurl, the duals of the
surface spaces) report no types yet.
grad of HCurlCurl is still flattened to
shape \((3,9)\) and has no
types.
Contracted components (normalcomponent,
nncomponent, the HDiv trace) are products with
the normal vector, not lists of form factors.
The types are not yet propagated through
CoefficientFunction expressions. Doing so would allow to
check pairings, and to choose reference-element kernels
automatically.
J. Schöberl. C++11 implementation of finite elements in NGSolve. ASC Report 30/2014, TU Wien, 2014.
D. N. Arnold, R. S. Falk and R. Winther. Finite element exterior calculus, homological techniques, and applications. Acta Numer. 15:1–155, 2006.
A. Bossavit. Whitney forms: a class of finite elements for three-dimensional computations in electromagnetism. IEE Proc. A 135(8):493–500, 1988.
D. N. Arnold and K. Hu. Complexes from complexes. Found. Comput. Math. 21:1739–1774, 2021.
J. Gopalakrishnan, K. Hu and J. Schöberl. A 2-complex containing Sobolev spaces of matrix fields. arXiv:2507.11869, 2025.
J. Gopalakrishnan, M. Neunteufel, J. Schöberl and M. Wardetzky. Generalizing Riemann curvature to Regge metrics. arXiv:2311.01603, 2023.
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.
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.