Numerical Analysis via Discrete Exterior Calculus
0. Geometry in computation
Numerical analysis replaces continuous objects with finite ones and controls the error. Derivatives become differences, integrals become sums, differential equations become linear systems. The standard toolkit for making these replacements (finite differences, finite elements, spectral methods) was developed over three centuries. Each tool has its own convergence theorems, stability conditions and failure modes.
Finite differences and low-order finite elements are incomplete versions of a single geometric construction: discrete exterior calculus (DEC). A classical method works when it happens to preserve some fragment of the geometric structure of the continuous problem. It fails when it violates that structure. DEC preserves all of it by construction.
We begin with a failure.
0.1. Poisson equation from physics
Consider a thin metal plate lying flat in the plane . The plate occupies a bounded region , and its edges are kept at fixed temperatures. Heat flows from hot to cold. After a long time the temperature reaches a steady state where nothing changes. What equation governs it?
Two physical facts suffice. The first is Fourier's law: heat flux is proportional to the negative temperature gradient. If is the temperature at position , the heat flux vector is
where is the thermal conductivity (a material property we set to 1 without loss of generality). Heat flows in the direction of steepest descent of the temperature.
The second is conservation of energy: in steady state, the net heat flux out through the boundary of any sub-region equals the total heat generated inside it. For a sub-region with boundary curve , this is
where is the outward unit normal to , is the arc length element along the boundary, is the area element, and is the heat source density (energy generated per unit area per unit time). The symbol denotes a closed line integral: an integral taken along a curve that forms a closed loop (here, the boundary of the sub-region). It is computed like an ordinary line integral, and the circle records that the path returns to its starting point.
The bridge between this integral statement and a pointwise equation is the divergence theorem. We state the theorem first for the plane that contains the plate.
For a smooth vector field on a bounded region with piecewise smooth boundary ,
The left side sums how much the field "spreads out" at each point. The right side is the total outward flow through the boundary curve. In this is Green's theorem in flux form.
Applying the divergence theorem to [eq:conservation] with , and noting that the equation holds for every sub-region we find that the integrand must vanish:
The operator is the Laplacian. Writing for the unknown function gives the Poisson equation:
The derivation generalises to . A flux law, conservation and the divergence theorem produce the Poisson equation in any dimension.
Let be a bounded region in with piecewise smooth boundary , and let be a smooth vector field on . Then
where is the divergence, is the -dimensional volume element on , is the -dimensional surface element on , and is the outward unit normal. The closed integral is taken over the entire boundary, an -dimensional closed surface with no boundary of its own.
The boundary has one dimension less than the region . The theorem relates an integral over the interior to an integral over this boundary.
The general statement [eq:divergence-thm-eq] specialises as follows:
. The region is an interval , whose boundary is the pair of points (a 0-dimensional "surface"). The outward normals are at and at . The theorem reduces to the fundamental theorem of calculus: .
. The boundary is a closed curve (1-dimensional). The volume element is the area element and the surface element is the arc length element . This is the case of the thin plate.
. The boundary is a closed surface (2-dimensional). The theorem is the classical divergence theorem of Gauss: .
The Poisson equation in is then
In the Laplacian is ; in it adds . When (no sources) the equation is Laplace's equation and its solution is a harmonic function.
The Poisson equation governs more than heat conduction. In electrostatics is the electric potential and is the charge density divided by the permittivity. In Newtonian gravity is the gravitational potential and is a multiple of the mass density. In each case a flux law (Fourier, Gauss, Newton) and conservation (divergence theorem) produce [eq:poisson-intro].
0.2. Five-point stencil
To solve [eq:poisson-intro] on a computer we approximate the Laplacian with finitely many operations. The oldest approach is finite differences. Place a uniform rectangular grid over the domain with spacing in both directions. At each interior grid point , approximate the second derivatives using the Taylor expansion:
and similarly for . Adding the two gives the five-point stencil for the discrete Laplacian:

