# Homework Help: Density of an ideal gas as a function of height

Tags:
1. Jan 16, 2017

### Ian Baughman

1. The problem statement, all variables and given/known data
If air has a density of ρ0 on the surface, calculate its density as a function of the height y for two scenarios:
(a) the temperature is constant at T0;
(b) the temperature decreases linearly T(y) = T0 − ay.
Express your results using the given variables together the gravitational acceleration g, gas constant R and air molar mass M.

I think I am making an incorrect assumption or just going about this incorrectly. Let me know if you guys see the mistake. I am just focusing on part a as of now.
2. Relevant equations

1) F = ma
2) pV = nRT = (m/M)RT

3. The attempt at a solution

1) First, using the ideal gas law, we know:
ρ=(pM)/(RT)
2) Since M, R, and T are constant if we can figure out how pressure is changing with respect to height (y) then we can find how density is as well.

3) Assuming a "slab" of air with a height of dy and a cross-sectional area of A at surface level we can apply Newton's second law:
Fp_up - Fp_down - mg = ma
4) Fp_up = pressure acting up on slab Fp_down = pressure acting down on slab and a = 0. This gives:
Fp_up = Fp_down + mg
5) Since p = (F/A) ⇒ F = pA:
pA = (p + dp)A + ρ(Ady)g
6) I think this is where my mistake is but since we're considering a slab at surface level ρ in the above equation would be equal to ρ0

7) Form here I was able to solve the differential equation in step #5 and get:
p(y) = P00gy
8) I then substituted this in for p in the equation in step #1 and in turn got ρ as a function of y.

2. Jan 16, 2017

### Orodruin

Staff Emeritus
Note that $\rho$ changes with height as pressure changes with height. What does this tell you about the differential equation?

3. Jan 16, 2017

### Ian Baughman

That is has two different functions in it. What I ended up doing was using ρ=(pM)/(RT) to find dp/dy and then substitute that into the step 5 equation which gives me a linear first order differential equation consisting only of ρ'(y) and ρ(y). I did a similar approach in part b.

1) Using ρ=(pM)/(RT) I could find dp/dy=(R/M)(T'(y)ρ(y) + T(y)ρ'(y)).
2) I then substituted this into the equation:
dp/dy=-gρ​
3) SInce we know T(y) we can express it as a first order differential equation with variable coefficients. I used an integrating factor that does not work out very nicely. Is there something I missed or is this just unavoidable?

4. Jan 16, 2017

### haruspex

Please show that in detail.
But I suggest it will be easier working with an equation for p.
At 5) you have dp=ρg dy, and at 1), pM=ρRT. Eliminating ρ, what do they give you?

5. Jan 16, 2017

### Ian Baughman

1) I used equation one, pM=ρRT, and solved for p yielding p=(RT/M)ρ.
2) From here I found:
dp/dy=(RT/M)ρ'(y). ​
3) Using:
pA=(p+dp)A+ρ(Ady)g ⇒ dp=-ρgdy ⇒ dp/dy=-gρ​
4) I replaced dp/dy with (RT/M)ρ' and got (RT/M)ρ'=-gp.
5) Since this is a linear first order homogeneous diff eq, ρ'+(gM/RT)ρ=0, I used the characteristic polynomial, r+(gM/RT)=0.
6) I ended up getting this:
ρ(y)=ρoe(-gM/RT)y

6. Jan 16, 2017

### haruspex

Ok, that was a little convoluted but you got to the right place.
(I would have written dp=-ρg dy, pM=ρRT, so dp/p=-(gM/RT)dy, p=Ce-(gM/RT)y etc.)
So what about the case where T is linear with height?

7. Jan 16, 2017

### Ian Baughman

For this part I used dp/dy=-gρ because the forces were not dependent upon temperature. I also used p=(ρRT/M) to get dp/dy=(R/M)(T'(y)ρ(y)+T(y)ρ'(y)) since both temperature and density are dependent upon height. We know T(y)=To-ay so T'(y)=-a. Combinding dp/dy=(R/M)(T'(y)ρ(y)+T(y)ρ'(y)) and dp/dy=-gρ I was able to come up with this differential equation (sorry for it being a little messy):
ρ'(y)+((Mg-aR)/(RTo-ay))ρ(y)=0​

8. Jan 17, 2017

### haruspex

Should that be R(T0-ay)?
Anyway, can you solve that? For a hint see my last step in post #6.

9. Jan 17, 2017

@Ian Baughman I think you might find it useful to know that fluids and gases experience a force per unit volume given by $\vec{f}_v=-\nabla P$. The gravitational field supplies a force per unit volume of $\vec{f}_g=-\delta g \hat{z}$ where $\delta$ is the mass density of the fluid or gas. In order to have equilibrium, the net forces must be equal to zero: $-\nabla P-\delta g \hat{z}=0$. From this you can get a differential equation for the pressure as a function of height. You are already on the right track, but I thought you might find this of some use.

