Add a method to get star's bolometric luminosity
parent
f371bd31c1
commit
198e067f75
|
@ -961,22 +961,17 @@ float Star::getRadius() const
|
||||||
return details->getRadius();
|
return details->getRadius();
|
||||||
|
|
||||||
#ifdef NO_BOLOMETRIC_MAGNITUDE_CORRECTION
|
#ifdef NO_BOLOMETRIC_MAGNITUDE_CORRECTION
|
||||||
// Use the Stefan-Boltzmann law to estimate the radius of a
|
auto lum = getLuminosity();
|
||||||
// star from surface temperature and luminosity
|
|
||||||
return SOLAR_RADIUS * (float) sqrt(getLuminosity()) *
|
|
||||||
square(SOLAR_TEMPERATURE / getTemperature());
|
|
||||||
#else
|
#else
|
||||||
// Calculate the luminosity of the star from the bolometric, not the
|
// Calculate the luminosity of the star from the bolometric, not the
|
||||||
// visual magnitude of the star.
|
// visual magnitude of the star.
|
||||||
float solarBMag = SOLAR_BOLOMETRIC_MAG;
|
auto lum = getBolometricLuminosity();
|
||||||
float bmag = getBolometricMagnitude();
|
#endif
|
||||||
auto boloLum = (float) exp((solarBMag - bmag) / LN_MAG);
|
|
||||||
|
|
||||||
// Use the Stefan-Boltzmann law to estimate the radius of a
|
// Use the Stefan-Boltzmann law to estimate the radius of a
|
||||||
// star from surface temperature and luminosity
|
// star from surface temperature and luminosity
|
||||||
return SOLAR_RADIUS * (float) sqrt(boloLum) *
|
return SOLAR_RADIUS * (float) sqrt(lum) *
|
||||||
square(SOLAR_TEMPERATURE / getTemperature());
|
square(SOLAR_TEMPERATURE / getTemperature());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1139,6 +1134,19 @@ void Star::setLuminosity(float lum)
|
||||||
absMag = astro::lumToAbsMag(lum);
|
absMag = astro::lumToAbsMag(lum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Star::getBolometricLuminosity() const
|
||||||
|
{
|
||||||
|
#ifdef NO_BOLOMETRIC_MAGNITUDE_CORRECTION
|
||||||
|
return getLuminosity();
|
||||||
|
#else
|
||||||
|
// Calculate the luminosity of the star from the bolometric, not the
|
||||||
|
// visual magnitude of the star.
|
||||||
|
float solarBMag = SOLAR_BOLOMETRIC_MAG;
|
||||||
|
float bmag = getBolometricMagnitude();
|
||||||
|
return (float) exp((solarBMag - bmag) / LN_MAG);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
StarDetails* Star::getDetails() const
|
StarDetails* Star::getDetails() const
|
||||||
{
|
{
|
||||||
return details;
|
return details;
|
||||||
|
|
|
@ -265,6 +265,7 @@ public:
|
||||||
|
|
||||||
float getApparentMagnitude(float) const;
|
float getApparentMagnitude(float) const;
|
||||||
float getLuminosity() const;
|
float getLuminosity() const;
|
||||||
|
float getBolometricLuminosity() const;
|
||||||
|
|
||||||
// Return the exact position of the star, accounting for its orbit
|
// Return the exact position of the star, accounting for its orbit
|
||||||
UniversalCoord getPosition(double t) const;
|
UniversalCoord getPosition(double t) const;
|
||||||
|
|
Loading…
Reference in New Issue