Laplacian
SPH Laplacian of a field, in four estimator schemes. Kernel:
coreOperations/wp_laplacian.py (computeSPHLaplacianTensor_Kernel);
JVP coreOperations/wp_laplacianJVP.py (one function per scheme plus a
dispatcher).
Equation
All four schemes share one per-pair quantity, q_ij, which depends on
gradientMode only (never on laplacianMode):
(with the usual apparent-volume / grad-h substitutions). The schemes then combine differently:
| Scheme | Estimator |
|---|---|
Naive (1) | — the analytic second-derivative-of- kernel Laplacian sphKernelLaplacian: with , , , , (and for or ). Never reads the kernel gradient, so no correction can affect it. |
Brookshaw (2) | , |
Dot (3) | DJ Price SPH/MHD eq. 96 (computeLaplacianDot2): the field is processed in blocks of dim components; each block is projected against and combined with the same Brookshaw uses. Requires the flattened field size to be a multiple of dim — scalar fields in D are rejected with a ValueError. |
Default (4) | computeDotLaplacian: with , — Brookshaw's exact shape one quotient-rule level deeper (a second, tighter regularized distance). |
Consistency constraint (documented in wp_laplacian.py): for the
family to be a consistent estimator,
must vanish for spatially constant — otherwise the sum picks up an
uncancelled residual from the kernel's own second-moment
scaling that grows without bound as resolution increases.
satisfies this by construction; reusing the
Gradient/Divergence/Curl coefficient tables unmodified would inherit
the divergent residual, which is why the Laplacian's q_ij is its own
table (the Symmetric row above is the self-term-subtracted,
density-weighted variant of the same family).
Output: same shape as the input field (scalar scalar, vector vector).
Public API
warpOperation(
queryParticles, operationProperties, domain,
queryValues=f, referenceValues=f,
queryVolumes=None, referenceVolumes=None,
crkState=None, gradHState=None, renormalizationState=None,
adjacency=None,
)
with operation == WarpOperation.Laplacian.
| Option | Default | Effect |
|---|---|---|
laplacianMode | Brookshaw | estimator scheme (table above) |
gradientMode | Naive | selects only q_ij |
positiveDivergence | False | adds the positiveDotProduct extra term to every scheme's contribution |
supportMode / operationMode / corrections / calibration | — | as in Gradient; CRK/renormalization act on the same kernel gradient Brookshaw/Dot/Default consume |
JVP / HVP
Value JVP — relaunch-on-tangents, as usual.
Geometry JVP — warpOperationJVP dispatches
computeSPHLaplacianGeometryJVP, which routes by laplacianMode to one
of four hand-derived kernels sharing a
_laplacianGeometryChainJVP building block (the
regularized-distance chain on top of
sphKernelGradientJVP):
- Brookshaw: ,
— ordinary
product/quotient rule; generalized to scalar and vector fields
(2026-08-25, after a vector-field diffusion consumer hit the
scalar_t-only boundary). - Naive: with the analytic kernel
Laplacian,
using
sphKernelLaplacianJVP(built from the derivative ladder, cross-checked against the textbook form). - Dot: same shared chain plus the per-
dim-block projection and its tangent; the projection reduction lives in its own@wp.funcreturning(proj, dproj)— Warp's automatic reverse-mode adjoint is wrong when a loop-accumulated local is consumed by a later nonlinear op in the same function body (found and fixed 2026-08-20, pinned by gradcheck). - Default: one quotient-rule level deeper (), no block structure.
Scope restrictions:
- CRK / renormalization tangents: supported for Brookshaw, Dot and Default (Dot/Default landed in the 2026-08-21 follow-up); Naive is permanently excluded — its estimator never reads the corrected kernel gradient, so there is no formula for either correction to affect. Omitted tangent states hold the correction frozen.
positiveDivergenceis rejected (its extra term is in no derived formula).gradHStateunsupported; query-mass tangents rejected; the value-tangent term is fused into the same loop.
Gated per scheme by
tests/operations/test_forward_mode_geometry_jvp_laplacian_naive.py,
..._brookshaw.py, ..._dot.py, ..._default.py (gradcheck +
finite-difference references; the Brookshaw/Naive files also carry the
2026-08-25 vector-field generalization tests).
No HVP exists for the Laplacian.
Tests
tests/operations/test_operations_core.py— shape/finiteness (including the Dot-scheme scalar-fieldValueError).tests/operations/test_operations_consistency.py— scheme comparison on linear/quadratic fields.tests/operations/test_forward_mode_value_jvp.py— value JVP.tests/operations/test_forward_mode_geometry_jvp_laplacian_*.py— the four geometry JVPs, with and without CRK/renorm tangents.tests/operations/test_grid_modes.py— adjacency vs grid parity.