Skip to content

Commit

Permalink
Simplify SystemBody::GetAtmPressure
Browse files Browse the repository at this point in the history
L = g/H (specific heat)
gM/RL = gM/R(g/H) = gMH/Rg = MH/R
  • Loading branch information
Mc-Pain authored and Webster Sheets committed Nov 13, 2023
1 parent b42a745 commit 93873f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/galaxy/SystemBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ double SystemBody::GetAtmPressure(double altitude) const
{
const double gasMolarMass = GetMolarMass(GetSuperType());
const double surfaceGravity_g = CalcSurfaceGravity();
const double lapseRate_L = surfaceGravity_g / GetSpecificHeat(GetSuperType()); // deg/m
const double specificHeat = GetSpecificHeat(GetSuperType());
const double lapseRate_L = surfaceGravity_g / specificHeat; // deg/m
const double surfaceTemperature_T0 = GetAverageTemp(); //K

return m_atmosPressure * pow((1 - lapseRate_L * altitude / surfaceTemperature_T0),
(surfaceGravity_g * gasMolarMass / (GAS_CONSTANT_R * lapseRate_L))); // in ATM since p0 was in ATM
(specificHeat * gasMolarMass / GAS_CONSTANT_R)); // in ATM since p0 was in ATM
}

double SystemBody::GetAtmDensity(double altitude, double pressure) const
Expand Down

0 comments on commit 93873f6

Please sign in to comment.