Van der Waals Gas Simulator — Real Gas Compressibility Factor
From temperature, pressure, attraction constant a and excluded-volume constant b, this tool computes the real-gas molar volume V_m and compressibility factor Z in real time, compares the van der Waals isotherm to the ideal-gas law, and displays the critical T_c and P_c.
Parameters
Temperature T
K
Pressure P
atm
Attraction a
L²·atm/mol²
Excluded volume b
L/mol
Gas constant R = 0.08206 L·atm/(mol·K). V_m is found by Newton iteration of f(V_m) = (P + a/V_m²)(V_m - b) − RT = 0. Default values correspond to nitrogen (a≈1.36, b≈0.0387).
Results
—
Molar volume V_m
—
Compressibility Z
—
Critical T_c
—
Critical P_c
P-V_m Isotherm
Blue = van der Waals isotherm at T / gray = ideal gas PV=RT / orange = critical isotherm T=T_c / yellow dot = current state (V_m, P).
Z-P Compressibility Curve
Vertical = Z = PV_m/(RT) / horizontal = P in atm / blue = van der Waals / gray dashed = Z=1 ideal gas / yellow dot = current P, Z.
Theory & Key Formulas
The van der Waals equation adds intermolecular attraction (a/V_m²) and excluded-volume (b) corrections to the ideal gas law:
$$\left(P + \frac{a}{V_m^2}\right)(V_m - b) = R\,T$$
The compressibility factor measures deviation from the ideal gas:
$$Z = \frac{P\,V_m}{R\,T}$$
From the critical-point condition (dP/dV_m = d²P/dV_m² = 0):
Since V_m is implicit, we solve it by Newton iteration starting from the ideal-gas value V_m_0 = RT/P. R = 0.08206 L·atm/(mol·K).
What is the Van der Waals Gas Simulator
🙋
In high school we learned PV = nRT, but I keep hearing it does not work for real gases. How much does it actually fail?
🎓
That is exactly what this tool shows. The defaults match nitrogen: a = 1.35, b = 0.039, T = 300 K, P = 50 atm. You should see V_m roughly 0.480 L/mol and Z = PV_m/(RT) roughly 0.974. An ideal gas would give V_m = RT/P = 0.492 L/mol and Z exactly 1, so real nitrogen is about three percent more compressible than the ideal gas at this state.
🙋
The notes say Z < 1 means attraction dominates. What does that physically mean?
🎓
The a/V_m² term in the van der Waals equation represents attraction between molecules. It effectively pulls them together, so the gas needs less volume than the ideal value, hence Z < 1. At very high pressure, molecules are squeezed and the excluded-volume b kicks in, fighting further compression, and Z rises above 1. Slide P up to 200 atm and you can watch Z climb past unity.
🙋
The critical temperature stat shows about 125 K. What does that number really mean?
🎓
Above T_c no amount of pressure liquefies the gas. Nitrogen has T_c near 126 K, or about minus 147 Celsius, so at room temperature nitrogen stays gaseous no matter how hard you squeeze it. To make liquid nitrogen you must cool below about 100 K. CO_2 by contrast has T_c near 304 K, just above room temperature, so 70 atm at 25 Celsius is enough to liquefy it. That is what is inside a soda CO_2 cylinder.
🙋
If I drop T below T_c the left graph becomes wavy. What is that?
🎓
Try T = 100 K. The van der Waals curve develops a maximum and a minimum. Mathematically this is the cubic equation showing three real roots. Physically the Maxwell construction replaces the wiggle by a horizontal tie-line representing the gas-liquid coexistence pressure. The left branch is liquid, the right branch is vapour, and the unstable middle is never observed. That van der Waals captures all of this with only two parameters is the historical breakthrough.
Frequently Asked Questions
Typical van der Waals constants, with a in L²·atm/mol² and b in L/mol, are He a=0.034 b=0.024, H₂ a=0.247 b=0.027, N₂ a=1.36 b=0.0387, O₂ a=1.36 b=0.0319, CO₂ a=3.59 b=0.0427, H₂O a=5.46 b=0.0305, NH₃ a=4.17 b=0.0371. The defaults of this tool match nitrogen. A larger a indicates stronger intermolecular attraction (easier to liquefy), while a larger b indicates physically larger molecules.
Below T_c the van der Waals equation has three real roots for V_m. The largest is the vapour root, the smallest is the liquid root, and the middle one is physically unstable. This tool uses Newton iteration starting from the ideal-gas value, which converges to the vapour root, so even in the two-phase region it reports the gas-phase molar volume. The full Maxwell equal-area construction is not displayed; for accurate phase-equilibrium work use Soave-Redlich-Kwong or Peng-Robinson equations.
Defining reduced variables T_r = T/T_c, P_r = P/P_c and V_r = V_m/V_c, the van der Waals equation becomes (P_r + 3/V_r²)(V_r - 1/3) = 8T_r/3, which contains no substance-specific constants. This is the theoretical basis of the corresponding-states principle: any two gases at the same reduced temperature and pressure should have nearly the same Z. Engineering Z(T_r, P_r) charts use this idea to estimate real-gas properties of substances whose detailed equations of state are unknown.
Van der Waals captures the qualitative behaviour of real gases correctly, including the existence of a critical point, the gas-liquid transition, and the Boyle temperature. Quantitatively it has noticeable errors: the predicted critical compressibility Z_c = PV/RT is always 3/8 = 0.375, while real values are 0.27 to 0.29, and errors can reach 10 to 30 percent near the critical region. Industrial practice uses Redlich-Kwong, Soave-Redlich-Kwong or Peng-Robinson, with Peng-Robinson being the de facto standard in the oil and gas industry.
Real-World Applications
Natural-gas pipeline design. Natural gas is transported at 70 to 100 atm, well into the non-ideal regime. Sizing capacity with PV=nRT overestimates volume by 5 to 10 percent, which is unacceptable for compressor selection and pipe sizing. Engineers therefore use van der Waals or, more commonly, the Peng-Robinson equation to compute Z and correct the throughput. Setting P = 100 atm in this tool shows Z rising above 1, meaning real gas resists compression more than the ideal model predicts.
Liquefied natural gas (LNG) plants. Liquefying methane requires cooling below its critical temperature T_c ≈ 191 K under appropriate pressure. The van der Waals critical parameters T_c and P_c provide the entry-level estimates for each constituent (methane, ethane, propane) and, combined with mixing rules, set the operating envelope for liquefaction cycles such as Joule-Thomson expansion or mixed-refrigerant cascades.
Supercritical CO₂ extraction. CO₂ has T_c ≈ 304 K and P_c ≈ 73 atm, both close to ambient conditions. A small amount of heating and compression produces a supercritical fluid with gas-like diffusivity and liquid-like solvent power. Decaffeination of coffee, extraction of hop oils, and reaction-medium chemistry all use this idea, and the design relies on van der Waals-type equations of state.
Cryogenic engineering. Producing liquid nitrogen at 77 K, liquid helium at 4.2 K, cooling superconducting magnets, or designing liquid-hydrogen tanks for space launch vehicles all require accurate real-gas modelling. Attraction dominates at low temperature, so the a parameter is decisive; helium has an unusually small a, which is why its liquefaction is famously difficult and was achieved only in 1908.
Common Misconceptions and Caveats
The most common mistake is to treat the van der Waals equation as a rigorous equation of state. It is the first equation that correctly captures the qualitative behaviour of real gases, but its quantitative accuracy is limited. Near the critical region and inside the two-phase envelope, errors can reach 10 to 30 percent. For industrial sizing engineers use Peng-Robinson or Soave-Redlich-Kwong, and for high precision they use multi-parameter fits such as GERG-2008 or even quantum-chemistry calculations. Treat this tool as an educational and conceptual aid.
Another pitfall is the assumption that Z = 1 means the gas is fully ideal in every sense. Z = 1 is just an instantaneous ratio PV/RT. Internal energy U(T,V) and heat capacity C_v(T,V) still depend on volume for a real gas. The Joule-Thomson coefficient, temperature change in adiabatic expansion, and enthalpy H(T,P) all differ from ideal-gas values even when Z = 1. Always check the derived thermodynamic relations, not only Z.
Finally, the equation treats a and b as constants, but they are weakly temperature-dependent. Soave and others introduced a temperature-dependent function alpha(T) for the attraction term, leading to the Soave-Redlich-Kwong and Peng-Robinson equations. When you sweep T over a wide range with fixed a and b, view the result as a representative value for that range, not as a high-precision prediction.