hannorein / rebound

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

Alteration of the initial conditions in the simulation #668

Closed AlanCefali closed 9 months ago

AlanCefali commented 1 year ago

Hi,

I'm trying to simulate a particle between a binary star in a S-type configuration. Everything works perfectly in the case the second star has small mass, however for larger mass values, the initial condition added in the simulations is changed.

Example: "sim.add(m=1-0.1,r=0.005) # Star ; mu = 0.0909 sim.add(m=m2, a=1.0, e=0.05, r=rj/1.2, M=0, omega=0,Omega=0, primary=sim.particles[0]) sim.add(m=m3, a=0.4807498568, e=0.05, r=rp, M=0, omega=0,Omega=0,inc=np.radians(10),primary=sim.particles[0]) sim.move_to_com() # I already tried remove the "move_to_com" ps=sim.particles print("m3 :",ps[2].omega, ps[2].Omega, ps[2].M)"

The print returns: "m3 : 3.141592653589793 0.0 3.141592653589793"

Using m2 = 0.01, the print returns the correct initial conditions: "m3 : 0.0 0.0 0.0".

I also tried to use another value of G (different than 1) changing the semi-major axis but the results were the same.

What could it be? Can you help me?

Thank you!

Alan

hannorein commented 1 year ago

I believe what you see is just a manifestation of the fact that some orbital parameters are not uniquely defined and you're just at the boundary of where REBOUND makes a switch. For example, you can change omega and M by 180 degrees (pi) and have the same physical orbit if you also flip the sign of the inclination. If you print out all six orbital parameters, you might be able to convince you that the physical position of the planet is what you expect. There is no way to fix this coordinate issue. All your physical results should not depend on it. I hope that makes sense.

hannorein commented 9 months ago

I'll close this issue for now, but feel free to reopen it if you think there remains a problem.