# User:XZise/Atmospheric Height

Hey, I stumbled upon this one, when I worked on the {{Infobox/Body}} template on this wiki.

According to the section drag in the atmosphere article, the pressure at a specific height can be calculated and those calculations do return the same results as measurements taken by the PresMat Barometer:

${\displaystyle p_{a}=p_{0}\cdot e^{\frac {-a}{H}}}$

In the {{Infobox/Body}} template the atmospheric height is now calculated by:

${\displaystyle a_{\text{atmo}}=-ln(10^{-6})\cdot H}$

Now ${\displaystyle H}$ is the scale height which could be found also in the infobox, but is not important for the next step because it cancels out: Determine the pressure at the atmospheric height. Now in theory this should be constant, as the drag also depend on the pressure because otherwise that would mean a craft would slow down due to drag around one celestial body while around another the game doesn't simulate the drag anymore because it's above the atmosphere. But in both cases the theoretical pressure would be the same. So lets calculate this pressure:

{\displaystyle {\begin{aligned}p_{\text{atmo}}&=p_{0}\cdot e^{\frac {-a_{\text{atmo}}}{H}}\\&=p_{0}\cdot e^{-{\frac {-ln(10^{-6}\cdot H}{H}}}\\&=p_{0}\cdot e^{ln(10^{-6}}\\&=p_{0}\cdot 10^{-6}\end{aligned}}}

So the pressure at the atmospheric height is simply ${\displaystyle p_{0}\cdot 10^{-6}}$ where ${\displaystyle p_{0}}$ is the pressure at sea level. On Kerbin this is 1 atm on sea level and 10⁻⁶ atm at the atmospheric height. But Jool for example has still 15×10⁻⁶ atm left at the atmospheric height, as the pressure on “sea level” is 15 atm. Now doing the reverse: At which altitude is 15×10⁻⁶ atm on Kerbin. By my understanding, this should be a save height as craft in Jool's orbit won't be slowed down at this height/pressure.

Now to calculate the altitude for a specific pressure change the formula:

{\displaystyle {\begin{aligned}p_{0}\cdot e^{\frac {-a}{H}}&=p_{a}\\e^{\frac {-a}{H}}&={\frac {p_{a}}{p_{0}}}\\{\frac {-a}{H}}&=ln\left({\frac {p_{a}}{p_{0}}}\right)\\a&=-ln\left({\frac {p_{a}}{p_{0}}}\right)\cdot H\end{aligned}}}

This looks like the “atmospheric height” formula, with the difference that palt/p0 is 10⁻⁶. So now for Kerbin we use for palt (the pressure for the searched altitude) is 15×10⁻⁶ atm, p0 is 1 atm and H is 5000 m. This is now saying 55537.3018 meters.

So applying Jool's “atmospheric height pressure” on Kerbin means, that you can savely orbit at about 56 km which is way lower than 69 km. On the other side, the altitude of 10⁻⁶ atm at Jool is 165 235.608 m so about 30 km higher. Eve has a difference of 10 km and Duna about -5 km (as p0 is lower than 1 atm).

Now you maybe saying that 15×10⁻⁶ atm and 10⁻⁶ atm aren't very far away (although the different altitudes are pretty far away as 56 km are only 80 % of 69 km) you know could construct an example with an sea level pressure of 10⁺⁶ atm resulting in a pressure of 1 atm at the “atmospheric height” which is the pressure at Kerbin's sea level.

So either I mixed something up or the calculation for the atmospheric height is wrong or the formula for the atmospheric drag in the wiki is wrong.

So please let me know who does what wrong.