From b520356160745ed9cca734b193e8d92e9234778c Mon Sep 17 00:00:00 2001 From: Oleg Solovyov Date: Thu, 9 Nov 2023 14:41:52 +0300 Subject: [PATCH] Simplify SystemBody::GetAtmPressure L = g/H (specific heat) gM/RL = gM/R(g/H) = gMH/Rg = MH/R --- src/galaxy/SystemBody.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/galaxy/SystemBody.cpp b/src/galaxy/SystemBody.cpp index c856f294d69..9dab74cc4b1 100644 --- a/src/galaxy/SystemBody.cpp +++ b/src/galaxy/SystemBody.cpp @@ -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