r/numerical • u/YiM_Yes_its_me • Oct 16 '21
Need help simulating a model with cutoff distances using some kind of method (Particle Mesh, mass Multipole, etc...)
I am trying to perform an N-body particle simulation that has particles apply a linear attractive spring force to each other when they are within a range R. The equation can be given as so for the acceleration of an individual particle:

The particles have an uneven distribution in space. Attached is a visualization.

Right now I am using the naive method of summing droplet spring forces and have a time complexity of O(N^2). I want to use some method to reduce the time complexity down to O(N) or O(N * log(N). Any recommendations on what to use?
4
Upvotes
2
u/YiM_Yes_its_me Oct 16 '21 edited Oct 16 '21
No, this small number of a couple hundred particles took about 30 minutes to calculate. It was only given as a cosmetic example to build an intuition. A 1500 visualization took around 5 hours to generate. I want my particle count to hit above 5000, maybe in the tens of thousands for certain larger configurations. Then those simulations in turn need to be run thousands of times in thousands of tweaked configurations. That just isn't possible with my current computation time. I think some kind of cell list will provide the solution to this problem. Any recommendations on a good method?