Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
CInterface.h File Reference

Declare C-style functions for accessing the functionality of the Star library. More...

#include "../StellarEvolution/CInterface.h"
#include "../Core/SharedLibraryExportMacros.h"
#include "EvolvingStar.h"
#include "../Evolve/DissipationQuantities.h"
+ Include dependency graph for CInterface.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

LIB_PUBLIC EvolvingStarcreate_star (double mass, double feh, double wind_strength, double wind_saturation_frequency, double diff_rot_coupling_timescale, const MESAInterpolator *interpolator)
 Create a star to participate in the orbital evolution calculation. More...
 
LIB_PUBLIC void destroy_star (EvolvingStar *star)
 Destroy a previously created star. More...
 
LIB_PUBLIC void set_star_dissipation (EvolvingStar *star, unsigned zone_index, unsigned num_tidal_frequency_breaks, unsigned num_spin_frequency_breaks, double *tidal_frequency_breaks, double *spin_frequency_breaks, double *tidal_frequency_powers, double *spin_frequency_powers, double reference_phase_lag, double inertial_mode_enhancement, double inertial_mode_sharpness)
 Set the dissipative properties of one of the zones of a star. More...
 
LIB_PUBLIC void detect_stellar_wind_saturation (EvolvingStar *star)
 
LIB_PUBLIC void select_interpolation_region (const EvolvingStar *star, double age)
 Prepare the zone quantities for interpolation around the given age. More...
 
LIB_PUBLIC double modified_phase_lag (const EvolvingStar *star, unsigned zone_index, int orbital_frequency_multiplier, int spin_frequency_multiplier, double forcing_frequency, int deriv, double *above_lock_value)
 See Evolve::BrokenPowerlawPhaseLagZone::modified_phase_lag for details. More...
 
LIB_PUBLIC double core_formation_age (const EvolvingStar *star)
 The age at which the core of a star forms. More...
 
LIB_PUBLIC double lifetime (const EvolvingStar *star)
 The lifetime of a star (the maximum age at which it can be queried) More...
 
LIB_PUBLIC double luminosity (EvolvingStar *star, double age)
 The luminosity of a star at a given age. More...
 
LIB_PUBLIC void luminosity_array (EvolvingStar *star, const double *age, unsigned nvalues, double *result)
 The luminosity of a star at a given array of ages. More...
 
LIB_PUBLIC double core_inertia (EvolvingStar *star, double age)
 The moment of inertia of the stellar core at a given age. More...
 
LIB_PUBLIC double core_inertia_deriv (EvolvingStar *star, double age, int deriv_order)
 One of the derivatives of the moment of inertia of the stellar core at a given age. More...
 
LIB_PUBLIC void core_inertia_array (EvolvingStar *star, const double *age, unsigned nvalues, double *result)
 The moment of inertia of the stellar core at a given array of ages. More...
 
LIB_PUBLIC void core_inertia_deriv_array (EvolvingStar *star, const double *age, int deriv_order, unsigned nvalues, double *result)
 One of the derivatives of the moment of inertia of the stellar core at a given array of ages. More...
 
LIB_PUBLIC double envelope_inertia (EvolvingStar *star, double age)
 The moment of inertia of the stellar envelope at a given age. More...
 
LIB_PUBLIC double envelope_inertia_deriv (EvolvingStar *star, double age, int deriv_order)
 One of the derivatives of the moment of inertia of the stellar envelope at a given age. More...
 
LIB_PUBLIC void envelope_inertia_array (EvolvingStar *star, const double *age, unsigned nvalues, double *result)
 The moment of inertia of the stellar envelope at a given array of ages. More...
 
LIB_PUBLIC void envelope_inertia_deriv_array (EvolvingStar *star, const double *age, int deriv_order, unsigned nvalues, double *result)
 One of the derivatives of the moment of inertia of the stellar envelope at a given array of ages. More...
 
LIB_PUBLIC double star_radius (EvolvingStar *star, double age)
 The radius of the star at a given age. More...
 
