# Modeling the Atmosphere, pt. 2

The previous Modeling the Atmosphere post derived an expression for describing the change in pressure $dP$ with respect to change in altitude $dz$ in terms of density $\rho$ and acceleration due to gravity $g$:

$\frac{dP}{dz} = -\rho g$

This equation is short to write, but it is not particularly useful. Before applying it to real-life situations, it must be transformed into the barometric equation.

First, recall that density $\rho$ represents mass per unit volume. In Modeling the Atmosphere, pt. 1, $\rho$ was used to replace the expression $\frac{M}{V}$, where $M$ represents the mass of a thin slice $S$ of air with volume $V$. Now,

$\frac{dP}{dz} = -\frac{Mg}{V}$

Air is not actually composed of slices, so it would be more convenient to represent the mass $M$ in terms of particles. By volume, Earth’s atmosphere is composed of about 78% $N_2$, 21% $O_2$, and 1% $Ar$. Approximating Earth air as an ideal gas and using some information from the periodic table, the mass of one mole ($6.022 \times 10^{23}$) of air particles can be calculated:

$0.78(2 \cdot 14.02 \frac{\text{g}}{\text{mol}}) + 0.21(2 \cdot16.00 \frac{\text{g}}{\text{mol}}) + 0.01(39.95 \frac{\text{g}}{\text{mol}}) \approx 29.98 \frac{\text{g}}{\text{mol}} \approx 0.029 \frac{\text{kg}}{\text{mol}}$

So on average, $6.022 \times 10^{23}$ air particles (a.k.a. one mole of air particles) masses approximately $0.029 \text{ kg}$. Using this knowledge, the mass $M$ of one slice $S$ of air may be re-expressed as $0.029 \frac{\text{kg}}{\text{mol}} \cdot N \text{mol}$, where $N$ represents the number of moles of air particles in the slice $S$ of atmosphere. The same process holds for any other collection of particles that can be modeled as an ideal gas. For a general gas, each mole might mass $m \text{ kg}$ instead of $0.029 \text{ kg}$. Generally:

$\frac{dP}{dz} = \frac{-mNg}{V}$

and for Earth’s atmosphere in particular,

$\frac{dP}{dz} = \frac{-0.029 N g}{V}$

Now that the mass $M$ of the slice $S$ of atmosphere has been re-expressed as $mN$, let’s re-express the volume $V$ of the atmosphere slice using the ideal gas law:

$PV = NkT$

Solving for volume yields:

$V = \frac{NkT}{P}$

Substitute:

$\frac{dP}{dz} = \frac{-mNg}{\frac{NkT}{P}}$

and simplify:

$\frac{dP}{dz} = \frac{-mg}{kT} P$

At this point, we’ve almost transformed the starting equation into the barometric equation. To review, $m$ represents the mass per mole of the ideal gas (for Earth’s atmosphere, $m \approx 0.029 \frac{\text{kg}}{\text{mol}}$ ), $g \approx 9.81 \frac{\text{m}}{\text{s}^2}$ is the acceleration due to gravity, $k \approx 1.38 \times 10^{-23} \frac{\text{J}}{\text{K}}$ is the Boltzmann constant, and $T$ is the temperature in Kelvin (assumed to be constant – regardless of height – in this idealized atmosphere).

The next step requires calculus. First, “multiply both sides” by the differential $dz$:

$dP = \frac{-mg}{kT} P dz$

and divide both sides by $P$:

$\frac{1}{P} dP = \frac{-mg}{kT} dz$

Using the classic technique for solving differential equations, integrate both sides:

$\int \frac{1}{P} dP = \int \frac{-mg}{kT} dz$

$\ln{P} = \frac{-mg}{kT} z + c$

Exponentiate both sides:

$P(z) = e^{\frac{-mg}{kT}z+c} = e^c e^{\frac{-mg}{kT}z}$

Using the boundary condition when $z = 0$, it’s clear that the constant $e^c$ corresponds to the pressure at zero altitude: $P_0 = e^c$. Thus,

$P(z) = P_0 e^{\frac{-mg}{kT}z}$

Finally, we have derived the barometric equation. Using this equation, the pressure $P$ of an idealized atmosphere can be determined as a function of altitude $z$. Interestingly, this derivation is not the only method for obtaining the barometric equation. Check back for an alternate derivation and an application to satellite testing with weather balloons.