R N S C and B stars
Posted: 20.06.2004, 03:29
For some odd reason when I calculate the radius of these stars they are coming up 2 and a half times larger or a tad smaller for the B class...than they are in Celestia...I am using this code in my program which works for all the other classes just fine...Is there some other calculation going on in Celestia for these stars that I am missing?
Thanks!
Code: Select all
double sscGenerator::getStellarRadius(double absMag, bool boloCorrect) {
double blum = 0;
int lumIndex = 0;
switch (getStellarLumValue())
{
case 7:
case 6:
case 5:
case 4:
lumIndex = 2;
break;
case 3:
case 2:
lumIndex = 1;
break;
case 1:
case 0:
lumIndex = 0;
break;
default:
lumIndex = 0;
}
switch(starClass) {
case 'O':
blum = absMag + bmag_correctionO[lumIndex][starSubClass];
break;
case 'B':
blum = absMag + bmag_correctionB[lumIndex][starSubClass];
break;
case 'A':
blum = absMag + bmag_correctionA[lumIndex][starSubClass];
break;
case 'F':
blum = absMag + bmag_correctionF[lumIndex][starSubClass];
break;
case 'G':
blum = absMag + bmag_correctionG[lumIndex][starSubClass];
break;
case 'K':
blum = absMag + bmag_correctionK[lumIndex][starSubClass];
break;
case 'M':
blum = absMag + bmag_correctionM[lumIndex][starSubClass];
break;
case 'R':
case 'S':
case 'N':
blum = absMag + bmag_correctionM[lumIndex][8];
}
double solarBMag = SOLAR_ABSMAG + bmag_correctionG[0][2];
double boloLum = (double) exp((solarBMag - blum) / LN_MAG);
// Use the Stefan-Boltzmann law to estimate the radius of a
// star from surface temperature and luminosity
if(boloCorrect == true) {
return SOLAR_RADIUS * (double) sqrt(boloLum) * pow(SOLAR_TEMPERATURE / getStellarTemp(),2);
}
else {
return SOLAR_RADIUS * (double) sqrt(absMagToLum(absMag)) *
pow(SOLAR_TEMPERATURE / getStellarTemp(),2);
}
}
Thanks!