Smoothing Kernels

The following smoothing kernels are currently available:

Smoothing KernelCompact SupportTyp. Smoothing LengthRecommended ApplicationStability
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.

Usage

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.GaussianKernelType
GaussianKernel{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.

source
TrixiParticles.Poly6KernelType
Poly6Kernel{NDIMS}()

Poly6 kernel, a commonly used kernel in SPH literature, 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.

References

  • Matthias Müller, David Charypar, and Markus Gross. "Particle-based fluid simulation for interactive applications". In: Proceedings of the 2003 ACM SIGGRAPH/Eurographics symposium on Computer animation. Eurographics Association. 2003, pages 154-159. doi: 10.5555/846276.846298
source
TrixiParticles.SchoenbergCubicSplineKernelType
SchoenbergCubicSplineKernel{NDIMS}()

Cubic spline kernel by Schoenberg (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.

References

  • Daniel J. Price. "Smoothed particle hydrodynamics and magnetohydrodynamics". In: Journal of Computational Physics 231.3 (2012), pages 759-794. doi: 10.1016/j.jcp.2010.12.011
  • Joseph J. Monaghan. "Particle methods for hydrodynamics". In: Computer Physics Reports 3.2 (1985), pages 71–124. doi: 10.1016/0167-7977(85)90010-3
  • Isaac J. Schoenberg. "Contributions to the problem of approximation of equidistant data by analytic functions. Part B. On the problem of osculatory interpolation. A second class of analytic approximation formulae." In: Quarterly of Applied Mathematics 4.2 (1946), pages 112–141. doi: 10.1090/QAM/16705
source
TrixiParticles.SchoenbergQuarticSplineKernelType
SchoenbergQuarticSplineKernel{NDIMS}()

Quartic spline kernel by Schoenberg (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.

References

  • Daniel J. Price. "Smoothed particle hydrodynamics and magnetohydrodynamics". In: Journal of Computational Physics 231.3 (2012), pages 759-794. doi: 10.1016/j.jcp.2010.12.011
  • Joseph J. Monaghan. "Particle methods for hydrodynamics". In: Computer Physics Reports 3.2 (1985), pages 71–124. doi: 10.1016/0167-7977(85)90010-3
  • Isaac J. Schoenberg. "Contributions to the problem of approximation of equidistant data by analytic functions. Part B. On the problem of osculatory interpolation. A second class of analytic approximation formulae." In: Quarterly of Applied Mathematics 4.2 (1946), pages 112–141. doi: 10.1090/QAM/16705
source
TrixiParticles.SchoenbergQuinticSplineKernelType
SchoenbergQuinticSplineKernel{NDIMS}()

Quintic spline kernel by Schoenberg (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.

References

  • Daniel J. Price. "Smoothed particle hydrodynamics and magnetohydrodynamics". In: Journal of Computational Physics 231.3 (2012), pages 759-794. doi: 10.1016/j.jcp.2010.12.011
  • Joseph J. Monaghan. "Particle methods for hydrodynamics". In: Computer Physics Reports 3.2 (1985), pages 71–124. doi: 10.1016/0167-7977(85)90010-3
  • Isaac J. Schoenberg. "Contributions to the problem of approximation of equidistant data by analytic functions. Part B. On the problem of osculatory interpolation. A second class of analytic approximation formulae." In: Quarterly of Applied Mathematics 4.2 (1946), pages 112–141. doi: 10.1090/QAM/16705
source
TrixiParticles.SpikyKernelType
SpikyKernel{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. 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.

References

  • Matthias Müller, David Charypar, and Markus Gross. "Particle-based fluid simulation for interactive applications". In: Proceedings of the 2003 ACM SIGGRAPH/Eurographics symposium on Computer animation. Eurographics Association. 2003, pages 154-159. doi: 10.5555/846276.846298
source
TrixiParticles.WendlandC2KernelType
WendlandC2Kernel{NDIMS}()

Wendland C2 kernel (Wendland, 1995), 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 & Aly, 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.

References

  • Walter Dehnen & Hassan Aly. "Improving convergence in smoothed particle hydrodynamics simulations without pairing instability". In: Monthly Notices of the Royal Astronomical Society 425.2 (2012), pages 1068-1082. doi: 10.1111/j.1365-2966.2012.21439.x

  • Holger Wendland. "Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree." In: Advances in computational Mathematics 4 (1995), pages 389-396. doi: 10.1007/BF02123482

source
TrixiParticles.WendlandC4KernelType
WendlandC4Kernel{NDIMS}()

Wendland C4 kernel, 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 & Aly, 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.

References

  • Walter Dehnen & Hassan Aly. "Improving convergence in smoothed particle hydrodynamics simulations without pairing instability". In: Monthly Notices of the Royal Astronomical Society 425.2 (2012), pages 1068-1082. doi: 10.1111/j.1365-2966.2012.21439.x

  • Holger Wendland. "Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree." In: Advances in computational Mathematics 4 (1995): 389-396. doi: 10.1007/BF02123482

source
TrixiParticles.WendlandC6KernelType
WendlandC6Kernel{NDIMS}()

Wendland C6 kernel, 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, see (Dehnen & Aly, 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.

References

  • Walter Dehnen & Hassan Aly. "Improving convergence in smoothed particle hydrodynamics simulations without pairing instability". In: Monthly Notices of the Royal Astronomical Society 425.2 (2012), pages 1068-1082. doi: 10.1111/j.1365-2966.2012.21439.x

  • Holger Wendland. "Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree." In: Advances in computational Mathematics 4 (1995): 389-396. doi: 10.1007/BF02123482

source