**Path:**Release / RisingPT.ipynb

**Description:**Learning Materials released by the MathTrek Team

**Views:**1359

**License:**OTHER

**Image:**ubuntu2004

**Project:**MathTrek

Edit | Raw | Embed | Download

# Rising Up in the Air - Experimenting with Radio Balloons

# Part III: Combining Temperature and Pressure

By Ingo Dahn, (Koblenz, Germany [email protected]) and Ambjörn Naeve (Stockholm, Sweden [email protected])

Weather balloons are a simple, but important mean to explore the atmosphere. They carry radiosondes high up in the air (how high?) These radiosondes measure several parameters of the atmosphere during their flight, for instance air temperature and air pressure. Weather balloons collect many data. With a good understanding of atmospheric phenomena, we should be able to predict these data to a certain extent. Can you do it?

This notebook lets you perform your own experiments with real weather balloons. We have started in

Part IIn this part we are combining temperature and pressure towards a general model to calculate height from pressure. Then, comparing with the real balloon data, we can evaluate the quality of these calculations. On the way, we shall explore why a ballon flies at all.

You can repeat all this yourself with data from many balloon risings! Can you come up with a better model?

This notebook is made of a sequence of cells:

Text cells, explaining what we do. The text cells analyze a specific default balloon flight. They do not change and, depending on your working environment, you may not be able to change the content of text cells.

**Code cells**with Sage code. You must _execute_ these cells to actually run the code. Depending on your environment, you execute cells by pressing the*Execute*button, by clicking into the cell and pressing*Shift+Return*or by selecting a*Run*item from the*Cell*menu. You can modify the content of code cells and you should do this in the places indicated in order to perform your own live experiments with real weather data!**Note:**Code cell calculations mostly use the results of calculations of previous cells. Therefore it is important that they are__executed in the given order__.Hovering the mouse over the SageMath icon will reveal some additional explanations on the code - try it

**Interactive questions**from Wamap. Many of these questions come with written examples, explaining the underlying Math.

Don't worry, if you don't understand the content of the code cells! We start simple and so you don't need to know a lot of Math, Physics or Programming - just go and experiment! Whenever you run into trouble - have a look at our

License: This document is made available under a

Creative Commons Attribution Share Alike License 4.0The following cell prepares the environment by downloading data from weather balloon flights "

If it has in line 2 `randomBalloon=False` (the default) it uses a specific sample balloon flight which is discussed in the comments. You may change it to `randomBalloon=True` in order to select data from a randomly selected balloon flight.

**This cell must be executed first.**

# Change the value of randomBalloon to True in order to select a flight by chance randomBalloon=False load('https://raw.githubusercontent.com/ingodahn/sageutils/master/weather.py') station=station() if randomBalloon: flight=station.getFlight('random') else: flight=station.getFlight() press=flight.dataPoints('height','pressure') temp=flight.dataPoints('height','temperature')

Note: Different notebooks use distinct computational environments. Therefore, if you use a randomly selected flight in this book, it is probably different from a flight you used in part I or II. If you want to continue working with the same flight, you should paste the output of the last code cell from of Part I into the following cell and execute it.

