Class Tracks2D

Class Documentation

class Tracks2D

A class representing a 2D set of stellar tracks.

Public Types

using M2DPtr = std::unique_ptr<interp::Mesh2DInterpolator<static_cast<size_t>(FieldIdx::nTrackQty)>>

Public Functions

Tracks2D(const std::string &trackName, double feh = 0.0, double vvcrit = defaultVVcrit, double afe = defaultAFe, const std::string &registryName = defaultRegistry)

Construct a Tracks2D object from tracks on disk.

Uses findTrack to locate the unique track in track set trackName matching feh, vvcrit, and afe, and throws a runtime error if no such track can be found. Tracks are stored for each mass, and the number of time points may not be the same for every mass. Tracks with fewer time points will be padded at the end so that the final set of times and stellar properties are square arrays.

Parameters:
  • trackName – Name of track set

  • feh – [Fe/H] value

  • vvcrit – Rotation rate v/vcrit

  • afe – Value of [alpha/Fe]

  • registryName – Name of the track registry file

inline Tracks2D(M2DPtr &&m2d, double feH, double aFe = std::numeric_limits<double>::quiet_NaN(), double vVcrit = std::numeric_limits<double>::quiet_NaN(), std::shared_ptr<const void> owner = nullptr)

Construct a Tracks2D object from a supplied Mesh2DInterpolator.

Parameters:
  • m2d – A unique_ptr to the interpolator from which to construct the track

  • feH – The [Fe/H] value of this set of tracks

  • aFe – The [alpha/Fe] value of this set of tracks, if any; defaults to quiet_NaN if not specified

  • vVcrit – The v/vcrit value of this set of tracks, if any; defaults to quiet_NaN if not specified

  • owner – If not null, an object this Tracks2D keeps alive for as long as it exists – e.g. the Tracks3D a lazily-evaluated m2d refers to (see Tracks3D::lazySliceConstFeH())

inline Tracks2D()

Construct an empty, invalid Tracks2D object.

virtual ~Tracks2D() = default
Tracks2D(const Tracks2D&) = delete
Tracks2D(Tracks2D&&) = default
auto operator=(const Tracks2D&) -> Tracks2D& = delete
auto operator=(Tracks2D&&) -> Tracks2D& = default
inline auto mMin() const

Return the minimum mass in the tracks.

Returns:

Minimum mass in the tracks

inline auto mMax() const

Return the maximum mass in the tracks.

Returns:

Maximum mass in the tracks

inline auto logTMin() const

Return the minimum log of time in the tracks.

Returns:

Minimum log10(time) in the tracks

inline auto logTMax() const

Return the maximum log of time in the tracks.

Returns:

Maximum log10(time) in the tracks

inline auto feH() const

Return the [Fe/H] value of this set of tracks.

Returns:

[Fe/H] value of this set of tracks

inline auto aFe() const

Return the [alpha/Fe] value of this set of tracks.

Returns:

[alpha/Fe] value of this set of tracks, or quiet_NaN if not available

inline auto vVcrit() const

Return the v/vcrit value of this set of tracks.

Returns:

v/vcrit value of this set of tracks, or quiet_NaN if not available

inline auto starLifetime(const double m) const

Return the lifetime of a star of specified mass.

Parameters:

m – Mass of the star whose lifetime should be returned

Returns:

The lifetime of a star of mass m, in yr – note this is the mesh’s own x-axis maximum (always log10(time), by convention throughout this codebase) un-logged back to plain yr, not xMax(m) itself

inline auto liveMassRange(const double logT) const

Return the range of stellar masses that are alive at a given time.

Parameters:

logT – log10(time / yr) at which to evaluate

Returns:

The range of stellar masses alive at the given time

inline auto massAndDerivFromLifetime(const double logT) const

Return the mass(es) and dm/d(logT) of the star(s) whose lifetime is a given value.

A thin wrapper around interp_->yEdgeSlope(logT, false): the mesh’s own right edge (see Mesh2DGrid::yEdgeSlope()’s own comment) is exactly the locus of (xMax(m), m) pairs across every tabulated mass – i.e. the (log-lifetime, mass) curve starLifetime() itself reads a single point off of – so finding where a line of constant x = logT crosses it gives every mass whose own lifetime is 10^logT yr. The slope yEdgeSlope() reports there is dm/d(logT), in the mesh’s own native (x, y) = (logT, mass) coordinates, not dm/dT (plain, un-logged lifetime) – left for the caller to convert via the chain rule (dm/dT = dm/d(logT) / (T * ln 10)) if needed.

Parameters:

logT – log10(lifetime / yr)

Returns:

One (mass, dm/d(logT)) pair per star whose own tabulated lifetime (see starLifetime()’s own comment) equals 10^logT yr – in general more than one for a non-monotonic mass-lifetime relation (e.g. a low- and a high-mass star sharing the same lifetime)

inline auto isAlive(const double m, const double logT) const -> bool

Check whether a star of a given mass is alive at a given time.

Parameters:
  • m – Mass of the star

  • logT – log10(time / yr) at which to evaluate

Returns:

True if a star of mass m is alive at logT, false otherwise

inline auto getTrack(const double m) const

Return the track for a star of a given mass.

Every point evaluation of the result has its surface mass fractions passed through renormalizeSurfaceAbundances() (see Interpolator1D::setPostProcess()).

Parameters:

m – Mass of the star whose track should be computed

Returns:

An unique_ptr to an Interpolator1D describing the track for a given mass

inline auto getIsochrone(const double logT) const

Return the isochrone at a given log time.

Note that this method returns a vector of Interpolator1D objects rather than a single one because for non-monotonic tracks there may be multiple disjoint segments to the isochrone.

Every point evaluation of the result has its surface mass fractions passed through renormalizeSurfaceAbundances() (see Interpolator1D::setPostProcess()).

Parameters:

logT – The log10(time) of the isochrone

Returns:

A vector of unique_ptr to Interpolator1D’s describing the isochrone

inline auto getStar(const double m, const double logT, const bool linear = false) const

Return the properties of a star of a given mass and age.

No safety checking is performed: it is an error to call this with an (m, logT) pair that does not correspond to a live star at that time. If it is uncertain whether the star is alive, check first by calling liveMassRange().

The result’s surface mass fractions are passed through renormalizeSurfaceAbundances().

Parameters:
  • m – Mass of the star

  • logT – log10(time / yr) at which to evaluate

  • linear – If true, force linear interpolation instead of the default interpolation type

Returns:

An array of the nTrackQty properties of the star