Skip to content

num::sph_kernel

Defined in header <spatial/sph_kernel.hpp>

template <int Dim>
struct sph_kernel;

Smoothed Particle Hydrodynamics (SPH) smoothing kernel and gradient evaluations in 2D / 3D.

Implements standard Monaghan cubic spline kernel \(W(r, h)\) and Desbrun Spiky pressure kernel gradients. Compact support is strictly within \(r \in [0, 2h]\).

Template parameters

  • Dim: Spatial dimension (2 or 3).

Members

member description
static float W(float r, float h) Evaluate Monaghan cubic spline kernel \(W(r, h)\) at distance \(r\) with smoothing length \(h\).
static float dW_dr(float r, float h) Evaluate radial derivative of the cubic spline kernel \(\frac{\partial W}{\partial r}\).
static float Spiky_dW_dr(float r, float h) Evaluate radial derivative of the Desbrun Spiky pressure kernel.
static std::array<float, Dim> Spiky_gradW(std::array<float, Dim> r_vec, float r, float h) Evaluate Spiky pressure kernel gradient vector \(\nabla W_{\text{spiky}}(\mathbf{r}_{ij}, h)\).