LIB_PUBLIC void star_radius_array (EvolvingStar *star, const double *age, unsigned nvalues, double *result)
 The radius of the star at an array of ages. More...
 
LIB_PUBLIC double lag_from_lgQ (double lgQ)
 Converts lg(Q) to a tidal phase lag. More...
 

Variables

LIB_PUBLIC const int NO_DERIV
 Identifier for not differentiating the phase lag. More...
 
LIB_PUBLIC const int AGE_DERIV
 Identifier for differentiating the phase lag w.r.t. age. More...
 
LIB_PUBLIC const int SPIN_FREQUENCY_DERIV
 Identifier for differentiating the phase lag w.r.t. spin freuqency. More...
 
LIB_PUBLIC const int ORBITAL_FREQUENCY_DERIV
 Identifier for differentiating the phase lag w.r.t. orbital freuqency. More...
 
struct LIB_PUBLIC EvolvingStar
 Opaque struct to cast to/from Star::InterpolatedEvolutionStar. More...
 

Detailed Description

Declare C-style functions for accessing the functionality of the Star library.

Definition in file CInterface.h.

Function Documentation

◆ core_formation_age()

LIB_PUBLIC double core_formation_age ( const EvolvingStar star)

The age at which the core of a star forms.

Parameters
starThe star for which to return the core formation age.

Definition at line 126 of file CInterface.cpp.

◆ core_inertia()

LIB_PUBLIC double core_inertia ( EvolvingStar star,
double  age 
)

The moment of inertia of the stellar core at a given age.

Parameters
starThe star whose luminosity to return.
ageThe age at which to return the luminosity.

Definition at line 172 of file CInterface.cpp.

◆ core_inertia_array()

LIB_PUBLIC void core_inertia_array ( EvolvingStar star,
const double *  age,
unsigned  nvalues,
double *  result 
)

The moment of inertia of the stellar core at a given array of ages.

Parameters
starThe star whose luminosity to return.
ageThe ages at which to return the moment of inertia.
nvaluesThe number of ages at which evaluation is required.
resultA pre-allocated memory (size: nvalues) where to place the result.

Definition at line 211 of file CInterface.cpp.

◆ core_inertia_deriv()

LIB_PUBLIC double core_inertia_deriv ( EvolvingStar star,
double  age,
int  deriv_order 
)

One of the derivatives of the moment of inertia of the stellar core at a given age.

Parameters
starThe star whose luminosity to return.
ageThe age at which to return the luminosity.
deriv_orderThe order of the derivative to return (0, 1, or 2).

Definition at line 182 of file CInterface.cpp.

◆ core_inertia_deriv_array()

LIB_PUBLIC void core_inertia_deriv_array ( EvolvingStar star,
const double *  age,
int  deriv_order,
unsigned  nvalues,
double *  result 
)

One of the derivatives of the moment of inertia of the stellar core at a given array of ages.

Parameters
starThe star whose luminosity to return.
ageThe ages at which to return the moment of inertia.
deriv_orderThe orde of the derivate to return (0, 1, or 2).
nvaluesThe number of ages at which evaluation is required.
resultA pre-allocated memory (size: nvalues) where to place the result.

Definition at line 227 of file CInterface.cpp.

◆ create_star()

LIB_PUBLIC EvolvingStar* create_star ( double  mass,
double  feh,
double  wind_strength,
double  wind_saturation_frequency,
double  diff_rot_coupling_timescale,
const MESAInterpolator interpolator 
)

Create a star to participate in the orbital evolution calculation.

Parameters
massMass of the star
fehThe [Fe/H] of the star
wind_strengthThe strength of the wind.
wind_saturation_frequencyThe frequency at which the wind loss saturates in rad/day.
diff_rot_coupling_timescaleThe timescale for differential rotation coupling.
interpolatorA StellarEvolution interpolator.

Definition at line 22 of file CInterface.cpp.

◆ destroy_star()

LIB_PUBLIC void destroy_star ( EvolvingStar star)

Destroy a previously created star.

Parameters
starThe star to destroy. Must have previously been created using create_star.

Definition at line 44 of file CInterface.cpp.

