Smoothing Kernels

The following smoothing kernels are currently available:

Smoothing KernelCompact SupportTyp. Smoothing LengthRecommended ApplicationStability
SchoenbergCubicSplineKernel[0,2h][0, 2h]1.11.1 to 1.31.3General + sharp waves++
SchoenbergQuarticSplineKernel[0,2.5h][0, 2.5h]1.11.1 to 1.51.5General+++
SchoenbergQuinticSplineKernel[0,3h][0, 3h]1.11.1 to 1.51.5General++++
GaussianKernel[0,3h][0, 3h]1.01.0 to 1.51.5Literature+++++
WendlandC2Kernel[0,1h][0, 1h]2.52.5 to 4.04.0General (recommended)++++
WendlandC4Kernel[0,1h][0, 1h]3.03.0 to 4.54.5General+++++
WendlandC6Kernel[0,1h][0, 1h]3.53.5 to 5.05.0General+++++
Poly6Kernel[0,1h][0, 1h]1.51.5 to 2.52.5Literature+
SpikyKernel[0,1h][0, 1h]1.51.5 to 3.03.0Sharp 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 rr has to be a scalar, so in the context of SPH, the kernel should be used as

W(rarb,h).W(\Vert r_a - r_b \Vert, h).

The gradient required in SPH,

raW(rarb,h) \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 rarbr_a - r_b and distance is rarb\Vert r_a - r_b \Vert.

TrixiParticles.GaussianKernelType
GaussianKernel{NDIMS}()

Gaussian kernel given by

W(r,h)=σdhder2/h2W(r, h) = \frac{\sigma_d}{h^d} e^{-r^2/h^2}

where dd is the number of dimensions and

  • σ2=1π\sigma_2 = \frac{1}{\pi} for 2D,
  • σ3=1π3/2\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 hh, such as 3h3h.

In this implementation, the kernel is truncated at 3h3h, so this kernel function has a compact support of [0,3h][0, 3h].

The smoothing length is typically in the range [1.0δ,1.5δ][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 [3], especially in computer graphics contexts. It is defined as

W(r,h)=1hdw(r/h)W(r, h) = \frac{1}{h^d} w(r/h)

with

w(q)=σ{(1q2)3if 0q<1,0if q1,w(q) = \sigma \begin{cases} (1 - q^2)^3 & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}

where dd is the number of dimensions and σ\sigma is a normalization factor that depends on the dimension. The normalization factor σ\sigma is 4/π4 / \pi in two dimensions or 315/64π315 / 64\pi in three dimensions.

This kernel function has a compact support of [0,h][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δ,2.5δ][1.5\delta, 2.5\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source
TrixiParticles.SchoenbergCubicSplineKernelType
SchoenbergCubicSplineKernel{NDIMS}()

Cubic spline kernel by Schoenberg (1946), given by

W(r,h)=1hdw(r/h) W(r, h) = \frac{1}{h^d} w(r/h)

with

w(q)=σ{14(2q)3(1q)3if 0q<1,14(2q)3if 1q<2,0if q2,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 dd is the number of dimensions and σ\sigma is a normalization constant given by σ=[23,107π,1π]\sigma =[\frac{2}{3}, \frac{10}{7 \pi}, \frac{1}{\pi}] in [1,2,3][1, 2, 3] dimensions.

This kernel function has a compact support of [0,2h][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δ,1.3δ][1.1\delta, 1.3\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source
TrixiParticles.SchoenbergQuarticSplineKernelType
SchoenbergQuarticSplineKernel{NDIMS}()

Quartic spline kernel by Schoenberg (1946), given by

W(r,h)=1hdw(r/h) W(r, h) = \frac{1}{h^d} w(r/h)

with

w(q)=σ{(5/2q)45(3/2q)4+10(1/2q)4if 0q<12,(5/2q)45(3/2q)4if 12q<32,(5/2q)4if 32q<52,0if q52,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 dd is the number of dimensions and σ\sigma is a normalization constant given by σ=[124,961199π,120π]\sigma =[\frac{1}{24}, \frac{96}{1199 \pi}, \frac{1}{20\pi}] in [1,2,3][1, 2, 3] dimensions.

This kernel function has a compact support of [0,2.5h][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δ,1.5δ][1.1\delta, 1.5\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source
TrixiParticles.SchoenbergQuinticSplineKernelType
SchoenbergQuinticSplineKernel{NDIMS}()

Quintic spline kernel by Schoenberg (1946), given by

W(r,h)=1hdw(r/h) W(r, h) = \frac{1}{h^d} w(r/h)

with

w(q)=σ{(3q)56(2q)5+15(1q)5if 0q<1,(3q)56(2q)5if 1q<2,(3q)5if 2q<3,0if q3,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 dd is the number of dimensions and σ\sigma is a normalization constant given by σ=[1120,7478π,1120π]\sigma =[\frac{1}{120}, \frac{7}{478 \pi}, \frac{1}{120\pi}] in [1,2,3][1, 2, 3] dimensions.

This kernel function has a compact support of [0,3h][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δ,1.5δ][1.1\delta, 1.5\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

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 [3]. It is defined as:

W(r,h)=1hdw(r/h) W(r, h) = \frac{1}{h^d} w(r/h)

with:

w(q)=σ{(1q)3if 0q<1,0if q1,w(q) = \sigma \begin{cases} (1 - q)^3 & \text{if } 0 \leq q < 1, \\ 0 & \text{if } q \geq 1, \end{cases}

where dd is the number of dimensions and the normalization factor σ\sigma is 10/π10 / \pi in two dimensions or 15/π15 / \pi in three dimensions.

This kernel function has a compact support of [0,h][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δ,3.0δ][1.5\delta, 3.0\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source
TrixiParticles.WendlandC2KernelType
WendlandC2Kernel{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)=1hdw(r/h) W(r, h) = \frac{1}{h^d} w(r/h)

with

w(q)=σ{(1q)4(4q+1)if 0q<1,0if q1,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 dd is the number of dimensions and σ\sigma is a normalization factor dependent on the dimension. The normalization factor σ\sigma is 40/7π40/7\pi in two dimensions or 21/2π21/2\pi in three dimensions.

This kernel function has a compact support of [0,h][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δ,4.0δ][2.5\delta, 4.0\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source
TrixiParticles.WendlandC4KernelType
WendlandC4Kernel{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)=1hdw(r/h) W(r, h) = \frac{1}{h^d} w(r/h)

with

w(q)=σ{(1q)6(35q2/3+6q+1)if 0q<1,0if q1,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 dd is the number of dimensions and σ\sigma is a normalization factor dependent on the dimension. The normalization factor σ\sigma is 9/π9 / \pi in two dimensions or 495/32π495 / 32\pi in three dimensions.

This kernel function has a compact support of [0,h][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δ,4.5δ][3.0\delta, 4.5\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source
TrixiParticles.WendlandC6KernelType
WendlandC6Kernel{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)=1hdw(r/h)W(r, h) = \frac{1}{h^d} w(r/h)

with:

w(q)=σ{(1q)8(32q3+25q2+8q+1)if 0q<1,0if q1,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 dd is the number of dimensions and σ\sigma is a normalization factor dependent on the dimension. The normalization factor σ\sigma is 78/7π78 / 7 \pi in two dimensions or 1365/64π1365 / 64\pi in three dimensions.

This kernel function has a compact support of [0,h][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δ,5.0δ][3.5\delta, 5.0\delta], where δ\delta is the typical particle spacing.

For general information and usage see Smoothing Kernels.

source