hannorein / rebound

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

rebound not using particle masses when calculating Period #656

Closed AlessioPop closed 1 year ago

AlessioPop commented 1 year ago

Hi, I'm new to REBOUND,

I am not sure how REBOUND calculates the Period of an N-body system using the information of the added particles. Basically, I'm trying to calculate the Period of an orbit (see image) but for some reason when I print the Period it's implying that the total mass of the system is smaller than the combined mass of particles 1 and 2. I am not sure if it's using Jacobian values but when I plot the orbit it looks just fine only the Period is way too long when I integrate it over a time period.

Help

hannorein commented 1 year ago

Welcome to REBOUND! You have several typos in the line where you assign the units. Most importantly it's sim.units not sim.unit. Because of that you never get an error message. It should be something like:

sim.units = ('yr', 'sunmass', 'AU')

If you make that change you should see the correct period.

(For the future: please copy and paste code -- don't post a picture -- that makes debugging much easier).