#Paste status below this line temp = [(376, 15.0000000000000), (500, 13.9000000000000), (767, 11.4000000000000), (996, 9.90000000000000), (1000, 9.90000000000000), (1373, 7.40000000000000), (1469, 6.80000000000000), (1500, 6.60000000000000), (1785, 5.20000000000000), (1795, 5.20000000000000), (1845, 4.20000000000000), (1885, 3.40000000000000), (1936, 5.00000000000000), (1966, 5.40000000000000), (1976, 5.60000000000000), (2000, 5.80000000000000), (2007, 5.80000000000000), (2048, 6.50000000000000), (2111, 7.60000000000000), (2280, 6.00000000000000), (2647, 2.80000000000000), (2960, 0.100000000000000), (3052, -0.700000000000000), (3077, -0.900000000000000), (3250, -1.10000000000000), (3356, -1.90000000000000), (3546, -3.30000000000000), (3643, -2.30000000000000), (3816, -3.50000000000000), (3991, -3.50000000000000), (4119, -3.70000000000000), (4275, -5.20000000000000), (4634, -8.70000000000000), (4895, -9.90000000000000), (4937, -10.1000000000000), (5366, -12.5000000000000), (5395, -12.8000000000000), (5513, -13.9000000000000), (5680, -15.3000000000000), (5815, -16.1000000000000), (6563, -22.2000000000000), (6798, -24.1000000000000), (6832, -24.3000000000000), (7320, -27.5000000000000), (7558, -28.9000000000000), (8448, -36.9000000000000), (8694, -39.1000000000000), (8757, -39.7000000000000), (9055, -42.1000000000000), (9077, -42.3000000000000), (9320, -44.3000000000000), (9729, -47.7000000000000), (10063, -50.7000000000000), (10136, -51.1000000000000), (10510, -54.5000000000000), (10617, -55.7000000000000), (11319, -61.1000000000000), (11347, -61.3000000000000), (11461, -61.9000000000000), (11910, -63.7000000000000), (11999, -64.3000000000000), (12093, -63.4000000000000), (12489, -59.6000000000000), (12523, -59.3000000000000), (12880, -58.4000000000000), (13220, -57.5000000000000), (13418, -58.6000000000000), (13620, -59.7000000000000), (13700, -58.7000000000000), (13786, -58.6000000000000), (13872, -58.4000000000000), (14702, -57.0000000000000), (15164, -56.3000000000000), (15326, -56.0000000000000), (15549, -55.7000000000000), (16081, -56.7000000000000), (16270, -57.1000000000000), (16609, -57.0000000000000), (16847, -57.0000000000000), (17037, -57.0000000000000), (17247, -56.9000000000000), (17435, -56.9000000000000), (17675, -56.8000000000000), (18237, -56.7000000000000), (18530, -56.7000000000000), (18599, -56.4000000000000), (18833, -55.5000000000000), (18978, -55.6000000000000), (19197, -55.8000000000000), (19878, -56.3000000000000), (20223, -56.6000000000000), (20660, -56.9000000000000), (20767, -57.0000000000000), (20870, -57.2000000000000), (21358, -57.8000000000000), (21886, -58.5000000000000), (23890, -57.1000000000000), (24557, -56.9000000000000), (25070, -56.7000000000000), (25628, -56.5000000000000), (26241, -56.4000000000000), (26460, -56.3000000000000), (26923, -56.4000000000000), (27456, -56.5000000000000), (27682, -56.5000000000000), (27721, -56.5000000000000), (28121, -55.2000000000000), (28419, -54.3000000000000), (28732, -53.3000000000000), (29063, -52.4000000000000), (29413, -51.3000000000000), (29730, -50.4000000000000), (29952, -49.8000000000000), (30300, -48.8000000000000), (30733, -47.6000000000000), (30930, -47.1000000000000), (30997, -46.9000000000000), (32406, -47.7000000000000), (34448, -40.7000000000000)] press = [(376, 969.0), (500, 954.9), (767, 925.0), (996, 900.0), (1000, 899.6), (1373, 860.0), (1469, 850.0), (1500, 846.9), (1785, 818.0), (1795, 817.0), (1845, 812.0), (1885, 808.0), (1936, 803.0), (1966, 800.0), (1976, 799.0), (2000, 796.7), (2007, 796.0), (2048, 792.0), (2111, 786.0), (2280, 770.0), (2647, 736.0), (2960, 708.0), (3052, 700.0), (3077, 698.0), (3250, 683.0), (3356, 674.0), (3546, 658.0), (3643, 650.0), (3816, 636.0), (3991, 622.0), (4119, 612.0), (4275, 600.0), (4634, 573.0), (4895, 554.0), (4937, 551.0), (5366, 521.0), (5395, 519.0), (5513, 511.0), (5680, 500.0), (5815, 491.0), (6563, 444.0), (6798, 430.0), (6832, 428.0), (7320, 400.0), (7558, 387.0), (8448, 341.0), (8694, 329.0), (8757, 326.0), (9055, 312.0), (9077, 311.0), (9320, 300.0), (9729, 282.0), (10063, 268.0), (10136, 265.0), (10510, 250.0), (10617, 246.0), (11319, 220.0), (11347, 219.0), (11461, 215.0), (11910, 200.0), (11999, 197.0), (12093, 194.0), (12489, 182.0), (12523, 181.0), (12880, 171.0), (13220, 162.0), (13418, 157.0), (13620, 152.0), (13700, 150.0), (13786, 148.0), (13872, 146.0), (14702, 128.0), (15164, 119.0), (15326, 116.0), (15549, 112.0), (16081, 103.0), (16270, 100.0), (16609, 94.8), (16847, 91.3), (17037, 88.6), (17247, 85.7), (17435, 83.2), (17675, 80.1), (18237, 73.3), (18530, 70.0), (18599, 69.2), (18833, 66.7), (18978, 65.2), (19197, 63.0), (19878, 56.6), (20223, 53.6), (20660, 50.0), (20767, 49.2), (20870, 48.4), (21358, 44.8), (21886, 41.2), (23890, 30.0), (24557, 27.0), (25070, 24.9), (25628, 22.8), (26241, 20.7), (26460, 20.0), (26923, 18.6), (27456, 17.1), (27682, 16.5), (27721, 16.4), (28121, 15.4), (28419, 14.7), (28732, 14.0), (29063, 13.3), (29413, 12.6), (29730, 12.0), (29952, 11.6), (30300, 11.0), (30733, 10.3), (30930, 10.0), (30997, 9.9), (32406, 8.0), (34448, 5.9)] # Paste status above this line print('Status restored')

