Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
StellarEvolution::EvolvingStellarQuantity Class Referenceabstract

A class for stellar properties that depend on age. More...

#include <EvolvingStellarQuantity.h>

+ Inheritance diagram for StellarEvolution::EvolvingStellarQuantity:
+ Collaboration diagram for StellarEvolution::EvolvingStellarQuantity:

Public Member Functions

 EvolvingStellarQuantity ()
 Default constructor (only useful for derived classes which do not use the interpolation). More...
 
 EvolvingStellarQuantity (double mass, const std::valarray< double > &track_masses, The(\f$[Fe/H]\f$) for which evolution tracks are given. const std::valarray< double > &track_feh, The evolution tracks of the relevant quantity on the grid defined by \p track_masses and \p track_feh. The const std::vector< const OneArgumentDiffFunction *> &evolution_tracks, Whether the track uses log(age) as the independent argument instead of age. bool log_age=true, Whether the track is uses log(quantity) as the dependent argument instead of quantity. bool log_quantity=true, Whether this is a quantity that is identically zero below some age and turns on afterwards bool starts_zero=false)
 Create an evolving quantity that interpolates to the given mass. More...
 
brief Prepare the quantity for interpolation around the given age After calling this requesting values or derivatives outside the range of the continuous region containing this age (see ::discontinuities) fails an assert. virtual void select_interpolation_region(double age) const
 
Return the value the quantity takes at the given age in virtual Gyr double operator() (double age) const
 The value of the function at the given abscissa. More...
 
Return the age derivative of the quantity at the given age in virtual Gyr const FunctionDerivativesderiv (double age) const
 Returns a pointer to the derivative of the function. More...
 
The largest age for which the quantity can be interpolated in virtual Gyr double range_high () const
 The lower end of the range over which the function is defined. More...
 
brief The smallest age for which the quantity can be interpolated in virtual Gyr double range_low () const
 The upper end of the range over which the function is defined. More...
 
The ages at which the quantity may be virtual discontinuous const std::vector< double > & discontinuities () const
 
An iterator over the ages (in Gyr) where the quantity takes the given y value. InterpSolutionIterator crossings(double=0) const
 
- Public Member Functions inherited from Core::OneArgumentFunction< double, double >
virtual InterpSolutionIterator crossings (double y=0) const=0
 An iterator over the abscissas where the function takes the given y value. More...
 
virtual ~OneArgumentFunction ()
 Provide a virtual destructor for a virtual class. More...
 

Public Attributes

brief Prepare the quantity for interpolation around the given age After calling this method
 

Protected Member Functions

virtual double age_to_interp_param (double age, double mass, double feh) const
 Return the interpoltaion parameter given age, mass and [Fe/H]. More...
 
virtual double interp_param_to_age (double interp_param, double mass, double feh) const
 Return the age in Gyrs given an interpolation parameter, mass, and [Fe/H]. More...
 

Private Member Functions

size_t track_index (size_t mass_index, size_t feh_index) const
 Return the index within ::__evolution_tracks for the given mass and [Fe/H] indices. More...
 
bool track_in_range (size_t track_i, double age) const
 Answer if a given track can participate in interpolating to the given age. More...
 
bool track_in_range (size_t mass_i, size_t feh_i, double age) const
 Answer if a given track can participate in interpolating to the given age. More...
 
void check_grid_range () const
 Verify that the stellar mass and [Fe/H] are within range of the evolution tracks. More...
 
void find_cell (const std::valarray< double > &boundaries, double value, size_t &below_index, size_t &above_index) const
 The two indices within the given sorted array defining the closed internal containing value. More...
 
void set_interp_age_ranges ()
 Fill the ::__min_interp_ages and ::__max_interp_ages members. More...
 
double evaluate_track (double age, const OneArgumentDiffFunction &track, const FunctionDerivatives **derivatives) const
 Interpolate the quantity for the given track to the given age, returning NaN if out of age range. More...
 
