novaphy.SPHKernels¶
Standard SPH smoothing kernels used by SolverPBF
and SolverSPH. Exposed as @staticmethod
helpers so you can call them without instantiating the class.
Static methods¶
| Method | Description |
|---|---|
SPHKernels.poly6(r_sq, h) -> float |
Poly6 density-estimation kernel. Note: takes the squared distance r_sq. |
SPHKernels.spiky(r_len, h) -> float |
Spiky kernel value (scalar r_len). |
SPHKernels.spiky_grad(r, h) -> Vec3 |
Gradient of the Spiky kernel for pressure forces (vector r from j to i). |
SPHKernels.cubic_spline(r_len, h) -> float |
Cubic-spline kernel value (used by SPH viscosity / interpolation). |
Example¶
import numpy as np
import novaphy
h = 0.1
W = novaphy.SPHKernels.poly6(r_sq=0.005, h=h)
grad_W = novaphy.SPHKernels.spiky_grad(
r=np.array([0.05, 0.0, 0.0], dtype=np.float32), h=h,
)
print(W, grad_W)
Notes¶
- All kernels assume float32 inputs. Pass NumPy arrays of the right dtype to avoid silent casts.
- A Wendland / quintic-spline kernel is not currently provided. Adding one is straightforward — file an issue if your fluid setup needs it before a release adds it upstream.