# Virial expansion for a gas

Reference: Daniel V. Schroeder, An Introduction to Thermal Physics, (Addison-Wesley, 2000) – Problem 1.17.

The ideal gas law isn’t entirely accurate for any real gas. For low density gases, one way of accounting for deviations from the ideal gas law is to use a virial expansion:

$\displaystyle PV=nRT\left[1+\frac{B\left(T\right)}{\left(V/n\right)}+\frac{C\left(T\right)}{\left(V/n\right)^{2}}+\ldots\right] \ \ \ \ \ (1)$

where ${B}$ and ${C}$ are the virial coefficients, and depend on the particular gas we’re modelling. For nitrogen molecules ${\mbox{N}_{2}}$ the measured values of ${B}$ are

 ${T\mbox{ (K)}}$ ${B\mbox{ (m}^{3}/\mbox{mol})}$ ${V/n\left(\mbox{ m}^{3}/\mbox{mol}\right)}$ ${B\left(T\right)/\left(V/n\right)}$ 100 ${-160\times10^{-6}}$ 0.0082 ${-0.0195}$ 200 ${-35\times10^{-6}}$ 0.0164 ${-0.00213}$ 300 ${-4.2\times10^{-6}}$ 0.0246 ${-0.00017}$ 400 ${9.0\times10^{-6}}$ 0.0328 ${0.000274}$ 500 ${16.9\times10^{-6}}$ 0.0410 ${0.000412}$ 600 ${21.3\times10^{-6}}$ 0.0492 ${0.000433}$

Using the ideal gas law and the gas constant ${R=8.31\mbox{ J/K}}$ to get values for ${V/n}$ at each temperature gives the third column in the table, and then we can use these values to calculate the ${B/\left(V/n\right)}$ terms in the fourth column. [Note that I’ve converted Schroeder’s values to SI units.] The corrections are very small so the ideal gas law should work well under these conditions.

As to why ${B}$ is negative for low temperatures and positive for high temperatures, it is known that gas molecules feel a weak attraction when fairly close to each other. At low temperatures, the molecular speed is lower, so this attraction would have a chance to be more strongly felt. Thus the molecules would tend to be closer to each other than if they didn’t interact, resulting in a slightly smaller volume. A negative value of ${B}$ (at a given ${P}$ and ${T}$) means a smaller volume.

For higher temperatures, the molecules are moving too fast for this attraction to have any effect, so molecules simply bounce off each other. Because the molecules have a non-zero volume (as opposed to the point molecules assumed by the ideal gas law), a slightly larger volume is needed at a given (high) temperature and pressure.

Another equation of state (that is, a relation between ${P}$, ${V}$ and ${T}$) is the van der Waals equation:

$\displaystyle \left(P+\frac{an^{2}}{V^{2}}\right)\left(V-nb\right)=nRT \ \ \ \ \ (2)$

where the parameters ${a}$ and ${b}$ are constant for a given gas. To compare this to the virial expansion above, we can write this as

 $\displaystyle \left(P+\frac{an^{2}}{V^{2}}\right)\left(V-nb\right)$ $\displaystyle =$ $\displaystyle \left(P+\frac{an^{2}}{V^{2}}\right)V\left(1-\frac{nb}{V}\right)\ \ \ \ \ (3)$ $\displaystyle PV$ $\displaystyle =$ $\displaystyle nRT\left(1-\frac{nb}{V}\right)^{-1}-\frac{an^{2}}{V}\ \ \ \ \ (4)$ $\displaystyle$ $\displaystyle =$ $\displaystyle nRT\left[\left(1-\frac{b}{V/n}\right)^{-1}-\frac{a}{RT\left(V/n\right)}\right] \ \ \ \ \ (5)$

By Taylor-expanding the first term in brackets, assuming ${bn/V\ll1}$, we get

 $\displaystyle PV$ $\displaystyle \approx$ $\displaystyle nRT\left[1+\frac{b}{V/n}+\frac{b^{2}}{\left(V/n\right)^{2}}-\frac{a}{RT\left(V/n\right)}\right]\ \ \ \ \ (6)$ $\displaystyle$ $\displaystyle =$ $\displaystyle nRT\left[1+\frac{1}{V/n}\left(b-\frac{a}{RT}\right)+\frac{b^{2}}{\left(V/n\right)^{2}}\right] \ \ \ \ \ (7)$

