SPH Kernels

Definition of some SPH kernel functions

class pysph.base.kernels.CubicSpline(dim=1)[source]

Bases: object

Cubic Spline Kernel: [Monaghan1992]

\[\begin{split}W(q) = \ &\sigma_3\left[ 1 - \frac{3}{2}q^2\left( 1 - \frac{q}{2} \right) \right], \ & \textrm{for} \ 0 \leq q \leq 1,\\ = \ &\frac{\sigma_3}{4}(2-q)^3, & \textrm{for} \ 1 < q \leq 2,\\ = \ &0, & \textrm{for}\ q>2, \\\end{split}\]

where \(\sigma_3\) is a dimensional normalizing factor for the cubic spline function given by:

\[\begin{split}\sigma_3 = \ & \frac{2}{3h^1}, & \textrm{for dim=1}, \\ \sigma_3 = \ & \frac{10}{7\pi h^2}, \ & \textrm{for dim=2}, \\ \sigma_3 = \ & \frac{1}{\pi h^3}, & \textrm{for dim=3}. \\\end{split}\]

References

[Monaghan1992](1, 2) J. Monaghan, Smoothed Particle Hydrodynamics, “Annual Review of Astronomy and Astrophysics”, 30 (1992), pp. 543-574.
dwdq(rij=1.0, h=1.0)[source]
Gradient of a kernel is given by
\[\]

abla W = normalization rac{dW}{dq} rac{dq}{dx}

abla W = w_dash rac{dq}{dx}

Here we get w_dash by using dwdq method
get_deltap()[source]
gradient(xij=[0.0, 0, 0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.Gaussian(dim=2)[source]

Bases: object

Gaussian Kernel: [Liu2010]

\[\begin{split}W(q) = \ &\sigma_g e^{-q^2}, \ & \textrm{for} \ 0\leq q \leq 3,\\ = \ & 0, & \textrm{for} \ q>3,\\\end{split}\]

where \(\sigma_g\) is a dimensional normalizing factor for the gaussian function given by:

\[\begin{split}\sigma_g = \ & \frac{1}{\pi^{1/2} h}, \ & \textrm{for dim=1}, \\ \sigma_g = \ & \frac{1}{\pi h^2}, \ & \textrm{for dim=2}, \\ \sigma_g = \ & \frac{1}{\pi^{3/2} h^3}, & \textrm{for dim=3}. \\\end{split}\]

References

[Liu2010](1, 2) M. Liu, & G. Liu, Smoothed particle hydrodynamics (SPH): an overview and recent developments, “Archives of computational methods in engineering”, 17.1 (2010), pp. 25-76.
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.QuinticSpline(dim=2)[source]

Bases: object

Quintic Spline SPH kernel: [Liu2010]

\[\begin{split}W(q) = \ &\sigma_5\left[ (3-q)^5 - 6(2-q)^5 + 15(1-q)^5 \right], \ & \textrm{for} \ 0\leq q \leq 1,\\ = \ &\sigma_5\left[ (3-q)^5 - 6(2-q)^5 \right], & \textrm{for} \ 1 < q \leq 2,\\ = \ &\sigma_5 \ (3-q)^5 , & \textrm{for} \ 2 < q \leq 3,\\ = \ & 0, & \textrm{for} \ q>3,\\\end{split}\]

where \(\sigma_5\) is a dimensional normalizing factor for the quintic spline function given by:

\[\begin{split}\sigma_5 = \ & \frac{1}{120 h^1}, & \textrm{for dim=1}, \\ \sigma_5 = \ & \frac{7}{478\pi h^2}, \ & \textrm{for dim=2}, \\ \sigma_5 = \ & \frac{1}{120\pi h^3}, & \textrm{for dim=3}. \\\end{split}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.SuperGaussian(dim=2)[source]

Bases: object

Super Gaussian Kernel: [Monaghan1992]

\[\begin{split}W(q) = \ &\frac{1}{h^{d}\pi^{d/2}} e^{-q^2} (d/2 + 1 - q^2), \ & \textrm{for} \ 0\leq q \leq 3,\\ = \ & 0, & \textrm{for} \ q>3,\\\end{split}\]

where \(d\) is the number of dimensions.

dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.WendlandQuintic(dim=2)[source]

Bases: object

The following is the WendlandQuintic kernel(C2) kernel for 2D and 3D.

\[\begin{split}W(q) = \ & \alpha_d (1-q/2)^4(2q +1))), \ & \textrm{for} \ 0\leq q \leq 2,\\ = \ & 0, & \textrm{for} \ q>2,\\\end{split}\]

where \(d\) is the number of dimensions and

\[\begin{split}\alpha_d = \ & \frac{7}{4\pi h^2}, \ & \textrm{for dim=2}, \\ \alpha_d = \ & \frac{21}{16\pi h^3}, \ & \textrm{for dim=3}\end{split}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0, 0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.WendlandQuinticC2_1D(dim=1)[source]

Bases: object

The following is the WendlandQuintic kernel (Wendland C2) kernel for 1D.

\[\begin{split}W(q) = \ & \alpha_d (1-q/2)^3 (1.5q +1))), \ & \textrm{for} \ 0\leq q \leq 2,\\ = \ & 0, & \textrm{for} \ q>2,\\\end{split}\]

