Exact and approximate discrete vector-field operators on a Cartesian mesh
In this blog post, I attempt to introduce exact and accompanying consistent approximate discrete vector-field operators on a Cartesian mesh. These operators will act on and “produce” various styles of discretized fields. So first, the staggering of various field discretizations is introduced.
Field discretizations
We consider a cubic Cartesian mesh of size , and origin that is meshed by cubic cells of size . These cells have Cartesian indices . We introduce two discretizations of a scalar field :
- presents the field value at the position of the left-lower-back vertex of the corresponding cell:
- presents the field’s cell-averaged value over the corresponding cell:
These scalar fields are accompanied by two discretizations for a vector field, .
- represents the average of the field’s components over the cell’s face with corresponding normal vector. For example for ,
- represents the average of the field’s components over the cell’s edge with corresponding tangential vector. For example for
Exact field operators
With these discretizations we can define three exact operators.
- Exact scalar-gradient operator (): We can readily compute the edge-averaged values of from the vertex values of (), from the gradient theorem. For example, for , The exact discrete gradient operator is denoted as , where the subscripts, indicating the staggering, also reference the operator definition.
- Exact curl operator
():
We can readily compute the face-averaged curl from an edge-averaged
vector field, From Stokes’ theorem. E.g. for
,
The exact discrete curl operator is denoted as
- Exact divergence operator (): We can readily compute the cell-averaged divergence () from the face-averaged vector-components, from Gauss’ theorem, The exact discrete divergence operator is denoted as .
Given that these are exact operators, it is no surprise that the two possible “double ” identities are satisfied: Indeed, if we compute the exact (face-averaged) curl from exact (edge-averaged) gradient (computed from vertex values), we exactly get the zero vector. Further the exact (cell averaged) divergence of a (face-averaged) curl (from an edge-averaged vector field) is also exactly zero. Note that the set of three exact operators always “go up” in dimensionality, As such it would be nice if we could augment this set op operator definitions, with operators in the other direction. We call these, now approximate, operators “consistent” when the formulations satisfy the “double ” identities exactly.
Consistent approximate operators.
We introduce three second-order accurate operators to complement the three exact operators.
- Approximate face-averaged gradient from cell-averaged fields,
- Approximate edge-averaged curl from face-averaged vector fields,
- Approximate vertex-point divergence from edge-averaged fields,
It can be easily verified that these operators satisfy the aforementioned “double ” identities exactly, and are therefore labeled “consistent”.
Applications
To finalize this blog post, and to illustrate the use of these formulations, five elementary “applications” for vector-field analysis are introduced.
Application 1: The Laplacian
We can compute the Laplacian () of a scalar field “in place”, i.e. from a vertex field, as a vertex field and from a cell-averaged field as a cell-averaged field. Using the exact gradient operator, or using the exact divergence operator,
Application 2: Two Projection methods
With the Laplacian we can project a vector field onto the space of divergence free vector fields. For a face-averaged vector field () the steps are,
- Compute the exact cell-averaged divergence:
- Solve the discrete Poisson problem for the cell-averaged field ,
- Reject the gradient of from (containing the divergence) to find the desired divergence-free projected vector field, ,
With this method, one can claim the cell-averaged divergence of is exactly zero. Alternatively, one can project an edge-averaged vectorfield () with similar steps,
- Compute the approximate vertex-point divergence
- Solve the Poisson problem for the vertex-point field ,
- Reject the gradient of from (containing the divergence) to find the desired projection vector ,
Although the approximate divergence of will be exactly zero, the latter method seems less favorable compared to the former, as for the latter, errors arise for both applications of the approximate divergence operator. I wonder if these two can be related.
Application 3: Vector potential
For a vector field described by a vector potential , we can find the vector potential by solving either, or, depending on the (face or edge) distretization of .
Application 4: Consistent Helmholtz decomposition
Combining the projection (for the scalar potential) and vector potential, we can decompose any scalar field into a (rotation free) scalar gradient and (divergence free) curl field,
There are two options:
- A face-averaged vector field () may be reconstructed by a cell-averaged scalar potential and an edge-averaged vector potential.
- An edge-averaged vector field () may be reconstructed by a vertex-point scalar potential and a face-averaged vector potential.
Application 5: The vector Laplacian
Since we have not defined a method to compute the gradient of a vector-component field, the vector Laplacian seems illusive. However, using the identity: we can approximate the vector Laplacian “in place” for edge-averaged vector fields, and face-averaged vector fields,
Further applications of these “applications” will be presented later.
Vector product in dimensions
It is often1 said that the vector product (“”, cross product) cannot be generalized to other than three dimensions. But it depends a bit on how one defines the vector product. If we forgo the requirement that is must be a binary operation (i.e. the product of two vectors) but instead require vectors for the dimensional vector product, it generalizes quite naturally: By the properties of determinants, it remains to be distributive over addition (i.e. it is a linear, product-style operator), if any two vectors in the product are parallel, and is perpendicular to every argument of the product. Using this definition, we can use it for any dimension larger than one. For example, the vector product of in 2 dimensions is ,
It is not often a topic of discussion, really.↩︎