danieljprice / phantom

Phantom Smoothed Particle Hydrodynamics and Magnetohydrodynamics code
https://phantomsph.github.io
Other
103 stars 223 forks source link

set_binary should take periastron distance instead of semi-major axis by default #445

Open danieljprice opened 1 year ago

danieljprice commented 1 year ago

Related to #302, to allow use of set_binary for orbits with e >= 1, it would be simpler for the set_binary routine to accept the pericentre distance by default instead of the semi-major axis. This would simplify setup of elliptic vs parabolic/hyperbolic orbits since one could use the same parameter for all cases, and hence make a single call to set_binary, e.g. in setup_grtde.f90

This change would have no effect on the user-facing parameters in the .setup files, as individual .setup files could still read the semi-major axis as the input parameter as desired and convert this to rp. But several routines already do this the other way round (reading rp and converting to a)

A possible argument against is that fixing "a" fixes the energy and period of the orbit while varying the eccentricity, while fixing rp does not.

It would be straightforward enough to make both possible: give either rperi= or semimajoraxis= as optional arguments.