# 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

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:
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.