hannorein / rebound

💫 An open-source multi-purpose N-body code.
https://rebound.readthedocs.io/
GNU General Public License v3.0
842 stars 218 forks source link

WHDS coordinates in WHFAST with OpenMP? #363

Closed christophb02 closed 5 years ago

christophb02 commented 5 years ago

Hi, I am simulating systems of star + planetary embryos + planetesimals and use WHFAST + WHDS coordinates (for some reason democratic heliocentric coord. are much less accurate, e.g. in the energy error, perhaps due to close encounters with the star). Is there a (deeper) reason why WHDS coordinates are not OpenMP-parallelized, besides that you may simply have not needed it so far?

Thanks and cheers, Christoph

hannorein commented 5 years ago

The accuracy depends on the specific simulation, i.e. which two particles have a close encounter.

There is no reason why the WHDS coordinates are not parallelized. I just didn't need it yet myself. It should be pretty simple to add a few pragma statements yourself. If you're having trouble with it, maybe post a short example setup of the kind of simulation you're interested in and I could try to parallelize it.

christophb02 commented 5 years ago

Thanks for the advice!

I have included the Rebound integrators in a C program which has grown quite extensive meanwhile (several 1000 lines of code), so posting a short code example is not directly possible. However, I simulate a star, gas giants (currently the Sun+Jupiter+Saturn), and few hundred planetary embryos (fully interacting) and planetesimals (testparticle_type = 1) in the terrestrial planet region. The bulk of the integration is done with WHFAST, and for close encounters it switches to IAS15 (for all bodies). (Currently I don't use MERCURIUS because when I started this project the documentation said that it was still in an experimental stage.)

Well, if you find some time to quickly OpenMP-parallelize the WHDS coordinates this would be great and very helpful (you know the code much better than me), but otherwise I can also try it myself!

Thanks for your help! Christoph

hannorein commented 5 years ago

Hi Christoph,

It took me a while, but I think I've made all the changes for OpenMP to work with WHDS. It's on the master branch now. Whether it's fast or not really depends on the application and will probably require some fine tuning. I hope it's correct, but take these changes with a grain of salt and let us know if you think something is wrong. I'll close this issue for now.

Hanno

christophb02 commented 5 years ago

Dear Hanno,

thank you very much! I will start testing it immediately and of course I let you know if I find anything odd or suspicious!

All the Best, Christoph