Ideal and real gases
A gas fills the vessel that holds it, compresses easily and, at low pressures, all gases behave almost the same: the equation PV = nRT describes them all with a single constant. This topic derives that equation from Boyle's, Charles's, Gay-Lussac's and Avogadro's laws, uses it for density, molar mass and mixtures (Dalton's law), and then explains why and when it fails: the compressibility factor Z, the van der Waals equation and its successors by Redlich–Kwong and Peng–Robinson, and the principle of corresponding states. The examples open in the «Ideal and real gases» tool, which compares each model with the reference equation of state of the substance.
The ideal-gas model
The state of an amount of gas is described by four quantities: the pressure P (the force per unit area with which the molecules hit the walls), the volume V, the temperature T and the amount n (in mol). The ideal gas is the model in which molecules are points with no volume of their own that neither attract nor repel each other: they only collide with each other and with the walls. No gas is exactly like that, but when the molecules are far apart (low pressure) and move fast (high temperature) their volume and forces barely matter, and the model works very well.
The temperature of the gas laws is always the absolute one, in kelvin: . With degrees Celsius the ratios come out wrong, because 0 °C is not the absence of motion: going from 10 °C to 20 °C does not double anything, while from 283.15 K to 293.15 K the temperature rises 3.5%. The tool always converts to kelvin and writes it in the first step.
| Pressure unit | Equals | R in L·unit/(mol·K) |
|---|---|---|
| Pa (N/m²) | — | 8.314 J/(mol·K) = 8.314 Pa·m³/(mol·K) |
| kPa | 1000 Pa | 8.314 |
| bar | 100 kPa | 0.08314 |
| atm | 101.325 kPa = 760 mmHg | 0.08206 |
| mmHg | 133.32 Pa | 62.36 |
| psi | 6.895 kPa | — |
The gas constant is R = 8.314462618 J/(mol·K), the same in any system of units: only its number changes. Since a J is a Pa·m³ and a m³ is 1000 L, R is 8.314 L·kPa/(mol·K); and dividing by the kPa of each pressure unit gives 0.08206 L·atm/(mol·K), 0.08314 L·bar/(mol·K) and 62.36 L·mmHg/(mol·K). The tool writes R in the pressure and volume units you choose and says so in the «Working units» step.
The gas laws
The empirical gas laws say what happens when two quantities change and the other two stay fixed. Boyle's: at constant temperature and amount, the volume is inversely proportional to the pressure, . If a gas is squeezed to half its volume, its pressure doubles:
Charles's: at constant pressure, the volume is proportional to the absolute temperature, . If V is plotted against the temperature in °C, every line, at any pressure, points to V = 0 at −273.15 °C: that is how absolute zero was found. Gay-Lussac's: at constant volume, the pressure is proportional to T, (an aerosol can in a fire). And Avogadro's: at constant P and T, equal volumes hold the same number of molecules, , whatever the gas.
The four laws are cases of a single one. If V is proportional to T, to 1/P and to n separately, it is proportional to their combination, and the proportionality constant is the same for all gases: it is R.
The second form, the general equation, compares two states of the same gas: whatever does not change cancels. With n constant the combined law remains, ; with n and T constant, Boyle's; and so on. In the «Change of state» view you type the two states, leave empty the value you are looking for, and leave the quantities that do not change empty in both states (or with the same number): the tool cancels what does not change and says which law applies in the «Law that applies» card.
| What does not change | Law | Relation | Tool example |
|---|---|---|---|
| n, T | Boyle | 4.0 L at 1.0 atm → 2.5 atm: 1.6 L | |
| n, P | Charles | 2.50 L from 25 to 100 °C: 3.129 L | |
| n, V | Gay-Lussac | 2.0 atm from 20 to 120 °C: 2.682 atm | |
| P, T | Avogadro | 1.50 mol in 36.0 L → 2.50 mol: 60 L | |
| n | combined | 500 mL, 740 mmHg, 22 °C → 0 °C and 760 mmHg: 450.6 mL |
The equation PV = nRT
With three of the four quantities the equation gives the fourth. One mole of any ideal gas at 0 °C and 1 atm takes up the molar volume L; at 25 °C and 1 atm, 24.47 L; and at 0 °C and 1 bar (the standard conditions IUPAC recommends), 22.71 L. Two moles of N₂ at 25 °C and 1 atm take up 48.93 L, and weigh g.
Mass, density and molar mass
The amount can be given as a mass: , with M the molar mass. Substituting into PV = nRT and calling the density gives a very useful relation, because it needs neither V nor n:
The density of a gas is proportional to its molar mass: CO₂ (44 g/mol) is denser than air (29 g/mol) and collects at the bottom of a cellar; helium (4 g/mol) rises. And the other way round: measuring the density of an unknown gas at a known P and T gives its molar mass (example 2). The tool works with the four relations at once (PV = nRT, m = nM, m = ρV and PM = ρRT): with the data you type it solves in a chain for everything it can, and if you type more data than needed it checks that they agree (within 0.5%) and, if not, says which relation fails. The molar mass can be typed as a number or as a formula (CO2, N2), which the tool converts with the standard atomic masses.
Gas mixtures: Dalton's law
In a mixture of ideal gases each gas behaves as if it were alone in the vessel: it fills the whole volume and exerts its own partial pressure, the one it would have alone. Since PV = nRT holds for each with the same V and T, the partial pressures add up as the moles do:
The mole fraction is at the same time the fraction of the moles and that of the pressure. The mean molar mass lets the mixture be treated as a single gas: its density is . The tool's dry air (N₂ 0.7808, O₂ 0.2095, Ar 0.0093 and the rest, 0.0004, of CO₂) has g/mol and, at 25 °C and 1 atm, a density of 1.184 g/L.
A gas collected over water
In the laboratory a gas is often collected by displacing water from an inverted vessel. The gas comes out saturated with water vapor, so inside there is a mixture: with the water level equal inside and out, the total pressure is the atmospheric one and that of the dry gas is the difference. The vapor pressure of water depends only on the temperature; at 25 °C it is 3.170 kPa (23.78 mmHg). The tool computes it with the IAPWS-95 equation of state of water, the same as its thermodynamic tables, between 0.01 °C and 100 °C.
Real gases: the compressibility factor
To measure how far a real gas departs from the ideal one, the compressibility factor is used: the ratio of the real molar volume to the one it would have as an ideal gas at the same P and T:
Z sums up two effects the ideal model ignores. Molecules attract each other: one heading for the wall is held back by those it leaves behind and hits less hard, so the pressure is lower than the ideal one and Z < 1; this effect dominates at moderate pressures and low temperatures. And molecules take up volume: the free space to move in is smaller than V, collisions are more frequent and Z > 1; this effect dominates at high pressures, when the molecules are packed together.
The curves of the figure come from the reference equation of state of each substance, the one the tool uses as the comparison value: Helmholtz-energy equations fitted to thousands of measurements (for CO₂, the one by Span and Wagner from 1996), evaluated on the site with CoolProp's coefficients. They reproduce the measurements within their uncertainty, so they serve to judge the simple models.
At the Boyle temperature the two effects balance at low pressures and the gas follows Boyle's law over a wide pressure range. By the tool's reference equations it is 326.2 K for N₂, 408.5 K for argon, 508.6 K for methane and 722.0 K for CO₂: the more the molecules attract each other, the higher it is. That is why air, at room temperature, is close to ideal up to pressures of tens of bar.
The van der Waals equation
In 1873 van der Waals corrected the ideal-gas equation for both effects. Because of the size of the molecules, the free volume is not v but , with b the covolume (the volume taken up, effectively, by the molecules of a mole). Because of attraction, the pressure on the wall drops by an amount proportional to the number of attracting pairs of molecules, that is, to the square of the concentration, :
With a = b = 0 it is the ideal gas again. The remarkable thing is that this simple equation predicts the liquid: below a certain temperature, its isotherms have a maximum and a minimum, and one pressure corresponds to three volumes. The point where the maximum and the minimum merge is the critical point: there the isotherm has a horizontal inflection point.
Solving for a and b from Tc and Pc (both are well measured) gives the constants the tool uses, and a fixed value of the compressibility factor at the critical point:
For CO₂, with Tc = 304.13 K and Pc = 73.773 bar from the CoolProp constants list: a = 0.3657 Pa·m⁶/mol² (3.657 L²·bar/mol²) and b = 4.285×10⁻⁵ m³/mol (0.04285 L/mol). Textbooks often give values fitted to other measurements, such as a = 3.59 L²·atm/mol² and b = 0.0427 L/mol; with them the model's critical point comes out at 303.6 K and 73.89 bar. Both options are in the tool: the substance from the list, or «Other: data of the exercise» with a and b.
The equation as a cubic in Z
When P and T are known and the volume is sought, the equation is a cubic. Written for Z with and :
It has one real root (gas or supercritical fluid) or three. With three, the smallest is the liquid, the largest the vapor and the middle one has no physical meaning; the stable one is that of lowest Gibbs energy, that is, of lowest fugacity coefficient φ. For van der Waals, . The tool writes the cubic with its coefficients, all its roots with their ln φ and marks the stable one with ✓ (example 7).
Redlich–Kwong and Peng–Robinson
Van der Waals captures the essentials, but its numbers are rather off: its Zc = 0.375 is larger than that of real substances: by their reference equations, 0.2894 for N₂, 0.2746 for CO₂ and 0.2294 for water. Its successors change the attraction term and make it depend on temperature:
Peng–Robinson adds the acentric factor ω, which measures how far the vapor pressure of the substance departs from that of a fluid of spherical molecules (ω ≈ 0 for argon and methane, 0.224 for CO₂, 0.344 for water). The three are cases of the same general cubic, , with the coefficients of the table:
| Model | ε | σ | (in ) | (in ) | Zc | Needs |
|---|---|---|---|---|---|---|
| van der Waals | 0 | 0 | 27/64 = 0.42188 | 1/8 = 0.125 | 0.375 | Tc, Pc |
| Redlich–Kwong | 0 | 1 | 0.42748 (× ) | 0.08664 | 1/3 | Tc, Pc |
| Peng–Robinson | 1 − √2 | 1 + √2 | 0.45724 × α(T) | 0.07780 | 0.3074 | Tc, Pc, ω |
The tool's critical constants are those of the CoolProp 8.0.0 list (MIT license), which takes them from the reference equation of state of each substance; the substance card shows them and «Where these data come from» cites the source. Some of them:
| Substance | Tc (K) | Pc (bar) | ω | M (g/mol) |
|---|---|---|---|---|
| He | 5.1953 | 2.2832 | −0.3835 | 4.0026 |
| H₂ | 33.144 | 12.964 | −0.219 | 2.0159 |
| N₂ | 126.19 | 33.958 | 0.0372 | 28.014 |
| Ar | 150.69 | 48.63 | −0.00219 | 39.948 |
| O₂ | 154.6 | 50.464 | 0.0222 | 31.999 |
| CH₄ | 190.56 | 45.992 | 0.01142 | 16.043 |
| CO₂ | 304.13 | 73.773 | 0.2239 | 44.01 |
| C₃H₈ | 369.89 | 42.512 | 0.1521 | 44.096 |
| NH₃ | 405.56 | 113.63 | 0.2557 | 17.03 |
| H₂O | 647.1 | 220.64 | 0.3443 | 18.015 |
Corresponding states
If P, v and T are measured in units of the critical point, the reduced variables , and , the van der Waals equation loses a and b: substituting , and , it becomes the same for every substance,
This is the principle of corresponding states: different gases at the same Tr and Pr have (almost) the same Z. It follows from any two-constant model, and nature obeys it rather well for simple molecules, as the figure shows with the reference equations: at Tr = 1.2 the curves of N₂, CH₄ and CO₂ almost coincide. Water, with polar molecules that form hydrogen bonds, departs; that is why a third parameter such as ω is needed. The generalized compressibility charts of thermodynamics textbooks are these curves, for fluids of small ω.
In the first step of «Real gas» the tool writes the reduced temperature and, if the pressure was given, the reduced pressure: they are the first clue to how far the gas will depart from ideal.
When the ideal gas fails
The table sums up the examples of the «Real gas» view, with the deviation of the ideal gas from the reference equation:
| Case | Tr | Pr | Real Z | Ideal-gas error |
|---|---|---|---|---|
| N₂ at 25 °C and 200 bar (n in 50 L) | 2.363 | 5.89 | 1.056 | +5.55 % |
| Steam at 400 °C and 100 bar (V) | 1.04 | 0.4532 | 0.8509 | +17.5 % |
| Methane at 25 °C and 200 bar (n in 50 L) | 1.565 | 4.349 | 0.8239 | −17.6 % |
| CO₂: 1 mol in 0.500 L at 300 K (P) | 0.9864 | — | 0.7765 | +28.8 % |
| N₂ at 150 K and 50 bar (v) | 1.189 | 1.472 | 0.6649 | +50.4 % |
| Propane at 25 °C and 20 bar (v): liquid | 0.8061 | 0.4705 | 0.07179 | +1290 % |
- With a small Pr (a few hundredths, like air at 1 atm) the ideal gas almost always works: N₂ at 300 K departs by less than 1% up to about 100 bar (Z = 0.9966 at 50 bar and 1.0052 at 100 bar).
- Near the critical point (Tr ≈ 1, Pr ≈ 1) is where it fails most: CO₂ at 300 K and N₂ at 150 K.
- Below Tc and at a pressure above the vapor pressure the substance is a liquid, and the ideal gas makes no sense at all (propane: an error of over 1000%).
- At high Tr and high Pr («permanent» gases strongly compressed) the size of the molecules dominates and Z > 1: the ideal gas overestimates the amount that fits in a cylinder.
How to use the simulator
The tool is under Chemistry → Ideal and real gases. At the top, under «What do you want to compute?», you choose one of four views; below, «Examples» loads a problem into the matching view. On the right you get the result, a figure and the «Step by step», with the button for the detailed solution in PDF.
| View | What you type | What it gives |
|---|---|---|
| «Ideal gas» | under «1. What you know about the gas», three of «Pressure P», «Volume V», «Temperature T» and «Amount n», each with its unit; under «2. Mass and density (optional)», «Formula or molar mass M», «Mass m» or «Density ρ» | everything that can be solved for, with the formula of each result; it warns if the data do not agree |
| «Change of state» | P, V, T and n of «State 1» and «State 2»; the value sought left empty; those that do not change left empty (or equal) | the value sought, the law that applies and the check |
| «Mixtures (Dalton)»: «Gas mixture» | each gas with its amount and «Given as» mol, grams, mole fraction or partial pressure («+ Add gas»); and two of «Temperature», «Vessel volume» and «Total pressure» | total pressure, moles, mean molar mass, density and the table with n, m, x, mass % and partial pressure of each gas |
| «Mixtures (Dalton)»: «Gas collected over water» | the gas, «Water temperature», «Total (barometric) pressure» and «Volume collected» or «Amount of gas» | dry-gas pressure, water vapor pressure, moles or volume and the error of forgetting the vapor |
| «Real gas» | the «Substance» (from the list or «Other: data of the exercise (a, b or Tc, Pc, ω)…»), T and two of P, V and n (with V and n empty you get the molar volume) | the result of each model with its Z, the phase and the deviation from the «Reference equation»; the plot of Z against P; the constants of each model and the cubic with its roots |
- Numbers accept a decimal comma and scientific notation. Each field has its unit selector: pressure in atm, kPa, bar, mmHg, Pa, MPa or psi; volume in L, mL or m³; temperature in °C, K or °F.
- With the volume in m³ the tool works in SI (Pa, m³, kg) and writes R = 8.3145 Pa·m³/(mol·K); with L, in L and the chosen pressure unit.
- In «Real gas», the substance card gives M, Tc, Pc and ω, and «Where these data come from» cites CoolProp and the reference equation. The first time a substance is chosen, the tool loads its data (it says so meanwhile).
- The result cards of «Real gas» are «Ideal gas», «van der Waals», «Redlich–Kwong», «Peng–Robinson» and «Reference equation»; under each number come Z, the deviation in % and the phase (gas, vapor, liquid, supercritical).
- If the data are too many or contradict each other, the tool does not guess: it says which relation fails and by how much, or what is missing.
Common mistakes
- Using the temperature in °C in PV = nRT or in the ratios of the gas laws.
- Mixing units: R = 0.08206 requires liters and atmospheres; with kPa you must use 8.314 L·kPa/(mol·K).
- Applying 22.4 L/mol away from 0 °C and 1 atm: at 25 °C and 1 atm it is 24.47 L/mol.
- Splitting the total pressure by mass: partial pressures follow the moles (x = n/total n), not the grams.
- Forgetting the water vapor of a gas collected over water: at 25 °C you get about 3% too many moles.
- Taking the wrong root of the cubic, or the middle one, which has no physical meaning.
- Believing that the ideal gas always overestimates the pressure: with Z > 1 (crowded molecules) it underestimates it.
- Using van der Waals as if it were exact: it is the simplest of the cubics; in the liquid it fails by a lot.
Worked examples
Example 1How much CO₂ fits in a tank
Solution
- Absolute temperature: K. With liters and atmospheres, L·atm/(mol·K).
- mol.
- g/mol, so g.
- Density: g/L, the same as gives without going through n. At 5 atm CO₂ is five times denser than at 1 atm.
Solve it in Simuveliq
- In Chemistry → Ideal and real gases, under «Examples», choose Grams of CO₂ in a 10.0 L tank at 5.00 atm and 20 °C: it opens the «Ideal gas» view with P, V, T and the formula CO2 typed and n empty.
- The cards give «Amount of gas n» 2.079 mol, «Mass m» 91.48 g and «Density ρ» 9.148 g/L, each with its formula. In the «Step by step», the first step turns the 20 °C into 293.15 K and writes R = 0.082057 L·atm/(mol·K), and M(CO₂) = 44.009 g/mol comes from the formula.
Example 2Molar mass from the density
Solution
- From : g/mol.
- It amounts to saying that a mole takes up 22.41 L at 0 °C and 1 atm and weighs g.
- Candidates with that molar mass: N₂ (28.014 g/mol), CO (28.010) and C₂H₄ (28.054). The density alone does not tell them apart; with three significant figures in the density, any of the three fits.
Solve it in Simuveliq
- Under «Examples» choose Molar mass of a gas with density 1.25 g/L at 0 °C and 1 atm. The «Molar mass M» card gives 28.02 g/mol with the formula M = ρ·R·T / P.
- Below, the tool says what it cannot compute: without an amount (V, n or m) there is no volume and no moles. Type 56.0 g in «Mass m» and n and V appear.
Example 3Combined law: taking a volume to 0 °C and 760 mmHg
Solution
- The amount does not change: , with temperatures in kelvin: K and K.
- mL.
- Sanity check: more pressure and less temperature both shrink the gas; it comes out at 0.9011 times the initial volume.
Solve it in Simuveliq
- Under «Examples» choose Combined law: 500 mL at 740 mmHg and 22 °C, to 0 °C and 760 mmHg: the «Change of state» view with the two states and V₂ empty.
- The card gives V₂ = 450.6 mL (×0.9011 relative to state 1) and «Law that applies»: «Combined gas law». The step by step converts the temperatures to kelvin, solves for V₂ and checks that P·V/T is the same in both states.
Example 4A mixture of three gases
Solution
- Moles: He ; O₂ ; N₂ . Total mol.
- Total pressure as a single gas: atm.
- Mole fractions 0.3999, 0.2001 and 0.4, and partial pressures : He 1.222 atm, O₂ 0.6117 atm, N₂ 1.223 atm (they add up to 3.057).
- Mean molar mass g/mol, and density g/L, the same as gives.
Solve it in Simuveliq
- Under «Examples» choose 10 L tank with 2.00 g of He, 8.00 g of O₂ and 14.0 g of N₂ at 25 °C: the «Mixtures (Dalton)» view, «Gas mixture», with each gas «Given as» grams.
- The cards give «Total pressure» 3.057 atm, «Total moles» 1.249 mol, «Mean molar mass» 19.209 g/mol and «Mixture density» 2.4 g/L; the table, the n, m, x, mass % and partial pressure of each gas. Change the He to 4.00 g and watch every fraction change.
Example 5Oxygen collected over water
Solution
- Water vapor pressure at 25 °C (equation of state of water): 3.170 kPa = 23.78 mmHg.
- Dalton: mmHg.
- With R in L·mmHg: mol, and g.
- If the vapor were forgotten and the 755 mmHg used, you would get 0.01015 mol: 3.25% too much.
Solve it in Simuveliq
- Under «Examples» choose O₂ collected over water: 250 mL at 25 °C and 755 mmHg: the «Mixtures (Dalton)» view on «Gas collected over water».
- The cards give «Dry gas pressure» 731.2 mmHg, «Water vapor pressure» 23.78 mmHg, «Moles of dry gas» 0.009832 mol and «Mass of dry gas» 0.3146 g, and a notice with the error of forgetting the vapor (3.25%). Change the «Water temperature» to 40 °C: the vapor pressure rises a lot and so does the error.
Example 6CO₂ near its critical point: four models
Solution
- Molar volume m³/mol. Ideal gas: Pa = 49.89 bar.
- Van der Waals with Tc = 304.13 K and Pc = 73.773 bar: Pa·m⁶/mol², m³/mol. Repulsion term bar; attraction term bar; bar, .
- The reference equation (Span and Wagner) gives 38.74 bar, . The ideal gas overshoots by 28.8%; van der Waals by 3.09%; Redlich–Kwong gives 38.95 bar (+0.55%) and Peng–Robinson 38.2 bar (−1.4%).
- With , CO₂ is almost at its critical point, where the attraction between molecules counts a lot: that is why the ideal gas fails so badly.
Solve it in Simuveliq
- Under «Examples» choose CO₂: pressure of 1 mol in 0.500 L at 300 K: the «Real gas» view with the substance «Carbon dioxide (CO₂)» and P empty.
- The five cards give 49.89, 39.94, 38.95, 38.2 and 38.74 bar, with their Z and deviation (+28.8%, +3.09%, +0.55%, −1.4%). The step by step writes a and b of each model and the two van der Waals terms; the «Comparison» sums it up in a table.
- Change the volume to 5 L: every model approaches the ideal one (Z almost 1), because the molecules end up ten times further apart.
Example 7Propane at 20 bar: the cubic with three roots
Solution
- With Tc = 369.89 K and Pc = 42.512 bar: and . The cubic is .
- It has three roots: (liquid), (not physical) and (vapor). Their are −0.3725, −0.2356 and −0.2702: the liquid one is the lowest, so the stable state is the liquid.
- m³/mol = 0.1404 L/mol.
- The reference gives 0.08898 L/mol (liquid): van der Waals overshoots by 57.8%, Peng–Robinson stays at 0.08514 L/mol (−4.32%) and the ideal gas (1.239 L/mol) makes no sense here.
Solve it in Simuveliq
- Under «Examples» choose Propane at 25 °C and 20 bar: three roots, liquid. The cards give 1.239 L (ideal gas), 0.1404 L (van der Waals), 0.09908 L (Redlich–Kwong), 0.08514 L (Peng–Robinson) and 0.08898 L (reference), all in the liquid phase except the ideal gas.
- In the van der Waals step the tool writes the cubic, its three roots with the chosen one marked ✓ and the three ln φ. Lower the pressure to 5 bar: it falls below the models' vapor pressure and the stable root becomes the vapor one.
Example 8A nitrogen cylinder at 200 bar: Z > 1
Solution
- Ideal gas: mol, that is kg.
- Reduced: and . Far above the critical temperature and at high pressure, the size of the molecules dominates: Z > 1.
- The reference equation gives and mol ( kg). The ideal gas overestimates the charge by 5.55%; Redlich–Kwong gives 391.7 mol (+2.49%) and Peng–Robinson 393.0 mol (+2.84%).
Solve it in Simuveliq
- The button opens the «Real gas» view with «Nitrogen (N₂)», 25 °C, 200 bar, 50 L and the amount empty (this example is not in the «Examples» list).
- The cards give 403.4 mol (ideal gas), 400.9 (van der Waals), 391.7 (Redlich–Kwong), 393 (Peng–Robinson) and 382.2 mol (reference, Z = 1.056, supercritical). In the plot of Z against P every curve rises above 1.
- Change the unit of «Amount n» to kg to read the mass: 10.71 kg with the reference.