pioneerspacesim/pioneer — pull request #1363 by Ae-2222 (2012-07-15 23:26:24+00:00)
Title: Give planets their own atmospheres in physics (meaningful pressure readout values)

This patch updates the atmospheric model from a same temperature approximation that scales Earth's atmosphere (I think it's Earth's atmosphere) to fit other planets and distribution to a [Dry Adiabatic](http://en.wikipedia.org/wiki/Lapse_rate#Dry_adiabatic_lapse_rate) atmosphere model.
* Pressure readouts for earth are meaningful for the troposphere (in terms of average values)
* Transfers to a lot of planets/gas giants as gasses obey same laws
* Currently the molar mass and specific heat of Earth air is used. This can be extended later probably by the time we need to have atmosphere compositions to make Bruneton scattering (which should be implemented eventually) look varied.
* Counterpart to issue #1357 which gives planets their own rendered atmosphere

The model
* Does not assume gasses stay at the same temperature as the planet surface (as a packet of air rises in the atmosphere it cools down adiabatically)
* Features a linear decrease in temperature with height, called the lapse rate
* Valid when there are no state changes of things like water (dew forming in clouds)
* Does not work when things like the solar wind ionises things/heats them up, but that's only in a tiny fraction

Reference - taken from [here](http://en.wikipedia.org/wiki/File:Atmospheric_Pressure_vs._Altitude.png) which says it's from a formula in a CRC book.
![pling!](http://upload.wikimedia.org/wikipedia/commons/8/88/Atmospheric_Pressure_vs._Altitude.png)

Values in the dry adiabatic model (we probably use similar surface temperature, gas properties, surface density etc. values so it should look roughly similar)

````
height(m): 0.000000, pressure(kpa): 101.079371, density: 1.222882
height(m): 1000.000000, pressure(kpa): 89.591487, density: 1.048241
height(m): 2000.000000, pressure(kpa): 79.066483, density: 0.895632
height(m): 3000.000000, pressure(kpa): 69.454411, density: 0.762467
height(m): 4000.000000, pressure(kpa): 60.706202, density: 0.646475
height(m): 5000.000000, pressure(kpa): 52.773680, density: 0.545661
height(m): 6000.000000, pressure(kpa): 45.609587, density: 0.458264
height(m): 7000.000000, pressure(kpa): 39.167594, density: 0.382726
height(m): 8000.000000, pressure(kpa): 33.402324, density: 0.317663
height(m): 9000.000000, pressure(kpa): 28.269378, density: 0.261846
height(m): 10000.000000, pressure(kpa): 23.725353, density: 0.214179
height(m): 11000.000000, pressure(kpa): 19.727866, density: 0.173683
height(m): 12000.000000, pressure(kpa): 16.235588, density: 0.139485
height(m): 13000.000000, pressure(kpa): 13.208265, density: 0.110800
height(m): 14000.000000, pressure(kpa): 10.606753, density: 0.086926
height(m): 15000.000000, pressure(kpa): 8.393053, density: 0.067235
height(m): 16000.000000, pressure(kpa): 6.530348, density: 0.051161
height(m): 17000.000000, pressure(kpa): 4.983042, density: 0.038197
height(m): 18000.000000, pressure(kpa): 3.716813, density: 0.027890
height(m): 19000.000000, pressure(kpa): 2.698656, density: 0.019832
height(m): 20000.000000, pressure(kpa): 1.896948, density: 0.013658
height(m): 21000.000000, pressure(kpa): 1.281512, density: 0.009044
height(m): 22000.000000, pressure(kpa): 0.823699, density: 0.005700
height(m): 23000.000000, pressure(kpa): 0.496470, density: 0.003370
height(m): 24000.000000, pressure(kpa): 0.274517, density: 0.001828
height(m): 25000.000000, pressure(kpa): 0.134391, density: 0.000879
height(m): 26000.000000, pressure(kpa): 0.054675, density: 0.000351
height(m): 27000.000000, pressure(kpa): 0.016219, density: 0.000102
height(m): 28000.000000, pressure(kpa): 0.002471, density: 0.000015
height(m): 29000.000000, pressure(kpa): 0.000031, density: 0.000000
height(m): 30000.000000, pressure(kpa): 0.000000, density: 0.000000

It matches very closely. Note beyond a certain level the model will give zero values.