See also: Course-wide Conventions & Notation
Run the code: Notebook for Section 1.4, in which you can change and rerun the Python cells of this section in your browser.
Overview and Learning Objectives¶
Real gases deviate from ideal behavior when finite molecular size and intermolecular forces become important. This section introduces the compressibility factor as a quantitative measure of nonideality and develops the van der Waals equation of state (EOS), including its critical constants and the principle of corresponding states.
At sufficiently high pressures (high densities) or low temperatures, we can no longer treat gases as collections of noninteracting point particles. High pressure/density brings molecules closer together, increasing collision frequency and making both excluded volume and intermolecular interactions more consequential. Lower temperature reduces kinetic energy, so these interactions more strongly perturb behavior. This section develops practical ways to quantify deviations from ideality and introduces the van der Waals EOS.
Learning objectives:
Define the compressibility factor and interpret vs. in terms of net attractions/repulsions.
Write the van der Waals EOS in particle and molar forms and interpret the parameters and .
Derive (or use) the van der Waals critical constants , , .
Non-dimensionalize the van der Waals EOS to obtain the corresponding-states form in reduced variables.
Core Ideas and Derivations¶
Deviations from Ideal Behavior¶
Compressibility Factor¶
Source
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.constants import R
sys.path.append("..") # the book folder, which holds figstyle
import figstyle as fs
# Measured isotherm of water at 776.4 K (T_r = 1.2, above the critical temperature), NIST Chemistry WebBook
water = pd.read_csv("../_static/section-04/isothermal-properties-for-water-Tr=1.2.csv")
P_water = water["Pressure (bar)"].to_numpy()
Z_water = P_water * 1e5 * water["Volume (m3/mol)"].to_numpy() / (R * water["Temperature (K)"].to_numpy())
T_water = water["Temperature (K)"].iloc[0] # temperature of the isotherm (K), for the label
def draw(c):
fig, ax = plt.subplots(figsize=(6, 3.9), constrained_layout=True)
ax.fill_between(P_water, Z_water, 1, where=Z_water <= 1, color=c.tint(c.blue, 0.78), lw=0, interpolate=True)
ax.fill_between(P_water, Z_water, 1, where=Z_water >= 1, color=c.tint(c.vermilion, 0.78), lw=0, interpolate=True)
ax.axhline(1, color=c.gray, ls="--", lw=1.4)
ax.plot(P_water, Z_water, color=c.ink)
ax.text(3950, 0.97, "ideal gas, $Z = 1$", color=c.gray, ha="right", va="top")
ax.text(1000, 0.47, f"water at {T_water:.0f} K", color=c.ink, ha="left", va="top")
P_cross = np.interp(1, Z_water[Z_water.argmin():], P_water[Z_water.argmin():])
ax.plot(P_cross, 1, "o", mfc=c.ground, mec=c.ink, mew=1.5, ms=6, zorder=5)
ax.annotate("coincidentally ideal", xy=(P_cross, 1), xytext=(2000, 1.20), ha="center", va="center",
arrowprops=dict(arrowstyle="-", color=c.muted, lw=0.9, shrinkB=5))
ax.text(1050, 0.86, "attraction dominates\n$Z < 1$", color=c.ink, ha="center", va="center")
ax.text(3500, 1.36, "repulsion dominates\n$Z > 1$", color=c.ink, ha="right", va="center")
ax.set(xlabel="Pressure $P$ (bar)", ylabel="Compressibility factor $Z$", xlim=(0, 4000), ylim=(0.3, 1.5))
return fig
fs.show(draw, alt="Compressibility factor of water at 776 K against pressure from 0 to 4000 bar. The curve starts at 1, "
"falls to a minimum near 0.5, rises through 1, and continues to rise. The area between the curve "
"and the line Z equals 1 is labeled attraction dominates where Z is below 1 and repulsion dominates "
"where Z is above 1.")Figure 1.4.1:Compressibility factor of water at 776 K, above its critical temperature of 647 K, as a function of pressure, with the ideal-gas line () for comparison. Where (blue), attractive forces dominate, most strongly at the minimum of . Where (orange), repulsive forces dominate. The crossing of marks a “coincidentally ideal” state.
One convenient measure of nonideality is the compressibility factor :
Table 1.4.1:Behavior of Water at Different Pressures
Pressure | Volume | Analysis | Water | |
|---|---|---|---|---|
High | Repulsive interactions | Pauli (steric) repulsion | ||
Medium | Attractive interactions | H-bonding and van der Waals interactions | ||
Low | Ideal-gas behavior | — |
Van der Waals Fluid¶
Van der Waals Equation of State¶
The van der Waals equation of state is among the simplest real-gas models (and was central to the work recognized by the Nobel Prize in Physics 1910):
Table 1.4.2:Forms of the van der Waals Equation of State
where and are substance-dependent parameters capturing two departures from ideality:
: Net attractive interactions between particles.
: Volume associated with finite particle size (excluded volume).
Figure 1.4.2 relates the two parameters to the potential energy of a pair of molecules.
Source
from matplotlib.patches import Circle
def draw_pair_potential(c):
r = np.linspace(0.93, 2.6, 600) # distance in units of the molecular diameter
u = 4 * (r**-12 - r**-6) # Lennard-Jones form, in units of the depth of the well
fig, ax = plt.subplots(figsize=(6, 3.9), constrained_layout=True)
ax.axhline(0, color=c.gray, lw=0.9)
ax.fill_between(r, u, 0, where=u > 0, color=c.tint(c.vermilion, 0.78), lw=0)
ax.fill_between(r, u, 0, where=u < 0, color=c.tint(c.blue, 0.78), lw=0)
ax.plot(r[u >= 0], u[u >= 0], color=c.vermilion)
ax.plot(r[u <= 0], u[u <= 0], color=c.blue)
ax.text(1.06, 1.25, "repulsion at short distance:\nthe molecules cannot overlap,\nwhich gives $b$",
color=c.vermilion, va="center", ha="left")
ax.text(1.56, -0.74, "attraction at larger distance:\nthe molecules pull on each other,\nwhich gives $a$",
color=c.blue, va="center", ha="left")
ax.set(xlim=(0.8, 2.6), ylim=(-1.25, 2.0), xticks=[1], xticklabels=["molecular\ndiameter"], yticks=[0],
xlabel="Distance between two molecules", ylabel="Potential energy of the pair")
return fig
fs.show(draw_pair_potential,
alt="Potential energy of two molecules against the distance between them. At distances shorter than about one "
"molecular diameter, the energy rises steeply above zero, labeled repulsion, which gives b. At larger "
"distances, the energy dips below zero in a shallow well and returns to zero, labeled attraction, which "
"gives a.")Figure 1.4.2:Schematic potential energy of two molecules as a function of the distance between them. The steep rise at short distance keeps the molecules apart, and the parameter accounts for the volume that they exclude. The shallow well at larger distance is the net attraction between the molecules, which the parameter accounts for.
Van der Waals Isotherm¶
Source
from matplotlib.lines import Line2D
# Van der Waals constants of carbon dioxide and the critical point that they predict
a_m = 3.6551 # L^2 bar/mol^2
b_m = 0.042816 # L/mol
R_L_bar = R / 100 # gas constant in L bar/(mol K)
Tc_vdW = 8 * a_m / (27 * b_m * R_L_bar) # K
Pc_vdW = a_m / (27 * b_m**2) # bar
Vc_vdW = 3 * b_m # L/mol
def vdw_pressure(T, V):
"""Pressure (bar) of the van der Waals fluid at temperature T (K) and molar volume V (L/mol)."""
return R_L_bar * T / (V - b_m) - a_m / V**2
# Measured isotherms of carbon dioxide at 0.9, 1.0, and 1.1 times its critical temperature (NIST Chemistry WebBook)
measured = {Tr: pd.read_csv(f"../_static/section-04/isothermal-properties-for-carbon-dioxide-Tr={Tr}.csv")
for Tr in (0.9, 1.0, 1.1)}
def draw(c):
colors = {0.9: c.blue, 1.0: c.gray, 1.1: c.vermilion}
names = {0.9: r"$0.9\,T_c$", 1.0: r"$T_c$", 1.1: r"$1.1\,T_c$"}
V = np.linspace(0.5 * Vc_vdW, 0.5, 800)
fig, ax = plt.subplots(figsize=(6, 4), constrained_layout=True)
for Tr in (0.9, 1.0, 1.1):
data = measured[Tr]
V_data, P_data = 1e3 * data["Volume (m3/mol)"].to_numpy(), data["Pressure (bar)"].to_numpy()
ax.plot(V, vdw_pressure(Tr * Tc_vdW, V), color=colors[Tr], ls=(0, (3.5, 2)), lw=1.5)
ax.plot(V_data, P_data, color=colors[Tr])
order = np.argsort(V_data)
ax.text(0.512, np.interp(0.5, V_data[order], P_data[order]), names[Tr], color=colors[Tr], va="center",
clip_on=False)
ax.legend(handles=[Line2D([], [], color=c.ink, label="measured"),
Line2D([], [], color=c.ink, ls=(0, (3.5, 2)), lw=1.5, label="van der Waals")],
loc="upper right", bbox_to_anchor=(0.97, 1.0))
ax.set(xlabel=r"Molar volume $V_{\mathrm{m}}$ (L/mol)", ylabel="Pressure $P$ (bar)", xlim=(0, 0.5), ylim=(20, 120))
return fig
fs.show(draw, alt="Pressure against molar volume for carbon dioxide at 0.9, 1.0, and 1.1 times the critical "
"temperature. Solid curves are measured and dashed curves are the van der Waals equation. Below "
"the critical temperature, the measured isotherm has a horizontal segment where liquid and vapor "
"coexist, and the van der Waals isotherm has a loop there. The two sets of curves agree at large "
"volume and differ most at small volume.")Figure 1.4.3:Measured (solid) and van der Waals (dashed) isotherms of CO below, at, and above the critical temperature . For , the van der Waals EOS exhibits the characteristic loop associated with phase separation, where the measured isotherm is horizontal; at the isotherm has an inflection point; and for the liquid–vapor transition disappears.
Source
# The Maxwell construction follows https://scipython.com/blog/the-maxwell-construction/
from matplotlib.colors import to_rgb
from scipy.optimize import brentq
def vdw_reduced(Tr, Vr):
"""Reduced pressure of the van der Waals fluid at reduced temperature Tr and reduced volume Vr."""
return 8 * Tr / (3 * Vr - 1) - 3 / Vr**2
def maxwell(Tr):
"""Maxwell construction for an isotherm below the critical temperature.
Returns the reduced pressure of the tie line and the three reduced volumes at which the isotherm crosses it
(liquid, middle, vapor). The tie line is placed so that the two areas between it and the loop are equal.
"""
def crossings(Pr):
return np.sort(np.roots([3 * Pr, -(Pr + 8 * Tr), 9, -3]).real)
def area_difference(Pr):
V_liq, _, V_vap = crossings(Pr)
area_under_isotherm = 8 * Tr / 3 * np.log((3 * V_vap - 1) / (3 * V_liq - 1)) + 3 / V_vap - 3 / V_liq
return area_under_isotherm - Pr * (V_vap - V_liq)
# The tie line lies between the minimum and the maximum of the loop, where dPr/dVr = 0.
V_min, V_max = np.sort(np.roots([4 * Tr, -9, 6, -1]).real)[1:]
low, high = max(vdw_reduced(Tr, V_min), 0), vdw_reduced(Tr, V_max)
span = high - low
Pr = brentq(area_difference, low + 1e-6 * span, high - 1e-6 * span)
return Pr, crossings(Pr)
# Coexistence curve: the ends of the tie lines for a series of temperatures up to the critical temperature
Tr_series = 1 - np.linspace(0.45, 0.01, 60) ** 2
ties = [maxwell(Tr) for Tr in Tr_series]
dome_P = np.array([Pr for Pr, _ in ties] + [1.0]) * Pc_vdW
dome_V_liq = np.array([V[0] for _, V in ties] + [1.0]) * Vc_vdW
dome_V_vap = np.array([V[2] for _, V in ties] + [1.0]) * Vc_vdW
dome_V = np.concatenate([dome_V_liq, dome_V_vap[::-1]])
dome = np.concatenate([dome_P, dome_P[::-1]])
Tr_loop = 0.9 # reduced temperature of the isotherm with the loop (below 1)
Pr_tie, (Vr_liq, Vr_mid, Vr_vap) = maxwell(Tr_loop)
P_tie, V_liq, V_mid, V_vap = Pr_tie * Pc_vdW, Vr_liq * Vc_vdW, Vr_mid * Vc_vdW, Vr_vap * Vc_vdW
def draw(c):
V = np.linspace(1.02 * b_m, 0.5, 1500)
P_cold, P_crit = vdw_reduced(Tr_loop, V / Vc_vdW) * Pc_vdW, vdw_reduced(1.0, V / Vc_vdW) * Pc_vdW
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(fs.WIDTH, 3.7), constrained_layout=True, sharex=True, sharey=True)
# (a) The loop, the tie line, and the two equal areas
ax1.fill(dome_V, dome, color=c.fill, lw=0)
ax1.plot(dome_V, dome, color=c.muted, lw=0.9)
loop = (V >= V_liq) & (V <= V_vap)
ax1.fill_between(V[loop], P_cold[loop], P_tie, color=c.tint(c.blue, 0.55), lw=0)
ax1.plot(V, P_crit, color=c.gray, lw=1.6)
ax1.plot(V, P_cold, color=c.blue)
ax1.plot([V_liq, V_vap], [P_tie, P_tie], color=c.blue, lw=1.2)
ax1.plot([V_liq, V_vap], [P_tie, P_tie], "o", mfc=c.ground, mec=c.blue, mew=1.5, ms=6, zorder=5)
ax1.plot(Vc_vdW, Pc_vdW, "o", mfc=c.ground, mec=c.gray, mew=1.5, ms=6, zorder=5)
ax1.plot([0, Vc_vdW], [Pc_vdW, Pc_vdW], color=c.gray, lw=0.9, ls=":")
ax1.plot([Vc_vdW, Vc_vdW], [30, Pc_vdW], color=c.gray, lw=0.9, ls=":")
ax1.text(0.012, Pc_vdW + 0.8, "$P_c$", color=c.gray, va="bottom")
ax1.text(Vc_vdW + 0.008, 31, r"$V_{\mathrm{m},c}$", color=c.note, va="bottom")
ax1.text(0.30, 68.5, r"$T = T_c$", color=c.gray, va="bottom")
ax1.text(0.295, 33.6, rf"$T = {Tr_loop:g}\,T_c$", color=c.blue, va="center")
ax1.annotate("equal areas", xy=(0.5 * (V_liq + V_mid), P_tie - 4.5), xytext=(0.215, 38), color=c.ink,
ha="center", va="center", arrowprops=dict(arrowstyle="-", color=c.muted, lw=0.9, shrinkB=2))
ax1.annotate("", xy=(0.5 * (V_mid + V_vap) - 0.02, P_tie + 1.2), xytext=(0.225, 39.5),
arrowprops=dict(arrowstyle="-", color=c.muted, lw=0.9, shrinkA=6, shrinkB=2))
fs.panel(ax1, "a", "Maxwell construction")
# (b) The regions of the diagram
liquid, vapor, fluid = c.tint(c.liquid, 0.7), c.tint(c.gas, 0.7), c.fill
top = 80.0
left, right = V <= Vc_vdW, V >= Vc_vdW
ax2.fill_between(V[left], np.minimum(P_crit[left], top), top, color=fluid, lw=0)
ax2.fill_between(V[right], Pc_vdW, top, color=fluid, lw=0)
ax2.fill_between(V[left], np.interp(V[left], dome_V_liq, dome_P, left=0), np.minimum(P_crit[left], top),
color=liquid, lw=0)
ax2.fill_between(V[right], np.interp(V[right], dome_V_vap[::-1], dome_P[::-1], right=0), Pc_vdW, color=vapor, lw=0)
# Inside the dome, the color follows the fraction of vapor given by the position along the tie line.
grid_V, grid_P = np.meshgrid(np.linspace(0, 0.5, 500), np.linspace(30, Pc_vdW, 300))
edge_liq, edge_vap = np.interp(grid_P, dome_P, dome_V_liq), np.interp(grid_P, dome_P, dome_V_vap)
fraction = np.clip((grid_V - edge_liq) / np.maximum(edge_vap - edge_liq, 1e-9), 0, 1)
image = np.zeros(grid_V.shape + (4,))
image[..., :3] = (1 - fraction[..., None]) * np.array(to_rgb(liquid)) + fraction[..., None] * np.array(to_rgb(vapor))
image[..., 3] = (grid_V >= edge_liq) & (grid_V <= edge_vap)
ax2.imshow(image, extent=(0, 0.5, 30, Pc_vdW), origin="lower", aspect="auto", interpolation="bilinear", zorder=1)
ax2.plot(dome_V, dome, color=c.muted, lw=0.9, zorder=2)
ax2.plot(V[left], P_crit[left], color=c.gray, lw=1.2)
ax2.plot([Vc_vdW, 0.5], [Pc_vdW, Pc_vdW], color=c.gray, lw=1.2)
ax2.plot(Vc_vdW, Pc_vdW, "o", mfc=c.ground, mec=c.gray, mew=1.5, ms=6, zorder=5)
ax2.text(0.063, 60, "Liquid", color=c.ink, rotation=90, ha="center", va="center")
ax2.text(0.215, 44, "Liquid and vapor", color=c.ink, ha="center", va="center")
ax2.text(0.42, 62, "Vapor", color=c.ink, ha="center", va="center")
ax2.text(0.30, 77, "Supercritical fluid", color=c.ink, ha="center", va="top")
ax2.annotate("critical point", xy=(Vc_vdW, Pc_vdW), xytext=(0.20, 67), color=c.ink, va="center",
arrowprops=dict(arrowstyle="-", color=c.muted, lw=0.9, shrinkB=5))
fs.panel(ax2, "b", "Regions")
ax1.set(xlim=(0, 0.5), ylim=(30, 80), xlabel=r"Molar volume $V_{\mathrm{m}}$ (L/mol)", ylabel="Pressure $P$ (bar)")
ax2.set(xlabel=r"Molar volume $V_{\mathrm{m}}$ (L/mol)")
return fig
fs.show(draw, alt="Two panels of pressure against molar volume for the van der Waals model of carbon dioxide. Panel a: "
"the isotherm at 0.9 times the critical temperature has a loop, a horizontal tie line cuts the loop "
"into two equal areas, and the critical isotherm passes through the critical point at the top of "
"the coexistence curve. Panel b: the same diagram divided into regions. Liquid lies at small "
"volume, vapor at large volume, liquid and vapor together under the coexistence curve, and the "
"supercritical fluid above the critical temperature and pressure.")Figure 1.4.4:(a) Van der Waals isotherm of CO at with the Maxwell construction, which replaces the unphysical loop by a horizontal tie line that defines liquid–vapor coexistence. The two shaded areas are equal. The thin curve joins the ends of the tie lines at all temperatures up to the critical point at , where the liquid and vapor phases merge. (b) The regions of the diagram. Under the coexistence curve, the color follows the fraction of vapor.
Within the loop, part of the van der Waals isotherm has a pressure that increases with volume, which is mechanically unstable and is not observed. The Maxwell construction replaces the loop with a horizontal tie line at the coexistence pressure, placed so that the two areas enclosed between the line and the loop are equal; the ends of the tie line give the molar volumes of the coexisting liquid and vapor.
Critical Point¶
Expanding Equation (1.4.5) and rearranging terms gives a cubic equation for :
Complete Derivation of the Cubic Equation in
Below , Equation (1.4.6) has three real roots for pressures within the van der Waals loop; as rises to , these roots merge into one at the inflection point of the critical isotherm. At the critical point, the cubic therefore has a triple root at , so it can be written as
Matching coefficients yields
Complete Derivation of the Critical Point
Corresponding States¶
Source
# Measured isotherms of four substances at three reduced temperatures (NIST Chemistry WebBook)
substances = {"argon": "Ar", "oxygen": r"O$_2$", "water": r"H$_2$O", "carbon-dioxide": r"CO$_2$"}
reduced = {(name, Tr): pd.read_csv(f"../_static/section-04/isothermal-properties-for-{name}-Tr={Tr}.csv")
for name in substances for Tr in (1.0, 1.2, 2.0)}
def draw(c):
colors = dict(zip(substances, [c.blue, c.vermilion, c.green, c.purple]))
fig, axs = plt.subplots(1, 3, figsize=(fs.WIDTH, 3.1), constrained_layout=True, sharex=True, sharey=True)
for ax, letter, Tr in zip(axs, "abc", (1.0, 1.2, 2.0)):
ax.axhline(1, color=c.gray, ls="--", lw=1.0)
for name, label in substances.items():
data = reduced[name, Tr]
Z = 1e5 * data["Pressure (bar)"] * data["Volume (m3/mol)"] / (R * data["Temperature (K)"])
ax.plot(data["Pr"], Z, color=colors[name], lw=1.8, label=label)
ax.set(xlabel="Reduced pressure $P_r$", xlim=(0, 8), ylim=(0, 1.2), xticks=[0, 2, 4, 6, 8])
fs.panel(ax, letter, f"$T_r = {Tr}$")
axs[0].set(ylabel="Compressibility factor $Z$")
axs[0].legend(loc="lower right", handlelength=1.4)
return fig
fs.show(draw, alt="Three panels of the compressibility factor against reduced pressure from 0 to 8 for argon, oxygen, "
"water, and carbon dioxide, at reduced temperatures of 1.0, 1.2, and 2.0. Within each panel, the "
"four curves nearly coincide. At a reduced temperature of 1.0, the curves drop steeply to about 0.2 "
"to 0.3 near a reduced pressure of 1 and then rise. At 1.2, the minimum is shallower, and at 2.0, "
"the curves stay close to 1.")Figure 1.4.5:Compressibility factor of argon, oxygen, water, and carbon dioxide against the reduced pressure at reduced temperatures of (a) 1.0, (b) 1.2, and (c) 2.0. At the same reduced conditions, the four gases show similar trends, consistent with the principle of corresponding states. Water deviates most from the common curve.
Introduce reduced variables , , and via
and substitute into Equation (1.4.5) to obtain
This corresponding-states form shows that all van der Waals fluids obey the same reduced EOS when expressed relative to their critical properties.
Complete Derivation of the Corresponding States Equation
Computational Studio: Real Gas¶
In Figure 1.4.6, you can choose a gas and a temperature and compare the ideal-gas law with the van der Waals EOS and with the Peng–Robinson EOS, a later equation of the same kind.
Figure 1.4.6:Compressibility factor and isotherm of a gas according to the ideal-gas law, the van der Waals EOS (Eq. (1.4.5)), and the Peng–Robinson EOS. Panel (a) shows against the pressure, and panel (b) shows the pressure against the molar volume on a logarithmic scale. The constants of both EOS follow from the critical temperature and the critical pressure of the gas. Below , the thick lines follow the Maxwell construction of Figure 1.4.4, and the thin lines in panel (b) are the loops that it replaces.
You can also open the studio in a new tab: Real Gas Studio.
Worked Example¶
van der Waals critical constants and for CO¶
Use the van der Waals parameters used in the section plots: , , and .
The van der Waals critical constants are
Critical volume
Critical pressure
Critical temperature
Critical compressibility factor
Comparison with experiment
The predicted and are within 0.1% of the measured values for CO, and , as expected, because van der Waals parameters are usually determined from the measured critical temperature and pressure. The measured critical molar volume, , and the corresponding are both smaller than the van der Waals predictions.
Result. The van der Waals model predicts , , , and .
Concept Checks¶
Why can a gas be “coincidentally ideal” (i.e., ) even when interactions are not negligible?
What physical effects are represented by the and corrections in the van der Waals EOS?
At fixed , how does typically change as increases, and why?
Why does the reduced-variable form imply similar behavior across different substances at corresponding reduced conditions?
Key Takeaways¶
Nonideality is quantified by ; suggests net attractions and suggests net repulsions.
The van der Waals EOS introduces an attraction parameter and an excluded-volume parameter .
Critical constants follow directly from the cubic form of the van der Waals EOS, with .
Using reduced variables yields the corresponding-states form shared by all van der Waals fluids.