# What am I doing wrong in this estimation of the mass of the atmosphere?

I'm trying to approximate the mass of the atmosphere. I'm treating it as an ideal gas and therefore its density follows:

$$\rho(z) = \rho(0)e^{(\frac{-mgz}{k_BT})}$$

Where I'm using $$m=4.2122\cdot10^{-26}$$ kg as a weighted average taking into account the nitrogen and oxygen portions of the atmosphere; $$T=288.15$$ K as the average temperature of the atmosphere. We also need the density at sea leve, $$\rho(R_T)=1.225$$ kgm^-3 Then, making use of spherical coordinates, where the $$z$$ coordinate is $$r$$ (upper and lower limits are $$R_T + H$$ and $$R_T$$ respectively, with $$H=10^5$$ m):

$$m=\int dm = \int\rho dv= \int_{0}^{2\pi}\int_{0}^{\pi}\int_{R_T}^{R_T+H}r^2 \sin\theta e^{(\frac{-mgz}{k_BT})}drd\theta d\phi=4\pi\int_{R_T}^{R_T+H}\rho(R_T)r^2 e^{(\frac{-mgz}{k_BT})}dr=-4\pi\rho(R_T)(\frac{k_BT}{mg})^3[e^\frac{-mgr}{k_BT}((\frac{mgr}{k_BT})^2-2(\frac{mgr}{k_BT})+2)]_{R_T}^{R_T + H}$$

Which I inputted into Matlab, and then into my calculator, getting a result which is basically zero in both. What am I doing wrong here?

EDIT: As was brought up in the comments, if we take the relative distance from the ground so that the exponential in the lower limit results in 1 (so the lower limit is $$0$$ and the upper limit is $$H$$), the resulting value is much closer to the correct $$5\cdot10^{18}$$ kg result. However it's in the $$10^{13}$$ order, so it's rather far still.

• Why do you integrate in spherical coordinates and yet not use $z=r\cos(\theta)$? Commented Feb 1, 2022 at 17:35
• Oh, yeah, I missed that completely. I'll try it with the cosine now. Commented Feb 1, 2022 at 17:40
• @Newbie I thought about it and that would bring some trouble. For example for a point at 45 degrees of colatitude (or latitude), the z component at 30 km altitude using r times cosine would be 4500 km. That's inside the Earth. Commented Feb 1, 2022 at 17:46
• What you label as "z" is radial distance so it is "r" in spherical coordinates.
– nasu
Commented Feb 1, 2022 at 17:56
• Your final answer does not seem to give a very small value. It may be a prolem with the units. And indeed, at $r=R_T$ the exponential should be 1.
– nasu
Commented Feb 1, 2022 at 18:02

As you wrote $$m=\int_{V}\rho dV=\int_{\phi=0}^{2\pi}\int_{\theta=0}^{\pi}\int_{r=R_{1}}^{R_{2}}\rho(0)e^{-\frac{mg}{k_{\rm B}T}z}r^{2}\sin\theta drd\theta d\phi$$ Now define $$\alpha_{0}=\frac{mg}{k_{\rm B}T}$$ and use $$z=r$$ since as brought up in the comments $$z$$ is the altitude measured from the ground and may be denoted by radial distance $$r$$ in spherical coordinates. You end up with $$m=2\pi\rho(0)\int_{r=R_{1}}^{R_{2}}r^{2}e^{-\alpha_{0}r}\int_{\theta=0}^{\pi}\sin\theta d\theta dr$$ The integration over $$\theta$$ is 2 and you're left with the integration over $$r$$: $$m=4\pi\rho(0)\int_{r=R_{1}}^{R_{2}}r^{2}e^{-\alpha_{0}r} dr$$ This is a standard integral. You can use $$u=-\alpha_{0}r$$ such that $$du=-\alpha_{0}dr$$ and you have $$m=-\frac{4\pi\rho(0)}{\alpha_{0}^{3}}\int_{u=-\alpha_{0}R_{1}}^{-\alpha_{0}R_{2}}u^{2}e^{u} du$$ As mentioned here the solution to this integral is $$e^{u}(u^{2}-2u+2)$$. I apologize for my earlier comment about how $$z$$ relates to $$r$$.

