SPH-Water-Simulation icon indicating copy to clipboard operation
SPH-Water-Simulation copied to clipboard

Neighbour search finds self

Open abainbridge opened this issue 7 years ago • 0 comments

When SPHSolver::findNeighborhoods() generates the vector of neighbours for each particle, it include the particle itself. In other words a particle is found as a neighbour of itself. This seems wrong to me. Maybe I've misunderstood, but it looks like this causes the maths to go wrong and is also wasteful of CPU time.

SPHSolver::calculateDensity() finds the distance between each particle and its neighbours. Obviously the distance between a particle and itself is zero. Things go a bit wrong then, and ever particle gets 67000 added to its density.

Once the neighbour search is fixed, then denistySum needs to be initialised to REST_DENSITY in SPHSolver::calculateDensity(). And then to get back to a stable simulation, REST_DENSITY needs to be changed to about 40000 in the constants.cpp.

abainbridge avatar Mar 19 '17 14:03 abainbridge