matthewholman / assist

ASSIST is a software package for ephemeris-quality integrations of test particles.
https://assist.readthedocs.io/
GNU General Public License v3.0
24 stars 10 forks source link

Option to turn on/off different force terms #24

Closed hannorein closed 1 year ago

hannorein commented 1 year ago

(This pull requests build on the jpl_calc one. To see the important changes have a look at 4bc5c61c0f4ab7f75310a84f27b05d78a71bc075)

This pull request implements a way to turn on/off different forces. It adds a new variable forces in assist_extras to store which forces are to be included. By default all the force terms are included (using eig_gr). The user can turn off individual terms by doing something like this :

assist->forces ^= ASSIST_FORCE_PLANETS; // turn off contributions form planets
assist->forces ^= ASSIST_FORCE_ASTEROIDS; // turn off contributions form asteroids
assist->forces ^= ASSIST_FORCE_EARTH_HARMONICS; // turn off contributions form higher order harmonics from earth
assist->forces = ASSIST_FORCE_SUN; // Only consider the force from the sun

Implementation details: Basically, I've just added a few if statements in the force routines. The constants ASSIST_FORCE_.. are powers of two. This should not be a problem unless we'll ever have more than 31 different forces. All possible combinations can be achieved using logic operations (^= above is an in-place xor).

aryaakmal commented 1 year ago

This is great!

matthewholman commented 1 year ago

I completely agree with Arya. This is awesome!