### Dividing Pressure by Temperature

We have seen in Part II that experimental data are not a reliable base for calculating the height of an airplane from the pressure it measures. So we need a better founded model.

So far we have explored the dependency of temperature from height and of pressure from height. After a critical look at what we have done so far, height looks somewhat suspicious: While temperature and pressure are properties of the air, height is the distance between the air and something completely different: The earth!

We move on as simple as possible, ignoring the earth and looking at the relation between the two properties of the air: Temperature and Pressure.

To explore the relation between two magnitudes of different nature, it is often a promising first shot to look at their quotient, in our case $\frac{pressure}{temperature}$. If we are lucky, both could be proportional. Given the irregular dependency of temperature from height vs. the regular development of pressure, proportionality is unlikely, but it's woth an attempt.

Note that the minimal pressure is 0, but we have measured temperature in °C which is rather arbitrary. That did not matter as long as we were only interested in differences of temperature, but it makes a difference when we use temperature in a quotient (consider $t=0°C$). So, we better change to absolute temperature in °K (degree Kelvin) by adding 273.15.

qpt=[(press[i][1]/(temp[i][1]+273.15),press[i][0]) for i in range(0,len(press))] show(list_plot(qpt),axes_labels=["mbar/K","m"])

This is not a constant function, so temperature and pressure are not proportional.

### The Ideal Gas Law, Density and Buoyancy

What is the meaning of this quotient $\frac{P}{T}$? The

ideal gas law$\frac{P}{T}=\rho\cdot R_{specific}$

The proportionality factor $R_{specific}$ is the gas constant. Each gas has it's specific proportionality factors, therefore this factor is called specific gas constant, which is given as $287.058 \dfrac{J}{kg \, K} \,$ for dry air.

Tip: Calculating with units requires some care. To compare magnitudes measured in different unit, it is always a good idea to convert them to a representation using a standard scale. This

Unit Calculator#### A Critical Eye on the Ideal Gas Law

A real gas is a complex mixture, the properties of which change with height and temperature. To find formulas that allow to approximately calculate properties of the air, mathematical models must

how to simplify the model to derive such formulas and

to understand how these simplifications affect the validity of the derived formulas.

One of these simplifications concerns the compression of air. Unlike liquids, air is compressible. Under the weight of the atmosphere above it, the same amount of air molecules needs a smaller volume at sea level than high up. This is described by the ideal gas law.

#### Air Density

