Program Listing for File EvolvingStar.h¶
↰ Return to documentation for file (/home/kpenev/projects/git/poet/poet_src/Star/EvolvingStar.h)
#ifndef __EVOLVING_STAR_H
#define __EVOLVING_STAR_H
#include "../Core/SharedLibraryExportMacros.h"
#include "SaturatingSkumanichWindBody.h"
#include "ExponentialDecayDiffRotBody.h"
#include "../StellarEvolution/Interpolator.h"
#include "EvolvingStellarCore.h"
#include "EvolvingStellarEnvelope.h"
namespace Star {
class LIB_PUBLIC InterpolatedEvolutionStar :
public SaturatingSkumanichWindBody,
public ExponentialDecayDiffRotBody {
private:
const StellarEvolution::EvolvingStellarQuantity *__luminosity;
double __lifetime;
EvolvingStellarEnvelope __envelope;
EvolvingStellarCore __core;
public:
InterpolatedEvolutionStar(
double mass,
double feh,
double wind_strength,
double wind_saturation_frequency,
double diff_rot_coupling_timescale,
const StellarEvolution::Interpolator &interpolator
) :
SaturatingSkumanichWindBody(wind_strength,
wind_saturation_frequency),
ExponentialDecayDiffRotBody(diff_rot_coupling_timescale),
__luminosity(interpolator(StellarEvolution::LUM, mass, feh)),
__lifetime(__luminosity->range_high()),
__envelope(mass,
interpolator(StellarEvolution::RADIUS,
mass,
feh),
interpolator(StellarEvolution::ICONV,
mass,
feh)),
__core(std::max(__envelope.min_interp_age(),
interpolator.core_formation_age()),
interpolator(StellarEvolution::MRAD, mass, feh),
interpolator(StellarEvolution::RRAD, mass, feh),
interpolator(StellarEvolution::IRAD, mass, feh))
{}
unsigned number_zones() const {return 2;}
Evolve::DissipatingZone &zone(unsigned zone_index)
{
assert(zone_index<=1);
if(zone_index == 0) return __envelope;
else return __core;
}
const EvolvingStellarEnvelope &envelope() const {return __envelope;}
EvolvingStellarEnvelope &envelope() {return __envelope;}
const EvolvingStellarCore &core() const {return __core;}
EvolvingStellarCore &core() {return __core;}
const Evolve::DissipatingZone &zone(unsigned zone_index) const
{
assert(zone_index<=1);
if(zone_index==0) return __envelope;
else return __core;
}
double lifetime() const {return __lifetime;}
double luminosity(double age) const {return (*__luminosity)(age);}
~InterpolatedEvolutionStar() {delete __luminosity;}
virtual void reached_critical_age(double age)
{
__core.reached_critical_age(age);
__envelope.reached_critical_age(age);
}
virtual double next_stop_age() const
{return std::min(__core.next_stop_age(),
__envelope.next_stop_age());}
virtual void select_interpolation_region(double age) const
{
__core.select_interpolation_region(age);
__envelope.select_interpolation_region(age);
}
};//End InterpolatedEvolutionStar class
}//End Star namespace.
#endif