I'm implementing basic fluid flow simulator using SPH method basing on e.g. https://www10.informatik.uni-erlangen.de/Publications/Theses/2010/Staubach_BA10.pdf.

EDIT (dead url): https://www10.cs.fau.de/publications/theses/2010/Staubach_BT_2010.pdf

So far I've implemented:

  • uniform grid constructing

  • density and pressure field calculating

  • pressure force and viscosity force calculating
  • velocity damping force calculating
  • surface tension force (surface normal and curvature value) calculating
  • acceleration and velocity calculating (basing on these forces and gravity force)

Unfortunately I have a problem with calibrating parameters to avoid particles clustering or spreading them in every possible direction.

Is there a way other than random to calculate proper values of simulation parameters?

My parameters are:

  • particle radius - (I'd like it to be 0.3 and to set other parameters corresponding to this one)
  • smoothing radius - 4*particle radius = 1.2
  • particle mass - decides about everything
  • stiffness - decides about value of pressure force (k in 2.19 equation)
  • rest density - decides about pressure field (ρ0 in 2.19 equation)
  • dynamic viscosity - decides about value of viscosity force (μ in 2.25 equation)
  • gravity force - (0.0, -9.81, 0.0)
  • velocity damping - decides about value of damping force (F = -velocity damping * velocity)
  • tension coefficient - decides about value of surface tension force (σ in 2.30 equation)
  • tension treshold - minimal length of surface normal to calculate surface tension force (l in 2.31 equation)
  • time step

I'm pretty sure that my calculations are fine. Unfortunately example values from this or other documents don't work for me and I probably need to calculate them on my own.

I'll be glad to answer any questions about my implementation to help you help me. :)

Oh, almost forgot, I'm using CUDA 6.0.

  • $\begingroup$ Do you mean you have a hard time 1. setting the initial conditions or 2. that the particles tend to gather as time passes ? $\endgroup$ Aug 22 '14 at 7:35
  • $\begingroup$ I try to set initial condition for e.g box of 10x10x10 particles. I can't figure out parameters so it acts like water (form some kind of stable droplet and fall down with gravity). Particles explode, pulse like a heart and form clusters or collapse. $\endgroup$
    – Aerion
    Aug 22 '14 at 13:55
  • $\begingroup$ Would you be willing to share your code so we can have a look? Also the link you posted is broken. $\endgroup$
    – nluigi
    Aug 6 '17 at 7:50

A few constraints that usually work in scientific SPH (weakly compressible) computations:

  • particle radius or influence radius, $\Delta$: define it arbitrarily to set the resolution.

  • smoothing radius, $h$: it depends on the kernel function, in your case $h=\Delta/4$.

  • rest density $\rho_0$: 1000 for water.

  • particle mass, $m$: The number of neighbours in 3D should be about $n=50$. The mass can be calculated as: $m=\frac{4\Delta^3\pi}{3n}\rho_0$

  • Stiffness: $c<10u_{max}$, where $u_{max}$ is the maximum velocity expected in the simulation.

  • Viscosity $\mu$: The link is dead, so I don't see the equation but is assume $\mu\approx0.01..0.1$

  • time step: $dt_{max}\approx0.2\min\bigg(\sqrt{\frac{h}{a_{max}}},\frac{h}{c}\bigg)$

  • initial interparticle distance: $dx=\sqrt[3]{\frac{4\Delta^3\pi}{3n}}$

  • $\begingroup$ Do you have a reference for these values as recommended values? $\endgroup$
    – Paul
    Oct 2 '17 at 21:56

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.