void check_grid_expansion_directions (AllowedGridGrowth &grow, double age) const
 Figure out in which directions we can expand a mass-[Fe/H] interpolation grid, assuming a single direction expansion. More...
 
bool expand_grid (const AllowedGridGrowth &grow, double age) const
 Attempt to expand the current interpolation grid returning true on success. More...
 
void update_interpolation_grid () const
 Find the best sub-grid of tracks to interpolate on. More...
 
double interpolate (double age, const FunctionDerivatives **derivatives=NULL) const
 Interpolate the quantity to the desired age. More...
 
double age_to_interp_param (double age) const
 Return the interpoltaion parameter for the given age for the current star. More...
 
double interp_param_to_age (double interp_param) const
 Return the age for the given interpoltaion parameter for the current star. More...
 

Private Attributes

double __mass
 The mass to which to interpolate in \(M_\odot\). More...
 
double __feh
 The [Fe/H] to which to interpolate. More...
 
double __min_age
 The minimum age for which this quantity is defined in Gyr. More...
 
double __max_age
 The maximum age for which this quantity is defined in Gyr. More...
 
bool __log_age
 Whether the tracks have log(age) instead of age as their argument. More...
 
bool __log_quantity
 Whether the tracks are of log(quantity) instead of the quantity. More...
 
bool __initially_zero
 Should the quantity be assumed zero below the minimum track age. More...
 
std::valarray< double > __track_masses
 The masses of the evolution tracks. More...
 
std::valarray< double > __track_feh
 The [Fe/H] of the evolution tracks. More...
 
std::valarray< double > __min_interp_ages
 The minimum interpolation age for the current star to which each track can contribute. More...
 
std::valarray< double > __max_interp_ages
 The maximum interpolation age for the current star to which each track can contribute. More...
 
std::vector< double > __interp_grid_change_ages
 The ages at which the interpolation grid needs to be re-determined. More...
 
std::vector< double >::const_iterator __next_grid_change_age
 The entry in ::__interp_grid_change_ages up to which the current interpolation grid is valid. More...
 
size_t __mass_index_above
 The index of the smallest track mass not smaller than ::__mass. More...
 
size_t __mass_index_below
 The index of the largest track mass not exceeding ::__mass. More...
 
size_t __feh_index_above
 The index of the smallest track [Fe/H] not smaller than ::__feh. More...
 
size_t __feh_index_below
 The index of the largest track [Fe/H] not exceeding ::__feh. More...
 
std::vector< const OneArgumentDiffFunction * > __evolution_tracks
 The model tracks for the evolution of the quantity on the grid defined by ::__track_masses and ::__track_feh. More...
 
alglib::real_1d_array __interp_masses
 The current track masses participating in the interpolation. More...
 
alglib::real_1d_array __interp_feh
 The current track [Fe/H] values participating in the interpolation. More...
 
size_t __min_interp_mass_index
 The index within ::__track_masses of the lowest mass currently participating in the interpolation. More...
 
size_t __max_interp_mass_index
 The index within ::__track_masses of the highest mass currently participating in the interpolation. More...
 
size_t __min_interp_feh_index
 The index within ::__track_feh of the lowest [Fe/H] currently participating in the interpolation. More...
 
size_t __max_interp_feh_index
 The index within ::__track_feh of the highest [Fe/H] currently participating in the interpolation. More...
 

Detailed Description

A class for stellar properties that depend on age.

Definition at line 38 of file EvolvingStellarQuantity.h.

Constructor & Destructor Documentation

◆ EvolvingStellarQuantity() [1/2]

StellarEvolution::EvolvingStellarQuantity::EvolvingStellarQuantity ( )
inline

Default constructor (only useful for derived classes which do not use the interpolation).

Definition at line 310 of file EvolvingStellarQuantity.h.

◆ EvolvingStellarQuantity() [2/2]

