Contents

There are two different equations for computing pressure at various height regimes below 86 km (or 278,400 feet). The first equation is used when the value of standard temperature lapse rate is not equal to zero; the second equation is used when standard temperature lapse rate equals zero.

The value of subscript b ranges from 0 to 6 in accordance with each of seven successive layers of the atmosphere shown in the table below. In these equations, g0, M and R* are each single-valued constants, while P,L,T, and h are multivalued constants in accordance with the table below. The values used for M,g0, and R* are in accordance with the U.S. Standard Atmosphere, 1976, and the value for R* in particular does not agree with standard values for this constant.[2] The reference value for Pb for b = 0 is the defined sea level value, P0 = 101 325 Pa or 29.92126 inHg. Values of Pb of b = 1 through b = 6 are obtained from the application of the appropriate member of the pair equations 1 and 2 for the case when h = hb+1.[2]

The expressions for calculating density are nearly identical to calculating pressure. The only difference is the exponent in Equation 1.

There are two different equations for computing density at various height regimes below 86 geometric km (84 852 geopotential meters or 278,385.8 geopotential feet). The first equation is used when the value of standard temperature lapse rate is not equal to zero; the second equation is used when standard temperature lapse rate equals zero.

The value of subscript b ranges from 0 to 6 in accordance with each of seven successive layers of the atmosphere shown in the table below. The reference value for ρb for b = 0 is the defined sea level value, ρ0 = 1.2250 kg/m3 or 0.0023768908 slug/ft3. Values of ρb of b = 1 through b = 6 are obtained from the application of the appropriate member of the pair equations 1 and 2 for the case when h = hb+1.[2]

In these equations, g0, M and R* are each single-valued constants, while ρ, L, T and h are multi-valued constants in accordance with the table below. The values used for M, g0 and R* are in accordance with the U.S. Standard Atmosphere, 1976, and that the value for R* in particular does not agree with standard values for this constant.[2]

Below is the C++ implementation of the US Standard Atmosphere version 1976. The calculations below 51 km are adopted from equations in Practical Meteorology[3] and the calculations above 51 km are adopted from Atmospheric Models at Rocket and Space Technology.[4] Some validation data is available at avs.org.

floatgetStandardPressure(floataltitude/* meters */)//return Pa{//Below 51km: Practical Meteorology by Roland Stull, pg 12//Above 51km: http://www.braeunig.us/space/atmmodel.htm//Validation data: https://www.avs.org/AVS/files/c7/c7edaedb-95b2-438f-adfb-36de54f87b9e.pdfaltitude=altitude/1000.0f;//convert meters to kmfloatgeopot_height=getGeopotential(altitude);floatt=getStandardTemperature(geopot_height);if(geopot_height<=11)return101325*pow(288.15f/t,-5.255877f);elseif(geopot_height<=20)return22632.06*exp(-0.1577f*(geopot_height-11));elseif(geopot_height<=32)return5474.889f*pow(216.65f/t,34.16319f);elseif(geopot_height<=47)return868.0187f*pow(228.65f/t,12.2011f);elseif(geopot_height<=51)return110.9063f*exp(-0.1262f*(geopot_height-47));elseif(geopot_height<=71)return66.93887f*pow(270.65f/t,-12.2011f);elseif(geopot_height<=84.85)return3.956420f*pow(214.65f/t,-17.0816f);throwstd::out_of_range("altitude must be less than 86km.");}//geopot_height = earth_radius * altitude / (earth_radius + altitude) /// all in kilometers//temperature is in Kelvin = 273.15 + CelsiusfloatgetStandardTemperature(floatgeopot_height){//standard atmospheric pressure//Below 51km: Practical Meteorology by Roland Stull, pg 12//Above 51km: http://www.braeunig.us/space/atmmodel.htmif(geopot_height<=11)//tropospherereturn288.15f-(6.5*geopot_height);elseif(geopot_height<=20)//Staroshere startsreturn216.65f;elseif(geopot_height<=32)return196.65f+geopot_height;elseif(geopot_height<=47)return228.65f+2.8*(geopot_height-32);elseif(geopot_height<=51)//Mesosphere startsreturn270.65f;elseif(geopot_height<=71)return270.65f-2.8*(geopot_height-51);elseif(geopot_height<=84.85)return214.65f-2*(geopot_height-71);//Thermospehere has high kinetic temperature (500c to 2000c) but temperature//as measured by thermometer would be very low because of almost vacuumthrowstd::out_of_range("geopot_height must be less than 84.85km.");}floatgetGeopotential(floataltitude_km){constexprfloatEARTH_RADIUS=6356.766;//kmreturnEARTH_RADIUS*altitude_km/(EARTH_RADIUS+altitude_km);}