remove particles in parallel

Hello forum,

Say I have many particles moving around. I simulate their motion in a parallel manner. The density of the particles could vary inside the space due to their movement. When they get too dense, it’s hard to see them clearly. So the idea is removing some particles from the high density area.

Here comes a problem. Suppose a particle A knows about its local density and the density is too high.So it wants to remove itself from the space. In A’s neighborhood, there is another particle B, which also decides to remove itself because of the hight density. And there are other particles in the same neighborhood, they all decide to remove themselves because of the high local density. If everything happens in parallel, we will end up getting a very low density area, or even an empty area.

Is there a good way to handle this kind of problem in parallel?

Thank you,

It seems to me this could be addressed by making the removal probabilistic, where the probability of removal is a function of local density. For example, if the number of neighbors in a bounding radius is 16, but the target density is 4, each particle would remove itself with probability 12/16, e.g. implemented by generating a random number between 0 and 1 and removing itself when the number is less than 0.75.

Or use a regular pattern (selected as a function of local density) for blanking out certain particles. That way the same particles will disappear over multiple frames of your simulation+visualization.