Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
StellarEvolution::MESA::Interpolator Class Reference

A stellar evolution interpolator based on the MESA tracks. More...

#include <MESAIO.h>

+ Inheritance diagram for StellarEvolution::MESA::Interpolator:
+ Collaboration diagram for StellarEvolution::MESA::Interpolator:

Public Member Functions

 Interpolator ()
 
 Interpolator (const std::string &model_directory, unsigned num_threads, const std::vector< double > &smoothing=__default_smoothing, const std::vector< int > &nodes=__default_nodes, const std::vector< bool > &vs_log_age=__default_vs_log_age, const std::vector< bool > &log_quantity=__default_log_quantity)
 Creates a stellar evolution interpolator based on evolution tracks computed with MESA. More...
 
- Public Member Functions inherited from StellarEvolution::Interpolator
 Interpolator ()
 Construct an object that can be set to interpolate between tabulated evolution tracks. More...
 
 Interpolator (const std::valarray< double > &tabulated_masses, const std::valarray< double > &tabulated_feh, const std::list< std::valarray< double > > &tabulated_ages, const std::vector< std::list< std::valarray< double > > > &tabulated_quantities, const std::vector< double > &smoothing, const std::vector< int > &nodes, const std::vector< bool > &vs_log_age, const std::vector< bool > &log_quantity, unsigned num_threads)
 Creates a fully functional stellar evolution interpolator. More...
 
void create_from (const std::valarray< double > &tabulated_masses, const std::valarray< double > &tabulated_feh, const std::list< std::valarray< double > > &tabulated_ages, const std::vector< std::list< std::valarray< double > > > &tabulated_quantities, const std::vector< double > &smoothing, const std::vector< int > &nodes, const std::vector< bool > &vs_log_age, const std::vector< bool > &log_quantity, unsigned num_threads)
 Fully setup an object created by the default constructor. More...
 
virtual EvolvingStellarQuantityoperator() (QuantityID quantity, double mass, double feh) const
 Return a single quantity interpolation to a given mass and [Fe/H]. More...
 
virtual double core_formation_age () const
 The age at which the core begins to form in Gyr. More...
 
virtual void save_state (const std::string &filename="../interp_state_data") const
 Serializes the interpolation state to file. More...
 
virtual void load_state (const std::string &filename="../interp_state_data")
 Loads data from serialization. More...
 
void delete_tracks ()
 Free all evolution tracks, rendering all created quantities unuseable! More...
 

Static Public Member Functions

static double default_smoothing (StellarEvolution::QuantityID quantity)
 The default smoothing argument used for a given quantity. More...
 
static const std::vector< double > & default_smoothing ()
 Return the default smoothing argument to pass to constructor. More...
 
static int default_nodes (StellarEvolution::QuantityID quantity)
 The default interpolation nodes used for a given quantity. More...
 
static const std::vector< int > & default_nodes ()
 Return the default nodes argument to pass to constructor. More...
 
static bool default_vs_log_age (StellarEvolution::QuantityID quantity)
 By default is the given quantity interpolated vs log(age)? More...
 
static const std::vector< bool > & default_vs_log_age ()
 Return the default vs_log_age argument to pass to constructor. More...
 
static bool default_log_quantity (StellarEvolution::QuantityID quantity)
 By default is the log(given quantity) interpolated? More...
 
static const std::vector< bool > & default_log_quantity ()
 Return the default log_quantity argument to pass to constructor. More...
 

Private Member Functions

bool parse_model_file_name (const std::string &filename)
 Parse the mass (in \(M_\odot\)) and [Fe/H] from a track filename. More...
 
void sort_last_track_by_age ()
 Sorts the quantities read from the last track by age. More...
 
void read_model_file (const std::string &filename)
 Reads a single evolution track file. More...
 
void log_current_age_ranges () const
 Output the current masses [Fe/H] and age ranges. More...
 
void get_mass_feh_grid (std::valarray< double > &masses, std::valarray< double > &feh)
 Verify that the track masses and [Fe/H] form a grid and return the grid. More...
 
EvolutionIterator begin ()
 Returns an EvolutionIterator pointing to the beginning of all quantities. More...
 
EvolutionIterator end ()
 Returns an EvolutionIterator pointing to the end of all quantities. More...
 
void move (EvolutionIterator &dest, EvolutionIterator &source)
 Moves source to right before destination. More...
 
void sort_tracks ()
 Sorts the data by mass and [Fe/H]. More...
 

Private Attributes

std::list< double > __mass_list
 The masses of the available tracks in the order read. More...
 
std::list< double > __feh_list
 The [Fe/H] values of the available tracks in the order read. More...
 
std::list< std::valarray< double > > __track_ages
 The ages at which each track is tabulated. More...
 
std::vector< std::list< std::valarray< double > > > __track_quantities
 A structure holding all interesting quantities from the MESA tracks except age. More...
 

Static Private Attributes

