How to simulate planets orbit curce around the sun ?

In summary, the author provides a summary of how to simulate planets orbit curve around the sun. He explains that you need to know Keplers laws of planetary motion, and that you need to make nested iterative loops to plot all points in orbits, calculate the force vector pulling on them from the parent body, and calculate the change in velocity. He also warns that you need to make sure that the coordinates of the planets are consistent with the coordinates of the parent body, and that if you stop at that, your simulated planets will soon wander off, or crash into the Sun, or do something else equally bizzare.
  • #36
DrStupid said:
Most of the time is used for the calculation of accelerations and this is not that difficult to parallelize. For an n-body system there are n·(n-1)/2 connections. With k processors just assign n·(n-1)/(2·k) to every processor. Simultaneous memory access can be avoided by mirroring position and mass data k times. It might be also useful to parallelize parts of the numerical integrator but everything else does not need to be optimized.
It is very hard to parallelize. Derivative computations can be expensive (e.g., a plate model for aerodynamic drag, non-spherical gravity, a throttleable rocket with a complex buildup/trailoff, a stiff set of robotic arm links, ...), and then yes, the derivative calculations vastly overwhelm the integration. Assuming simple Newtonian gravity calculations for spherical mass distributions, the problem at hand has exceeding simple derivative calculations. The overhead of coarse grain parallelism (e.g., threads) is going to swamp any gains from using threads -- particularly so if one is using a sophisticated integration technique.

Fine-grain parallelism is a different story. It is possible to farm out the entire integration process to a GPU. It's a pain in the rear and it's not very portable, but it is doable.
 
Astronomy news on Phys.org
  • #37
D H said:
...
Assembly programming is a a niche field today, mostly relegated to area of firmware. To quote John Moore (of Moore's law fame), "He who hasn't hacked assembly language as a youth has no heart. He who does as an adult has no brain."

Assembly is pretty much dead in the field of scientific programming, and has been for a couple of decades ...
I agree that assembly language can be very tedious and also it is not very portable. But also it can be very fun. But maybe I have a bizarre way of having fun! And if Moore is right then I should have a heart, but no brain ... That is something to think about :-)
 
Back
Top