hannorein / rebound

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

small unit inconsistency? #607

Closed r-zachary-murray closed 2 years ago

r-zachary-murray commented 2 years ago

Hi,

I noticed something odd in Rebound. I've used sim.units to generate a planet in a orbit at 1 AU around a 1 Solar Mass star with velocity appropriate for a circular orbit. When I do this I find the resulting orbit isn't quite circular, it has some very small eccentricity and a semi-major axis above one. I also attempted to do this an alternative way, by taking sim.G = 4 pi^2. In this case I get the expected result. See example here: https://github.com/r-zachary-murray/temp/blob/main/rebound_units/mre_example.ipynb.

I think this is because the numbers being used to do the scaling in sim.units - while very accurate - are slightly inconsistent with each other. Hence the question: what actual values are being used to do the sim.units scaling?

-Thanks

hannorein commented 2 years ago

I think this is because of the difference between a Julian year (the time unit you get when you choose "yr") versus a tropical year (the time the planet takes to complete one orbit).

I think Julian year does make sense as the default for "yr". We could add tropical year as another option, but there are so many potential issues, I'm really not sure it's worth it.

r-zachary-murray commented 2 years ago

I see that makes sense! Thanks for the clarification!

hannorein commented 2 years ago

You're welcome! Units are just a mess. G=1 always wins ;-)