StellarEvolution::EvolvingStellarQuantity::EvolvingStellarQuantity ( double  mass,
const std::valarray< double > &  track_masses,
The(\f$[Fe/H]\f$) for which evolution tracks are given. const std::valarray< double > &  track_feh,
The evolution tracks of the relevant quantity on the grid defined by \p track_masses and \p track_feh. The const std::vector< const OneArgumentDiffFunction *> &  evolution_tracks,
Whether the track uses log(age) as the independent argument instead of age. bool  log_age = true,
Whether the track is uses log(quantity) as the dependent argument instead of quantity. bool  log_quantity = true,
Whether this is a quantity that is identically zero below some age and turns on afterwards bool  starts_zero = false 
)

Create an evolving quantity that interpolates to the given mass.

Parameters
massThe stellar mass to interpolate to in \(M_\odot\)
fehThe stellar (

Member Function Documentation

◆ age_to_interp_param() [1/2]

double StellarEvolution::EvolvingStellarQuantity::age_to_interp_param ( double  age) const
inlineprivate

Return the interpoltaion parameter for the given age for the current star.

Definition at line 263 of file EvolvingStellarQuantity.h.

◆ age_to_interp_param() [2/2]

double StellarEvolution::EvolvingStellarQuantity::age_to_interp_param ( double  age,
double  mass,
double  feh 
) const
protectedvirtual

Return the interpoltaion parameter given age, mass and [Fe/H].

Must be an increasing monotonic function

Parameters
ageThe age for which the interpolation parameter is needed in Gyrs.
massThe stellar mass for which the interpolation parameter is needed in \(M_\odot\).
fehThe stellar [Fe/H] for which the interpolation parameter is needed in \([Fe/H]\).

Definition at line 475 of file EvolvingStellarQuantity.cpp.

◆ check_grid_expansion_directions()

void StellarEvolution::EvolvingStellarQuantity::check_grid_expansion_directions ( AllowedGridGrowth grow,
double  age 
) const
private

Figure out in which directions we can expand a mass-[Fe/H] interpolation grid, assuming a single direction expansion.

Parameters
growThe current state of the grid expansion possibilities. On output, directions in which growth is no longer allowed are disabled.
ageThe age for which we will interpolate.

Definition at line 168 of file EvolvingStellarQuantity.cpp.

◆ check_grid_range()

void StellarEvolution::EvolvingStellarQuantity::check_grid_range ( ) const
private

Verify that the stellar mass and [Fe/H] are within range of the evolution tracks.

Definition at line 15 of file EvolvingStellarQuantity.cpp.

◆ deriv()

const FunctionDerivatives * StellarEvolution::EvolvingStellarQuantity::deriv ( double  x) const
virtual

Returns a pointer to the derivative of the function.

The use of a pointer allows avoiding potentially expensive copy opertaions.

Implements Core::OneArgumentDiffFunction.

Reimplemented in StellarEvolution::PolynomialEvolutionQuantity, StellarEvolution::SumQuantity, and StellarEvolution::ZeroQuantity.

Definition at line 656 of file EvolvingStellarQuantity.cpp.

◆ evaluate_track()

double StellarEvolution::EvolvingStellarQuantity::evaluate_track ( double  age,
const OneArgumentDiffFunction track,
const FunctionDerivatives **  derivatives 
) const
private

Interpolate the quantity for the given track to the given age, returning NaN if out of age range.

If derivatives is not NULL initializes that to a pointer to a derivatives at the current age structure.

Parameters
ageThe age at which to evaluate the track. If ::__log_age is true, the track is evaluated at log(track_age), otherwise it is directly passed to the track. In particular, the caller should have already transformed this argument to the correct interpolation parameter.
trackThe track to evaluate. Should be an entry from ::__evolution_tracks.
derivativesIf not NULL, *derivatives is set to a newly allocated derivative instance of one of the children FunctionDerivatives classes.

Definition at line 143 of file EvolvingStellarQuantity.cpp.

◆ expand_grid()

bool StellarEvolution::EvolvingStellarQuantity::expand_grid ( const AllowedGridGrowth grow,
double  age 
) const
private

Attempt to expand the current interpolation grid returning true on success.

Parameters
growThe current state of the grid expansion possibilities.
ageThe age to which we will interpolate.

Definition at line 238 of file EvolvingStellarQuantity.cpp.

◆ find_cell()

void StellarEvolution::EvolvingStellarQuantity::find_cell ( const std::valarray< double > &  boundaries,
double  value,
size_t &  below_index,
size_t &  above_index 
) const
private

The two indices within the given sorted array defining the closed internal containing value.

If value is not exactly equal to an array entry, the two indices are consecutive, if the value is exactly equal to an entry, the two indices are the same.

Parameters
boundariesThe boundaries of the grid cells in a single dimension.
valueThe value whose cell we are looking for.
below_indexThe index of the largest boundary <= value.
above_indexThe index of the smallest boundary >= value.

Definition at line 51 of file EvolvingStellarQuantity.cpp.

◆ interp_param_to_age() [1/2]

double StellarEvolution::EvolvingStellarQuantity::interp_param_to_age ( double  interp_param) const
inlineprivate

Return the age for the given interpoltaion parameter for the current star.

Definition at line 268 of file EvolvingStellarQuantity.h.

◆ interp_param_to_age() [2/2]

double StellarEvolution::EvolvingStellarQuantity::interp_param_to_age ( double  interp_param,
double  mass,
double  feh 
) const
protectedvirtual

Return the age in Gyrs given an interpolation parameter, mass, and [Fe/H].

Must be an increasing monotonic function

Parameters
interp_paramThe interpolation parameter for which the age is needed.
massThe stellar mass for which the interpolation parameter is needed in \(M_\odot\).
fehThe stellar [Fe/H] for which the interpolation parameter is needed in \([Fe/H]\).

Definition at line 494 of file EvolvingStellarQuantity.cpp.

◆ interpolate()

double StellarEvolution::EvolvingStellarQuantity::interpolate ( double  age,
const FunctionDerivatives **  derivatives = NULL 
) const
private

Interpolate the quantity to the desired age.

If derivatives is not NULL initializes that to a pointer to a derivatives at the current age structure.

Definition at line 388 of file EvolvingStellarQuantity.cpp.

◆ operator()()

Return the value the quantity takes at the given age in virtual Gyr double StellarEvolution::EvolvingStellarQuantity::operator() ( double  in_value) const
inlinevirtual

The value of the function at the given abscissa.

Implements Core::OneArgumentFunction< double, double >.

Reimplemented in StellarEvolution::PolynomialEvolutionQuantity, StellarEvolution::SumQuantity, and StellarEvolution::ZeroQuantity.

Definition at line 356 of file EvolvingStellarQuantity.h.

◆ range_high()

The largest age for which the quantity can be interpolated in virtual Gyr double StellarEvolution::EvolvingStellarQuantity::range_high ( ) const
inlinevirtual

The lower end of the range over which the function is defined.

Implements Core::OneArgumentFunction< double, double >.

Reimplemented in StellarEvolution::PolynomialEvolutionQuantity, StellarEvolution::SumQuantity, and StellarEvolution::ZeroQuantity.

Definition at line 363 of file EvolvingStellarQuantity.h.

◆ range_low()

brief The smallest age for which the quantity can be interpolated in virtual Gyr double StellarEvolution::EvolvingStellarQuantity::range_low ( ) const
inlinevirtual

The upper end of the range over which the function is defined.

Implements Core::OneArgumentFunction< double, double >.

Reimplemented in StellarEvolution::PolynomialEvolutionQuantity, StellarEvolution::SumQuantity, and StellarEvolution::ZeroQuantity.

Definition at line 367 of file EvolvingStellarQuantity.h.

◆ set_interp_age_ranges()

void StellarEvolution::EvolvingStellarQuantity::set_interp_age_ranges ( )
private

Fill the ::__min_interp_ages and ::__max_interp_ages members.

Definition at line 95 of file EvolvingStellarQuantity.cpp.

◆ track_in_range() [1/2]

bool StellarEvolution::EvolvingStellarQuantity::track_in_range ( size_t  track_i,
double  age 
) const
inlineprivate

Answer if a given track can participate in interpolating to the given age.

Parameters
track_iThe index of the track to check within ::__evolution_tracks.
ageThe age to which interpolation is desired.

Definition at line 148 of file EvolvingStellarQuantity.h.

◆ track_in_range() [2/2]

bool StellarEvolution::EvolvingStellarQuantity::track_in_range ( size_t  mass_i,
size_t  feh_i,
double  age 
) const
inlineprivate

Answer if a given track can participate in interpolating to the given age.

Parameters
mass_iThe index of the mass of the track to check within ::__track_masses.
feh_iThe index of the [Fe/H] of the track to check within ::__track_feh.
ageThe age to which interpolation is desired.

Definition at line 164 of file EvolvingStellarQuantity.h.

◆ track_index()

size_t StellarEvolution::EvolvingStellarQuantity::track_index ( size_t  mass_index,
size_t  feh_index 
) const
inlineprivate

Return the index within ::__evolution_tracks for the given mass and [Fe/H] indices.

Parameters
mass_indexThe index within ::__track_masses of the desired mass.
feh_indexThe index within ::__track_feh of the desired [Fe/H].

Definition at line 137 of file EvolvingStellarQuantity.h.

◆ update_interpolation_grid()

void StellarEvolution::EvolvingStellarQuantity::update_interpolation_grid ( ) const
private

Find the best sub-grid of tracks to interpolate on.

Definition at line 337 of file EvolvingStellarQuantity.cpp.

Member Data Documentation

◆ __evolution_tracks

std::vector<const OneArgumentDiffFunction *> StellarEvolution::EvolvingStellarQuantity::__evolution_tracks
private

The model tracks for the evolution of the quantity on the grid defined by ::__track_masses and ::__track_feh.

The mass index varies faster.

Definition at line 108 of file EvolvingStellarQuantity.h.

◆ __feh

double StellarEvolution::EvolvingStellarQuantity::__feh
private

The [Fe/H] to which to interpolate.

Definition at line 42 of file EvolvingStellarQuantity.h.

◆ __feh_index_above

size_t StellarEvolution::EvolvingStellarQuantity::__feh_index_above
mutableprivate

The index of the smallest track [Fe/H] not smaller than ::__feh.

Definition at line 91 of file EvolvingStellarQuantity.h.

◆ __feh_index_below

size_t StellarEvolution::EvolvingStellarQuantity::__feh_index_below
mutableprivate

The index of the largest track [Fe/H] not exceeding ::__feh.

Definition at line 91 of file EvolvingStellarQuantity.h.

◆ __initially_zero

bool StellarEvolution::EvolvingStellarQuantity::__initially_zero
private

Should the quantity be assumed zero below the minimum track age.

Definition at line 62 of file EvolvingStellarQuantity.h.

◆ __interp_feh

alglib::real_1d_array StellarEvolution::EvolvingStellarQuantity::__interp_feh
mutableprivate

The current track [Fe/H] values participating in the interpolation.

Definition at line 112 of file EvolvingStellarQuantity.h.

◆ __interp_grid_change_ages

std::vector<double> StellarEvolution::EvolvingStellarQuantity::__interp_grid_change_ages
private

The ages at which the interpolation grid needs to be re-determined.

Definition at line 82 of file EvolvingStellarQuantity.h.

◆ __interp_masses

alglib::real_1d_array StellarEvolution::EvolvingStellarQuantity::__interp_masses
mutableprivate

The current track masses participating in the interpolation.

Definition at line 112 of file EvolvingStellarQuantity.h.

◆ __log_age

bool StellarEvolution::EvolvingStellarQuantity::__log_age
private

Whether the tracks have log(age) instead of age as their argument.

Definition at line 56 of file EvolvingStellarQuantity.h.

◆ __log_quantity

bool StellarEvolution::EvolvingStellarQuantity::__log_quantity
private

Whether the tracks are of log(quantity) instead of the quantity.

Definition at line 59 of file EvolvingStellarQuantity.h.

◆ __mass

double StellarEvolution::EvolvingStellarQuantity::__mass
private

The mass to which to interpolate in \(M_\odot\).

Definition at line 42 of file EvolvingStellarQuantity.h.

◆ __mass_index_above

size_t StellarEvolution::EvolvingStellarQuantity::__mass_index_above
mutableprivate

The index of the smallest track mass not smaller than ::__mass.

Definition at line 91 of file EvolvingStellarQuantity.h.

◆ __mass_index_below

size_t StellarEvolution::EvolvingStellarQuantity::__mass_index_below
mutableprivate

The index of the largest track mass not exceeding ::__mass.

Definition at line 91 of file EvolvingStellarQuantity.h.

◆ __max_age

double StellarEvolution::EvolvingStellarQuantity::__max_age
private

The maximum age for which this quantity is defined in Gyr.

Definition at line 50 of file EvolvingStellarQuantity.h.

◆ __max_interp_ages

std::valarray<double> StellarEvolution::EvolvingStellarQuantity::__max_interp_ages
private

The maximum interpolation age for the current star to which each track can contribute.

Definition at line 74 of file EvolvingStellarQuantity.h.

◆ __max_interp_feh_index

size_t StellarEvolution::EvolvingStellarQuantity::__max_interp_feh_index
mutableprivate

The index within ::__track_feh of the highest [Fe/H] currently participating in the interpolation.

Definition at line 121 of file EvolvingStellarQuantity.h.

◆ __max_interp_mass_index

size_t StellarEvolution::EvolvingStellarQuantity::__max_interp_mass_index
mutableprivate

The index within ::__track_masses of the highest mass currently participating in the interpolation.

Definition at line 121 of file EvolvingStellarQuantity.h.

◆ __min_age

double StellarEvolution::EvolvingStellarQuantity::__min_age
private

The minimum age for which this quantity is defined in Gyr.

Definition at line 50 of file EvolvingStellarQuantity.h.

◆ __min_interp_ages

std::valarray<double> StellarEvolution::EvolvingStellarQuantity::__min_interp_ages
private

The minimum interpolation age for the current star to which each track can contribute.

Definition at line 74 of file EvolvingStellarQuantity.h.

◆ __min_interp_feh_index

size_t StellarEvolution::EvolvingStellarQuantity::__min_interp_feh_index
mutableprivate

The index within ::__track_feh of the lowest [Fe/H] currently participating in the interpolation.

Definition at line 121 of file EvolvingStellarQuantity.h.

◆ __min_interp_mass_index

size_t StellarEvolution::EvolvingStellarQuantity::__min_interp_mass_index
mutableprivate

The index within ::__track_masses of the lowest mass currently participating in the interpolation.

Definition at line 121 of file EvolvingStellarQuantity.h.

◆ __next_grid_change_age

std::vector<double>::const_iterator StellarEvolution::EvolvingStellarQuantity::__next_grid_change_age
mutableprivate

The entry in ::__interp_grid_change_ages up to which the current interpolation grid is valid.

Definition at line 86 of file EvolvingStellarQuantity.h.

◆ __track_feh

std::valarray<double> StellarEvolution::EvolvingStellarQuantity::__track_feh
private

The [Fe/H] of the evolution tracks.

Definition at line 66 of file EvolvingStellarQuantity.h.

◆ __track_masses

std::valarray<double> StellarEvolution::EvolvingStellarQuantity::__track_masses
private

The masses of the evolution tracks.

Definition at line 66 of file EvolvingStellarQuantity.h.


The documentation for this class was generated from the following files: