1

I'm studying Müller's paper about Smoothed Particle Hydrodynamics (SPH).

To compute fluid viscosity, the following kernel function is proposed (paragraph 3.5, eq. 22):

$$W_{viscosity}(\mathbf{r}, h)=\frac{15}{2\pi h^3} \begin{cases} -\frac{r^3}{2h^3} + \frac{r^2}{h^2} + \frac{h}{2r} - 1, & 0 \le r \le h \\ 0 & \text{otherwise} \end{cases} $$

I'm interested in the 2D case, so I'm assuming that $$ h \in \mathbb{R}^+, \mathbf{r} \in \mathbb{R}^2, r=||\mathbf{r}||_2$$

Immediately after the kernel definition, it is stated that $$\nabla^2 W(\mathbf{r}, h)=\frac{45}{\pi h^6} (h - r)$$

but I get a different result when I calculate the Laplacian on my own.

I start with the linearity of the Laplacian operator:

$$ \nabla^2 (a \cdot f(\mathbf{x}) + b \cdot g(\mathbf{x})) = a\cdot\nabla^2 f(\mathbf{x}) + b \cdot \nabla^2 g(\mathbf{x})$$

Assuming $ 0 \le r \le h $ I have:

$$ \nabla^2 W_{viscosity}(\mathbf{r}, h) = \frac{15}{2\pi h^3} \left[ -\frac{ \nabla^2 ||\mathbf{r}||_2^3}{2h^3} + \frac{\nabla^2 ||\mathbf{r}||_2^2}{h^2} + \frac{h}{2}\nabla^2 \frac{1}{||\mathbf{r}||_2}\right] $$ where on the last term I dropped the $-1$ because it's an additive constant.

Given the following general rule:

$$\nabla^2 ||\mathbf{r}||_2^n = n^2 ||\mathbf{r}||_2^{n-2}$$

I need in particular: $$\nabla^2 ||\mathbf{r}||_2^3 = 9||\mathbf{r}||_2$$ $$\nabla^2 ||\mathbf{r}||_2^2 = 4$$ $$\nabla^2 \frac{1}{||\mathbf{r}||_2} = \frac{1}{||\mathbf{r}||_2^3}$$

Thus

$$ \frac{15}{2\pi h^3} \left[ -\frac{ \nabla^2 ||\mathbf{r}||_2^3}{2h^3} + \frac{\nabla^2 ||\mathbf{r}||_2^2}{h^2} + \frac{h}{2}\nabla^2 \frac{1}{||\mathbf{r}||_2}\right]$$ $$= \frac{15}{2\pi h^3} \left[ -\frac{ 9||\mathbf{r}||_2}{2h^3} + \frac{4}{h^2} +\frac{h}{2||\mathbf{r}||_2^3}\right]$$ $$= \frac{15}{2\pi h^3} \frac{-9||\mathbf{r}||_2^4 + 8h||\mathbf{r}||_2^3 + h^4}{2 h^3 ||\mathbf{r}||_2^3}$$ $$=\frac{15\left( -9||\mathbf{r}||_2^4 + 8h||\mathbf{r}||_2^3 + h^4 \right)}{4\pi h^6 ||\mathbf{r}||_2^3}$$

which is different from the Laplacian presented in the paper.

Surprisingly, Mathematica seems to agree with my derivation:

Wviscosity[rx_, ry_, h_] := With[
   {
       r = Sqrt[rx^2 + ry^2]
   },
   15/(2*\[Pi]*h^3)*
   Piecewise[{{-r^3/(2*h^3) + r^2/h^2 + h/(2*r) - 1, 0 <= r <= h}}, 0]
];

Laplacian[Wviscosity[rx, ry, h] , {rx, ry}] // FullSimplify

yields

Mathematica Laplacian result

I think it's unlikely that the paper is wrong, so what am I missing?

Thanks

1 Answers1

1

I finally found the error: I'm considering $\mathbf{r} \in \mathbb{R}^2$, while the paper assumes $\mathbf{r} \in \mathbb{R}^3$, which affects the laplacian formulas as well as the definition of $W_{viscosity}$.

I've found here a very good derivation of the smoothing kernels, which gives some insight on why the kernels are what they are. The presented 2D kernels agree with the ones reported by Muller himself here.

On a final note, it seems that many 2D SPH implementations just use the 3D kernel formulas whereas the 2D kernels should be used instead.

  • Many papers in the field simply omit the details of the kernel functions because they consider them as "community knowledge". I am sure they have the proper coefficients in their code otherwise the solution would be unstable. – BalazsToth Apr 28 '21 at 15:01