This approximation is accurate: the error between and at each grid point is bounded by a constant times when is smooth.
We write as to mean that there exists a constant (independent of ) such that for all sufficiently small . For instance, means "bounded by a constant times ." The notation states the rate at which a quantity shrinks under refinement: halving the mesh spacing reduces an quantity by a factor of four and an quantity by two. We use it to state convergence rates.
On a square domain with interior grid points per side, the discrete Poisson equation is a sparse linear system of equations in unknowns, solvable in operations via fast methods.
This works on rectangular domains. The trouble begins with other domains.
0.3. Failure on an L-shaped domain
Consider the L-shaped domain formed by removing the upper-right quadrant from the square : . This domain has a re-entrant corner at the origin with interior angle .
The solution of the Laplace equation on this domain (with suitable boundary conditions) is singular at the re-entrant corner. In polar coordinates centred at the origin, with measured counter-clockwise from the edge along the positive -axis, the leading term is
The exponent means the gradient diverges as near the corner. The solution is continuous but not smooth.
Apply the five-point stencil [eq:five-point] to this domain. Two things limit it:
-
Staircase boundary. The L-shape fits a grid whose lines pass through the corner only because its edges are axis-aligned. A rotated L or a curved boundary falls between grid lines, and the discrete domain is then a staircase with an geometric error at every boundary cell.
-
Regularity failure. The five-point stencil's error estimate requires (four continuous derivatives). But the solution has unbounded derivatives at the corner. The stencil is applied at the grid points next to the corner as if were smooth there, and the local error at those points is much larger than .
The computed solution is degraded globally. The convergence rate in the energy norm drops from to roughly and the error spreads over the entire domain. Refining the grid helps much more slowly than the smooth theory predicts.
Domains with corners and curved boundaries are the rule in applications. The L-shaped domain is the simplest example of a universal problem: the rectangular grid imposes a geometry on the computation that may have nothing to do with the geometry of the problem.
What geometric structure does the rectangular grid destroy, and how do we build methods that preserve it? We replace the rectangular grid with a simplicial complex, sampled function values with cochains and the Laplacian with the Hodge Laplacian. We begin with the simplicial complex.
1. Simplicial complexes
The rectangular grid divides a domain into simple geometric pieces. Rectangles are rigid. They cannot conform to curved boundaries without staircase artefacts and they impose coordinate directions that may have nothing to do with the problem. Triangles and their higher-dimensional analogues are flexible: any domain in can be triangulated with a mesh that conforms to the boundary. This section develops the combinatorial machinery for triangulations.
1.1. Simplices
The basic building block generalises the triangle to arbitrary dimension. We first need points in "general position."
A set of points is affinely independent if the vectors are linearly independent. Equivalently no point in the set is an affine combination of the others.
A -simplex is the convex hull of affinely independent points :
The number is the dimension of the simplex.
A 0-simplex is a point. A 1-simplex is a line segment. A 2-simplex is a triangle. A 3-simplex is a tetrahedron. These are the building blocks of all the meshes in this article.
We write the vertices in boldface because they are elements of that act as both points (locations in space) and vectors (objects we add, subtract and scale). This is possible because is a set of points, a vector space (with componentwise addition and scalar multiplication) and a metric space (with the Euclidean distance). The vector from the origin to the point is , and conversely every vector determines a unique point. The expression in the definition of affine independence subtracts two points to obtain a displacement vector.
The identification fails in two settings. On a curved manifold (a sphere, a torus, the surface of an aeroplane wing) the tangent space at a point (where velocity vectors live) differs from the manifold (where points live). Two points on a sphere have no canonical difference vector. On with curvilinear coordinates (polar, cylindrical, spherical) the basis vectors vary with the point and vectors at different points cannot be compared without a connection (parallel transport). In both cases points and vectors are distinct and one needs tangent bundles, connections and covariant derivatives. See Analysis on Manifolds, Part I.
Here we work in with Cartesian coordinates and the identification is safe. We use boldface for vertices (points/vectors in ), plain italic for scalar components of a tangent vector, and for a generic point.
A face of a -simplex is any simplex formed by a non-empty subset of the vertices. A face of dimension (omitting exactly one vertex) is a facet. The -th facet of is
where denotes omission.
1.2. Orientation
The boundary operator needs the two "directions" in which a simplex can be traversed. An edge runs from to or from to . A triangle runs clockwise or counter-clockwise.
An orientation of a -simplex is an equivalence class of orderings of its vertices, where two orderings are equivalent if they differ by an even permutation. Each -simplex with has exactly two orientations. We write for the orientation determined by the given ordering, and for the opposite orientation.
The edge has two orientations: (from to ) and (from to ). The triangle has two orientations: (counter-clockwise if the vertices are arranged that way) and (clockwise). Also (an odd permutation), while (a cyclic, hence even, permutation).
1.3. Simplicial complexes
A simplicial complex is a collection of simplices glued along shared faces and subject to two compatibility conditions that exclude overlaps and dangling pieces.
A simplicial complex in is a finite collection of simplices such that:
- Every face of a simplex in is also in .
- The intersection of any two simplices in is empty or a face of both.
The dimension of is the maximum dimension of any simplex in . The underlying space is the union of all simplices in .
A simplicial complex is a mesh (a triangulation in 2D, a tetrahedral mesh in 3D). The two conditions exclude dangling vertices and overlapping elements and force neighbouring elements to meet along shared faces. Every bounded domain in with piecewise smooth boundary can be triangulated: some simplicial complex has an underlying space approximating the domain to any accuracy.
1.4. Chains and the boundary operator
A -chain on a simplicial complex is a formal linear combination of oriented -simplices in with integer coefficients:
The set of all -chains forms a free abelian group under addition.
A -chain is a formal "sum of oriented -simplices with multiplicities." A single oriented triangle is a 2-chain. Two triangles sharing an edge form a 2-chain. The formal sum is also a 2-chain. Chains are the discrete analogue of oriented submanifolds.
The boundary operator is the linear map defined on each oriented -simplex by
and extended to all chains by linearity.
The boundary of an edge is the difference of its endpoints: . The boundary of a triangle is the sum of its edges with alternating signs: . The signs orient the edges consistently around the triangle: following , then , then traverses the boundary of the triangle.
The central algebraic fact about the boundary operator is the following.
For all , the composition of consecutive boundary operators is the zero map:
Proof
It suffices to check a single oriented -simplex , since is linear. Applying [eq:boundary-op] twice:
where indexes the vertices of the facet with already removed. Each -face (with ) appears exactly twice in this sum: once from removing first (sign , because 's position shifts down by 1 after is removed) and once from removing first (sign ). These two contributions have signs and , which sum to zero. Every term in the double sum cancels and .
The boundary of a boundary is empty. The boundary of a triangle is a closed loop of edges. The boundary of that loop is an alternating sum of endpoints. They cancel pairwise because each vertex is the start of one edge and the end of another. The orientation convention forces this cancellation.
1.5. Boundary matrices
Once the simplices in each dimension are ordered the boundary operator is a matrix. The entry in row (a -simplex) and column (a -simplex) is if appears in with a positive sign, if it appears with a negative sign, and otherwise.
Take 4 vertices on a line connected by 3 edges , , . The boundary matrix is :
The -th column encodes : a at the starting vertex and a at the ending vertex.
Take 4 vertices forming a square with 5 edges and 2 triangles. Label the vertices , , , , the edges , , , , , and the triangles , . The boundary matrices are:
The product is the zero matrix, as [eq:dd-zero] requires.
The identity can be checked by matrix multiplication. It holds for every simplicial complex whatever the number or arrangement of its simplices, since it follows from the algebraic structure of the boundary operator. It expresses a topological invariant (a boundary has no boundary) that no metric or coordinate system can destroy.
2. Cochains and the coboundary operator
Chains represent discrete pieces of a domain: vertices, edges, triangles and their formal combinations. Numerical analysis assigns numbers to these pieces: a temperature at each vertex, a flux across each edge, a charge on each triangle. These assignments are cochains, the discrete analogues of differential forms.
2.1. Cochains
Cochains are dual to chains: chains are formal sums of simplices and cochains are linear functions that evaluate chains to real numbers.
A -cochain on a simplicial complex is a linear map from -chains to real numbers. Equivalently it assigns a real number to each oriented -simplex and changes sign under orientation reversal:
The space of all -cochains is denoted . It is a real vector space of dimension equal to the number of -simplices in .
A 0-cochain assigns a number to each vertex and is a sampled scalar field. Temperature at sensors, voltage at circuit nodes and function values at mesh points are 0-cochains.
A 1-cochain assigns a number to each oriented edge. It is a quantity integrated along a curve: work done by a force field, voltage drop along a wire or mass flux through a gate.
A 2-cochain assigns a number to each oriented triangle. It is a quantity integrated over a surface: magnetic flux through a loop, heat flux through a membrane or charge enclosed by a surface element.
A differential form is integrated over submanifolds of the corresponding dimension: a 0-form is evaluated at a point, a 1-form integrated along a curve and a 2-form integrated over a surface. Cochains assign numbers to the discrete analogues of points, curves and surfaces.
2.2. Coboundary operator
The boundary operator maps -chains to -chains. Its dual the coboundary operator maps -cochains to -cochains and is the discrete analogue of the exterior derivative.
The coboundary operator is defined by
for every -simplex and every -cochain . That is, the coboundary of on equals on the boundary of .
Represent cochains as column vectors with one entry per simplex. Then : the coboundary matrix is the transpose of the boundary matrix. This is the definition of the transpose of a linear map, since .
The composition of consecutive coboundary operators is the zero map:
Proof
This is the dual of [eq:dd-zero]. For any -cochain and any -simplex :
by from [dd-zero]. In matrix form: .
The cochain complex (or discrete de Rham complex) of a simplicial complex is the sequence
where for all . This is the discrete analogue of the de Rham complex of smooth differential forms.
2.3. Finite differences recovered
On a 1D mesh the coboundary operator is the finite difference operator. This is the first classical method to emerge from DEC.
Let be a 1D simplicial complex with vertices at positions , connected by edges . Let be the 0-cochain that samples a function at the vertices: . Then:
On a uniform mesh with spacing this is times the forward finite difference .
Proof
By the definition of the coboundary [eq:coboundary-op]:
The coboundary is the transpose of the boundary. On a 1D mesh the boundary matrix has at the start vertex and at the end vertex of each edge (as in the triangulated interval example of Section 1). Its transpose is a difference operator. The 1D finite difference method is the coboundary operator of the simplicial complex.
The second difference operator (used in the 5-point stencil [eq:five-point] and in 1D second-derivative approximations) is up to sign and a factor : the coboundary composed with its transpose. It is a special case of the Hodge Laplacian of Section 6.
2.4. Interpolation error of the coboundary
How well does the coboundary of a sampled function approximate the integral of the derivative?
Let be , and let be the 0-cochain sampling at the vertices of a 1D mesh with maximum edge length . For each edge of length and midpoint :
The coboundary is the exact integral of the derivative. Read as a pointwise derivative at the midpoint it is accurate to .
Proof
We have and by the fundamental theorem of calculus, which proves the identity.
For the bound apply the midpoint rule to : for some . Divide by .
The coboundary of a 0-cochain has no approximation error. The error enters when the cochain (a number per edge) represents the continuous function (a value at every point). This is the error of the de Rham and Whitney maps (Section 4).
Classical finite differences approximate derivatives with or error depending on the stencil. In DEC the coboundary computes the exact integral of the derivative. The approximation error lies in identifying a cochain (an integrated quantity) with a pointwise quantity (a function value). The Whitney map (Section 4) makes this identification precise and controls the error.
2.5. One-dimensional simple harmonic oscillator
We apply the coboundary operator to an eigenvalue problem. The one-dimensional quantum harmonic oscillator satisfies the time-independent Schrödinger equation:
with boundary conditions as . The exact eigenvalues are for , and the eigenfunctions are Hermite functions.
Discretisation. Take a uniform mesh on with vertices at , . Impose (the wavefunction vanishes at the boundary, a good approximation for large ). The unknowns are the interior values for .
The second derivative is approximated by the coboundary composed with its transpose. With being the coboundary matrix (transpose of the boundary matrix from Section 1), the kinetic energy operator is
the familiar tridiagonal matrix with on the diagonal and on the super- and sub-diagonals. The potential is a diagonal matrix . The discrete Hamiltonian is
The symmetric tridiagonal eigenproblem takes operations and gives the approximate eigenvalues.
Results. With and (), the first five eigenvalues are:
| Exact | Computed | Absolute error | |
|---|---|---|---|
| 0 | 0.5000 | 0.4998 | |
| 1 | 1.5000 | 1.4990 | |
| 2 | 2.5000 | 2.4974 | |
| 3 | 3.5000 | 3.4950 | |
| 4 | 4.5000 | 4.4918 |
The eigenvalue error grows with because higher modes oscillate faster and need finer meshes. It decreases as under refinement, the second-order accuracy of the second-difference stencil .
use nalgebra::{DMatrix, DVector, SymmetricEigen};
fn main() {
// Uniform mesh on [-8, 8]: N + 1 vertices, N edges e_i = [v_i, v_{i+1}]
let n = 200;
let l = 8.0_f64;
let h = 2.0 * l / n as f64;
// Coboundary d0 (N x (N+1)): row i is -1 at v_i and +1 at v_{i+1}
let mut d0 = DMatrix::<f64>::zeros(n, n + 1);
for i in 0..n {
d0[(i, i)] = -1.0;
d0[(i, i + 1)] = 1.0;
}
// Dirichlet conditions: keep the N - 1 interior vertex columns
let d0_int = d0.columns(1, n - 1).into_owned();
let kinetic = d0_int.transpose() * &d0_int * (0.5 / (h * h));
// Potential: diagonal V_ii = x_i^2 / 2 at the interior vertices
let potential = DMatrix::from_diagonal(&DVector::from_fn(n - 1, |i, _| {
let x = -l + (i + 1) as f64 * h;
x * x / 2.0
}));
// Hamiltonian H = T + V and its symmetric eigensolve
let eigen = SymmetricEigen::new(kinetic + potential);
let mut eigenvalues: Vec<f64> = eigen.eigenvalues.iter().copied().collect();
eigenvalues.sort_by(|a, b| a.partial_cmp(b).unwrap());
for (i, &e) in eigenvalues.iter().take(5).enumerate() {
let exact = i as f64 + 0.5;
println!("E_{i} = {e:.6} (exact {exact:.4}, error {:.2e})", (e - exact).abs());
}
}1D SHO in Rust with nalgebra
Python/NumPy comparison
import numpy as np
from scipy.linalg import eigh_tridiagonal
N = 200
L = 8.0
h = 2 * L / N
x = np.linspace(-L + h, L - h, N - 1) # interior vertices
# Tridiagonal Hamiltonian: T + V
diag = 1.0 / h**2 + x**2 / 2 # main diagonal
off = -0.5 / h**2 * np.ones(N - 2) # off-diagonals
eigenvalues, _ = eigh_tridiagonal(diag, off)
exact = np.arange(5) + 0.5
for i in range(5):
err = abs(eigenvalues[i] - exact[i])
print(f"E_{i} = {eigenvalues[i]:.6f} (exact {exact[i]:.4f}, error {err:.2e})")
The Hamiltonian is assembled from the coboundary operator and a diagonal potential matrix. The second-difference stencil arises as , the coboundary composed with its transpose. With the Hodge star this composition is the Hodge Laplacian (Section 6) and the convergence follows from the Whitney interpolation error bounds of Section 4.
3. Differential forms and the exterior derivative
The Whitney map (Section 4) turns cochains into differential forms using the wedge product and the exterior derivative . This section constructs both from multivariable calculus and linear algebra.
3.1. Differential forms
A function assigns a number to each point. A differential form assigns a number to a point together with some tangent vectors at that point. The number of vectors is the degree of the form.
A (smooth) -form on an open set assigns smoothly to each point an alternating multilinear map
where is the tangent space at . Alternating means that swapping two arguments negates the output. Multilinear means that is linear in each argument separately.
In coordinates on , the coordinate differentials are the basic 1-forms. Each reads off the -th component of a tangent vector:
0-forms. A 0-form is a smooth function . It takes no tangent vectors and returns the function value at the point.
1-forms. A 1-form takes one tangent vector and returns a number. In , every 1-form can be written
where are smooth functions. Given a tangent vector , the form evaluates to . This is a dot product with the vector field . Hence 1-forms are sometimes identified with vector fields in .
2-forms. A 2-form takes two tangent vectors and returns a number. In , every 2-form can be written
The wedge product is defined below. A 2-form in has three components and can also be identified with a vector field. This identification depends on the dimension and the metric.
-forms. An -form on takes tangent vectors and returns a number. Every -form is a scalar multiple of and the space of -forms is one-dimensional at each point. An -form is a volume form and measures oriented volume.
Every -form with is zero: any vectors in are linearly dependent and an alternating form vanishes on linearly dependent inputs. The number of linearly independent -forms at each point in is .
3.2. Wedge product
The wedge product builds higher-degree forms from lower-degree ones and is the multiplication of the exterior algebra.
The wedge product (or exterior product) of a -form and a -form is the -form defined by
where the sum runs over all permutations of , and is the sign of the permutation.
The permutation formula [eq:wedge] serves proofs. Computations use the following rules.
The wedge product satisfies:
-
Bilinearity. , and similarly in the second argument. Also for any constant .
-
Associativity. .
-
Graded commutativity. If is a -form and is a -form, then
Hence for all , and for all .
Proof of graded commutativity
Define the permutation that moves the last elements before the first elements: for and for . This permutation is a product of transpositions and has sign . Substituting in the sum [eq:wedge] relabels the arguments and swaps the roles of and with the sign .
Let and be 1-forms in . Using bilinearity, , and :
The components are those of the cross product . The wedge product of two 1-forms in is the cross product of the exterior algebra.
3.3. Exterior derivative
The exterior derivative differentiates differential forms. It combines the gradient, curl and divergence of vector calculus in a single operation.
The exterior derivative is the unique linear operator that takes -forms to -forms and satisfies:
-
On 0-forms. If is a smooth function, then . This is the total differential, the gradient written as a 1-form.
-
Leibniz rule. For a -form and any form ,
- Nilpotency. for every form .
These properties determine uniquely. For a -form summed over increasing multi-indices the exterior derivative is
In with coordinates :
Gradient (d on 0-forms). For a function :
Under the identification of 1-forms with vector fields, this is .
Curl (d on 1-forms). For :
Under the identification of 2-forms with vector fields (via the Hodge star), this is .
Divergence (d on 2-forms). For :
The coefficient is .
The classical identities (curl of gradient is zero) and (divergence of curl is zero) are special cases of . This identity follows from the equality of mixed partial derivatives and underlies the "exactness" results of vector calculus.
Nilpotency gives a cochain complex of smooth forms, the de Rham complex:
where denotes the space of smooth -forms on . It is the continuous analogue of the cochain complex of Section 2.
Proof of
It suffices to show for every smooth function (the general case follows by the Leibniz rule and the fact that every -form is a sum of terms ). We compute:
Since and (equality of mixed partials for smooth functions), the terms with indices and cancel pairwise.
3.4. Integration of forms and Stokes' theorem
A -form is integrated over a -dimensional oriented submanifold to give a number. Stokes' theorem connects integration and differentiation of forms.
Let be a smooth -form and a compact oriented -dimensional manifold with boundary . Then
Every classical integration theorem of vector calculus is a special case of [eq:stokes]:
- : the fundamental theorem of calculus, .
- in : Green's theorem.
- in : the classical Stokes' theorem (relating curl to circulation).
- in : the divergence theorem.
The coboundary of Section 2 is defined by . This is the discrete version of . The coboundary is the discrete exterior derivative and satisfies the discrete Stokes' theorem exactly.
3.5. Integration notation
Multivariable calculus writes double integrals as and triple integrals as . In the language of differential forms these are and .
In with the Euclidean metric the two notations give the same number. The standard volume form on is , and the Lebesgue measure element is . They coincide because the metric tensor is the identity matrix: the Riemannian volume form has .
On a curved manifold or in curvilinear coordinates the distinction matters. The Riemannian volume form has a factor for the stretching of coordinate lines. In polar coordinates , the volume form is , not , because the Jacobian of the coordinate transformation is . The shorthand "" hides this factor.
Wedge notation makes the orientation and metric dependence explicit. Here we write for differential forms and reserve for classical integrals.
4. Whitney forms and discrete-to-continuous
Cochains assign numbers to simplices and differential forms assign numbers to tangent vectors at every point. The de Rham map turns a continuous form into a cochain by integrating over simplices. The Whitney map turns a cochain into a continuous form by interpolation. Together they connect the continuous and discrete worlds and their error controls the accuracy of every DEC computation.
4.1. Barycentric coordinates
The Whitney map needs a coordinate system intrinsic to each simplex. Barycentric coordinates express a point of a simplex as a weighted average of its vertices with weights summing to one.
Let be a -simplex. The barycentric coordinates of a point are the unique real numbers satisfying
Each is an affine function of , equal to 1 at and 0 at all other vertices: .
On a 1-simplex (edge) , the barycentric coordinates are and . These are the linear interpolation weights.
On a 2-simplex (triangle) the coordinate equals the ratio of the area of the triangle (opposite to ) to the area of the full triangle .
The gradients are constant on each simplex (because is affine), and their exterior derivatives are constant 1-forms. These constant 1-forms are the building blocks of Whitney forms.
4.2. Whitney map
The Whitney map interpolates a cochain with barycentric coordinates to give a continuous differential form. The form is piecewise polynomial and smooth on the interior of each simplex.
The Whitney map sends a -cochain to a piecewise smooth -form on the underlying space , defined as follows. For each oriented -simplex , the Whitney -form associated to is
where denotes omission. For a cochain , the Whitney form is
The cases by degree follow.
For , the Whitney form of a 0-cochain is
This is piecewise linear interpolation: the function that equals at each vertex and is linear on each simplex. Whitney 0-forms are the hat functions of classical finite element analysis.
For , the Whitney form associated to an edge is
This is a piecewise smooth 1-form that is nonzero only on simplices containing the edge . It has unit circulation along the edge and zero circulation along all other edges.
For , the Whitney form associated to a triangle is
This 2-form integrates to 1 over and to 0 over all other triangles.
4.3. de Rham map
The Whitney map goes from discrete to continuous. The de Rham map converts a continuous form into a cochain by integrating over each simplex.
The de Rham map sends a smooth -form to the -cochain defined by
for each oriented -simplex . That is, integrate the form over each simplex.
The de Rham map samples a continuous field by integration. For 0-forms (evaluation at the vertex). For 1-forms, (circulation along the edge). For 2-forms, (flux through the triangle). Cochains from the de Rham map are integrals of continuous fields and have geometric meaning.
4.4. Round trip of the de Rham and Whitney maps
The Whitney and de Rham maps are approximate inverses of each other.
For any -cochain ,
The de Rham map composed with the Whitney map is the identity on cochains.
Proof
We show that for every -simplex . By linearity, it suffices to take to be the indicator cochain of a single simplex (equal to 1 on and 0 on all other -simplices). Then and we need . This normalisation follows from the integral of products of barycentric coordinates over simplices:
where is the volume of . The factor in [eq:whitney-map] makes this integral equal 1 when . When , the Whitney form restricts to zero on . Take a vertex of not in . Its barycentric coordinate is identically zero on . Hence also restricts to zero there, and every term of [eq:whitney-map] contains one of the two.
The Whitney map commutes with the exterior derivative and the coboundary: for any -cochain ,
Differentiating the Whitney form equals applying the coboundary to the cochain and then taking the Whitney form.
Proof
By linearity, it suffices to check on the indicator cochain of a single -simplex, relabelled . Both sides are computed on one top-dimensional simplex at a time. If does not contain both sides vanish on by the argument at the end of the previous proof. Suppose and write .
Left side. By the Leibniz rule . Summing the terms gives .
Right side. is the coefficient of in . The -faces of containing are for the vertices of outside , and appears in with coefficient . Expanding [eq:whitney-map] for gives . Sum over and use and (all barycentric coordinates of sum to 1):
In every term of [eq:whitney-map] vanishes except the one that omits , and that term gives . The right side is therefore , which equals the left side.
The following diagram commutes:
The coboundary on cochains is exactly the exterior derivative on Whitney forms. DEC approximates only in the Hodge star (Section 5), which encodes geometry. The coboundary encodes topology.
4.5. Interpolation error
The other composition approximates smooth forms with error controlled by the mesh size.
Let be a smooth -form on a simplicial complex with mesh size (maximum simplex diameter). Then:
where is a constant depending only on the shape regularity of the mesh and the dimension, and is the Sobolev norm of (the form and its first derivatives).
Proof sketch
On each top-dimensional simplex the Whitney form has coefficients of degree at most 1 (affine in the barycentric coordinates), and the span of the Whitney forms on contains every constant -form. Since is the identity ([rw-identity]), the operator reproduces constant -forms. A scaling argument on a reference simplex bounds it on smooth forms with a constant that depends only on the shape regularity of . The Bramble-Hilbert lemma applied to , which vanishes for constant , then gives , where is the diameter of . Squaring and summing over all simplices gives the global bound.
For a smooth function (a 0-form), the Whitney interpolant is the piecewise linear interpolant, and
The extra power of over the general bound arises because Whitney 0-forms are the standard finite elements and reproduce every affine function. Whitney -forms with reproduce only constant forms, and the Bramble-Hilbert lemma then gives one power of .
The Whitney interpolation error theorem contains the classical error estimates. Piecewise linear interpolation error ( in for functions) is the 0-form case. The error of approximating a vector field by its edge circulations (used in edge-based finite elements) is the 1-form case. The error of approximating a flux density by its face integrals (used in face-based finite elements) is the 2-form case. All are controlled by the mesh size and the shape regularity of the simplices.
5. Discrete Hodge star
Simplicial complexes, cochains, the coboundary operator and Whitney forms are topological. None depends on distances, angles or volumes. The coboundary matrix is the same whether the simplices are equilateral or deformed. The identity is combinatorial.
A PDE needs measurement. The Poisson equation [eq:poisson-intro] involves the Laplacian, which depends on the metric (distances and angles). The energy of a heat distribution involves the norm, which integrates against a volume form. The Hodge star introduces the metric into DEC.
5.1. Dual mesh
Every simplicial complex has a dual decomposition of the same domain built from the circumcentres of its simplices. The primal mesh decomposes the domain into simplices (triangles, tetrahedra) and the dual mesh into cells perpendicular to the primal elements. The ratio of dual cell volume to primal simplex volume is the Hodge star.
The circumcentre of a -simplex is the unique point equidistant from all vertices of . For a triangle, this is the centre of the circumscribed circle. For a tetrahedron, it is the centre of the circumscribed sphere.
The circumcentric dual mesh of a simplicial complex is built as follows. For each -simplex in , the dual cell is the -dimensional region formed by connecting the circumcentres of all simplices containing . Specifically:
- The dual of a vertex is the -dimensional region bounded by the perpendicular bisectors of the edges meeting at (a Voronoi cell).
- The dual of an edge is the -dimensional polygon connecting the circumcentres of the triangles (or higher simplices) sharing .
- The dual of a triangle (in 3D) is the edge connecting the circumcentres of the two tetrahedra sharing .
The dual mesh is a Voronoi-like decomposition of the domain. Every primal -simplex has a dual -cell and the two intersect orthogonally because circumcentres are equidistant from vertices. This orthogonality makes the Hodge star diagonal.
5.2. Well-centredness
The dual mesh assumes that circumcentres lie inside their simplices. When this fails (for obtuse triangles) dual cell volumes can become negative and the Hodge star breaks down.
A simplicial complex is well-centred if the circumcentre of every simplex lies in the interior of that simplex.
The circumcentre of a triangle lies outside the triangle when it has an angle greater than . Then dual cell volumes can become negative, the Hodge star matrix has negative entries and the cochain inner product (defined below) is no longer positive definite. Energy estimates, stability analysis and the convergence theory then fail.
In 2D, a Delaunay triangulation of a point set is well-centred if and only if all triangle angles are acute (strictly less than ). Inserting additional vertices (Steiner points) always achieves this. In 3D well-centredness is harder to guarantee and DEC meshing is the construction of well-centred tetrahedral meshes.
Alternatives exist for meshes that are not well-centred (the barycentric dual, the diagonal approximation with absolute values) but they lose the exactness of certain properties. We use well-centred meshes throughout.
5.3. Discrete Hodge star
With the dual mesh the Hodge star is a diagonal matrix of ratios of dual cell volumes to primal simplex volumes.
The discrete Hodge star is the diagonal matrix with entries
where is the -dimensional volume of the primal simplex and is the -dimensional volume of the dual cell .
Take a 2D triangle mesh. The Hodge star on 0-cochains () has diagonal entries equal to the area of the Voronoi cell around each vertex divided by 1 (the "volume" of a 0-simplex). The Hodge star on 1-cochains () has entries equal to the length of the dual edge (connecting circumcentres of adjacent triangles) divided by the length of the primal edge. The Hodge star on 2-cochains () has entries equal to 1 divided by the area of each triangle (the dual of a triangle is a 0-cell, a point, with "volume" 1).
The coboundary operator is determined by the combinatorics of the mesh (which simplices are faces of which). It is unchanged when the vertices move or the simplices stretch. The Hodge star depends on the positions of the vertices, the shapes and sizes of the simplices and the volumes of the dual cells. DEC separates the two: topology is exact and geometry is approximate.
5.4. Cochain inner product
The Hodge star makes the space of cochains an inner product space with norms, energies and adjoint operators. The inner product of two -cochains weights each simplex by the corresponding Hodge star entry.
The discrete inner product on -cochains is
On a well-centred mesh all Hodge star entries are positive and this is an inner product (symmetric, bilinear, positive definite).
The discrete norm of a -cochain is
The discrete seminorm of a 0-cochain is
It is the "energy" of the discrete gradient, analogous to the continuous .
5.5. Convergence of the Hodge star
On a family of well-centred meshes with mesh size and uniformly bounded shape regularity, the discrete Hodge star converges to the smooth Hodge star: for any smooth -form
where is the de Rham map [eq:derham-map] and is the smooth Hodge star.
Proof sketch
On each simplex the discrete Hodge star approximates the smooth Hodge star by volume ratios. The smooth Hodge star of a constant -form on a simplex is plus corrections from the variation of the form across the simplex. These are because the form varies by at most across a simplex of diameter . Summing over all simplices with the quasi-uniformity of the mesh gives the global bound. Well-centredness makes the volume ratios positive and bounded.
The coboundary is exact. The Whitney map introduces interpolation error and the Hodge star introduces metric error. The total error is the sum of these two. The solution is in the norm and in the norm by a duality argument.
5.6. Two-dimensional simple harmonic oscillator
We extend the 1D computation of Section 2 to two dimensions. The 2D quantum harmonic oscillator satisfies
with exact eigenvalues and degeneracies: (non-degenerate), (doubly degenerate), (triply degenerate), and so on.
Discretisation. Triangulate the square with a Delaunay mesh. The Hodge Laplacian on 0-forms (defined in Section 6) is
which approximates . With the diagonal matrix the discrete Hamiltonian is . Multiplying by gives the symmetric generalised eigenproblem with .
Results. With and a Delaunay triangulation of a grid (2500 interior vertices), the first six eigenvalues are:
| Level | Exact | Degeneracy | Computed (mean) | Relative error |
|---|---|---|---|---|
| 1.000 | 1 | 0.9958 | ||
| 2.000 | 2 | 1.9885 | ||
| 3.000 | 3 | 2.9747 |
The degeneracies are reproduced to within the discretisation error: the two eigenvalues near differ by and the three near spread over . The splitting comes from the diagonals of the triangulation, which break the rotational symmetry of the problem. On a log-log plot of eigenvalue error against the slope is approximately 2, the predicted rate.
The Rust listings in this section and the following ones are pseudocode. The mesh type and the helpers it calls (delaunay_triangulate_square, restrict_to_interior, sparse_generalised_eigsh and the rest) stand for a Delaunay mesher, a Dirichlet restriction and a sparse generalised eigensolver. No published crate exports them under these names. The Python listing under each one runs as printed and produced the numbers in the text.
// Pseudocode: the mesh type and its helpers are placeholders.
// Delaunay triangulation of [-6, 6]^2 with ~2500 interior vertices
let mesh = delaunay_triangulate_square(-6.0, 6.0, 50);
// DEC operators
let d0 = mesh.coboundary_matrix(0); // edges x vertices
let star0 = mesh.hodge_star(0); // diagonal, vertices
let star1 = mesh.hodge_star(1); // diagonal, edges
// Stiffness matrix: A = d0^T * star1 * d0 (so L0 = star0_inv * A)
let star1_d0 = &star1 * &d0;
let stiffness = &d0.transpose() * &star1_d0;
// Potential: V_ii = (x_i^2 + y_i^2) / 2
let potential = mesh.vertex_diagonal(|v| (v.x * v.x + v.y * v.y) / 2.0);
// Generalised eigenproblem: (0.5 * A + star0 * V) psi = E * star0 * psi
let (h_int, star0_int) = mesh.restrict_to_interior(
&(0.5 * &stiffness + &(&star0 * &potential)),
&star0,
);
let eigenvalues = sparse_generalised_eigsh(&h_int, &star0_int, 6);
for (i, &e) in eigenvalues.iter().enumerate() {
println!("E_{i} = {e:.4}");
}2D SHO in Rust (pseudocode)
Python/NumPy comparison
import numpy as np
from scipy.spatial import Delaunay
from scipy.sparse import lil_matrix, diags, csr_matrix
from scipy.sparse.linalg import eigsh
# --- Grid and Delaunay triangulation ---
n_side = 52
L = 6.0
x = np.linspace(-L, L, n_side)
xx, yy = np.meshgrid(x, x)
points = np.column_stack([xx.ravel(), yy.ravel()])
tri = Delaunay(points)
n_verts = len(points)
# --- Build DEC operators from triangle geometry ---
# Collect unique oriented edges
edge_map = {}
for simplex in tri.simplices:
for i in range(3):
e = tuple(sorted((simplex[i], simplex[(i + 1) % 3])))
if e not in edge_map:
edge_map[e] = len(edge_map)
n_edges = len(edge_map)
# d0: coboundary operator (n_edges x n_verts)
d0 = lil_matrix((n_edges, n_verts))
for (v0, v1), idx in edge_map.items():
d0[idx, v0] = -1
d0[idx, v1] = 1
d0 = csr_matrix(d0)
# Hodge stars: circumcentric star1, barycentric (lumped) star0
star0 = np.zeros(n_verts) # barycentric dual areas (one third of each triangle)
star1 = np.zeros(n_edges) # dual-edge / primal-edge length ratios
for simplex in tri.simplices:
i, j, k = simplex
pi, pj, pk = points[i], points[j], points[k]
area = 0.5 * abs((pj - pi)[0] * (pk - pi)[1] - (pj - pi)[1] * (pk - pi)[0])
# Circumcentre
D = 2 * (pi[0] * (pj[1] - pk[1]) + pj[0] * (pk[1] - pi[1])
+ pk[0] * (pi[1] - pj[1]))
if abs(D) < 1e-14:
cc = (pi + pj + pk) / 3
else:
ux = ((pi @ pi) * (pj[1] - pk[1]) + (pj @ pj) * (pk[1] - pi[1])
+ (pk @ pk) * (pi[1] - pj[1])) / D
uy = ((pi @ pi) * (pk[0] - pj[0]) + (pj @ pj) * (pi[0] - pk[0])
+ (pk @ pk) * (pj[0] - pi[0])) / D
cc = np.array([ux, uy])
for v in [i, j, k]:
star0[v] += area / 3
for (v0, v1) in [(i,j), (j,k), (i,k)]:
ek = tuple(sorted((v0, v1)))
eidx = edge_map[ek]
mid = 0.5 * (points[v0] + points[v1])
star1[eidx] += np.linalg.norm(cc - mid) / np.linalg.norm(points[v1] - points[v0])
# --- Assemble Hamiltonian ---
S1 = diags(star1)
Lap = d0.T @ S1 @ d0 # stiffness matrix
V = 0.5 * (points[:, 0]**2 + points[:, 1]**2)
S0 = diags(star0)
H = 0.5 * Lap + S0 @ diags(V)
# --- Restrict to interior vertices ---
edge_count = {}
for simplex in tri.simplices:
for i in range(3):
e = tuple(sorted((simplex[i], simplex[(i + 1) % 3])))
edge_count[e] = edge_count.get(e, 0) + 1
bnd = sorted({v for (v0, v1), c in edge_count.items() if c == 1 for v in (v0, v1)})
int_mask = np.ones(n_verts, dtype=bool)
int_mask[bnd] = False
int_idx = np.where(int_mask)[0]
H_int = csr_matrix(H.toarray()[np.ix_(int_idx, int_idx)])
S0_int = diags(star0[int_idx])
# --- Solve generalised eigenproblem ---
eigenvalues, _ = eigsh(H_int, k=6, M=S0_int, sigma=0, which='LM')
eigenvalues.sort()
exact = sorted(i + j + 1.0 for i in range(4) for j in range(4))[:6]
for i in range(6):
err = abs(eigenvalues[i] - exact[i])
print(f"E_{i} = {eigenvalues[i]:.4f} (exact {exact[i]:.1f}, error {err:.2e})")
In 1D the Hodge star on a uniform mesh is a scalar multiple of the identity and drops out of the eigenvalue problem. In 2D it is a diagonal matrix that encodes the local mesh geometry. Its entries (dual-length-to-primal-length ratios for and dual cell areas for ) vary across an unstructured mesh and affect both eigenvalues and eigenfunctions. Even on the grid used here is not a multiple of the identity: it is 1 on axis-aligned edges and 0 on the diagonals (Section 6.1).
6. Discrete Laplacian and Poisson's equation
We assemble the operators of the preceding sections into the discrete Laplacian. It discretises the Poisson equation [eq:poisson-intro] on arbitrary domains. These include the L-shaped domain where the five-point stencil failed.
6.1. Hodge Laplacian
The smooth Laplacian on functions (0-forms) is : apply the exterior derivative, the Hodge star, the exterior derivative again and the Hodge star once more. The general Hodge Laplacian on -forms has a further term from the codifferential , which vanishes on 0-forms. We treat 0-forms first.
The discrete Hodge Laplacian on 0-cochains is the linear operator
where is the coboundary, is the Hodge star on 1-cochains, and is the Hodge star on 0-cochains.
Each factor has a geometric role. The coboundary computes differences along edges (the discrete gradient). The Hodge star converts these differences into dual-edge fluxes weighted by the ratio of dual-edge length to primal-edge length. The transpose sums the incoming fluxes at each vertex (minus the discrete divergence). The inverse Hodge star normalises by the Voronoi cell area at each vertex. The composition is minus the discrete divergence of the discrete gradient. It approximates and is positive semidefinite.
On a uniform rectangular grid with spacing the Delaunay triangulation has right isosceles triangles. Each circumcentre is the midpoint of a hypotenuse. Then for every axis-aligned edge (the dual edge joins the centres of two grid squares and has the length of the primal edge), for every diagonal edge (both circumcentres sit at its midpoint) and for every interior vertex (the Voronoi cell is a square of side ). Substituting into [eq:hodge-laplacian] gives , the negative of the five-point stencil [eq:five-point], with the factor from . The five-point stencil is the Hodge Laplacian on a uniform Cartesian mesh.
The Hodge Laplacian on -cochains is
or equivalently , where is the discrete codifferential. It is the adjoint of for the cochain inner products of Section 5.4. For the second term vanishes (there is no ) and this is [eq:hodge-laplacian].
6.2. Discrete Poisson equation
Given a 0-cochain (the source) the discrete Poisson equation seeks a 0-cochain with
and boundary conditions. For Dirichlet conditions ( prescribed on boundary vertices) we partition the vertices into interior and boundary sets, restrict [eq:discrete-poisson] to interior vertices and move the known boundary values to the right-hand side. Multiplied by the system reads . Its matrix is sparse, symmetric and positive definite on the interior by well-centredness, and a sparse Cholesky factorisation or conjugate gradient iteration solves it.
Let be a bounded domain with Lipschitz boundary, and let be a family of well-centred simplicial complexes triangulating with mesh size and uniformly bounded shape regularity. Let be the smooth solution of with Dirichlet boundary conditions, and let be the solution of the discrete Poisson equation [eq:discrete-poisson] on . Then:
where is the Whitney map.
Proof sketch
The proof has three ingredients.
-
Relation to finite elements. In 2D the matrix with circumcentric equals the stiffness matrix of the Whitney 0-forms (the cotangent formula). The DEC equation is then the Galerkin method with the load vector computed by the lumped mass . In 3D the circumcentric differs from the stiffness weights and the comparison adds a consistency term.
-
Best approximation. Coercivity of the bilinear form (positive on a well-centred mesh) and Strang's first lemma bound the error by the best approximation plus the consistency errors of the lumped load (and, in 3D, of the stiffness): .
-
Interpolation error. The Whitney interpolation error theorem ([whitney-error]) gives . This is the estimate in . The Aubin-Nitsche duality argument gives in .
6.3. L-shaped domain revisited
Return to the L-shaped domain from Section 0. The solution of the Laplace equation is singular at the re-entrant corner: , with measured from the edge along the positive -axis.
On a uniform mesh the singularity limits every method. The five-point stencil converges at in the energy norm and in (the Aubin-Nitsche duality argument). The DEC Laplacian on the uniform right-triangle mesh is the five-point stencil (Section 6.1) and has the same rates. A triangulation can be refined near the corner. On a mesh graded towards the corner, with element size of order at distance for some , the DEC solution recovers the smooth-domain rates in and in .
The simplicial complex conforms exactly to the re-entrant corner with no staircase approximation. The graded mesh resolves the singularity without wasting degrees of freedom in the smooth interior. The Hodge Laplacian on this mesh keeps its structural properties (symmetry, positive definiteness, exactness of the coboundary) whatever the domain geometry.
// Pseudocode: the mesh type and its helpers are placeholders.
// L-shaped domain vertices (counter-clockwise)
let boundary = vec![
(-1.0, -1.0), (1.0, -1.0), (1.0, 0.0),
(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0),
];
// Graded Delaunay triangulation: refine near the re-entrant corner (0,0)
let mesh = delaunay_triangulate_polygon(&boundary, |x, y| {
let r = (x * x + y * y).sqrt().max(0.01);
0.02 + 0.15 * r // element size grows with distance from corner
});
// DEC operators
let d0 = mesh.coboundary_matrix(0);
let star1 = mesh.hodge_star(1);
// Stiffness A = d0^T * star1 * d0 is symmetric positive semidefinite.
// L0 = star0_inv * A is not symmetric, so Cholesky takes A:
// L0 u = f is equivalent to A u = star0 f.
let stiffness = &d0.transpose() * &(&star1 * &d0);
// RHS: f = 0 (Laplace equation), so star0 f = 0
// Boundary: u(r, theta) = r^(2/3) sin(2*theta/3), theta measured from the +y edge
// Restrict A to interior vertices and move the boundary values to the RHS
let (a_int, rhs) = mesh.apply_dirichlet(&stiffness, |x, y| {
let r = (x * x + y * y).sqrt();
let theta = (y.atan2(x) - std::f64::consts::FRAC_PI_2).rem_euclid(2.0 * std::f64::consts::PI);
r.powf(2.0 / 3.0) * (2.0 * theta / 3.0).sin()
});
// Solve: sparse Cholesky of the symmetric positive definite interior block
let u_h = sparse_cholesky_solve(&a_int, &rhs);
// Compute L2 error against exact solution
let l2_err = mesh.l2_error(&u_h, |x, y| {
let r = (x * x + y * y).sqrt();
let theta = (y.atan2(x) - std::f64::consts::FRAC_PI_2).rem_euclid(2.0 * std::f64::consts::PI);
r.powf(2.0 / 3.0) * (2.0 * theta / 3.0).sin()
});
println!("L2 error: {l2_err:.4e}");Poisson on the L-shaped domain in Rust (pseudocode)
Python/NumPy comparison
import numpy as np
from scipy.spatial import Delaunay
from scipy.sparse import lil_matrix, diags, csr_matrix
from scipy.sparse.linalg import spsolve
def build_dec_2d(points, simplices):
"""Build d0, star0, star1 from a 2D triangulation."""
n_v = len(points)
edge_map = {}
for s in simplices:
for i in range(3):
e = tuple(sorted((s[i], s[(i+1)%3])))
if e not in edge_map:
edge_map[e] = len(edge_map)
n_e = len(edge_map)
d0 = lil_matrix((n_e, n_v))
for (v0, v1), idx in edge_map.items():
d0[idx, v0] = -1; d0[idx, v1] = 1
d0 = csr_matrix(d0)
star0 = np.zeros(n_v); star1 = np.zeros(n_e)
for s in simplices:
i, j, k = s; pi, pj, pk = points[i], points[j], points[k]
area = 0.5 * abs((pj - pi)[0] * (pk - pi)[1] - (pj - pi)[1] * (pk - pi)[0])
D = 2*(pi[0]*(pj[1]-pk[1]) + pj[0]*(pk[1]-pi[1]) + pk[0]*(pi[1]-pj[1]))
cc = (pi+pj+pk)/3 if abs(D)<1e-14 else np.array([
((pi@pi)*(pj[1]-pk[1])+(pj@pj)*(pk[1]-pi[1])+(pk@pk)*(pi[1]-pj[1]))/D,
((pi@pi)*(pk[0]-pj[0])+(pj@pj)*(pi[0]-pk[0])+(pk@pk)*(pj[0]-pi[0]))/D])
for v in [i,j,k]: star0[v] += area/3
for (v0,v1) in [(i,j),(j,k),(i,k)]:
ek = tuple(sorted((v0,v1))); eidx = edge_map[ek]
mid = 0.5*(points[v0]+points[v1])
star1[eidx] += np.linalg.norm(cc-mid)/np.linalg.norm(points[v1]-points[v0])
return d0, star0, star1
def l_shaped_exact(x, y):
# theta in [0, 3*pi/2], measured from the edge on the positive y-axis
r = np.sqrt(x**2 + y**2)
theta = np.mod(np.arctan2(y, x) - np.pi/2, 2*np.pi)
return r**(2/3) * np.sin(2*theta/3)
def l_shaped_points(n, graded=False):
"""Grid points in [-1,1]^2 \\ (0,1]^2 (n odd, so the corner is a vertex)."""
t = np.linspace(0, 1, (n + 1) // 2)
if graded:
t = t**2 # cluster grid lines at the corner
v = np.unique(np.concatenate([-t, t]))
xx, yy = np.meshgrid(v, v)
pts = np.column_stack([xx.ravel(), yy.ravel()])
return pts[~((pts[:,0] > 1e-10) & (pts[:,1] > 1e-10))]
def solve_l(n, graded=False):
pts = l_shaped_points(n, graded)
tri = Delaunay(pts)
# Delaunay meshes the convex hull: drop the triangles over the notch
c = pts[tri.simplices].mean(axis=1)
simplices = tri.simplices[~((c[:,0] > 0) & (c[:,1] > 0))]
d0, star0, star1 = build_dec_2d(pts, simplices)
n_v = len(pts)
L = d0.T @ diags(star1) @ d0
# Boundary vertices
ec = {}
for s in simplices:
for i in range(3):
e = tuple(sorted((s[i], s[(i+1)%3]))); ec[e] = ec.get(e,0)+1
bnd = sorted({v for (v0,v1),c in ec.items() if c==1 for v in (v0,v1)})
mask = np.ones(n_v, bool); mask[bnd] = False; ii = np.where(mask)[0]
u_ex = l_shaped_exact(pts[:,0], pts[:,1])
Ld = L.toarray()
rhs = -Ld[np.ix_(ii, bnd)] @ u_ex[bnd]
u_int = spsolve(csr_matrix(Ld[np.ix_(ii,ii)]), rhs)
u_h = u_ex.copy(); u_h[ii] = u_int
return 2.0/(n - 1), np.sqrt(np.sum(star0 * (u_h - u_ex)**2))
for label, graded in [("Uniform", False), ("Graded", True)]:
print(f"\n{label} mesh:")
for n in [21, 41, 61, 81, 121]:
h, err = solve_l(n, graded)
print(f" h = {h:.4f}, L2 error = {err:.4e}")

Singularities in elliptic PDE solutions come from geometric features of the domain (corners, edges, changes in boundary conditions) and their severity is set by the local geometry (the interior angle at a corner, the opening angle of a crack). A mesh that concentrates elements where the solution varies rapidly recovers the optimal convergence rate. The Hodge Laplacian on any well-centred mesh satisfies the discrete maximum principle and the energy estimates however the elements are distributed.
7. Parabolic problems and the heat equation
The Poisson equation is elliptic and describes a steady state. The heat equation adds time and asks how the temperature evolves from an initial distribution. Its DEC discretisation follows from the Hodge Laplacian.
7.1. Continuous heat equation
The heat equation on a domain is
with initial condition and boundary conditions (Dirichlet, Neumann, or mixed) on . The solution describes how an initial temperature diffuses. Heat flows from hot to cold at a rate proportional to the Laplacian, which measures the deviation of from its local average.
7.2. Semidiscrete system
Replacing the spatial Laplacian with the Hodge Laplacian [eq:hodge-laplacian] and leaving time continuous gives the semidiscrete heat equation, a system of ODEs for the cochain :
The mass matrix weights each vertex by its Voronoi cell. On a uniform 1D mesh and the system is the method of lines for the heat equation.
7.3. Time integration
We discretise the time derivative of [eq:semidiscrete-heat]. Let be the time step and .
Forward Euler (explicit). This is
which gives . Each step is one matrix-vector multiply. The method is conditionally stable: the time step must satisfy for a mesh-dependent constant or the solution blows up.
Backward Euler (implicit). Evaluating the right-hand side at time level gives
Each step solves a sparse linear system. The method is unconditionally stable: any time step gives a bounded solution. The matrix on the left is symmetric positive definite by well-centredness. One sparse Cholesky factorisation reused at every step brings the work per step close to that of the explicit method.
Crank-Nicolson (trapezoidal). Averaging forward and backward Euler gives
This is unconditionally stable and second-order accurate in time (error ) where forward and backward Euler are first-order ().
Under the hypotheses of [poisson-convergence], the backward Euler DEC solution of the heat equation with time step satisfies
For Crank-Nicolson, the temporal error improves to .
7.4. Heat diffusion on a disk
Take the heat equation on the unit disk with homogeneous Dirichlet boundary conditions ( on ) and initial condition . The exact solution is a sum of Bessel functions and the temperature decays exponentially to zero as heat escapes through the boundary.
The maximum of sits at the centre, where the exact solution is with the positive zeros of . On a Delaunay triangulation of the disk with 1027 interior vertices (19 rings of points, all angles acute), backward Euler with gives the following decay of the maximum temperature:
| Time | Exact | DEC | Relative error |
|---|---|---|---|
| 0.00 | 1.0000 | 1.0000 | |
| 0.05 | 0.8004 | 0.8007 | |
| 0.10 | 0.6148 | 0.6161 | |
| 0.20 | 0.3482 | 0.3500 | |
| 0.50 | 0.0615 | 0.0623 |
The solution stays positive (the discrete maximum principle) and decreases monotonically as in the continuous problem. The spatial error () dominates at early times and the temporal error () at late times.
// Pseudocode: the mesh type and its helpers are placeholders.
// Delaunay triangulation of the unit disk, ~1000 interior vertices
let mesh = delaunay_triangulate_disk(1.0, 0.05);
let d0 = mesh.coboundary_matrix(0);
let star0 = mesh.hodge_star(0);
let star1 = mesh.hodge_star(1);
// Stiffness matrix: A = d0^T * star1 * d0
let stiffness = &d0.transpose() * &(&star1 * &d0);
// Backward Euler: (star0 + dt * A) u^{n+1} = star0 * u^n
// The matrix is symmetric positive definite; restrict it to interior vertices
let dt = 0.001;
let lhs = &star0 + &(&stiffness * dt);
let (lhs_int, star0_int) = mesh.restrict_to_interior(&lhs, &star0);
let chol = sparse_cholesky(&lhs_int); // factor once, reuse
// Initial condition: u0 = 1 - x^2 - y^2, restricted to interior
let mut u = mesh.interior_cochain(|v| 1.0 - v.x * v.x - v.y * v.y);
for step in 0..500 {
let rhs = &star0_int * &u;
u = chol.solve(&rhs); // reuse factorisation
if step % 50 == 49 {
let t = (step + 1) as f64 * dt;
println!("t = {t:.2}, max u = {:.4}", u.max());
}
}Heat equation on a disk in Rust (pseudocode)
Python/NumPy comparison
import numpy as np
from scipy.spatial import Delaunay
from scipy.sparse import lil_matrix, diags, csr_matrix
from scipy.sparse.linalg import splu
# --- Mesh: concentric rings in the unit disk ---
pts = [[0.0, 0.0]]
n_rad = 19
for i in range(1, n_rad + 1):
r = i / n_rad
nt = 6 * i # 6i points on ring i: near-equilateral triangles
for j in range(nt):
theta = 2 * np.pi * j / nt
pts.append([r * np.cos(theta), r * np.sin(theta)])
points = np.array(pts)
tri = Delaunay(points)
n_v = len(points)
# --- DEC assembly (same helper as previous cells) ---
edge_map = {}
for s in tri.simplices:
for i in range(3):
e = tuple(sorted((s[i], s[(i+1)%3])))
if e not in edge_map: edge_map[e] = len(edge_map)
n_e = len(edge_map)
d0 = lil_matrix((n_e, n_v))
for (v0, v1), idx in edge_map.items():
d0[idx, v0] = -1; d0[idx, v1] = 1
d0 = csr_matrix(d0)
star0 = np.zeros(n_v); star1 = np.zeros(n_e)
for s in tri.simplices:
i, j, k = s; pi, pj, pk = points[i], points[j], points[k]
area = 0.5 * abs((pj - pi)[0] * (pk - pi)[1] - (pj - pi)[1] * (pk - pi)[0])
D = 2*(pi[0]*(pj[1]-pk[1]) + pj[0]*(pk[1]-pi[1]) + pk[0]*(pi[1]-pj[1]))
cc = (pi+pj+pk)/3 if abs(D)<1e-14 else np.array([
((pi@pi)*(pj[1]-pk[1])+(pj@pj)*(pk[1]-pi[1])+(pk@pk)*(pi[1]-pj[1]))/D,
((pi@pi)*(pk[0]-pj[0])+(pj@pj)*(pi[0]-pk[0])+(pk@pk)*(pj[0]-pi[0]))/D])
for v in [i,j,k]: star0[v] += area/3
for (v0,v1) in [(i,j),(j,k),(i,k)]:
ek = tuple(sorted((v0,v1))); eidx = edge_map[ek]
mid = 0.5*(points[v0]+points[v1])
star1[eidx] += np.linalg.norm(cc-mid)/np.linalg.norm(points[v1]-points[v0])
# --- Stiffness and boundary restriction ---
A = d0.T @ diags(star1) @ d0
ec = {}
for s in tri.simplices:
for i in range(3):
e = tuple(sorted((s[i], s[(i+1)%3]))); ec[e] = ec.get(e,0)+1
bnd = sorted({v for (v0,v1),c in ec.items() if c==1 for v in (v0,v1)})
mask = np.ones(n_v, bool); mask[bnd] = False
int_idx = np.where(mask)[0]
S0_int = diags(star0[int_idx])
A_int = csr_matrix(A.toarray()[np.ix_(int_idx, int_idx)])
# --- Backward Euler time stepping ---
dt = 0.001
lhs = S0_int + dt * A_int
lu = splu(lhs.tocsc())
u = 1.0 - points[int_idx, 0]**2 - points[int_idx, 1]**2
for step in range(500):
u = lu.solve(S0_int @ u)
if (step + 1) % 50 == 0:
print(f"t = {(step+1)*dt:.3f}, max u = {u.max():.4f}")
8. Maxwell's equations and computational electromagnetics
The Poisson and heat equations involve only 0-forms (scalar fields). Maxwell's equations need the full de Rham complex: the electric field is a 1-form, the magnetic field a 2-form and charge density a 3-form, related by the exterior derivative and the Hodge star. DEC discretises them with the operators already built, and enforces the constraint equations (Gauss's laws) at the discrete level.
8.1. Maxwell's equations in differential forms
On 4-dimensional spacetime (a 3-dimensional domain times a time interval) Maxwell's equations in differential forms are
where is the electromagnetic 2-form (the Faraday tensor), is its Hodge dual, and is the current 3-form. In components on (separating electric and magnetic fields) these are the four familiar equations:
| Differential form | Classical form | Name |
|---|---|---|
| Faraday's law | ||
| No magnetic monopoles | ||
| Gauss's law | ||
| Ampère-Maxwell |
The equation (no magnetic monopoles) and (Faraday) are topological: they involve only the exterior derivative and hold on any manifold with any metric. The equations involving are metric-dependent: the Hodge star encodes the constitutive relations of the medium (permittivity, permeability).
If at time and evolves by then for all time by : . The same holds for Gauss's law. In DEC the discrete identity preserves the discrete constraints exactly at every time step with no drift. Discretisations without this structure enforce them by projection steps or divergence cleaning. The Yee scheme is the classical finite-difference exception: it is DEC on a staggered Cartesian mesh (Section 11).
8.2. DEC discretisation
DEC assigns each field to a cochain degree:
| Field | Continuous | Discrete | Stored on |
|---|---|---|---|
| Electric potential | 0-form | 0-cochain | vertices |
| Electric field | 1-form | 1-cochain | edges |
| Magnetic flux | 2-form | 2-cochain | triangles |
| Charge density | 3-form | 3-cochain | tetrahedra |
Faraday's law becomes and is exact because the coboundary is the transpose of the boundary. Gauss's law for magnetism becomes and is satisfied automatically by if for some 1-cochain (the vector potential). The constitutive relations (, ) are encoded in the Hodge star, which contains the material parameters.
8.3. Electrostatics of a biological cell
Take the electrostatic potential inside a spherical biological cell of radius , a dielectric sphere with permittivity in a medium with permittivity . A point charge at inside the cell creates a potential satisfying the Poisson equation , with continuity conditions at the membrane.
In DEC the variable permittivity enters through the Hodge star: is multiplied by the average of over the dual cell of the edge. The discrete Poisson equation is
where is the material Hodge star and is the discrete charge distribution (a 0-cochain that is nonzero only at the vertex closest to ).
On a tetrahedral mesh of the cell with approximately 5000 interior vertices and a refined layer near the membrane (where the permittivity jumps), the DEC solution captures the image charge effects of the dielectric mismatch. When the image charge has the sign of , and the potential inside the cell exceeds the Coulomb potential of an unbounded medium of permittivity . When it falls below.
DEC encodes material properties in the Hodge star and leaves the coboundary and the mesh topology unchanged. Finite-difference methods treat a permittivity jump specially at the interface (staircase approximation, immersed boundary corrections). In DEC the interface changes the diagonal entries of . The coboundary still satisfies , Gauss's law is still enforced and the convergence theory applies with the material Hodge star in place of the geometric one.
9. Elliptic eigenvalue problems and atomic orbitals
Sections 2 and 5 solved the Schrödinger equation in 1D and 2D with a harmonic potential. This section computes the energy levels and orbitals of the hydrogen atom in 3D with a Coulomb potential. The Hodge Laplacian discretises the kinetic energy and the potential is a diagonal 0-cochain. The atomic orbitals solve the resulting generalised sparse eigenproblem.
9.1. Hydrogen atom
The time-independent Schrödinger equation for the hydrogen atom (in atomic units, ) is
on , with as . The exact eigenvalues are for , with degeneracy . The eigenfunctions (orbitals) are products of radial functions and spherical harmonics: , , , and so on.
9.2. DEC discretisation in 3D
We truncate to the cube with Bohr radii and impose on its faces. The mesh starts from a tensor-product grid with 40 nodes in each direction at , where the are uniformly spaced in and . The spacing is 0.31 at the origin, where the Coulomb singularity needs resolution, and 2.9 at the faces. With an even node count the origin is the centre of a box and the potential is finite at every vertex. Each box is split into the six tetrahedra that share its main diagonal (the Kuhn subdivision).
The discrete Hamiltonian is
where is the 3D Hodge Laplacian on 0-forms [eq:hodge-laplacian] built with the vertex-to-edge coboundary, the ratio of circumcentric dual-face area to edge length and the circumcentric (Voronoi) dual volumes. Multiplying by gives and the eigenvalue problem
a generalised sparse eigenproblem. We seek the most negative eigenvalues.
All six Kuhn tetrahedra of a box have their circumcentre at the centre of the box, which lies on the shared diagonal. The tetrahedra are therefore not well-centred in the strict sense of Section 5.2: the circumcentre lies on an edge. Every dual volume is still non-negative. The dual faces of the face diagonals and of the main diagonal have zero area and give on those edges. The Hodge star is the volume of the dual box around each vertex. The DEC Laplacian on this mesh is the seven-point stencil on the graded grid, the 3D counterpart of the five-point stencil remark in Section 6.1. An unstructured Delaunay tetrahedral mesh is in general not well-centred and can have negative entries.
9.3. Energy levels and degeneracies
On this mesh (54,872 interior vertices) the 14 most negative eigenvalues group into the first three shells:
| Shell | Exact | Degeneracy | Computed (mean) | Relative error |
|---|---|---|---|---|
Within each shell the eigenvalues split as the cubic symmetry of the grid allows. In the shell an exactly degenerate triplet at (the three states) lies below a single eigenvalue at . The four values spread over . The shell splits into groups of three, two, three and one eigenvalues spread over . Lumping the mass into and sampling the potential at vertices make the scheme a non-Galerkin method. Its eigenvalues are therefore not upper bounds and the errors have either sign: the level lies above the exact value and the shell below it.
Refining the grid at fixed and shows the convergence. With 30, 40 and 50 nodes per direction (spacing 0.41, 0.31 and 0.25 at the origin) the relative error is , and for the level and , and for the shell, close to in the spacing at the origin. The shell does not improve (, and ). Its orbitals reach the faces of the cube and the Dirichlet condition there raises its energy by an amount no refinement removes. On the coarsest grid this truncation error and the discretisation error, which lowers the energy, happen to cancel.
The same code with has exact eigenvalues with degeneracies . On uniform Kuhn meshes of with spacing 0.80, 0.52 and 0.39 the ground-state error is , and . The rate is 2.0 in . The level stays triply degenerate and the sixfold level splits into two triplets. This checks the Hodge Laplacian, the circumcentric Hodge stars and the sparse eigensolver.
// Pseudocode: the mesh type and its helpers are placeholders.
// Kuhn subdivision of a graded 40^3 grid on [-20, 20]^3
let mesh = kuhn_graded_cube(20.0, 40, 3.0);
let d0 = mesh.coboundary_matrix(0);
let star0 = mesh.hodge_star(0); // circumcentric dual volumes
let star1 = mesh.hodge_star(1); // circumcentric dual-face area / edge length
// Stiffness matrix: A = d0^T * star1 * d0 (so L0 = star0_inv * A)
let stiffness = &d0.transpose() * &(&star1 * &d0);
// Coulomb potential: V_vv = -1/r (the origin is not a vertex)
let potential = mesh.vertex_diagonal(|v| -1.0 / (v.x * v.x + v.y * v.y + v.z * v.z).sqrt());
// Hamiltonian: H = 0.5 * A + star0 * V (symmetric)
let hamiltonian = 0.5 * &stiffness + &(&star0 * &potential);
// Restrict to interior, solve H psi = E star0 psi near the shift -0.6
let (h_int, s_int) = mesh.restrict_to_interior(&hamiltonian, &star0);
let eigenvalues = sparse_generalised_eigsh(&h_int, &s_int, 14, -0.6);
for (i, &e) in eigenvalues.iter().enumerate() {
println!("E_{i} = {e:.6}");
}Hydrogen atom in Rust (pseudocode)
Python/NumPy comparison
import numpy as np
from itertools import permutations
from scipy.sparse import coo_matrix, diags
from scipy.sparse.linalg import eigsh
# --- Graded tensor grid on the cube [-R, R]^3, each box split into 6 Kuhn tetrahedra ---
R, n, a = 20.0, 40, 3.0
s = np.linspace(-1, 1, n) # n even: the origin is not a vertex
g = R * np.sinh(a * s) / np.sinh(a) # spacing 0.31 at the origin, 2.9 at the faces
X, Y, Z = np.meshgrid(g, g, g, indexing="ij")
points = np.column_stack([X.ravel(), Y.ravel(), Z.ravel()])
n_v = len(points)
idx = np.arange(n_v).reshape(n, n, n)
corner = idx[:-1, :-1, :-1].ravel()
tets = []
for perm in permutations(range(3)): # walk from corner (0,0,0) to (1,1,1)
v, path = [0, 0, 0], [corner]
for ax in perm:
v[ax] = 1
path.append(idx[v[0]:n-1+v[0], v[1]:n-1+v[1], v[2]:n-1+v[2]].ravel())
tets.append(np.column_stack(path))
tets = np.vstack(tets)
def circumcentre(P):
"""Circumcentres of the simplices P[:, k+1, 3], in their own affine hulls."""
A = P[:, 1:] - P[:, :1]
G = np.einsum("nid,njd->nij", A, A)
b = 0.5 * np.einsum("nid,nid->ni", A, A)
lam = np.linalg.solve(G, b[..., None])[..., 0]
return P[:, 0] + np.einsum("ni,nid->nd", lam, A)
# --- Circumcentric Hodge stars, assembled tetrahedron by tetrahedron ---
P = points[tets]
cT = circumcentre(P)
edges, w1 = [], []
star0 = np.zeros(n_v)
for i, j in [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]:
k, l = [q for q in range(4) if q not in (i, j)]
m = 0.5 * (P[:, i] + P[:, j])
e = P[:, j] - P[:, i]
ck, cl = circumcentre(P[:, [i, j, k]]), circumcentre(P[:, [i, j, l]])
# star1: signed area of the dual polygon (m, ck, cT, cl) over the edge length
area = 0.5 * np.einsum("nd,nd->n", np.cross(ck - m, cT - m) + np.cross(cT - m, cl - m), e)
area /= np.linalg.norm(e, axis=1)
sign = np.sign(np.einsum("nd,nd->n", np.cross(P[:, k] - m, P[:, l] - m), e))
edges.append(np.sort(tets[:, [i, j]], axis=1))
w1.append(sign * area / np.linalg.norm(e, axis=1))
# star0: signed volumes of the pieces (v, m, c_face, cT) of the Voronoi cells
for a_, b_, f in [(i, j, k), (i, j, l), (j, i, k), (j, i, l)]:
o = [q for q in range(4) if q not in (a_, b_, f)][0]
cf = circumcentre(P[:, [a_, b_, f]])
vol = np.linalg.det(np.stack([m - P[:, a_], cf - P[:, a_], cT - P[:, a_]], axis=1)) / 6
ref = np.sign(np.linalg.det(np.stack([P[:, b_] - P[:, a_], P[:, f] - P[:, a_],
P[:, o] - P[:, a_]], axis=1)))
star0 += np.bincount(tets[:, a_], weights=vol * ref, minlength=n_v)
uniq, inv = np.unique(np.vstack(edges), axis=0, return_inverse=True)
star1 = np.bincount(inv.ravel(), weights=np.concatenate(w1))
n_e = len(uniq)
d0 = coo_matrix((np.r_[-np.ones(n_e), np.ones(n_e)],
(np.r_[np.arange(n_e), np.arange(n_e)], np.r_[uniq[:, 0], uniq[:, 1]])),
shape=(n_e, n_v)).tocsr()
# --- Hamiltonian H = (1/2) d0^T star1 d0 + star0 V, restricted to interior vertices ---
V = -1.0 / np.linalg.norm(points, axis=1)
H = 0.5 * (d0.T @ diags(star1) @ d0) + diags(star0 * V)
ii = np.where(np.all(np.abs(points) < R - 1e-9, axis=1))[0]
H_int = H[ii][:, ii].tocsc()
S0_int = diags(star0[ii]).tocsc()
print(f"{len(ii)} interior vertices, star1 >= {star1.min():.1e}, "
f"sum star0 = {star0.sum():.1f} (cube volume {(2 * R)**3:.1f})")
# --- Generalised eigenproblem H psi = E star0 psi ---
E = np.sort(eigsh(H_int, k=14, M=S0_int, sigma=-0.6, which="LM",
return_eigenvectors=False))
start = 0
for shell in (1, 2, 3):
vals = E[start:start + shell**2]
start += shell**2
exact = -0.5 / shell**2
print(f"n = {shell}: exact {exact:.4f}, mean {vals.mean():.4f}, "
f"rel. error {abs(vals.mean() - exact) / abs(exact):.1e}, "
f"spread {vals.max() - vals.min():.1e}")
print(" ", np.round(vals, 5))The visualisation is a rotating volume rendering of the exact real hydrogen wavefunctions . The number of radial nodes is , the real spherical harmonic sets the angular structure and the sign changes (blue to red) are the nodal surfaces that the DEC eigensolver must resolve.
10. Nonlinear problems and the Navier-Stokes equations
The Poisson equation, the heat equation, Maxwell's equations and the Schrödinger equation are linear. The Navier-Stokes equations for viscous incompressible flow are nonlinear because the fluid velocity is both the transport and the transported quantity. DEC discretises the vorticity-stream function formulation, where the de Rham complex enforces incompressibility exactly.
10.1. Vorticity-stream function formulation
The incompressible Navier-Stokes equations in 2D are
where is the velocity, is the pressure, and is the kinematic viscosity. In the language of forms the divergence-free constraint states that the velocity 1-form is coclosed, or equivalently that the flux form is closed. The constraint involves the metric through .
The vorticity is (a scalar in 2D) and the stream function satisfies . Incompressibility is automatic and the Navier-Stokes equations reduce to one scalar equation:
This is an advection-diffusion equation for the vorticity. The velocity follows from solving the Poisson equation and computing .
10.2. DEC discretisation
In DEC the vorticity and the stream function are 0-cochains (a scalar at each vertex). The velocity is a dual 1-cochain (circulations along dual edges) given by , where the Hodge star rotates the gradient 1-form by .
The discrete vorticity equation is
where is the discrete advection operator assembled from the edge circulations of the velocity. Each time step does the following.
- Solve for the stream function (a Poisson solve).
- Compute edge velocities .
- Assemble the advection operator from edge velocities.
- Advance by one time step using [eq:dec-vorticity].
The DEC discretisation enforces exactly. The normal flux of the velocity across a primal edge is , and the net flux out of a triangle is the signed sum over its edges, by . The velocity cochain stores the same numbers as circulations along the dual edges. The stream function formulation needs no pressure Poisson equation or projection step. In classical methods these steps introduce splitting errors.
The figure shows this DEC solver on the lid-driven cavity benchmark at . The top wall moves with unit velocity to the right and drives a primary recirculation vortex that fills the cavity. The vorticity concentrates at the top corners where the lid meets the stationary walls and diffuses into the interior as the continuous solution predicts.

10.3. Energy estimates
The cochain inner product defines the energy functional.
The discrete enstrophy satisfies
The enstrophy is non-increasing and strictly decreasing unless ( constant on each connected component). The continuous energy dissipation estimate is .
Proof
Multiply [eq:dec-vorticity] on the left by . The advection term vanishes because the advection operator is skew-symmetric. The diffusion term gives (non-negative because has positive entries on a well-centred mesh). Hence .
For linear problems (Poisson, heat, Schrödinger) the Lax equivalence theorem gives convergence from consistency and stability. It does not apply to nonlinear problems like Navier-Stokes. Their convergence proofs use a priori energy estimates, bounds on the solution's energy that are uniform in the mesh size. The enstrophy is bounded by its initial value, which bounds the norm of the vorticity, which bounds the velocity through the Poisson equation for the stream function. These estimates are the starting point for a convergence proof by the compactness arguments of Leray and Hopf.
The figure checks the energy dissipation theorem numerically. The initial vorticity is Taylor-Green-like (sinusoidal in both directions and zero on the boundary) and evolves under pure diffusion. The normalised enstrophy decreases strictly for both viscosities, as the theorem states. Higher viscosity dissipates faster, as the continuous estimate predicts.

10.4. Time integration and solver comparison
DEC separates the spatial discretisation (geometric and structure-preserving) from the time integration. The stiffness matrix is the same for every time integrator, and the integrator sets the stability, accuracy and energy behaviour of the full scheme.
Consider the DEC heat equation on the unit disk with on the boundary. Three classical time integrators behave differently on this semi-discrete system:
-
Forward Euler (explicit, first-order): . Conditionally stable: it is stable only when , where is the largest eigenvalue of . The solution blows up within a few time steps at the time step used here.
-
Backward Euler (implicit, first-order): . Unconditionally stable (the implicit solve damps all modes). Its error makes each mode decay too slowly, since .
-
Classical RK4 (explicit, fourth-order): applies four explicit stages per step. It is far more accurate than either Euler variant when it is stable, but its stability interval on the negative real axis is only . At the time step used here this bound fails and RK4 also diverges.

The same spatial discretisation compares directly with classical finite differences. On the unit square with the exact Poisson solution both the 5-point stencil and the DEC cotangent Laplacian converge at in . On this grid the two stiffness matrices coincide: every triangle is right isosceles, the cotangent weight of each diagonal edge is zero and the DEC stiffness is the five-point stencil (Section 6.1). The solutions differ only in the load vector. Finite differences weight by at every vertex. DEC weights it by the barycentric , which ranges from to because the four corners of each grid square are cocircular and the Delaunay triangulation chooses its diagonal arbitrarily. The uneven load raises the DEC error by a factor of about 1.5 at every .

11. Preserved structure
We began with the five-point stencil on an L-shaped domain. It converges at in the energy norm because a uniform grid cannot resolve the corner singularity and cannot follow a boundary off the grid lines. DEC meshes conform to the domain and preserve its structure through a separation principle: topology is exact and geometry is approximate.
The topological layer is the simplicial complex (Section 1), the cochain complex and coboundary operator (Section 2) and the identity . These are combinatorial. They do not depend on the positions of the vertices, the shapes of the simplices or the metric of the ambient space, and DEC preserves them exactly. Hence:
- Stokes' theorem holds exactly at the discrete level: .
- Gauss's laws are automatically satisfied: prevents magnetic monopoles from appearing and charge from being created or destroyed.
- Incompressibility of fluid flow is exact in the stream function formulation.
- Charge conservation is exact up to round-off: applying to the discrete Ampère-Maxwell law and using gives the discrete continuity equation.
The geometric layer is the Hodge star (Section 5), which encodes distances, angles, volumes and material properties. All the approximation error sits in this layer. The Hodge star converges at and the Whitney interpolation error is also . The Poisson solution is in and in .
The classical numerical methods are special cases:
| Classical method | DEC interpretation | What it preserves |
|---|---|---|
| Finite differences | Coboundary on a Cartesian mesh | (accidentally, on uniform grids) |
| Piecewise linear FEM | Whitney -forms | Galerkin orthogonality |
| Edge elements (Nédélec) | Whitney -forms | commutes with interpolation |
| Face elements (Raviart-Thomas) | Whitney -forms | Normal flux continuity |
| Yee scheme (FDTD) | DEC on a Cartesian dual mesh | for Maxwell |
Each classical method preserves a fragment of the structure because it was designed for one problem on one mesh. DEC preserves all of it because it discretises the entire de Rham complex. It needs a well-centred simplicial mesh (easy in 2D, harder in 3D, Section 5.2) and a diagonal Hodge star that inverts trivially. With these the energy estimates and conservation laws of the preceding sections hold for every problem treated here, from the Poisson equation on an L-shaped domain to the Navier-Stokes equations.