CHE-220 · Lesson 3 of 12 · 24 min
Ideal gases and the virial equation
The first stage of the Lakeshore Gas compressor takes carbon dioxide from 1.05 bar to 4 bar. The vendor's data sheet quotes the power, and Theo wants to check it from first principles. At these low pressures the ideal gas model should be close, but carbon dioxide molecules are large and attract each other, so how close is close? This lesson works through ideal gas processes, then introduces the virial equation, the simplest way to correct the ideal gas law for real-gas behaviour and the theoretical foundation for every equation of state that follows.
The ideal gas model
An ideal gas is one whose molecules occupy no volume and exert no forces on each other. No real gas meets that description, but all gases approach it as pressure falls toward zero, because the molecules are then so far apart that their size and attractions hardly matter. Two consequences define the model: the ideal gas equation of state, and the fact that internal energy and enthalpy depend on temperature alone.
Because \(U\) and \(H\) depend only on temperature for an ideal gas, their changes in any process can be found from heat capacities alone, whatever happens to pressure and volume. Ideal gas heat capacities do vary with temperature, and they are usually given as polynomials. This course uses the form \(C_P^{ig}/R = A + BT + CT^2 + DT^{-2}\) with \(T\) in kelvin, which fits most gases well from room temperature to about 1500 K. For carbon dioxide, approximate constants are \(A = 5.457\), \(B = 1.045\times10^{-3}\ \text{K}^{-1}\), \(C = 0\) and \(D = -1.157\times10^{5}\ \text{K}^2\).
Ideal gas processes in closed systems
Four idealized processes cover most textbook and many practical cases. For each, combine the first law with the ideal gas equation. The formulas below are per mole, for reversible processes, with work done on the gas positive.
| Process | Defining condition | Work W | Heat Q |
|---|---|---|---|
| Isothermal | T constant, PV constant | RT ln(P2/P1) | −W (since ΔU = 0) |
| Isobaric | P constant | −R(T2 − T1) | ΔH = ∫Cp dT |
| Isochoric | V constant | 0 | ΔU = ∫Cv dT |
| Adiabatic | Q = 0, PV^γ constant (constant γ) | ΔU = Cv(T2 − T1) | 0 |
| Polytropic | PV^δ constant | R(T2 − T1)/(δ − 1) | ΔU − W |
For a reversible adiabatic process with constant heat capacities, temperature and pressure are linked by \(T_2/T_1 = (P_2/P_1)^{(\gamma-1)/\gamma}\). The polytropic process generalizes all the others: \(\delta = 0\) is isobaric, \(\delta = 1\) isothermal, \(\delta = \gamma\) adiabatic and \(\delta \to \infty\) isochoric. Real compressors with some cooling follow polytropic paths between isothermal and adiabatic, which is why compressor vendors often quote a polytropic efficiency.
Steady-flow compression
A compressor is an open system, so its work comes from the steady-flow energy equation, not from the closed-system formulas. For a reversible, steady-flow process with negligible kinetic and potential energy changes, the shaft work per mole is the integral of volume over pressure. This differs from closed-system boundary work, \(-\int P\,dV\), by the flow work done pushing gas in and out. For an isothermal ideal gas the two happen to be equal, but for an adiabatic compression the steady-flow work is \(\gamma\) times the closed-system work for the same pressure ratio.
An adiabatic compressor needs more work than an isothermal one between the same pressures, because the gas heats up as it is compressed and hot gas has a larger volume to push. That is why multistage compressors cool the gas between stages, a point Lesson 10 develops.
Worked problem
Isothermal and adiabatic work for the first stage
Carbon dioxide enters the first compressor stage at 1.05 bar and 30 °C and leaves at 4.0 bar. Treating it as an ideal gas, find the reversible work per mole for (a) isothermal compression at 30 °C and (b) adiabatic compression with constant \(\gamma = 1.285\), the value at 30 °C. Take \(C_P = 4.50R\) for part (b), rounding the polynomial value of 4.51R.
Show solution
- (a) \(W_s = RT\ln(P_2/P_1) = 8.314 \times 303.15 \times \ln(4.0/1.05) = 3.371\ \text{kJ/mol}\).
- (b) \(T_2 = 303.15 \times (4.0/1.05)^{0.285/1.285} = 407.8\ \text{K}\), or 134.7 °C.
- \(W_s = C_P(T_2 - T_1) = 4.50 \times 8.314 \times (407.8 - 303.15) = 3.92\ \text{kJ/mol}\).
- At 815.3 kmol/h, or 226.5 mol/s, the reversible power is 0.76 MW isothermal and about 0.89 MW adiabatic.
Answer: Adiabatic compression needs about 16 percent more work than isothermal compression for this pressure ratio, and it delivers gas at about 135 °C. The program, which takes Cp from the polynomial at 30 °C, gives 134.5 °C, the same to within rounding. Real compressors are not reversible, so their actual power is higher again; Lesson 10 adds efficiencies.
Why real gases depart from ideal behaviour
Real molecules have size, and they attract each other at moderate distances and repel each other strongly when they get very close. At moderate densities the attractions dominate: molecules pull together, so the gas occupies less volume than an ideal gas at the same temperature and pressure, and \(Z = PV/RT\) falls below 1. At very high densities the repulsions dominate, the molecules' own volume becomes significant, and \(Z\) rises above 1. The compressibility factor captures both effects in one number. For carbon dioxide at 35 °C, \(Z\) is about 0.99 at 1 bar, 0.90 at 20 bar and only about 0.70 at 50 bar.
The virial equation
The virial equation expresses the compressibility factor as a power series. It has a firm theoretical basis in statistical mechanics: the second virial coefficient \(B\) reflects interactions between pairs of molecules, the third coefficient \(C\) interactions among three molecules, and so on. For a pure gas, the virial coefficients depend only on temperature. The series can be written in powers of pressure or in powers of molar density, \(1/V\).
At low to moderate pressures, the series truncated after the second term is accurate enough, and the pressure form is the easiest to use because it gives volume directly from temperature and pressure: \(Z = 1 + BP/(RT)\). It works well when \(Z\) is above about 0.85 or, roughly, when the molar volume is more than about twice the critical volume. At higher densities, the three-term density form helps, but beyond that point a cubic equation of state is usually more convenient.
Second virial coefficients are negative at low and moderate temperatures, where attractions dominate, and become positive at high temperature. For carbon dioxide near room temperature, \(B\) is around −120 cm³/mol; for nitrogen it is close to −5 cm³/mol, which is why nitrogen at a few bar is almost perfectly ideal while carbon dioxide is not. Measured values are tabulated for many gases, and the Pitzer correlation estimates \(B\) from corresponding states when no data exist.
Worked problem
A virial correction to the compression work
For carbon dioxide at 30 °C, the Pitzer correlation gives \(B = -120\ \text{cm}^3\text{/mol}\). Using the truncated virial equation, find the reversible isothermal work for compression from 1.05 to 4.0 bar and compare it with the ideal gas value.
Show solution
- With \(V = RT/P + B\), the integral \(\int V\,dP\) becomes \(RT\ln(P_2/P_1) + B(P_2 - P_1)\).
- Correction term: \(B(P_2 - P_1) = -120\times10^{-6} \times (4.0 - 1.05)\times10^5 = -35\ \text{J/mol}\).
- \(W_s = 3371 - 35 = 3336\ \text{J/mol} = 3.336\ \text{kJ/mol}\), about 1 percent below the ideal gas value.
Answer: At these pressures the ideal gas answer is good to about 1 percent, which is well inside the uncertainty of a compressor's efficiency. The correction grows with pressure: for the later stages, between 10 and 20 bar, the real-gas effect on work and on volumetric flow is several percent, enough to matter for sizing.
# Reversible work for the first carbon dioxide compression stage: ideal gas and virial estimates
import math
R = 8.314 # J/(mol K)
Tc, Pc, w = 304.2, 73.8e5, 0.224 # carbon dioxide (approximate)
A, B, D = 5.457, 1.045e-3, -1.157e5 # Cp/R = A + B T + D/T^2 for CO2 (approximate)
def B_pitzer(T):
Tr = T / Tc
B0 = 0.083 - 0.422 / Tr ** 1.6
B1 = 0.139 - 0.172 / Tr ** 4.2
return (B0 + w * B1) * R * Tc / Pc # m3/mol
def cp_R(T): return A + B * T + D / T ** 2
T1, P1, P2 = 303.15, 1.05e5, 4.0e5 # first stage: 30 C, 1.05 bar to 4 bar
n = 815.3 / 3.6 # mol/s (815.3 kmol/h from CHE-200)
# Isothermal, ideal gas: W = RT ln(P2/P1)
W_iso_ideal = R * T1 * math.log(P2 / P1)
# Isothermal, truncated virial Z = 1 + BP/RT: W = RT ln(P2/P1) + B (P2 - P1)
Bv = B_pitzer(T1)
W_iso_virial = W_iso_ideal + Bv * (P2 - P1)
print(f"B at 30 C = {Bv*1e6:.0f} cm3/mol")
print(f"Isothermal work: ideal {W_iso_ideal/1000:.3f} kJ/mol, virial {W_iso_virial/1000:.3f} kJ/mol")
# Adiabatic reversible, ideal gas with constant Cp evaluated at T1
cp1 = cp_R(T1); g = cp1 / (cp1 - 1)
T2c = T1 * (P2 / P1) ** ((g - 1) / g)
W_ad_const = cp1 * R * (T2c - T1)
# Adiabatic reversible with Cp(T): find T2 where integral of Cp/T dT = R ln(P2/P1)
def s_int(T2): # integral of (Cp/R)/T dT from T1 to T2
return A * math.log(T2 / T1) + B * (T2 - T1) - D / 2 * (1 / T2 ** 2 - 1 / T1 ** 2)
lo, hi = T1, T1 * 2
for _ in range(60):
mid = (lo + hi) / 2
if s_int(mid) < math.log(P2 / P1): lo = mid
else: hi = mid
T2v = mid
h_int = A * (T2v - T1) + B / 2 * (T2v ** 2 - T1 ** 2) - D * (1 / T2v - 1 / T1)
W_ad_var = R * h_int
print(f"Adiabatic, constant Cp (gamma {g:.3f}): T2 = {T2c-273.15:.1f} C, W = {W_ad_const/1000:.3f} kJ/mol")
print(f"Adiabatic, Cp(T): T2 = {T2v-273.15:.1f} C, W = {W_ad_var/1000:.3f} kJ/mol")
for label, Wm in (("isothermal ideal", W_iso_ideal), ("isothermal virial", W_iso_virial), ("adiabatic Cp(T)", W_ad_var)):
print(f"Power for the stage, {label:18s}: {Wm * n / 1e6:.2f} MW")B at 30 C = -120 cm3/mol Isothermal work: ideal 3.371 kJ/mol, virial 3.336 kJ/mol Adiabatic, constant Cp (gamma 1.285): T2 = 134.5 C, W = 3.924 kJ/mol Adiabatic, Cp(T): T2 = 126.2 C, W = 3.893 kJ/mol Power for the stage, isothermal ideal : 0.76 MW Power for the stage, isothermal virial : 0.76 MW Power for the stage, adiabatic Cp(T) : 0.88 MW
The program adds one refinement: with a temperature-dependent heat capacity, the adiabatic outlet temperature is about 126 °C rather than 135 °C, because carbon dioxide's heat capacity rises with temperature, and the reversible adiabatic work is 3.89 kJ/mol. For a pressure ratio of about 4, the constant-heat-capacity shortcut overestimates the outlet temperature by several degrees, which matters if materials or lubricants have temperature limits.
Using the virial equation sensibly
The truncated virial equation is a good choice for gases at low to moderate pressure, especially when measured second virial coefficients are available. It is linear in pressure, so it cannot reproduce the strong curvature of \(Z\) near the critical point, and it cannot describe liquids at all. Its strengths are simplicity and a sound theoretical basis. It also extends naturally to mixtures, where the mixture second virial coefficient is a quadratic sum over pairs of components, a fact that Thermodynamics II uses for fugacities of gas mixtures.
When pressures rise further, the next lesson's cubic equations of state take over. They need the same three parameters as the Pitzer correlation, the critical temperature, critical pressure and acentric factor, but they describe gases and liquids with one equation and capture the curvature that the truncated virial equation misses.
Common mistakes
MistakeUsing closed-system work formulas for a compressor.
InsteadCompressors are steady-flow devices: use Ws = ∫V dP, not −∫P dV.
MistakeAssuming enthalpy changes with pressure for an ideal gas.
InsteadFor an ideal gas, H depends on temperature only.
MistakeUsing the truncated virial equation near the critical point.
InsteadIt is linear in pressure; use it only while Z is above about 0.85.
MistakeTreating the heat capacity ratio as constant over large temperature rises.
InsteadIntegrate Cp(T) for accurate outlet temperatures in high-ratio compression.
MistakeMixing up B and B'.
InsteadB' = B/(RT); B has units of molar volume, B' units of reciprocal pressure.
Summary and key terms
- Ideal gases obey PV = RT, with U and H functions of temperature only.
- Reversible closed-system processes: isothermal, isobaric, isochoric, adiabatic and polytropic, each with standard work and heat formulas.
- Steady-flow reversible work is ∫V dP; adiabatic compression needs more work than isothermal.
- Real gases have Z below 1 at moderate densities because of attractions, above 1 at high densities because of repulsions.
- Truncated virial equation: Z = 1 + BP/(RT), valid while Z exceeds about 0.85.
- Pitzer correlation estimates B from Tc, Pc and ω.
- Ideal gas
- A model gas with no molecular volume or interactions, obeying PV = RT.
- Polytropic process
- A process following PV^δ = constant, generalizing isothermal, adiabatic and other paths.
- Second virial coefficient
- The coefficient B in Z = 1 + B/V, reflecting interactions between pairs of molecules.
- Compressibility factor
- Z = PV/(RT), equal to 1 for an ideal gas.
- Heat capacity ratio
- γ = Cp/Cv, which sets the temperature rise in adiabatic compression.
- Pitzer correlation
- A corresponding-states estimate of the second virial coefficient from Tc, Pc and ω.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Find the work to compress 1 mol of ideal gas isothermally at 300 K from 1 to 10 bar in steady flow.
Show answer
W = RT ln 10 = 8.314 × 300 × 2.303 = 5.74 kJ/mol.
For an ideal gas with γ = 1.4, find T2 for reversible adiabatic compression from 300 K and a pressure ratio of 5.
Show answer
T2 = 300 × 5^(0.4/1.4) = 475 K.
Nitrogen has B ≈ −5 cm³/mol at 25 °C. Estimate Z at 10 bar.
Show answer
Z = 1 + (−5×10⁻⁶ × 10⁶)/(8.314 × 298) = 0.998.
Using the program, what is the outlet temperature for adiabatic compression of CO₂ from 1.05 to 4.0 bar with Cp(T)?
Show answer
About 126 °C.
Why is nitrogen at a few bar closer to ideal than carbon dioxide?
Show answer
Its second virial coefficient is much smaller in magnitude because its molecules attract each other far more weakly.
What polytropic exponent describes an isothermal process?
Show answer
δ = 1.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.