The density of air is an especially important property. As will be discussed later, air density affects the available buoyancy of flying objects. Weather balloons do not measure air density, but the ideal gas law allows us to calculate it approximately. Weather balloons, however, do measure what is called the dew point of the air, indicating it's moisture and thus allowing for better approximations than the ideal gas law allows, but this is currently beyond the limits of this notebook.

Before we calculate air density from our weather balloon's data, we need to have a look at the units used to express the gas constant. Since $\ 1 \ J \ = 1 \ N \ m \$, we get $\ R_{specific} \ = \ 287.058 \ \dfrac{N \ m}{kg \; K} \$

Therefore $\rho = \frac{p\ mbar}{t\ K\cdot 287.058 \frac{N\ m}{kg\ K}}=\frac{p}{t}\cdot \frac{1}{287.058}\frac{mbar\ kg}{N\ m}$.

Since $1\ mbar=100\ Pa= 100\ \frac{N}{m^2}$ we have $\rho= \frac{p}{t}\cdot \frac{1}{2.87058}\ \frac{kg}{m^3}$ where $p$ is the pressure in $mbar$ and $t$ is the temperature in $K$.

rho=[(q[0]/2.87058,q[1]) for q in qpt] rhoPlot=list_plot(rho) show(rhoPlot,axes_labels=["Air Density (kg/m^3)","Height (m)"])

According to

Archimedes' PrincipleLet's check this. The German weather station at Idar-Oberstein uses

radio sondes of type RS41At which height did our balloon meet an air density that equals the density of it's helium inside?

i=0 while rho[i][0] >= 0.1785: i=i+1 h=rho[i][1] print("At a height of",h,"m the density of the helium exceeds that of the air.") hel=plot(h,(0,1.3),color='green') show(rhoPlot+hel,axes_labels=["Air Density (kg/m^3)","Height (m)"])

Why does the balloon fly so much higher than predicted by our model based on Archimedes' principle? In fact, the density of the balloon is even higher than the density of helium, because the mass of the balloon hull and of the equipment must be added to the mass of the helium.

The only way to keep the low density of the balloon with a constant mass is expanding it's volume. With increasing height, the air pressure decreases until it is less than the pressure of the helium in the balloon and the balloon expands, increasing it's volume and decreasing thus it's density, flying higher and higher until it bursts.

For example, an average balloon, which has a diameter of 1.5 m when started, may expand to a diameter of 7 m when it bursts after flight of about two hours at a height of 33 km.

### Barometric Formulas

Let's get back to our problem to find a reliable way of calculating the height of an airplane from the pressure of the air it meets.

Barometric formulasThere are more than one competing barometric formulas. On which

The following video derives the Second Barometric Formula.

This derivation is

We have already discussed the simplifications on which the ideal gas law is based. A further simplification, made in this video, assumes that

The video derives in line (3) from $P = \rho g h$ that for a small change $dh$ of height the change of the air pressure can be calculated as

$dP(z) \ = \ -\rho \ g \ dz .$That is plausible only if it is

How can that be justified? A closer inspection of the argument in the video shows that the invariance of air density is used only for slight changes of height, while it is still allowed, that the density has different values at different heights. So, in fact, it is only

We cannot really check the equation above since we only have a sparse set of discrete datapoints at quite different heights. But isn't it puzzling that, according to the equation above, (dP/dh)/rho is the gravitational constants? Towards the

end of the above videoRecall that press[i][1] is the pressure $p_i$ in millibar at the datapoint with index i, press[i][0] is the height $h_i$ in m at datapoint i. rho[i][0] is the density $\rho_i$ of the air at datapoint i in kg/m^3 as calculated above from the ideal gas law using the specific gas constant of dry air.

To translate the mbar of the pressure into the standard units of kg,m,s we use the fact that $1 \ \text {Pa} = 1 \ \dfrac {N}{m^2}$ and $1 \ N = 1 \ \dfrac {\text {kg} \times {m}}{s^2}$. Recall that you can convert units with the

