I am making a half simulator and half game with fluid simulation, using smoothed particle hydrodynamics (SPH) as the model. I was using "artificial viscosity" as my viscosity mainly to dampen energetic relative motion. It was quite hard to make stable, though, while also fast, so I went and tried "the usual" viscosity which is based around, $$\mathbf{f}^\text{visc}_i\sim\sum_j (\mathbf v_i-\mathbf v_j)\cdot\nabla^2 W\left(\mathbf r_i-\mathbf r_j,\,h\right)$$ where $W(x,\,h)$ is the kernel (see Eq 17 of this 2004 MS thesis by Kenneth Holmlund).

The issue with this method, compared to Monaghan's artificial viscosity (see page 20 of these lecture notes by Klessen or section 4.1 of Monaghan (1992)), is that it seems to dampen rigid body rotation - meaning particles not moving relative to each other, but spinning as a whole, like a planet. If I collapse the fluid to form a spinning planet, the spin will vanish over time with this simple viscosity.

I would expect this to be known, but I have not been able to find confirmation anywhere. I suspect two groups use SPH and neither have issues. In actual scientific models, the simple viscosity is not used and is not a problem and in gaming, it is fine that motion is dampened.

Can someone here real quick confirm that the "simple viscosity" outlined above does in fact prevent rigid body rotation and perhaps even suggest a correction term to correct it? Any references on this would be much appreciated.

  • $\begingroup$ I vaguely recall Monaghan's 1992 paper saying the viscosity was Galilean invariant and vanished for rigid body rotation. But I don't have access to it here to check. $\endgroup$ – tpg2114 Feb 16 '18 at 13:27
  • $\begingroup$ Sorry, I was playing a bit fast and loose with how I posed my question. I added a few references explaining what I am actually talking about. $\endgroup$ – Tom Taic Feb 16 '18 at 13:58
  • 1
    $\begingroup$ You're adding a term which damps relative velocity, and indeed rigid-bodies do have relative velocity [consider $v(r)$ vs. $v(r + dr)$ for circular motion], so one would expect their rotation to be damped out. Usually in these types of simulations a solid body is treated differently from the fluid (or the other fluid). $\endgroup$ – DilithiumMatrix Feb 16 '18 at 14:29

The naive differential operator with second order derivative of the kernel function gives poor estimation on the laplacian because of at least two reasons, making it almost useless in scientific computing.

Firstly, the relative position of the particles are not implied (only the distance between them) in the calculation, which means that the motion is damped regardless of the local particle layout. Consequently, it prevents rigid body rotation as well.

Secondly, most of the widely used kernel functions have inflection points, changing the sign of the second derivative within their influence radii. Obviously, this is fateful from both the accuracy and conservativity point of views. Consider for instance the problem of 1D heat conduction, where the second order PDE

$\frac{\partial T}{\partial t}=\frac{\partial^2T}{\partial x^2}$

governs the diffusion of heat in a solid body. Counterintuitively, simply due to the change of the sign of W, heat would be able to flow from cold to hot regions locally, violating the second law of thermodynamics.

I suggest to apply the artificial viscosity:

$\langle \Delta \textbf{v}_i\rangle=\alpha\sum_j^n \frac{2\textbf{v}_{ji}\textbf{r}_{ji}}{\vert\textbf{r}_{ji}\vert^2}\nabla W_{ij}V_j$,

where $\textbf{v}_{ji}=\textbf{v}_{j}-\textbf{v}_{i}$ and $\alpha=0.001..0.1$ is an adjustable parameter for the rate of viscosity. Artificial viscosity reduces the kernel derivative to first order by a Taylor series expansion of the local velocity, hence takes the relative position into account. Thereby, artificial viscosity kills non-physical oscillations by keeping the viscosity low especially for rigid body rotation. I suspect that there might have been some bugs in your implementation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.