Regarding the recent post in p.b.o-t about RK methods and n-body simulations,
here's what happens if you use the tree method. See p.b.a. for animation. The
simulation itself only took a couple hours up to this point with 30000
particles.
Again, it's not actually correct, but there's a threshold parameter that
determines when calculating forces whether the ratio of the potential size of a
node relative to the distance to that node is large enough that you need to look
at the children more closely. If the threshold is zero then you look at the
whole tree ( O(n^2) ); if it's too big you overlook a lot of detail ( O(n log
n) ). Somewhere in the middle is apparently a good enough compromise to within
a few percent. The force calculation is expensive enough that building the
tree at each RK sub-time-step is very little overhead.
There's a c program with an OpenGL interface if anyone's interested although
I'll have to make a couple parameters more obvious before posting. Thanks for
the fun idea!
- Ricky
Post a reply to this message
Attachments:
Download 'nbody.jpg' (121 KB)
Preview of image 'nbody.jpg'
|