A detailed Explanation how Athmospheres in KSP are working can be found here at the KSP Wiki
To calculate Atmospheric pressure and density in k-OS it can be done in this way:
set atmP to 2.718^((0-altitude)/5000). // calulates the Atmospheric pressure
set atmD to atmP * 1.2230948554874. // calulates the Atmospheric density
The 5000 is called the "scale height" and only true for Kerbin:
Body | Scale height in m |
---|---|
Jool | 10000 |
Eve | 7000 |
Kerbin | 5000 |
Laythe | 4000 |
Duna | 3000 |
The formula below will give you the force of drag at velocity. You will have to do some additional computation if you want to include a deployed parachute. The cD will change then, it wont be just 0.2.
Fd= 0.5 * atmDensity * (velocity)^2 * 0.2 * (mass*.008).
Thanks for Payload for contributing this information.
Formula for Terminal velocity: To do: Cleaning up the formula.
lock lnc_atm_d to 1.2230948554874 * bi_atm_p0 * (e ^ ((0 - altitude) / bi_atm_sh)).
lock lnc_vt to ((250 * bi_gm) / ((bi_r ^ 2) * vi_grav * lnc_atm_d)) ^ 0.5.
Thanks for HeadChef for contributing this information.