dtamayo / reboundx

A library for adding additional forces to the REBOUND N-body integration package
GNU General Public License v3.0
80 stars 60 forks source link

Question about documentation #71

Closed alekseygenerozov closed 2 years ago

alekseygenerozov commented 2 years ago

I was wondering about the following statement in section 6.1 docs: "Note that we should specifically update the passed particles array (NOT sim->particles)."

What exactly is the issue with doing this? Would updating sim->particles also be an issue for new effects?

I know this is not an issue per se, so apologies if this is not the right forum.

Thank you!

Aleksey

hannorein commented 2 years ago

(@dtamayo should confirm)

This is because some additional computation has to be done for certain coordinate systems. For example, the WHFast integrator can use Jacobi coordinates. If an additional force is applied to one particle, it will also affect other particles.

dtamayo commented 2 years ago

Questions always welcome! @hannorein is right as usual :) We sometimes need to evaluate the forces using an arbitrary array of particles and not using the current sim->particles array (e.g., evaluating the forces using particle states at different sub-timesteps in the rk integrator for intermediate calculations )