LV2000
03-07-2011, 01:48 PM
Hello,
I am trying to program a N-body simulator using the implementation of the 17th chapter of the book.
The code should distribute the work between several cores.
After thinking a little I figured out the following 2 ways:
1st) The most obvious way is to use an integrator on 6N equations. The issue with that is that I can't think of a way to parallelize the code (and I wouldn't want to mess up with the implementation)
2nd) The 2nd way is to compute the potential as a sum for every time step and then apply an integrator N times (for every particle) for a const time step dt. Then I update the coordinates and I do the same for the next time step. The advantage is that I can easily distribute the particles equally between the cores of the system, but I am not sure of the accuracy of this method.
Please can you comment on the above?
The object is to parrallelize without messing a lot with the numerical recipes implementation.
I am trying to program a N-body simulator using the implementation of the 17th chapter of the book.
The code should distribute the work between several cores.
After thinking a little I figured out the following 2 ways:
1st) The most obvious way is to use an integrator on 6N equations. The issue with that is that I can't think of a way to parallelize the code (and I wouldn't want to mess up with the implementation)
2nd) The 2nd way is to compute the potential as a sum for every time step and then apply an integrator N times (for every particle) for a const time step dt. Then I update the coordinates and I do the same for the next time step. The advantage is that I can easily distribute the particles equally between the cores of the system, but I am not sure of the accuracy of this method.
Please can you comment on the above?
The object is to parrallelize without messing a lot with the numerical recipes implementation.