2

I am trying to write some code for a fluid simulation. I have read about Smoothed Particle Hydrodynamics (SPH) and my question is related to the properties of the smoothing kernel.

  1. How do I set the support $h$ for a kernel?

I found the following kernel function used in SPH

$$\frac{315}{64 \pi h^9}(h^2 - r^2)^3 dr$$

Since one of the properties of the kernel used is that it has to be normalized, i.e. $$\int_{-h}^{h} \frac{315}{64 \pi h^9}(h^2 - r^2)^3 dr = 1$$

  1. I think that to set the correct value for $h$ is to compute that integral, is this correct?

I ask this because with random numbers in my code I found that it just doesn't work and I start to believe it is my problem is related to the parameters of the simulation, like the support of the kernel.

Kyle Kanos
  • 29,127
BRabbit27
  • 165

2 Answers2

4

This is a fairly old question, but given the current answer, I feel a need to add my own here as well for future reference.

$h$ is indeed an adjustable parameter. The problem with your integral is that it assumes a 1 dimensional setting while your smoothing kernel assumes a 3 dimensional setting. assuming a spherical coordinate system, the correct integral would be $$\frac{315}{64\pi h^9} \int_0^{2\pi}\int_0^\pi\int_0^hr^2(h^2 - r^2)^3 sin(\theta)dr d\theta d\phi = 1 $$ This triple integral integrates over a 3 dimensional space with length $h$, where the smoothing length $h$ is of arbitrary length and always normalizes to 1. This is pretty much how the normalization constant, $\frac{315}{64\pi h^9}$, for this particular kernel is computed. This does however mean that this constant is also not applicable if you're trying to do a 2D SPH simulation. If I've done my math right, for a 2D simulation, you should be using the normalization constant $\frac{4}{\pi h^8}$ instead

This said, SPH can be very sensitive to parameter settings, so while the kernel is normalized for any length $h$, not every length $h$ will produce stable simulations, at least not for every $m$ and $\rho_0$ where $m$ is the mass of a single particle and $\rho_0$ is the rest density.

Kazesui
  • 41
1

The parameter $h$ is the maximum distance that two smoothed particles, $a$ and $b$, can be before the distance between them is negligible for SPH purposes. If the distance, $\vert r_a-r_b\vert>h$ then the weight is zero.

For any kernel, the integral over the particular region, e.g. $r\in(-h,\,h)$, is necessarily 1. Since $h$ is an unknown parameter, then you must solve the integral for $h$. In your case, I get $h=3/\sqrt{2\pi}\simeq1.2$.

Kyle Kanos
  • 29,127