where \(d\) is the number of dimensions and

\[\alpha_d = \frac{5}{8h}, \textrm{for dim=1}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0, 0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.WendlandQuinticC4(dim=2)[source]

Bases: object

The following is the WendlandQuintic kernel (Wendland C4) kernel for
2D and 3D.
\[\begin{split}W(q) = \ & \alpha_d (1-q/2)^6(\frac{35}{12} q^2 + 3q +1))), \ & \textrm{for} \ 0\leq q \leq 2,\\ = \ & 0, & \textrm{for} \ q>2,\\\end{split}\]

where \(d\) is the number of dimensions and

\[\begin{split}\alpha_d = \ & \frac{9}{4\pi h^2}, \ & \textrm{for dim=2}, \\ \alpha_d = \ & \frac{495}{256\pi h^3}, \ & \textrm{for dim=3}\end{split}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.WendlandQuinticC4_1D(dim=1)[source]

Bases: object

The following is the WendlandQuintic kernel (Wendland C4) kernel for 1D.

\[\begin{split}W(q) = \ & \alpha_d (1-q/2)^5 (2q^2 + 2.5q +1))), \ & \textrm{for} \ 0\leq q \leq 2,\\ = \ & 0, & \textrm{for} \ q>2,\\\end{split}\]

where \(d\) is the number of dimensions and

\[\alpha_d = \frac{3}{4h}, \ \textrm{for dim=1}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.WendlandQuinticC6(dim=2)[source]

Bases: object

The following is the WendlandQuintic kernel(C6) kernel for 2D and 3D.

\[\begin{split}W(q) = \ & \alpha_d (1-q/2)^8 (4 q^3 + 6.25 q^2 + 4q +1))), \ & \textrm{for} \ 0\leq q \leq 2,\\ = \ & 0, & \textrm{for} \ q>2,\\\end{split}\]

where \(d\) is the number of dimensions and

\[\begin{split}\alpha_d = \ & \frac{78}{28\pi h^2}, \ & \textrm{for dim=2}, \\ \alpha_d = \ & \frac{1365}{512\pi h^3}, \ & \textrm{for dim=3}\end{split}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
class pysph.base.kernels.WendlandQuinticC6_1D(dim=1)[source]

Bases: object

The following is the WendlandQuintic kernel (Wendland C6) kernel for 1D.

\[\begin{split}W(q) = \ & \alpha_d (1-q/2)^7 (\frac{21}{8} q^3 + \frac{19}{4} q^2 + 3.5q +1))), \ & \textrm{for} \ 0\leq q \leq 2,\\ = \ & 0, & \textrm{for} \ q>2,\\\end{split}\]

where \(d\) is the number of dimensions and

\[\alpha_d = \ \frac{55}{64h}, \textrm{for dim=1}\]
dwdq(rij=1.0, h=1.0)[source]
get_deltap()[source]
gradient(xij=[0.0, 0.0, 0.0], rij=1.0, h=1.0, grad=[0, 0, 0])[source]
gradient_h(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
kernel(xij=[0.0, 0, 0], rij=1.0, h=1.0)[source]
pysph.base.kernels.get_compiled_kernel(kernel)[source]

Given a kernel, return a high performance wrapper kernel.

pysph.base.kernels.get_correction(kernel, h0)[source]