10. Sep 18, 2017

### Pushoam

How do you get: pM=ρRT?
But m = $\int_{all ~space ~up ~to~ height ~h} \rho (h) \, dV= A\int_0^h \rho \,d h$
$pM= \frac {\int_0^h \rho d\, h}{h} RT$

11. Sep 18, 2017

$M$ is presumably molecular weight and $m$ is the mass of the system of particles, but this is at best a clumsy approach and it is necessary to introduce a mass density $\delta=\frac{(M.W.) \,n}{V}=\frac{(M.W.) \, P}{RT}$ where I'm using $M.W.$ for molecular weight. The mass density $\delta$ will be a function of height for which they are using the letter $y$. (Normally $z$ is often used for height). $\\$ It is not necessary to introduce the total mass $m$ of this system of particles, and in this case, doing so is really a step in the wrong direction. $\\$ See post # 9 above for how to get a differential equation of pressure $P$ as a function of height. $\\$ Additional note: In the equation $PV=nRT$, $n$ is the number of moles of the system, but this problem needs to be worked using a density of moles of particles $\delta_{moles}=\frac{n}{V}$, and converting to a mass density $\delta=(M.W.) \delta_{moles}$. Writing $m=(M.W.) n$ is correct, but it offers little in solving the problem. The density of moles $\delta_{moles} =n/V$ and mass density $\delta= m/V=(M.W)n/V=(M.W.) \delta_{moles}$ are needed to solve the problem and not $n$ or $m$ by themselves. $\delta=(M.W.)n/V=(M.W.) \, P/(RT)$ can be used in the $\nabla P$ equation of post #9, and the differential equation is readily solved. $\\$ And one additional note: Using a small $p$ instead of a capital $P$ for pressure, and using a $\rho$ instead of a $\delta$ for density makes it very difficult to read through the equations. $p$ looks too much like $\rho$.

Last edited: Sep 18, 2017
12. Sep 19, 2017

### Pushoam

While applying the equation, PV = nRT,
P is the pressure acting on the system at height h due to all air molecules below the height h. Right?
So, m should be the mass of these molecules.
Why are you considering m as the mass of the infinitesimal small system ( the air molecule between height h and h + dh)?

13. Sep 19, 2017

A simpler approach if you aren't yet familiar with the gradient operator is to write $[P(z)-P(z+\Delta z)]A=(\delta ) A \Delta z \, g$, so that the upward force from the pressure difference on a thin layer of thickness $\Delta z$ is the same as the downward force from gravity on this same layer.($\delta$ here is the density. Note: Even though the letter $\delta$ is being used, it is not infinitesimal.) This gives, as $\Delta z \rightarrow 0$ that $-\frac{dP}{dz}=\delta g$. This is the starting point for the differential equation with mass density $\delta=(M.W.) n/V=(M.W.) P/(RT)$. $\\$ And notice for this differential equation, it can be rewritten as $\frac{dP}{P}=f(z) \, dz$, and then both sides can be integrated. $\\$ Additional comment: The equation $PV=nRT$ can also be written as a pressure vs. density relation: $P=\delta_{moles} RT$, where $\delta_{moles}=n/V$, so that mass density $\delta=(M.W.) \delta_{moles}=\frac{(M.W.)P}{RT}$. For problems involving a pressure that changes with altitude, it is necessary to use this second form of $PV=nRT$. This can also be written as $P=\frac{\delta \, RT}{M.W.}$ where $\delta$ is the mass density of the gas. $\\$ One additional note: The pressure is solved in this problem by solving a differential equation. To try to solve it buy using $m(z)=A \int\limits_{z}^{+\infty} \delta \, dz$ would be more difficult. Ultimately, you would need to write it in the form $\frac{dm}{dz}=- A \, \delta =...$ in order to solve for the pressure and/or the mass distribution function $m(z)$. And note that pressure $P(z)=\frac{m(z) \, g}{ A }$. $\\$ In fact, in looking at this last expression, it is an alternative derivation of the differential equation $\frac{dP}{dz}=-\delta \, g =-(M.W.)( \frac{P}{RT})g$.

Last edited: Sep 19, 2017
14. Sep 19, 2017

### Pushoam

When we use PV = nRT,
Here, P is the pressure acting on a surface at height h due to the air molecules lying under the surface. Is this correct?
So, n is the no.of moles of air molecules under this surface and V is the volume occupied by these air molecules.
So , $\delta= \frac {n[M.W]}{V}$ is uniform. Isn't it?

15. Sep 19, 2017

