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