# SPH Approximation of a Function

Let $\prod f\left(x\right)$ the integral approximation of a scalar function $f$ in space:

$\prod f\left(x\right)=\underset{\Omega }{\int }f\left(y\right)W\left(x-y,h\right)dy$

with $h$ the so-called smoothing length and $W$ a kernel approximation such that:

$\forall x,{\int }_{\Omega }W\left(x-y,h\right)dy=1$
and in a suitable sense
$\forall x,{\mathrm{lim}}_{h\to 0}W\left(x-y,h\right)=\delta \left(x-y\right)$

$\delta$ denotes the Dirac function.

Let a set of particles $i$ =1, n at positions ${x}_{i}$ ( $i$ =1,n) with mass ${m}_{i}$ and density ${\rho }_{i}$ . The smoothed approximation of the function $f$ is (summation over neighboring particles and the particle $i$ itself):

${\prod }_{s}f\left(x\right)=\sum _{i=1,n}\frac{{m}_{i}}{{\rho }_{i}}f\left({x}_{i}\right)W\left(x-y,h\right)$

The derivatives of the smoothed approximation are obtained by ordinary differentiation.

$\nabla f\left(x\right)=\sum _{i=1,n}\frac{{m}_{i}}{{\rho }_{i}}f\left({x}_{i}\right)\nabla W\left(x-y,h\right)$

The following kernel 1 which is an approximation of Gaussian kernel by cubic splines was chosen (Figure 1):

$r\le h⇒W\left(r,h\right)=\frac{3}{2\pi {h}^{3}}\left[\frac{2}{3}-{\left(\frac{r}{h}\right)}^{2}+\frac{1}{2}{\left(\frac{r}{h}\right)}^{3}\right]$
$h\le r\le 2h⇒W\left(r,h\right)=\frac{1}{4\pi {h}^{3}}{\left(2-\frac{r}{h}\right)}^{3}$

and
$2h\le r⇒W\left(r,h\right)=0$

This kernel has compact support, so that for each particle $i$ , only the closest particles contribute to approximations at $i$ (this feature is computationally efficient). The accuracy of approximating Equation 1 by Equation 4 depends on the order of the particles.

1 Monaghan J.J., Smoothed Particle Hydrodynamics, Annu.Rev.Astron.Astro-phys; Vol. 30; pp. 543-574, 1992.