◆ detect_stellar_wind_saturation()

LIB_PUBLIC void detect_stellar_wind_saturation ( EvolvingStar star)

Tell the star to detect its wind saturation state per its current configuration.

Parameters
starThe star to detect the saturation state of.

Definition at line 92 of file CInterface.cpp.

◆ envelope_inertia()

LIB_PUBLIC double envelope_inertia ( EvolvingStar star,
double  age 
)

The moment of inertia of the stellar envelope at a given age.

Parameters
starThe star whose luminosity to return.
ageThe age at which to return the luminosity.

Definition at line 244 of file CInterface.cpp.

◆ envelope_inertia_array()

LIB_PUBLIC void envelope_inertia_array ( EvolvingStar star,
const double *  age,
unsigned  nvalues,
double *  result 
)

The moment of inertia of the stellar envelope at a given array of ages.

Parameters
starThe star whose luminosity to return.
ageThe age at which to return the luminosity.
nvaluesThe number of ages at which evaluation is required.
resultA pre-allocated memory (size: nvalues) where to place the result.

Definition at line 264 of file CInterface.cpp.

◆ envelope_inertia_deriv()

LIB_PUBLIC double envelope_inertia_deriv ( EvolvingStar star,
double  age,
int  deriv_order 
)

One of the derivatives of the moment of inertia of the stellar envelope at a given age.

Parameters
starThe star whose luminosity to return.
ageThe age at which to return the luminosity.
deriv_orderThe order of the derivative to return (0, 1, or 2).

Definition at line 254 of file CInterface.cpp.

◆ envelope_inertia_deriv_array()

LIB_PUBLIC void envelope_inertia_deriv_array ( EvolvingStar star,
const double *  age,
int  deriv_order,
unsigned  nvalues,
double *  result 
)

One of the derivatives of the moment of inertia of the stellar envelope at a given array of ages.

Parameters
starThe star whose luminosity to return.
ageThe ages at which to return the moment of inertia.
deriv_orderThe orde of the derivate to return (0, 1, or 2).
nvaluesThe number of ages at which evaluation is required.
resultA pre-allocated memory (size: nvalues) where to place the result.

Definition at line 280 of file CInterface.cpp.

◆ lag_from_lgQ()

LIB_PUBLIC double lag_from_lgQ ( double  lgQ)

Converts lg(Q) to a tidal phase lag.

Definition at line 17 of file CInterface.cpp.

◆ lifetime()

LIB_PUBLIC double lifetime ( const EvolvingStar star)

The lifetime of a star (the maximum age at which it can be queried)

Parameters
starThe star whose lifetime to return.

Definition at line 133 of file CInterface.cpp.

◆ luminosity()

LIB_PUBLIC double luminosity ( EvolvingStar star,
double  age 
)

The luminosity of a star at a given age.

Parameters
starThe star whose luminosity to return.
ageThe age at which to return the luminosity.

Definition at line 140 of file CInterface.cpp.

◆ luminosity_array()

LIB_PUBLIC void luminosity_array ( EvolvingStar star,
const double *  age,
unsigned  nvalues,
double *  result 
)

The luminosity of a star at a given array of ages.

Parameters
starThe star whose luminosity to return.
ageThe ages at which to return the luminosity.
nvaluesThe number of ages at which evaluation is required.
resultA pre-allocated memory (size: nvalues) where to place the result.

Definition at line 150 of file CInterface.cpp.

◆ modified_phase_lag()

LIB_PUBLIC double modified_phase_lag ( const EvolvingStar star,
unsigned  zone_index,
int  orbital_frequency_multiplier,
int  spin_frequency_multiplier,
double  forcing_frequency,
int  deriv,
double *  above_lock_value 
)

See Evolve::BrokenPowerlawPhaseLagZone::modified_phase_lag for details.

