oh sry maybe i misunderstood you. right now the particles move only based on the pressure gradient that is calculated using the spiky kernel. there is no extra kernel for repulsive forces when the particles are close because - as you can see - it works well if the spiky kernel is used on both (density/pressure and pressure forces). i just wonder why it works pretty well that way, as in many papers people tell you to use the poly 6 kernel for the density as it should result in more physically realistic behavior.
so i cant figure out why particles that get too close to each other do not repulse each other as the spiky kernel should provide repulsive forces. the question is why they even start to get so close in the first place. must have something todo with the kernel i do not understand. as if the particles have to get really close to reach the desired density.
edit: what about the ideal gas btw
?
Ah okay, slight misunderstanding. I compute a local density for each interacting particle pair and use that value for a repulsive-only "local" pressure force. Then I sum up all local densities to a "global" density value, which is used in an attractive-repulsive pressure kernel. This is a fail-safe way to 100% avoid clumping. There are many, many different kernels for computing density, pressure, and viscosity, and you are completely free to invent your own. My kernels are self-invented for working without knowing the distance between particles. This way I don't need to normalize vectors and hence not use square-root, which makes the simulation much faster.
In my experience, clumping happens when two particles are pushed very close together, and the kernels aren't capable to separate them; they make each others density kernels reach a value higher than rest-density, resulting in a high pressure. Then the pressure kernel pushes all other particles away from the two, but it doesn't manage to separate the particles causing the high density.