The equation $PV=nRT$ in its simplest form applies to a small box of volume $V$ , and pressure and temperature are constant throughout the sample. The same equation can be used in problems involving the atmosphere around the earth where pressure and temperature will change with altitude, and the the pressure and temperature can only be expressed as a constant very locally. Instead of using a volume $V$ with $n$ moles present in the sample, the ratio $\frac{n}{V} =\delta_{moles}$ is used to describe the atmosphere. but it only can be considered uniform for very locally. The pressure $P$, temperature $T$, and density $\delta_{moles}$ completely describe the atmosphere locally , and because they are related by $P=\delta_{moles} RT$, given any two of the parameters, we can compute the 3rd one. $\\$ For the problem at hand, for the first part, they give us the info that $T$ is a constant with $T=T_o$, and we also know the pressure at height $z=0$. By the laws of gravity, this provides a differential equation $\frac{dP}{dz}=-(M.W.)\delta_{moles} g$ where $g$ is the gravitational constant, so that it is possible to solve for $P$ as a function of $z$. At higher altitudes, the pressure is lower. If we go to $z=10,000$ feet, the pressure drops to about 80% of what it is at $z=0$, etc. This problem is asking us to compute this function of $P$ vs. $z$ using the laws of gravity, along with knowing that the pressure must adjust itself to offset the gravity to have local equilibrium. $\\$ Incidentally, it may interest you that because the atmosphere is roughly 78% (by moles) diatomic nitrogen of M.W.=28 and 21% diatomic oxygen with M.W.=32, the approximate $M.W.$ that can be used in these formulas is $M.W.=30$ (grams per mole=30E-3 kg/mole). Meanwhile $R=.08206$ liter-atmosphere/(mole degree Kelvin), and $T=295$ kelvin for room temperature. In addition 1000 liters=1 m^3 , and $g=9.8 \, m/sec^2$. The pressure can then be expressed as a function of $z$ in meters. The result that we get for constant temperature $T=295$ K should look something like $P=P_o e^{-z/z_o }$, where $P_o=1$ atmosphere with $z_o \approx 10,000$ meters. (Just an estimate=I didn't compute it precisely). Two other conversion factors are necessary to compute this and that is 1 N (Newton)=1 kg m/sec^2 in order to cancel the units, along with 1 atm=1.01 E+5 N/m^2 . $\\$ Editing: Upon computing it more precisely, I get $z_o=8.3 E+3$ meters. $\\$ Additional item: The equation $PV=nRT$ is often presented in a first year chemistry course, and the students may get to analyze and practice with this equation for a week or more.( e.g. they change the volume at constant temperature and get $P_1 V_1=P_2 V_2$ etc.) If the student already has this background, the problem is a simple exercise, but it may be worthwhile to study this equation in detail if it is new to you.

Last edited: Sep 19, 2017
16. Sep 20, 2017

### Pushoam

Thank you, Charles Link ,for helping me again and again.

I think I have got it this time.
What I have understood:

Using the symbols already defined in the above posts ( particularly $\rho$ for mass density and M.W. for molecular weight),

Let's consider a small volume dV of air molecules at height h as our system.
Let's consider the equilibrium of the massless surface enclosing this molecules.
Now, according to Newton's first law, it is clear that
on any surface,
Force due to the pressure due to the molecules outside the system = - Force due to the pressure due to molecules inside the system
Pressure due to the molecules outside the system = pressure due to the molecules inside the system

Pressure due to the molecules inside the system of volume ΔV on any surface,
$P_{sys}= \frac n {ΔV } RT = \frac {\frac {Δm} {M.W.}} {ΔV} RT = \frac {\frac{Δ m }{ΔV}}{M.W.} RT$
In the limit ΔV→0
i.e. ΔV = dV, $\lim_{ΔV→0} \frac{Δ m }{ΔV} = \frac{d m }{dV} = \rho$
$P_{sys}= \frac {\rho }{M.W.} RT$
$P_{sys} = P_{atm} = \frac {\rho }{M.W.} RT$................................................................................................................(1)

Now considering the equilibrium of the system,
$P_{atm}(~on ~the ~lower ~surface) - P_{atm}(~on ~the ~upper ~surface) = \rho g Δz$
In the limit that Δz →0,
$\frac{dP_{atm}}{dz} = -\rho g$.............................................................................................................(2)

Solving the above two eqns.(1) and (2) along with initial conditions gives the required answer .
Is this correct so far?

Last edited: Sep 20, 2017
17. Sep 20, 2017

Very good. It might be helpful to know that the force from the atmosphere on one face of the surface is $F_{atm}=PA$. Meanwhile the gravitational force on a mass $\Delta m$ is $F_g= \Delta m \, g =\rho \,\Delta V \, g=\rho \, A \, \Delta z \, g$. The total force in the downward direction is $F_{total}= \rho \, A \, \Delta z \, g +P(z+\Delta z) \, A-P(z) \, A$. If there is to be no acceleration, since $F_{total}=\Delta m \, a$,(Newton's second law is $F=m a$), we must have $F_{total}=0$. This gives your equation (2) above.

18. Sep 20, 2017

Thank you.