• The $z$ in the atmospheric pressure equation is the height from the ground, which is not the same as the $z$ in spherical coordinates. Commented Feb 1, 2022 at 17:56
• @MichaelSeifert That's what I was thinking, after all for a large theta if you used the cosine you would end near the Earth's core. Commented Feb 1, 2022 at 17:57
• @MichaelSeifert Then $z=r$. I'll modify the answer accordingly. Thanks. Commented Feb 1, 2022 at 17:59
• I used that solution implicitly in my post, as far as I've checked (perhaps I've made a mistake inputting values), the closest I got to the correct value is still 5 orders of magnitude lower. Maybe the reasoning in my estimation is just not the best so the result, even if mathematically correct, is far from the correct one. Commented Feb 1, 2022 at 18:18
• @agaminon Can you tell me what you get for $\frac{k_{\rm B}T}{mg}$? Because I know that the scale height of the temperature is about 8 km. Just make sure that the units of $k_{\rm B}$ and $T$ are in harmony. Commented Feb 1, 2022 at 18:20

I admire your mathematical skills in tackling the problem as you did. My innate lack thereof is the reason I gave up on physics as a topic of study in 1972. But here is an easy way to estimate the mass of the atmosphere, as a check:

Every square INCH (corrected!!!) of the earth's surface has 14.7 pounds' worth of air sitting on top of it. Take the surface area of the earth and multiply it by 14.7 and there's the answer in pounds.

• Checked it and yes, it works perfectly fine! I guess I could calculate the mass of air per square meter myself to make it a bit more involved when presenting the problem. Nice idea. Commented Feb 1, 2022 at 18:44
• @agaminon This should be the correct way of calculating the mass of the atmosphere. Unless your original approach, it does not require assumptions about the temperature dependence with height, and neither about the exact shape of earth. Commented Feb 1, 2022 at 19:00
• @Thomas I assume then that I didn't make any mistakes in the derivation, rather the assumptions in the estimation are simply too approximate? Commented Feb 1, 2022 at 19:02
• @DavidWhite absolutely right, my mistake, will correct right now!!! -NN Commented Feb 1, 2022 at 20:36
• It is easier to remenber $1kg/cm^2$ Commented Feb 1, 2022 at 22:09

The barometric formula is not applicable for this case for at least two reasons:

• It is a formula for flat Earth, i.e., it is valid only close to the surface - the $$mgz$$ in the numerator is actually the gravitational potential energy. As a minimum one needs to replace it by that for the spherical earth: $$\phi(r)=-G\frac{Mm}{r}$$, where $$r$$ is the distance to the Earth center (rather than the height above the surface).
• The atmospheric density and pressure actually do not follow the barometric formula.
• You can completely ignore the mass of the atmosphere above H=100 km, so the sphericity of the earth does not make any difference here as H<<R. Also, if you take the local temperature T and density $\rho$ then the obtained column density (and thus mass) will be automatically correct as it corresponds to the local pressure (see my own answer) Commented Feb 1, 2022 at 22:23
• @Thomas One can do many different calculations and use many different models. The OP is trying to use the barometric formula, and I am addressing their approach. Commented Feb 2, 2022 at 8:17

The error in your equation is to have $$r$$ in the exponential rather than $$r-R$$ (the exponential must be $$1$$ at the earth's surface ($$r=R$$)). With the latter you obtain from your integration (assuming $$H$$ and the atmospheric scale height $$kT/(mg)$$ both small compared to $$R$$)

$$M = 4\pi\cdot \rho(R) \frac{kT}{mg}\cdot R^2 \cdot(1-e^{-H\frac{mg}{kT}})$$

The second term in the bracket can be neglected if the the height $$H$$ is large compared to the atmospheric scale height. In this case the local vertical column density is simply the volume density at the earth's surface (or in general the chosen reference point) times the atmospheric scale height. Multiplied by the earth's surface area, you then have the mass of the atmosphere.