# Problems in SPH implementation

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 16, 2017, 15:37 Problems in SPH implementation #1 New Member   Join Date: Nov 2017 Posts: 4 Rep Power: 7 Hi there everyone! I'm trying to implement SPH using CPU single core. I'm having troubles in making it stable. I'd like some help in order to understand what is wrong and how could I fix it. Please, take a look at the following videos: Water inside sphere using Kelager's parameters Water inside big box Water inside thinner box I've already tried using XSPH, the hash method to find the neighbors (now I'm using the regular grid, because the hash method didn't work for me) and two different ways of calculating the pressure force. Any ideas? Thanks! Last edited by YardenJ2R; November 17, 2017 at 07:25. Reason: Putting titles on the videos links

 November 17, 2017, 13:11 #2 New Member   Join Date: Nov 2017 Posts: 4 Rep Power: 7 I'm using mostly the following articles: Particle-Based Fluid Simulation for Interactive Applications, Matthias Müller, David Charypar and Markus Gross Lagrangian Fluid Dynamics Using Smoothed Particle Hydrodynamics, Micky Kelager Smoothed Particle Hydrodynamics Real-Time Fluid Simulation Approach, David Staubach It seems that the pressure force is being calculated better through Müller equation than Kelager's (both can be found in Kelager's article, one is equation 4.10 and the other is 4.11).

 November 17, 2017, 16:20 #3 New Member   Join Date: Nov 2017 Posts: 4 Rep Power: 7 I've just tested simulating steam as well (as described by Kelager): Steam inside a sphere I'm posting here because you guys that have more experience than me in CFD simulations could have an idea of what is going on (e.g., the problem probably is with the pressure force, or viscosity, or fiding the neightbors, or with collision response, etc). I can post the Fluid class if you guys need it. Thanks!

 November 17, 2017, 18:55 #4 Senior Member   Arjun Join Date: Mar 2009 Location: Nurenberg, Germany Posts: 1,149 Rep Power: 30 looking at all the videos so far, i would say that your instability is coming from lack of neighbors in some of the particles. Please check how others are handling when number of neighbors fall below certain level. Everything else looks good. Did you try the same with with smaller time step too and see when it becomes unstable.

November 20, 2017, 11:00
#5
New Member

Join Date: Nov 2017
Posts: 4
Rep Power: 7
Quote:
 Originally Posted by arjun looking at all the videos so far, i would say that your instability is coming from lack of neighbors in some of the particles. Please check how others are handling when number of neighbors fall below certain level. Everything else looks good. Did you try the same with with smaller time step too and see when it becomes unstable.

About that lack of neighbors, I've read some articles, but none talked about it. Actually, I'm not sure if that's the problem. The first and the third video shows a good number of neighbors, don't you think?

Kelager says that near-incompressibility can be achieved by increasing k (gas stiffness) and decreasing the timestep. I did that and the results are totally diferente. It seems more stable actually, but it feels less like a liquid. Also, if I decrease the timestep and increase the gas stiffness, then the liquid won't stop. It only stopped when I added a kind of friction for the velocity after collision.

Which is the problem with the box in your opinion? Thanks again!

Observation: I've seen that in at least one video, the timestep in the record is wrong. Please, read the description in the video. There's the correct value.

 Tags sph