Smoothing Kernels
The following smoothing kernels are currently available:
Smoothing Kernel | Compact Support | Typ. Smoothing Length | Recommended Application | Stability |
---|---|---|---|---|
SchoenbergCubicSplineKernel | $[0, 2h]$ | $1.1$ to $1.3$ | General + sharp waves | ++ |
SchoenbergQuarticSplineKernel | $[0, 2.5h]$ | $1.1$ to $1.5$ | General | +++ |
SchoenbergQuinticSplineKernel | $[0, 3h]$ | $1.1$ to $1.5$ | General | ++++ |
GaussianKernel | $[0, 3h]$ | $1.0$ to $1.5$ | Literature | +++++ |
WendlandC2Kernel | $[0, 1h]$ | $2.5$ to $4.0$ | General (recommended) | ++++ |
WendlandC4Kernel | $[0, 1h]$ | $3.0$ to $4.5$ | General | +++++ |
WendlandC6Kernel | $[0, 1h]$ | $3.5$ to $5.0$ | General | +++++ |
Poly6Kernel | $[0, 1h]$ | $1.5$ to $2.5$ | Literature | + |
SpikyKernel | $[0, 1h]$ | $1.5$ to $3.0$ | Sharp corners + waves | + |
We recommend to use the WendlandC2Kernel
for most applications. If less smoothing is needed, try SchoenbergCubicSplineKernel
, for more smoothing try WendlandC6Kernel
.
The kernel can be called as
TrixiParticles.kernel(smoothing_kernel, r, h)
The length of the compact support can be obtained as
TrixiParticles.compact_support(smoothing_kernel, h)
Note that $r$ has to be a scalar, so in the context of SPH, the kernel should be used as
\[W(\Vert r_a - r_b \Vert, h).\]
The gradient required in SPH,
\[ \nabla_{r_a} W(\Vert r_a - r_b \Vert, h)\]
can be called as
TrixiParticles.kernel_grad(smoothing_kernel, pos_diff, distance, h)
where pos_diff
is $r_a - r_b$ and distance
is $\Vert r_a - r_b \Vert$.
TrixiParticles.GaussianKernel
— TypeGaussianKernel{NDIMS}()
Gaussian kernel given by
\[W(r, h) = \frac{\sigma_d}{h^d} e^{-r^2/h^2}\]
where $d$ is the number of dimensions and
- $\sigma_2 = \frac{1}{\pi}$ for 2D,
- $\sigma_3 = \frac{1}{\pi^{3/2}}$ for 3D.
This kernel function has an infinite support, but in practice, it's often truncated at a certain multiple of $h$, such as $3h$.
In this implementation, the kernel is truncated at $3h$, so this kernel function has a compact support of $[0, 3h]$.
The smoothing length is typically in the range $[1.0\delta, 1.5\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
Note: This truncation makes this Kernel not conservative, which is beneficial in regards to stability but makes it less accurate.
TrixiParticles.Poly6Kernel
— TypePoly6Kernel{NDIMS}()
Poly6 kernel, a commonly used kernel in SPH literature [3], especially in computer graphics contexts. It is defined as
\[W(r, h) = \frac{1}{h^d} w(r/h)\]
with
\[w(q) = \sigma \begin{cases} (1 - q^2)^3 & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization factor that depends on the dimension. The normalization factor $\sigma$ is $4 / \pi$ in two dimensions or $315 / 64\pi$ in three dimensions.
This kernel function has a compact support of $[0, h]$.
Poly6 is well-known for its computational simplicity, though it's worth noting that there are other kernels that might offer better accuracy for hydrodynamic simulations. Furthermore, its derivatives are not that smooth, which can lead to stability problems. It is also susceptible to clumping.
The smoothing length is typically in the range $[1.5\delta, 2.5\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.SchoenbergCubicSplineKernel
— TypeSchoenbergCubicSplineKernel{NDIMS}()
Cubic spline kernel by Schoenberg (1946), given by
\[ W(r, h) = \frac{1}{h^d} w(r/h)\]
with
\[w(q) = \sigma \begin{cases} \frac{1}{4} (2 - q)^3 - (1 - q)^3 & \text{if } 0 \leq q < 1, \\ \frac{1}{4} (2 - q)^3 & \text{if } 1 \leq q < 2, \\ 0 & \text{if } q \geq 2, \\ \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization constant given by $\sigma =[\frac{2}{3}, \frac{10}{7 \pi}, \frac{1}{\pi}]$ in $[1, 2, 3]$ dimensions.
This kernel function has a compact support of $[0, 2h]$.
For an overview of Schoenberg cubic, quartic and quintic spline kernels including normalization factors, see Price (2012). For an analytic formula for higher order Schoenberg kernels, see Monaghan (1985). The largest disadvantage of Schoenberg Spline Kernel is the rather non-smooth first derivative, which can lead to increased noise compared to other kernel variants.
The smoothing length is typically in the range $[1.1\delta, 1.3\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.SchoenbergQuarticSplineKernel
— TypeSchoenbergQuarticSplineKernel{NDIMS}()
Quartic spline kernel by Schoenberg (1946), given by
\[ W(r, h) = \frac{1}{h^d} w(r/h)\]
with
\[w(q) = \sigma \begin{cases} \left(5/2 - q \right)^4 - 5\left(3/2 - q \right)^4 + 10\left(1/2 - q \right)^4 & \text{if } 0 \leq q < \frac{1}{2}, \\ \left(5/2 - q \right)^4 - 5\left(3/2 - q \right)^4 & \text{if } \frac{1}{2} \leq q < \frac{3}{2}, \\ \left(5/2 - q \right)^4 & \text{if } \frac{3}{2} \leq q < \frac{5}{2}, \\ 0 & \text{if } q \geq \frac{5}{2}, \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization constant given by $\sigma =[\frac{1}{24}, \frac{96}{1199 \pi}, \frac{1}{20\pi}]$ in $[1, 2, 3]$ dimensions.
This kernel function has a compact support of $[0, 2.5h]$.
For an overview of Schoenberg cubic, quartic and quintic spline kernels including normalization factors, see Price (2012). For an analytic formula for higher order Schoenberg kernels, see Monaghan (1985).
The largest disadvantage of Schoenberg Spline Kernel are the rather non-smooth first derivative, which can lead to increased noise compared to other kernel variants.
The smoothing length is typically in the range $[1.1\delta, 1.5\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.SchoenbergQuinticSplineKernel
— TypeSchoenbergQuinticSplineKernel{NDIMS}()
Quintic spline kernel by Schoenberg (1946), given by
\[ W(r, h) = \frac{1}{h^d} w(r/h)\]
with
\[w(q) = \sigma \begin{cases} (3 - q)^5 - 6(2 - q)^5 + 15(1 - q)^5 & \text{if } 0 \leq q < 1, \\ (3 - q)^5 - 6(2 - q)^5 & \text{if } 1 \leq q < 2, \\ (3 - q)^5 & \text{if } 2 \leq q < 3, \\ 0 & \text{if } q \geq 3, \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization constant given by $\sigma =[\frac{1}{120}, \frac{7}{478 \pi}, \frac{1}{120\pi}]$ in $[1, 2, 3]$ dimensions.
This kernel function has a compact support of $[0, 3h]$.
For an overview of Schoenberg cubic, quartic and quintic spline kernels including normalization factors, see Price (2012). For an analytic formula for higher order Schoenberg kernels, see Monaghan (1985).
The largest disadvantage of Schoenberg Spline Kernel are the rather non-smooth first derivative, which can lead to increased noise compared to other kernel variants.
The smoothing length is typically in the range $[1.1\delta, 1.5\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.SpikyKernel
— TypeSpikyKernel{NDIMS}()
The Spiky kernel is another frequently used kernel in SPH, especially due to its desirable properties in preserving features near boundaries in fluid simulations [3]. It is defined as:
\[ W(r, h) = \frac{1}{h^d} w(r/h)\]
with:
\[w(q) = \sigma \begin{cases} (1 - q)^3 & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}\]
where $d$ is the number of dimensions and the normalization factor $\sigma$ is $10 / \pi$ in two dimensions or $15 / \pi$ in three dimensions.
This kernel function has a compact support of $[0, h]$.
The Spiky kernel is particularly known for its sharp gradients, which can help to preserve sharp features in fluid simulations, especially near solid boundaries. These sharp gradients at the boundary are also the largest disadvantage as they can lead to instability.
The smoothing length is typically in the range $[1.5\delta, 3.0\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.WendlandC2Kernel
— TypeWendlandC2Kernel{NDIMS}()
Wendland C2 kernel [7], a piecewise polynomial function designed to have compact support and to be twice continuously differentiable everywhere. Given by
\[ W(r, h) = \frac{1}{h^d} w(r/h)\]
with
\[w(q) = \sigma \begin{cases} (1 - q)^4 (4q + 1) & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization factor dependent on the dimension. The normalization factor $\sigma$ is $40/7\pi$ in two dimensions or $21/2\pi$ in three dimensions.
This kernel function has a compact support of $[0, h]$.
For a detailed discussion on Wendland functions and their applications in SPH, see Dehnen (2012). The smoothness of these functions is also the largest disadvantage as they lose details at sharp corners.
The smoothing length is typically in the range $[2.5\delta, 4.0\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.WendlandC4Kernel
— TypeWendlandC4Kernel{NDIMS}()
Wendland C4 kernel [7], a piecewise polynomial function designed to have compact support and to be four times continuously differentiable everywhere. Given by
\[ W(r, h) = \frac{1}{h^d} w(r/h)\]
with
\[w(q) = \sigma \begin{cases} (1 - q)^6 (35q^2 / 3 + 6q + 1) & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization factor dependent on the dimension. The normalization factor $\sigma$ is $9 / \pi$ in two dimensions or $495 / 32\pi$ in three dimensions.
This kernel function has a compact support of $[0, h]$.
For a detailed discussion on Wendland functions and their applications in SPH, see Dehnen (2012). The smoothness of these functions is also the largest disadvantage as they loose details at sharp corners.
The smoothing length is typically in the range $[3.0\delta, 4.5\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.
TrixiParticles.WendlandC6Kernel
— TypeWendlandC6Kernel{NDIMS}()
Wendland C6 kernel [7], a piecewise polynomial function designed to have compact support and to be six times continuously differentiable everywhere. Given by:
\[W(r, h) = \frac{1}{h^d} w(r/h)\]
with:
\[w(q) = \sigma \begin{cases} (1 - q)^8 (32q^3 + 25q^2 + 8q + 1) & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}\]
where $d$ is the number of dimensions and $\sigma$ is a normalization factor dependent on the dimension. The normalization factor $\sigma$ is $78 / 7 \pi$ in two dimensions or $1365 / 64\pi$ in three dimensions.
This kernel function has a compact support of $[0, h]$.
For a detailed discussion on Wendland functions and their applications in SPH, Dehnen (2012). The smoothness of these functions is also the largest disadvantage as they loose details at sharp corners.
The smoothing length is typically in the range $[3.5\delta, 5.0\delta]$, where $\delta$ is the typical particle spacing.
For general information and usage see Smoothing Kernels.