Parameters
starThe star to get the modified phase lag for.
zone_indexThe index of the zone whose modified phase lag to return.
orbital_frequency_multiplierThe multiplier of the orbital frequency in the expression for the forcing frequency.
spin_frequency_multiplierThe multiplier of the spin frequency in the expression for the forcing frequency.
forcing_frequencyThe current forcing frequency in rad/day.
derivThe return value should be either the phase lag itself (NO_DERIV) or its derivative w.r.t. the specified quantity.
above_lock_valueIf the lag of a locked term is calculated this should be set to the lag assuming the spin frequency is just above the lock. Otherwise, leave untouched.

Definition at line 107 of file CInterface.cpp.

◆ select_interpolation_region()

LIB_PUBLIC void select_interpolation_region ( const EvolvingStar star,
double  age 
)

Prepare the zone quantities for interpolation around the given age.

See EvolvingStar::select_interpolation_region() for details.

Parameters
starThe star to select the interpolation region for.
ageThe age around which interpolation should work.

Definition at line 99 of file CInterface.cpp.

◆ set_star_dissipation()

LIB_PUBLIC void set_star_dissipation ( EvolvingStar star,
unsigned  zone_index,
unsigned  num_tidal_frequency_breaks,
unsigned  num_spin_frequency_breaks,
double *  tidal_frequency_breaks,
double *  spin_frequency_breaks,
double *  tidal_frequency_powers,
double *  spin_frequency_powers,
double  reference_phase_lag,
double  inertial_mode_enhancement,
double  inertial_mode_sharpness 
)

Set the dissipative properties of one of the zones of a star.

Parameters
starThe star to set the dissipation for.
zone_indexWhich zone to set the dissiaption for (0 - envelope, 1 - core).
num_tidal_frequency_breaksSee same name argument to set_zone_dissipation()
num_spin_frequency_breaksSee same name argument to set_zone_dissipation()
tidal_frequency_breaksSee same name argument to set_zone_dissipation()
spin_frequency_breaksSee same name argument to set_zone_dissipation()
tidal_frequency_powersSee same name argument to set_zone_dissipation()
spin_frequency_powersSee same name argument to set_zone_dissipation()
reference_phase_lagSee same name argument to set_zone_dissipation()
inertial_mode_enhancementSee same name argument to set_zone_dissipation()
inertial_mode_sharpnessSee same name argument to set_zone_dissipation()

Definition at line 49 of file CInterface.cpp.

◆ star_radius()

LIB_PUBLIC double star_radius ( EvolvingStar star,
double  age 
)

The radius of the star at a given age.

Parameters
starThe star whose radius to return.
ageThe age at which to return the stellar radius.

Definition at line 297 of file CInterface.cpp.

◆ star_radius_array()

LIB_PUBLIC void star_radius_array ( EvolvingStar star,
const double *  age,
unsigned  nvalues,
double *  result 
)

The radius of the star at an array of ages.

Parameters
starThe star whose radius to return.
ageThe ages at which to return the stellar radius.
nvaluesThe number of ages at which evaluation is required.
resultA pre-allocated memory (size: nvalues) where to place the result.

Definition at line 308 of file CInterface.cpp.

Variable Documentation

◆ AGE_DERIV

LIB_PUBLIC const int AGE_DERIV

Identifier for differentiating the phase lag w.r.t. age.

Definition at line 13 of file CInterface.cpp.

◆ EvolvingStar

struct LIB_PUBLIC EvolvingStar

Opaque struct to cast to/from Star::InterpolatedEvolutionStar.

Definition at line 30 of file CInterface.h.

◆ NO_DERIV

LIB_PUBLIC const int NO_DERIV

Identifier for not differentiating the phase lag.

Identifier for not differentiating the phase lag.

Definition at line 63 of file DissipationQuantities.h.

◆ ORBITAL_FREQUENCY_DERIV

LIB_PUBLIC const int ORBITAL_FREQUENCY_DERIV

Identifier for differentiating the phase lag w.r.t. orbital freuqency.

Definition at line 15 of file CInterface.cpp.

◆ SPIN_FREQUENCY_DERIV

LIB_PUBLIC const int SPIN_FREQUENCY_DERIV

Identifier for differentiating the phase lag w.r.t. spin freuqency.

Definition at line 14 of file CInterface.cpp.