Learning Scientific Programming with Python (2nd edition)
P6.4.3: The van der Waals equation of state
Question P6.4.3
The van der Waals equation of state may be written as follows to give the pressure, $p$, of a gas from its molar volume, $V$, and temperature, $T$: $$ p = \frac{RT}{V - b} - \frac{a}{V^2}, $$ where $a$ and $b$ are molecule-specific constants and $R=8.314\;\mathrm{J\,K^{-1}\,mol^{-1}}$ is the gas constant. It can readily be rearranged to yield the temperature for a given pressure and volume, but its form giving the molar volume in terms of pressure and temperature is a cubic equation: $$ pV^3 - (pb + RT)V^2 + aV - ab = 0 $$ Of the three roots to this equation, below the critical point, $(T_\mathrm{c}, p_\mathrm{c})$ all are real: the largest and smallest give the molar volume of the gas phase and liquid phase respectively; above the critical point, where no liquid phase exists, only one root is real and gives the molar volume of the gas (also known in this region as a supercritical fluid). The critical point is given by the condition $(\partial p / \partial V)_T = (\partial^2 p / \partial V^2)_T = 0$ and for a van der Waals gas is given by the formulae $$ T_c = \frac{8a}{27Rb}, \quad \quad p_c = \frac{a}{27b^2} $$
For ammonia the van der Waals constants are $a = 4.225\;\mathrm{L^2\,bar\,mol^{-2}}$ and $b = 0.03707\;\mathrm{L\,mol^{-1}}$.
(a) Find the critical point of ammonia, and then determine the molar volume at room temperature and pressure, $(298\;\mathrm{K}, 1\;\mathrm{atm})$ and at $(500\;\mathrm{K}, 12\;\mathrm{MPa})$.
(b) An isotherm is the set of points $(p, V)$ at a constant temperature satisfying an equation of state. Plot the isotherm ($p$ against $V$) for ammonia at 350 K using the van der Waals equation of state and compare it with the 350 K isotherm for an ideal gas, which has the equation of state $p=RT/V$.