Added ability to specify temperature and bolometric correction in .stc files.

sensor-dev
Andrew Tribick 2010-04-28 18:59:44 +00:00
parent 6a44c13ca4
commit 1960b7c888
3 changed files with 51 additions and 10 deletions

View File

@ -41,7 +41,9 @@ Barycenter "Solar System Barycenter:SSB"
SpectralType "G2V"
AbsMag 4.83
Temperature 5780
BoloCorrection -0.08
UniformRotation
{
Period 609.12 # 25.38 days
@ -212,7 +214,7 @@ Barycenter "Gliese 65:Luyten 726-8"
# Discovery of a very cool brown dwarf among the ten nearest stars
# to the Solar System. Lucas et al. http://arxiv.org/abs/1004.0317
"UGPSJ 0722-05:UGPSJ 072227.51-054031.2"
"UGPS J0722-05:UGPS J072227.51-054031.2"
{
RA 110.613750
Dec -5.675000

View File

@ -28,7 +28,8 @@ using namespace std;
// as one times SOLAR_RADIUS . . . the high metallicity of the Sun is
// probably what accounts for the discrepancy in temperature.
// #define SOLAR_TEMPERATURE 5780.0f
#define SOLAR_TEMPERATURE 5860.0f
#define SOLAR_TEMPERATURE 5780.0f
#define SOLAR_BOLOMETRIC_MAG 4.75f
// moved the following to astro.h
// #define SOLAR_RADIUS 696000
@ -979,7 +980,7 @@ float Star::getRadius() const
#else
// Calculate the luminosity of the star from the bolometric, not the
// visual magnitude of the star.
float solarBMag = SOLAR_ABSMAG + bmag_correctionG[0][2];
float solarBMag = SOLAR_BOLOMETRIC_MAG;
float bmag = getBolometricMagnitude();
float boloLum = (float) exp((solarBMag - bmag) / LN_MAG);

View File

@ -867,17 +867,30 @@ bool StarDatabase::createStar(Star* star,
double radius;
bool hasRadius = starData->getLength("Radius", radius);
double temperature;
bool hasTemperature = starData->getNumber("Temperature", temperature);
// disallow unphysical temperature values
if (temperature <= 0.0)
{
hasTemperature = false;
}
double bolometricCorrection;
bool hasBolometricCorrection = starData->getNumber("BoloCorrection", bolometricCorrection);
string infoURL;
bool hasInfoURL = starData->getString("InfoURL", infoURL);
Orbit* orbit = CreateOrbit(Selection(), starData, path, true);
if (hasTexture ||
hasModel ||
orbit != NULL ||
hasSemiAxes ||
hasRadius ||
hasRotationModel ||
if (hasTexture ||
hasModel ||
orbit != NULL ||
hasSemiAxes ||
hasRadius ||
hasTemperature ||
hasBolometricCorrection ||
hasRotationModel ||
hasInfoURL)
{
// If the star definition has extended information, clone the
@ -909,6 +922,31 @@ bool StarDatabase::createStar(Star* star,
details->addKnowledge(StarDetails::KnowRadius);
}
if (hasTemperature)
{
details->setTemperature((float) temperature);
if (!hasBolometricCorrection)
{
// if we change the temperature, recalculate the bolometric
// correction using formula from formula for main sequence
// stars given in B. Cameron Reed (1998), "The Composite
// Observational-Theoretical HR Diagram", Journal of the Royal
// Astronomical Society of Canada, Vol 92. p36.
double logT = log10(temperature) - 4;
double bc = -8.499 * pow(logT, 4) + 13.421 * pow(logT, 3)
- 8.131 * logT * logT - 3.901 * logT - 0.438;
details->setBolometricCorrection((float) bc);
}
}
if (hasBolometricCorrection)
{
details->setBolometricCorrection((float) bolometricCorrection);
}
if (hasInfoURL)
{
details->setInfoURL(infoURL);