system
Contents
system.c
Subroutines that control system-wide properties.
- Author
Rory Barnes (RoryBarnes)
- Date
May 7 2014
Functions
-
double fdMeanMotionToSemi(double dMass1, double dMass2, double dMeanMotion)
-
double fdPeriodToSemi(double dPeriod, double dMass)
-
double fdSemiToPeriod(double dSemi, double dMass)
-
double fdSemiToMeanMotion(double dSemi, double dMass)
-
double *fdOrbAngMom(BODY *body, CONTROL *control, int iBody)
Compute the orbital angular momentum of the iBodyth body as J = mu*sqrt(GMA(1-e^2)) for each orbiting body
-
double fdOrbPotEnergy(BODY *body, CONTROL *control, SYSTEM *system, int iBody)
Compute orbital potential energy neglecting planet-planet potential energy
-
double fdOrbKinEnergy(BODY *body, CONTROL *control, SYSTEM *system, int iBody)
Compute orbital kinetic energy of a body
-
double fdOrbEnergy(BODY *body, CONTROL *control, SYSTEM *system, int iBody)
Compute total orbital energy for a given body
-
double fdKinEnergy(BODY *body, CONTROL *control, SYSTEM *system, int iBody)
Compute total non-orbital kinetic energy of a body
-
double fdPotEnergy(BODY *body, CONTROL *control, SYSTEM *system, int iBody)
Compute a body’s non-orbital potential energy
-
double fdTotEnergy(BODY *body, CONTROL *control, SYSTEM *system)
Compute the total energy in the entire system, include lost energy
-
void kepler_eqn(BODY *body, int iBody)
Solves kepler’s equation for one body
- Parameters:
body – Struct containing all body information and variables
iBody – Index of body in question
-
void osc2cart(BODY *body, int iNumBodies)
Converts osculating orbital elements to Cartesian coordinates (in au & au/day)
- Parameters:
body – Struct containing all body information and variables
iNumBodies – Number of bodies in the system (star & planets)
-
void astro2bary(BODY *body, int iNumBodies)
Converts astrocentric Cartesian coordinates to barycentric
- Parameters:
body – Struct containing all body information and variables
iNumBodies – Number of bodies in the system (star & planets)
-
void bary2astro(BODY *body, int iNumBodies)
Converts barycentric Cartesian coordinates to astrocentric
- Parameters:
body – Struct containing all body information and variables
iNumBodies – Number of bodies in the system (star & planets)
-
void angularmom(BODY *body, double *AngMom, int iNumBodies)
Calculates angular momentum vector of planetary system
- Parameters:
body – Struct containing all body information and variables
AngMom – Resulting angular momentum vector
iNumBodies – Number of bodies in the system (star & planets)
-
void rotate_inv(BODY *body, SYSTEM *system, int iNumBodies)
Rotate coordinates into invariable plane
- Parameters:
body – Struct containing all body information and variables
system – Struct containing system information
iNumBodies – Number of bodies in the system (star & planets)
-
double normv(double *vector)
Calculates the magnitude of a vector
- Parameters:
vector – Any vector you what the magnitude of
- Returns:
The magnitude of vector
-
void cart2osc(BODY *body, int iNumBodies)
Converts Cartesian coordinates (in au & au/day) to osculating orbital elements
- Parameters:
body – Struct containing all body information and variables
iNumBodies – Number of bodies in the system (star & planets)
-
void inv_plane(BODY *body, SYSTEM *system, int iNumBodies)
Calculates coordinates of planetary system with respect to invariable plane
- Parameters:
body – Struct containing all body information and variables
system – Struct containing system information
iNumBodies – Number of bodies in the system (star & planets)
-
double fdMutualInclination(BODY *body, int iBody, int jBody)
Calculate the mutual or relative inclination of the orbital planes of iBody and jBody.
-
int fbCheckMaxMutualInc(BODY *body, EVOLVE *evolve, HALT *halt, IO *io, int iBody, int jBody, int iReason)
Check the maximum allowed mutual inclination.
- Parameters:
body – A pointer to the BODY instance
evolve – A pointer to the integration EVOLVE instance
halt – A pointer to the HALT instance
io – A pointer to the IO instance
update – A pointer to the UPDATE instance
iBody – The current index in the BODY instance, irrelevant in this case because mutual inclination is by definition a multi-body variable
iReason – Was the subroutine called from CheckHalts (0) or CheckProgress (1)?
- Returns:
TRUE if the mutual incliantion is larger than dMaxMutualInc, FALSE if not
-
double fdSemiTidalLockEqSt(BODY *body, int iNumLocked, int iBody)
Compute rate of change of semi-major axis for tidally locked star(s) if iNumLocked = 2, both are locked, otherwise, iBody gives body struct index for star that is tidally locked
-
double fdSemiDtEqSt(BODY *body, SYSTEM *system, int *iaBody)
Compute change in binary semi-major axis when circular, tidally locked, w ~ n when EQTIDE and STELLAR are active
-
void fdMergePlanet(BODY *body, UPDATE *update, fnUpdateVariable ***fnUpdate, int iBody)
Handle a merge by zeroing out lost planet’s derivatives, and adding its mass to the central body.
-
double fdRocheRadius(BODY *body, int iNumBodies, int iBody)
Calculate the Roche radius assuming body 0 is the host star using Eqn. 8 from Luger et al. (2015)
- Parameters:
body – BODY struct
iBody – int body indentifier
- Returns:
Body’s Roche radius
-
double fdBondiRadius(BODY *body, int iBody)
Calculate the Bondi radius assuming body 0 is the host star and that the planetary atmosphere at the Bondi radius is diatomic H2 at the blackbody equilibrium temperature set by thermal emission from the host star adapting equation. Adapted from equations 2 and 4 from Owen & Wu (2016)
- Parameters:
body – BODY struct
iBody – int body indentifier
- Returns:
Body’s Bondi radius
system.h
Subroutines that control system-wide properties.
- Author
Rory Barnes (RoryBarnes)
- Date
May 7 2014