Units CalculatorHence we get $x\ mbar\ =\ x \cdot 100\ Pa\ = \ x \cdot 100\ \cdot \dfrac {N}{m^2} =\ x \cdot 100 \ \dfrac {\text {kg} \times {m}}{s^2}$.

Therefore, we must multiply the pressure values $p_i$ (i.e. p[i][1] in the code) with 100 to have them in $\dfrac {\text {kg} \times {m}}{s^2}$, which then gives the quotient $\dfrac{dP}{dh\rho}$ in $\dfrac {m}{s^2}$, which is the SI unit for acceleration.

With this adaptation the following diagram plots the quotient $\dfrac{100\cdot(p_{i+1}-p_i)}{(h_{i+1}-h_i)((\rho_{i+1}+\rho_i)/2)}$ in $\dfrac {m}{s^2}$.

The horizontal axis shows the height $h_i \$ (of the corresponding datapoint $\ i$) in meters.

ph=[(press[i][0],100*(press[i+1][1]-press[i][1])/((press[i+1][0]-press[i][0])*(rho[i][0]+rho[i+1][0])/2)) for i in range(0,len(press)-1)] p_data=list_plot(ph) ph_mean=mean([ph[i][1] for i in range(0,len(ph)-1)]) p_mean=plot(ph_mean,(0,35000),color='red') show(p_data+p_mean,axes_labels=['Height','g-Quotient']) print('Mean value (red):',ph_mean)

If you keep in mind that the difference of height between 2 successive points can be easily several 100 m (which is far from being a small change), we should not expect high accuracy and so our values of $\dfrac{100\cdot(p_{i+1}-p_i)}{(h_{i+1}-h_i)((\rho_{i+1}+\rho_i)/2)}$ vary reasonably around $-g = -9.80665$, though with great variability.

The second barometric formula, derived in the video above calculates the pressure in dependence of the height as $P=P_0 e^{-k_2\cdot h}$ with $k_2=\frac{Mg}{RT}$ where $P_0=1013.25\ mbar$ is the pressure at sea level, $M=0.02896 \frac{kg}{mol}$ is the middle molar constant, $g=9.80665 \frac{m}{s^2}$ is the gravitational constant, $R=8.314 \frac{J}{K\ mol}$ is the universal gas constant, $R_{specific}=\frac{R}{M}$ is the specific gas constant and $T=288.15\ °K$ is the standard temperature.

P_0=1013.25 M=0.02896 g=9.80665 R=8.314 T_s=288.15 k_2=(M*g)/(R*T_s) P_bar2(x)=P_0*e^(-k_2*x) Plot_bar2=plot(P_bar2,0,35000,color='blue', legend_label='2nd Barometric Formula') Plot_balloon=list_plot(press,color='red',legend_label='Balloon Data') show(Plot_bar2+Plot_balloon,axes_labels=['Height (m)','Pressure (mbar)'])

That does not look very accurate, around heights of about 15 000 m. Let's look at the difference between the measured data and the data from the formula.

