@@ -209,7 +209,7 @@ double SystemBody::GetAtmPressure(double altitude) const
209209 return atmosPressure;
210210 } else {
211211 // above tropopause
212- const double tropopauseTemp = surfaceTemperature_T0 - lapseRate_L * m_tropopause;
212+ const double tropopauseTemp = GetAtmAverageTemp ( m_tropopause) ;
213213 return 0.1 * exp ((-surfaceGravity_g * gasMolarMass * (altitude - m_tropopause)) / (GAS_CONSTANT_R * tropopauseTemp));
214214 }
215215}
@@ -371,7 +371,7 @@ AtmosphereParameters SystemBody::CalcAtmosphereParams() const
371371 const double massPlanet_in_kg = (m_mass.ToDouble () * EARTH_MASS);
372372 const double g = G * massPlanet_in_kg / (radiusPlanet_in_m * radiusPlanet_in_m);
373373
374- double T = static_cast <double >(m_averageTemp );
374+ double T = static_cast <double >(GetAtmAverageTemp (m_tropopause) );
375375
376376 // XXX hack to avoid issues with sysgen giving 0 temps
377377 // temporary as part of sysgen needs to be rewritten before the proper fix can be used
@@ -391,9 +391,11 @@ AtmosphereParameters SystemBody::CalcAtmosphereParams() const
391391
392392 const float radiusPlanet_in_km = radiusPlanet_in_m / 1000 ;
393393 const float atmosHeight_in_km = radiusPlanet_in_km * (params.atmosRadius - 1 );
394+ const float tropopause_in_km = static_cast <float >(m_tropopause / 1000 );
394395 params.rayleighCoefficients = GetCoefficients (radiusPlanet_in_km, atmosHeight_in_km, atmosScaleHeight);
395396 params.mieCoefficients = GetCoefficients (radiusPlanet_in_km, atmosHeight_in_km, atmosScaleHeight / 6.66 ); // 7994 / 1200 = 6.61
396397 params.scaleHeight = vector2f (atmosScaleHeight, atmosScaleHeight / 6.66 );
398+ params.tropoHeight = vector2f (tropopause_in_km, tropopause_in_km / 6.66 );
397399
398400 return params;
399401}
0 commit comments