Comparing with 1 we see that the van der Waals model predicts

 $\displaystyle B\left(T\right)$ $\displaystyle =$ $\displaystyle b-\frac{a}{RT}\ \ \ \ \ (8)$ $\displaystyle C\left(T\right)$ $\displaystyle =$ $\displaystyle b^{2} \ \ \ \ \ (9)$

By fitting the curve 8 to the data in the table above, we can get estimates for ${a}$ and ${b}$. I used Maple’s Fit function (which does a least squares fit), with the result:

 $\displaystyle a$ $\displaystyle =$ $\displaystyle 0.0219\mbox{ J m}^{3}\mbox{mol}^{-2}\ \ \ \ \ (10)$ $\displaystyle b$ $\displaystyle =$ $\displaystyle 6.42\times10^{-5}\mbox{m}^{3}\mbox{mol}^{-1} \ \ \ \ \ (11)$

Comparing the value of ${b}$ with the values of ${V/n}$ in the above table, we see that our assumption of ${bn/V\ll1}$ is consistent, so we’re safe.

The following plot illustrates how good the fit is:

The green curve is the van der Waals fit 8 and the red crosses are the data from the table above. [Note that ${B}$ is plotted using Schroeder’s units, which are just SI units multiplied by ${10^{6}}$.] The fit is actually fairly good, so the van der Waals equation is a decent model for these data.

# Barometric equation: the exponential atmosphere

Reference: Daniel V. Schroeder, An Introduction to Thermal Physics, (Addison-Wesley, 2000) – Problem 1.16.

A model for the pressure in the atmosphere as a function of height can be estimated from the ideal gas law. Suppose we have a horizontal slab of air with thickness ${dz}$ and a unit cross sectional area. The density of air is a function ${\rho\left(z\right)}$ of height ${z}$ above sea level. The pressure of the air at height ${z}$ must be equal to the pressure of the air above it plus the weight of the air in the slab. In other words, the change in pressure as we go from height ${z}$ to ${z+dz}$ is just the weight of the air in the slab of thickness ${dz}$, so since pressure is force per unit area

$\displaystyle dP=-\rho g\; dz \ \ \ \ \ (1)$

where ${g}$ is the acceleration of gravity. The minus sign accounts for the fact that pressure decreases as we go higher.

The density of air can be written using the ideal gas law as

 $\displaystyle \rho$ $\displaystyle =$ $\displaystyle \frac{Nm}{V}\ \ \ \ \ (2)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m}{kT}P \ \ \ \ \ (3)$

where ${m}$ is the average mass of an air molecule, ${N}$ is the number of molecules in volume ${V}$ and ${T}$ is the temperature. We therefore get a differential equation for the pressure:

 $\displaystyle \frac{dP}{dz}$ $\displaystyle =$ $\displaystyle -\rho g\ \ \ \ \ (4)$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\frac{mg}{kT}P \ \ \ \ \ (5)$

This is called the barometric equation. In a realistic model, both ${g}$ and ${T}$ would depend on ${z}$, although since the atmosphere’s thickness isn’t really large enough to affect ${g}$ all that much, we can safely take it to be the usual ${g=9.8\mbox{ m s}^{-2}}$. The temperature does decrease substantially as we get higher, but if we want a crude model we can take it to be roughly constant. In that case, we can integrate the equation to get

 $\displaystyle \frac{dP}{P}$ $\displaystyle =$ $\displaystyle -\frac{mg}{kT}dz\ \ \ \ \ (6)$ $\displaystyle P$ $\displaystyle =$ $\displaystyle P\left(0\right)e^{-mgz/kT} \ \ \ \ \ (7)$

so the pressure decreases exponentially with altitude. Further, from 3, we have

$\displaystyle \rho\left(z\right)=\frac{m}{kT}P\left(z\right)=\frac{m}{kT}P\left(0\right)e^{-mgz/kT}\equiv\rho\left(0\right)e^{-mgz/kT} \ \ \ \ \ (8)$

Assuming a temperature of ${288\mbox{ K}}$ (${15^{\circ}\mbox{ C}}$), and taking ${P\left(0\right)=1\mbox{ atm}}$, we get the following values for pressure at various altitudes:

 Altitude ${z}$ (m) ${P\left(z\right)}$ (atm) 1430 0.844 3090 0.693 4420 0.592 8850 0.350

The last value is the altitude at the top of Mount Everest and compares with the measured value of 0.333 atm (33.7 kilopascals), so the model isn’t too bad.

A graph of pressure versus altitude is as follows: