All kernels are evaluated in compact form:
W(r,h)=Cdh−dk(q),q=hr∈[0,1],
with every kernel supported on q≤1 (i.e. a support radius of
1⋅h, regardless of the classical convention some splines use).
The smoothstep-style cpow_warp(x, p) = \max(x, 0)^p convention
implements the knot terms. Derivatives are stored as the compact
ladder k,k′,k′′,k′′′ and re-scaled with powers of h at the
evaluation level, so a kernel "family" is one module in
kernels/kernelFunctions/ exposing *_k, *_dkdq, *_d2kdq2,
*_d3kdq3, *_C_d, *_kernelScale, *_packingRatio.
The kernels
Select with KernelFunctions.<Name> in OperationProperties.
| Kernel | Compact form k(q) (per dim where it differs) | Cd (1D / 2D / 3D) | Smoothness |
|---|
Poly6 | (1−q2)3 | 35/32 / 4/π / 315/(64π) | C2 |
Spiky | (1−q)3 | 2 / 10/π / 15/π | C1 |
CubicSpline | (1−q)3−4(0.5−q)3 | 8/3 / 80/(7π) / 16/π | C2 |
QuarticSpline | (1−q)4−5(0.6−q)4+10(0.2−q)4 | 3125/768 / 46875/(2398π) / 15625/(512π) | C3 |
QuinticSpline | (1−q)5−6(32−q)5+15(31−q)5 | 243/40 / 15309/(478π) / 2187/(40π) | C4 |
B7 | (q−1)6−7(q−75)6+21(q−73)6−35(q−71)6 | 823543/92160 / 5764801/(113149π) / 5764801/(61440π) | C5 |
B8 | 56(q−0.25)7−28(q−0.5)7+8(q−0.75)7−(q−1)7 | 4096/315 / 589824/(7435π) / 16384/(105π) | C6 |
HOCT4 | Pq+Q for q≤α; (1−q)4+516(0.75−q)4−594(0.5−q)4 for q>α (α≈0.214108, Read et al. 2010 eqs. 46-51) | 2.06843 / 3.71583 / 6.51505 | C2; designed central cusp k′(0)=P=0 |
Gaussian | exp(−128q2), truncated at 16σ (σ=h/16) | (128/π)1/2 / 128/π / (128/π)3/2 | analytic; truncation at the e−128 level |
Wendland2 | 1D: (1−q)3(1+3q); d≥2: (1−q)4(1+4q) | 5/4 / 7/π / 21/(2π) | C2, positive definite |
Wendland4 | 1D: (1−q)5(1+5q+8q2); d≥2: (1−q)6(1+6q+335q2) | 3/2 / 9/π / 495/(32π) | C4, positive definite |
Wendland6 | 1D: (1−q)7(1+7q+19q2+21q3); d≥2: (1−q)8(1+8q+25q2+32q3) | 55/32 / 78/(7π) / 1365/(64π) | C6, positive definite |
ViscosityKernel | −21q3+q2+2q1−1 (XSPH viscosity) | 15/(2π) / 10/(9π) / 15/(2π) | — |
AdhesionKernel | (−4q2+6q−2)1/4 for q>0.5, else 0 | 0.007 (all dims) | — |
CohesionKernel | 2(1−q)3q3−1/64 for q<0.5; (1−q)3q3 else | 32/π (all dims) | — |
The Wendland family is the default in the notebooks and tests
(KernelFunctions.Wendland2); it is the family the
lattice-normalization calibration
has a closed-form analysis for (positive definite ⇒
L(nh)>1 strictly, no root in h).
Packing and support properties
Each kernel module also provides (Dehnen & Aly, Improving convergence
in SPH simulations) the properties properties.py exposes:
sphKernelScale(kernel, dim) — the h-to-spacing scale factor
(the support in particle-spacings for a well-packed lattice);
sphKernelN_H(kernel, dim) — the expected neighbor count
NH=facdpackdscaled with fac1=2,
fac2=π, fac3=34π;
sphKernel_xi(kernel, dim) — packing ratio × scale, the support in
spacing units.
These are properties of the kernel, not part of the evaluation: the
lattice-normalization factor is deliberately not applied to them.
Pairwise evaluation and the support schemes
The pairwise functions take both particles' supports (hi,hj) and
resolve the effective support with computePairwiseSupport
(util/support.py):
SupportScheme | value | Wij | ∇Wij |
|---|
Gather | 11 | W(xij,hi) | ∇W(xij,hi) |
Scatter | 12 | W(xij,hj) | ∇W(xij,hj) |
MeanSymmetric | 13 | W(xij,(hi+hj)/2) | ∇W(xij,(hi+hj)/2) |
KernelMeanSymmetric | 14 | 21(W(xij,hi)+W(xij,hj)) | 21(∇W(xij,hi)+∇W(xij,hj)) |
SuperSymmetric | 15 | 21(W(xij,hi)+W(xij,hj)) | 21(∇W(xij,hi)−∇W(xji |