Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Field operators

Use this page when a discrete gradient, divergence, flux, or related operator is applied to field values and you need to audit its orientation, spacing, units, boundary treatment, and conservation meaning.

The scientific question

How should a continuum differential relation be represented on finite entities, and which identities survive the discretization? An operator is not defined by a stencil alone. Its input and output locations, orientation, spacing or metric, boundary conditions, component basis, and units determine its scientific meaning.

For example, a discrete gradient may map node scalars to oriented edge differences, while a finite-volume divergence may map oriented face fluxes to cell-centered rates. Calling both arrays “derivatives” hides their distinct domains and conservation contracts.

Mathematical objects

Let scalar samples ϕi\phi_i live at ordered one-dimensional nodes xix_i. A forward difference gradient lives on the interval between nodes ii and i+1i+1. Its orientation points from ii to i+1i+1, and its units are [ϕ]/[x][\phi]/[x].

For a finite-volume cell cc with volume VcV_c, let face ff have outward signed orientation scf{1,+1}s_{cf}\in\{-1,+1\} relative to the cell, area AfA_f, and normal flux qfq_f. A discrete divergence lives at the cell and has units [q][A]/[V][q] [A]/[V]. Boundary faces require a supplied flux or a rule derived from the boundary conditions. Interior faces must appear with opposite signs in adjacent cells.

Matrices can represent these maps, but the matrix alone does not say whether an inner product includes mass, area, or volume weights. Therefore an algebraic transpose is not automatically the physically meaningful adjoint.

Core derivation

A one-dimensional edge gradient and a finite-volume cell divergence can be written as

(Gϕ)i+1/2=ϕi+1ϕixi+1xi,(Dq)c=1VcfcscfAfqf.(G\phi)_{i+1/2}=\frac{\phi_{i+1}-\phi_i}{x_{i+1}-x_i}, \qquad (Dq)_c=\frac{1}{V_c}\sum_{f\in\partial c}s_{cf}A_f q_f.

In (1), reversing an edge orientation reverses both the numerator ordering and the represented component. For divergence, summing Vc(Dq)cV_c(Dq)_c over cells cancels interior face contributions because the same face has opposite orientation in adjacent cells. What remains is boundary flux:

cVc(Dq)c=fΩsfAfqf.\sum_c V_c(Dq)_c=\sum_{f\in\partial\Omega}s_f A_f q_f.

Equation (2) is the discrete conservation statement to test. It depends on consistent incidence, geometry, and boundary accounting; it does not follow merely because a stencil resembles a continuum derivative.

An algebraic adjoint GTG^{\mathsf{T}} is defined by an unweighted Euclidean inner product. For symmetric positive-definite mass matrices M0\mathbf{M}_0 and M1\mathbf{M}_1, which are therefore invertible, the weighted algebraic adjoint and its exact inner-product identity are

G=M01GTM1,Gϕ,qM1=ϕ,GqM0.G^{*}=\mathbf{M}_{0}^{-1}G^{\mathsf{T}}\mathbf{M}_{1}, \qquad \langle G\phi,q\rangle_{\mathbf{M}_{1}} =\langle\phi,G^{*}q\rangle_{\mathbf{M}_{0}}.

Equation (3) is an algebraic definition and contains no boundary term. A discrete integration-by-parts or summation-by-parts claim instead relates the gradient to a separately defined discrete divergence DD. Under one declared matrix convention, that distinct identity is

Gϕ,qM1=ϕ,DqM0+ϕTEq,GTM1+M0D=E.\langle G\phi,q\rangle_{\mathbf{M}_{1}} =-\langle\phi,Dq\rangle_{\mathbf{M}_{0}} +\phi^{\mathsf{T}}\mathbf{E}_{\partial}q, \qquad G^{\mathsf{T}}\mathbf{M}_{1}+\mathbf{M}_{0}D =\mathbf{E}_{\partial}.

Here E\mathbf{E}_{\partial} represents the boundary bilinear form, including the trace and oriented normal-flux pairing appropriate to the discretization. It is generally nonzero. When the boundary form vanishes, as under suitable periodic or homogeneous boundary conditions, (4) reduces to D=GD=-G^{*}. That relation does not hold for a general nonzero boundary form.

Failure modes and interpretation limits

What Jaxstro may add

Current jaxstro.spatial, grid utilities, mesh utilities, geometry, and operator utilities remain narrower owners. Existing numerical operator utilities own generic algebraic mechanics; they do not claim field location, metric, boundary, or conservation semantics. jaxstro.fields does not exist, and no common operator package is imminent.

If two real consumers establish a shared contract, Jaxstro may later represent input and output entity locations, signed incidence, metric weights, boundary policies, unit transforms, and operator evidence. The abstraction would wrap scientific semantics around reusable linear maps without taking ownership of domain equations, Riemann solvers, time integrators, or application-specific closures.

Evidence required before implementation

Analytic tests must recover constant and linear-field derivatives on uniform and nonuniform domains with the expected convergence order. Unit tests must verify that gradient and divergence outputs carry the derived units. Orientation reversal and entity reordering must preserve the represented result. Boundary tests must cover periodic, prescribed-value, prescribed-flux, and unsupported policies explicitly.

Conservation evidence must verify (2) on structured and unstructured examples, including boundary flux. Adjoint claims require inner-product tests with the actual mass or metric matrices. Summation-by-parts claims require the complete discrete identity, including boundary terms. JAX tests must distinguish derivatives with respect to dynamic field values and coordinates from nondifferentiable topology, limiter, and boundary-policy choices.

Claim boundary

These examples define audit questions, not a universal operator API. A passing conservation identity does not establish accuracy or stability, and an algebraic transpose does not establish a continuum adjoint. This documentation promises no module or schedule. Shared ownership remains deferred until two consumers support the same field-location, topology, metric, boundary, unit, and evidence contract.

Connected representations, foundations, and methods