Recall that press[i][0] is the height of datapoint $i$ and press[i][1] is the pressure measured at this height. If a pilot uses the inverse of the barometric formula $H_{bar2}(P)=\frac{\ln(\frac{P}{P_0})}{-k_2}$ the difference between the real value press[i][0] and the value calculated from the real pressure H_bar(press[i][1] is plotted by the next cell

H_bar2(x)=log(x/P_0)/(-k_2) Plot_H2D=list_plot([(press[i][0],(press[i][0]-H_bar2(press[i][1]))) for i in range(0,len(press)-1)],color='blue',legend_label='2nd Barometric Formula') show(Plot_H2D,axes_labels=['Height (m)','Height Difference (m)'])

That's a big difference and it keeps growing with height. You probably wouldn't like to fly with a pilot using the second barometric formula for calculating his height if his calculations provide values which are too low for a few kilometers.

#### The First Barometric Formula

Let's see whether we can improve the model with the first barometric formula:

As in the derivation of the second barometric formula we

where we have introduced the notation $\ R_s \ = \ R_{specific}$ and $z$ is a variable for the height.

We also

and dividing $\ dP(z) \$ by the $\ P(z) \$ expression above we get:

$\frac{dP(z)}{P(z)} \ = \ - \frac{g\ dz}{R_s T(z)} ,$But, instead of a constant temperature,

From the equation above we get $\frac{dT}{dz}=L$ and hence $\ dz \ = \ \frac {1}{L} \ dT(z)$. Hence we have:

$\frac{dP(z)}{P(z)} \ = \ - \frac{g}{R_s L} \frac{dT(z)}{T(z)} .$Integrating this expression from the surface level $\ (z = 0) \$ to the altitude $\ z = h$, and remembering that $\ \frac{g}{R_s L} \$ is a constant, we get:

$\ \int\limits_0^h\frac{dP(z)}{P(z)} dz \ = \ - \frac{g}{R_s L} \int\limits_0^h \frac{dT(z)}{T(z)} dz ,$$\ [ \ \ln P(z) \ ]_0^h \ = \ - \frac{g}{R_s L} [ \ \ln T(z) \ ]_0^h \ ,$$\ \ln P(h) - \ln P(0) \ = \ - \frac{g}{R_s L} ( \ \ln T(h) - \ln T(0) \ ) \ ,$$\ \ln \frac{P(h)}{P(0)} \ = \ - \frac{g}{R_s L} \ln \frac{T(h)}{T(0)} = \ \frac{g}{R_s L} \ln \frac{T(0)}{T(h)},$$\ \frac{P(h)}{P(0)} \ = \ \left[\frac{T(0)}{T(h)}\right]^{ \dfrac{g}{R_s L}} .$Hence we have:

$\ P(h) \ = \ P(0) \ \left[ \ \frac {T(0)}{T(0)+Lh} \ \right]^{ \ \dfrac {g}{R_s L}} .$This equation is called the first barometric formula. Let's see, how it fits our ballon data.

L=-0.0065 R_s=R/M P_bar1(x)=P_0*(T_s/(T_s+L*x))^(g/(R_s*L)) Plot_bar1=plot(P_bar1,(0,35000),color='green',legend_label='1st Barometric Formula') show(Plot_bar2+Plot_bar1+Plot_balloon,axes_labels=['Height (m)','Pressure (mbar)'])

It looks like the First Barometric Formula has a much better match with the balloon data than the Second. Let's calculate it

The height $H_{bar1}(x)$ for pressure x is calculated by the inverse of the First Barometric Formula. With the shorthand $P_0=P(0),\ T_s=T(0),\ k_1=\frac{g}{R_sL}$ we can write the first barometric formula for pressure $x$ and height $h$ as

$x\ =\ P_0(\frac{T_s}{T_s+Lh})^{k_1},$$\frac{T_s+Lh}{T_s}\ =\ (\frac{P_0}{x})^\frac{1}{k_1},$$H_{bar1}(x)=\frac{T_s}{L}\cdot ((\frac{P_0}{x})^\frac{1}{k_1}-1)\ =\ \frac{T_s}{L}\cdot ((\frac{P_0}{x})^\frac{R_sL}{g}-1).$TL=T_s/L kk=(R_s*L)/g H_bar1(x)=TL*((P_0/x)^kk-1) Plot_H1D=list_plot([(press[i][0],(press[i][0]-H_bar1(press[i][1]))) for i in range(0,len(press)-1)],color='green',legend_label='1st Barometric Formula') show(Plot_H1D+Plot_H2D,axes_labels=['Height (m)','Height Difference (m)'])

For great heights, the values of the first barometric formula also deviate considerably from the values measured by our balloon, but the deviation is less than that of the values of the Second Barometric Formula. In particular, the First Barometric Formula shows a much better match in the region up to a height of 13 km which is essential for commercial aircrafts.

Thus,

Question: Can you guess, why even the First Barometric Formula behaves so badly above 13 km?

Answer: Recall from

Part I### To Do:

Analyse many balloon flights to find limitations for the development of temperature in the tropopause,

Modify the derivation of the First Barometric Formula to find a Barometric Formula for the tropopause to calculate height from air pressure

You may use the following cell for your own experiments.