static const std::vector< QuantityID__column_to_quantity
 The value at the indexed from Column is the StellarEvolution::QuantityID to which this column is converted. More...
 
static const std::vector< double > __default_smoothing
 The default amount of smoothing to use for each quantity. See StellarEvolution::Interpolator::create_from. More...
 
static const std::vector< int > __default_nodes
 The default number of node to use for each quantity. See StellarEvolution::Interpolator::create_from. More...
 
static const std::vector< bool > __default_vs_log_age
 The default selection of interpolation argument (age vs log(age) for each quantity. See StellarEvolution::Interpolator::create_from. More...
 
static const std::vector< bool > __default_log_quantity
 The default selection of interpolation function (quantity vs log(quantity) for each quantity. See StellarEvolution::Interpolator::create_from. More...
 

Detailed Description

A stellar evolution interpolator based on the MESA tracks.

Definition at line 192 of file MESAIO.h.

Constructor & Destructor Documentation

◆ Interpolator() [1/2]

StellarEvolution::MESA::Interpolator::Interpolator ( )
inline

Default constructor, use load_state to get a working interpolator.

Definition at line 293 of file MESAIO.h.

◆ Interpolator() [2/2]

StellarEvolution::MESA::Interpolator::Interpolator ( const std::string &  model_directory,
unsigned  num_threads,
const std::vector< double > &  smoothing = __default_smoothing,
const std::vector< int > &  nodes = __default_nodes,
const std::vector< bool > &  vs_log_age = __default_vs_log_age,
const std::vector< bool > &  log_quantity = __default_log_quantity 
)

Creates a stellar evolution interpolator based on evolution tracks computed with MESA.

Parameters
model_directoryThe directory containing the MESA evolution tracks
num_threadsHow many threads to use for simultaneous interpolation.
smoothingHow much to smooth each stellar evolution quantity when fitting. Use NaN for no smoothing. See StellarEvolution::QuantityID for the order of the quantities.
nodesHow many nodes to use when smoothing each stellar evolution quantity. Ignored if smooth_conv_inertia is NaN - no smoothing.

Negative values result in using min(-nodes[i], number of tabulated ages for each track).

Parameters
vs_log_ageShould interpolation be done vs. log(age) instead of age for each quantity?
log_quantityShould interpolation be done of log(quantity) instead of quantity for each quantity?

Definition at line 535 of file MESAIO.cpp.

Member Function Documentation

◆ begin()

EvolutionIterator StellarEvolution::MESA::Interpolator::begin ( )
private

Returns an EvolutionIterator pointing to the beginning of all quantities.

Definition at line 444 of file MESAIO.cpp.

◆ default_log_quantity() [1/2]

static bool StellarEvolution::MESA::Interpolator::default_log_quantity ( StellarEvolution::QuantityID  quantity)
inlinestatic

By default is the log(given quantity) interpolated?

Parameters
quantityThe quantity to return the default setting for.

Definition at line 361 of file MESAIO.h.

◆ default_log_quantity() [2/2]

static const std::vector<bool>& StellarEvolution::MESA::Interpolator::default_log_quantity ( )
inlinestatic

Return the default log_quantity argument to pass to constructor.

Definition at line 369 of file MESAIO.h.

◆ default_nodes() [1/2]

static int StellarEvolution::MESA::Interpolator::default_nodes ( StellarEvolution::QuantityID  quantity)
inlinestatic

The default interpolation nodes used for a given quantity.

Parameters
quantityThe quantity to return the default nodes for.

Definition at line 339 of file MESAIO.h.

◆ default_nodes() [2/2]

static const std::vector<int>& StellarEvolution::MESA::Interpolator::default_nodes ( )
inlinestatic

Return the default nodes argument to pass to constructor.

Definition at line 346 of file MESAIO.h.

◆ default_smoothing() [1/2]

static double StellarEvolution::MESA::Interpolator::default_smoothing ( StellarEvolution::QuantityID  quantity)
inlinestatic

The default smoothing argument used for a given quantity.

Parameters
quantityThe quantity to return the default smoothing for.

Definition at line 328 of file MESAIO.h.

◆ default_smoothing() [2/2]

static const std::vector<double>& StellarEvolution::MESA::Interpolator::default_smoothing ( )
inlinestatic

Return the default smoothing argument to pass to constructor.

Definition at line 335 of file MESAIO.h.

◆ default_vs_log_age() [1/2]

static bool StellarEvolution::MESA::Interpolator::default_vs_log_age ( StellarEvolution::QuantityID  quantity)
inlinestatic

By default is the given quantity interpolated vs log(age)?

Parameters
quantityThe quantity to return the default setting for.

Definition at line 350 of file MESAIO.h.

◆ default_vs_log_age() [2/2]

static const std::vector<bool>& StellarEvolution::MESA::Interpolator::default_vs_log_age ( )
inlinestatic

Return the default vs_log_age argument to pass to constructor.

Definition at line 357 of file MESAIO.h.

◆ end()

EvolutionIterator StellarEvolution::MESA::Interpolator::end ( )
private

Returns an EvolutionIterator pointing to the end of all quantities.

Definition at line 456 of file MESAIO.cpp.

◆ get_mass_feh_grid()

void StellarEvolution::MESA::Interpolator::get_mass_feh_grid ( std::valarray< double > &  masses,
std::valarray< double > &  feh 
)
private

Verify that the track masses and [Fe/H] form a grid and return the grid.

Parameters
massesOutput argument: the list of stellar masses in the grid (sorted and unique values only).
fehOutput argument: the list of stellar [Fe/H] in the grid (sorted and unique values only).

Definition at line 378 of file MESAIO.cpp.

◆ log_current_age_ranges()

void StellarEvolution::MESA::Interpolator::log_current_age_ranges ( ) const
private

Output the current masses [Fe/H] and age ranges.

Definition at line 233 of file MESAIO.cpp.

◆ move()

void StellarEvolution::MESA::Interpolator::move ( EvolutionIterator dest,
EvolutionIterator source 
)
private

Moves source to right before destination.

Definition at line 468 of file MESAIO.cpp.

◆ parse_model_file_name()

bool StellarEvolution::MESA::Interpolator::parse_model_file_name ( const std::string &  filename)
private

Parse the mass (in \(M_\odot\)) and [Fe/H] from a track filename.

If the filaneme follows the expected pattern, add the parsed values to ::__mass_list and ::__feh_list respectively and return true. If the filename is not formatted as expected return false and leave ::__mass_list and ::__feh_list unchanged.

Definition at line 252 of file MESAIO.cpp.

◆ read_model_file()

void StellarEvolution::MESA::Interpolator::read_model_file ( const std::string &  filename)
private

Reads a single evolution track file.

Definition at line 330 of file MESAIO.cpp.

◆ sort_last_track_by_age()

void StellarEvolution::MESA::Interpolator::sort_last_track_by_age ( )
private

Sorts the quantities read from the last track by age.

Definition at line 296 of file MESAIO.cpp.

◆ sort_tracks()

void StellarEvolution::MESA::Interpolator::sort_tracks ( )
private

Sorts the data by mass and [Fe/H].

Definition at line 494 of file MESAIO.cpp.

Member Data Documentation

◆ __column_to_quantity

const std::vector< QuantityID > StellarEvolution::MESA::Interpolator::__column_to_quantity
staticprivate

The value at the indexed from Column is the StellarEvolution::QuantityID to which this column is converted.

Columns not corresponding to a quantity are set to StellarEvolution::NUM_QUANTITIES.

Definition at line 201 of file MESAIO.h.

◆ __default_log_quantity

const std::vector< bool > StellarEvolution::MESA::Interpolator::__default_log_quantity
staticprivate

The default selection of interpolation function (quantity vs log(quantity) for each quantity. See StellarEvolution::Interpolator::create_from.

Definition at line 219 of file MESAIO.h.

◆ __default_nodes

const std::vector< int > StellarEvolution::MESA::Interpolator::__default_nodes
staticprivate

The default number of node to use for each quantity. See StellarEvolution::Interpolator::create_from.

Definition at line 209 of file MESAIO.h.

◆ __default_smoothing

const std::vector< double > StellarEvolution::MESA::Interpolator::__default_smoothing
staticprivate

The default amount of smoothing to use for each quantity. See StellarEvolution::Interpolator::create_from.

Definition at line 205 of file MESAIO.h.

◆ __default_vs_log_age

const std::vector< bool > StellarEvolution::MESA::Interpolator::__default_vs_log_age
staticprivate

The default selection of interpolation argument (age vs log(age) for each quantity. See StellarEvolution::Interpolator::create_from.

Definition at line 214 of file MESAIO.h.

◆ __feh_list

std::list<double> StellarEvolution::MESA::Interpolator::__feh_list
private

The [Fe/H] values of the available tracks in the order read.

Definition at line 225 of file MESAIO.h.

◆ __mass_list

std::list<double> StellarEvolution::MESA::Interpolator::__mass_list
private

The masses of the available tracks in the order read.

Definition at line 222 of file MESAIO.h.

◆ __track_ages

std::list< std::valarray<double> > StellarEvolution::MESA::Interpolator::__track_ages
private

The ages at which each track is tabulated.

Definition at line 228 of file MESAIO.h.

◆ __track_quantities

std::vector< std::list< std::valarray<double> > > StellarEvolution::MESA::Interpolator::__track_quantities
private

A structure holding all interesting quantities from the MESA tracks except age.

The innermost valarray is a particular parameter for a particular track as a function of age.

The middle list holds the same quantity for all tracks and is in the same order as __mass_list.

The outside array is indexed by quantity identified by StellarEvolution::QuantityID.

Definition at line 242 of file MESAIO.h.


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