sefffal / PlanetOrbits.jl

Tools for solving and displaying Keplerian orbits for exoplanets.
MIT License
33 stars 2 forks source link

Future Plans #7

Open sefffal opened 2 months ago

sefffal commented 2 months ago

The current package architecture has done an excellent job powering Octofitter, but we're starting to run up against limitations of the current API. In this issue, I want to outline my goals and ideas for a new package architecture.

Goals:

sefffal commented 2 months ago

In terms of specific architecture choices, my first instinct is to create a System parametric type that includes N (perhaps as low as zero) bodies and encodes a propagator. Encoding the number of bodies in the type has some advantages in allowing us to work with heterogeneous body types without dynamic dispatch.

We could adopt an inverse tree data type where each body is a lead node and holds a propagator object parent. Eg a moon could hold a planet with a Kepler solver, and the planet could hold a star with a Kepler solver. Alternatively, the planet could hold some kind of system object and an N body propagator. At the bottom of the tree could be a barycentre object encoding the position and velocity of the system as a whole. Calculating values with respect to another given body could result in a walk up the tree, calculating at each step.

On the other hand, it might be worth adopting a simpler architecture more inspired by rebound: 0-N bodies of the same data type indexed by a number only.