1 The formula p(x) for calculating the air pressure at a given altitude
2 ---------------------------------------------------------------------
4 Well known is the baromertic(?) formula
11 with p0 being the airpressure and rho0 being the air density at an altitude of
12 0 metres above sea level and g being the gravity constant of 9.81 m/sq. sec
14 This formula can easily be derivated when you know, that:
16 * the pressure difference is
20 * Boyle-Mariotte says:
24 Combinig the terms and changing them around I get:
27 -- = - rho * g = - [ ------ * p(x) ] * g
31 p'(x) = - ------ * p(x) * g
34 Solving that differential equation and knowing that p(0) = p0 I get:
43 -------------------------------------------------------------------------------
45 The problem with that equation is that it doesn't take different temperatures
46 at different altitudes into account. And the inaccuracies due to it are huge.
47 That's why this formula is only used in very low altitudes.
49 So to get a usefull formula for FlightGear I need to extend it. And as I'm
50 already 'recreating' that formula I'm taking the change in g into account, too.
51 This doesn't make such a dramatic difference to the result as the inclusion of
52 temperature change does, but it doesn't complicate the final formula too much.
54 So I get three formulas that I'm combining in the end:
56 * the change of g with the altitude:
61 G is the universal gravity constant(?) and is 6.673e-11 m^3 kg^-1 s^-2
62 m is the mass of the earth and is 5.977e24 kg
63 r is the radius of the earth and is 6368 km
65 * The pressure difference stays the same:
67 dp = - rho * g(x) * dx
69 * If I combine Boyle-Mariotte with Gay-Lussac I get:
72 rho = ----------- * ---
75 Combining the terms again I get this time:
78 -- = - rho * g(x) = - [ ----------- * ------ ] * g(x)
82 p'(x) = - ----------- * -------------
85 This DE isn't that easy to solve as the one above, it by looking into the right
86 books you'll see the general solution for:
98 and P(m,n) will be a point on the graph.
100 For q = n = 0 metres altitude we get y = m. As y is p(x) we know that m has to
103 So our final formuala is
106 f1(x) = ----------- * ------
112 - | f1(x) dx | f(x) dx
115 p(x) = p0 * e = p0 * e = p0 * e
117 The only disturbing thing we've got left is the integral. Luckily there is a
118 great service at http://integrals.wolfram.com/ that helps me doing it :-)
120 But the f(x) is still too general so I'm substituting:
123 f(x) = - -----------------------
124 p0 * (x + r)^2 * T(x)
126 but even that isn't good enough. But as I'm linearily interpolating between
127 two different temperatures I can say that T(x) = a*x + b for the x inbetween
128 two different stored temperatures. So I just need to integrate every pice
129 independandly. But anyway, I get:
132 f(x) = - ------------------------------
133 p0 * (x + r)^2 * (a * x + b)
135 Integrating that I get:
137 rho0 * T0 * G * m [ 1
138 F(x) = - ------------------- * [ ------------------------ -
139 p0 [ (-b + a * r) * (r + x)
142 a * log|r + x| a * log|b + a * x| ]
143 ---------------- + -------------------- ]
144 (b - a * r)^2 (b - a * r)^2 ]
146 To lower the computional cost I can transfere the equation.
151 factor = - -------------------
160 F(x) = factor * [ --------- - a * c * c * [log|r + x| + log|b + a * x|] ]
166 F(x) = factor * c * [ --------- - a * c * log|(r + x) * (b + a * x)| ]
169 -------------------------------------------------------------------------------
170 The following table shows quite nicely how accurate my formula is:
172 Altitude[m] | Airpressure [hPa] | Error [%]
173 | Official | My formula |
174 ------------+---------------+---------------+---------------
175 -200 | 1037.51 | 1037.24 | 0.0260
176 -100 | 1025.32 | 1025.19 | 0.0127
177 0 | 1013.25 | 1013.25 | 0.0
178 500 | 954.59 | 955.224 | 0.0664
179 1000 | 898.70 | 899.912 | 0.1349
180 2000 | 794.88 | 797.042 | 0.2720
181 3000 | 700.99 | 703.885 | 0.4130
182 4000 | 616.28 | 619.727 | 0.5593
183 5000 | 540.07 | 543.89 | 0.7073
184 6000 | 471.67 | 475.731 | 0.8610
185 7000 | 410.46 | 414.643 | 1.0191
186 8000 | 355.84 | 360.054 | 1.1842
187 9000 | 307.27 | 311.422 | 1.3513
188 10000 | 264.21 | 268.238 | 1.5245
189 20000 | 54.670/55.3 | 55.7971 | 2.0616/0.8989
190 30000 | 11.8 | 11.3149 | 1.5441
191 40000 | 3.0 | 2.74665 | 18.9703
192 50000 | 0.88 | 0.753043 | 41.9183
193 60000 | 0.257 | 0.221907 | 57.9802
194 70000 | 0.0602 | 0.0530785 | 61.9153
195 80000 | 0.0101 | 0.00905461 | 51.5725
196 100000 | 2.14e-4 | 2.03984e-4 | 5.5131
198 The official values are from the CINA atmosphere which assumes a air pressure
199 of 1013.25 hPa and a temperature of 15 degC at sea level and a temperature
200 gradient of -6.5 deg/km. The CINA atmosphere gives only values for altiudes
201 up to 20 km. The values for 20 km and above are from the 1959 ARDC atmosphere.
202 That's why I've got two values at 20000 metres.
203 The temperature changes dramtically in the altitudes over 20 km which I didn't
204 take care of in my calculations which explains the huge errors at that altitude
205 range. But you can see nicely that the values are at least quite close to the
207 Using a better temperature model for the altitudes above 20 km should
208 dramatically increase the accuracy there.