Theory

Gas in a Piston PhysicsPV = nRT, Pressure & Volume

ThermodynamicsIdeal gas law

Introduction

The ideal gas law, PV = nRT, encodes one of the most precisely tested relationships in classical physics: for a fixed amount of gas held at constant temperature, pressure and volume are hyperbolic inverses. Squeeze the volume by half and the pressure exactly doubles; expand to twice the space and the pressure falls to half. The law emerges from the statistical average of countless molecular collisions with the container walls, and it holds remarkably well for real gases near ordinary temperatures and pressures.

Engineers rely on this relationship whenever a gas must be stored, transported, or put to mechanical work. Pneumatic actuators, scuba regulators, internal combustion engine cycles, and refrigeration compressors all operate on pressure-volume relationships that PV = nRT governs at their core. The P–V diagram, which plots pressure against volume as one of those quantities changes, is the standard tool for analysing such processes, and an isotherm on that diagram is always a rectangular hyperbola whose exact shape is set by the product nRT.

Most people expect that compressing a gas by a small amount raises its pressure only slightly, and that large pressure changes require extreme volumes. The simulator overturns this intuition: with n = 0.5 mol and T = 300 K, the Pressure readout sits at 124.7 kPa at V = 10 L, but already reaches 249.4 kPa at V = 5 L. The pressure has doubled from a compression that only halved the volume, and the P–V dot has traced a steep arc up the hyperbola that is easy to miss when thinking about gas behaviour informally.


The Physics Explained

A completed run of the Gas in a Piston simulator, with the live P-V trace following the amber isotherm across the diagram.

The ideal gas law PV = nRT links four quantities: pressure P (in pascals), volume V (in cubic metres), the mole count n, and absolute temperature T (in kelvin), with the universal gas constant R = 8.314 J/(mol·K). At the simulator's default settings of n = 0.5 mol, T = 300 K, and V = 10 L (0.010 m³), the formula gives P = (0.5 × 8.314 × 300) / 0.010 = 1247.1 / 0.010 = 124 710 Pa, which the Pressure readout reports as 124.7 kPa. Every other readout traces back to the same formula: the PV readout shows 1247.1 J, which is simply nRT evaluated at those defaults.

Because the simulator holds T and n fixed while the volume slider moves, the relevant special case is Boyle's law: PV = constant. The constant equals nRT = 0.5 × 8.314 × 300 = 1247.1 J for the default settings. Moving the volume slider to 5 L (0.005 m³) puts P = 1247.1 / 0.005 = 249 420 Pa (249.4 kPa); moving it to 20 L (0.020 m³) gives P = 1247.1 / 0.020 = 62 355 Pa (62.4 kPa). The PV readout stays at 1247.1 J across every position because the product is invariant. This constancy is exactly what the amber dashed isotherm on the P–V diagram represents: every point on that curve satisfies the same PV = nRT product.

The live blue dot on the P–V diagram marks the current state. Set a smaller target volume and press Start (compression) and the dot climbs the hyperbola to the higher pressure; a larger target (expansion) settles it lower. The shape of the hyperbola depends on the nRT product. Raising T from 300 K to 600 K at V = 10 L doubles the pressure from 124.7 kPa to 249.4 kPa and shifts the entire isotherm upward, because nRT has doubled from 1247.1 J to 2494.2 J. Doubling n from 0.5 mol to 1.0 mol produces the same shift for the same reason: the product that defines the isotherm's position is nRT, not its individual factors.

Molecule count within the gas column visualises why pressure rises on compression. The six animated blue dots inside the cylinder bounce between the left wall and the piston face. As the piston moves left, the same six dots occupy a smaller space, implying more frequent collisions per unit area of wall – which is precisely the mechanism that raises macroscopic pressure. The animation is a qualitative illustration of the statistical average that PV = nRT quantifies.


Key Equations

Ideal gas law PV = nRT

At the default settings (n = 0.5 mol, T = 300 K, V = 10 L = 0.010 m³, R = 8.314 J/(mol·K)), the left side evaluates to P × 0.010 and the right side to 0.5 × 8.314 × 300 = 1247.1 J, giving P = 124 710 Pa = 124.7 kPa. The Pressure readout confirms this value. Every slider combination produces a pressure that can be recovered by inserting the displayed n, T, and V into this single equation.

Pressure from moles, temperature, volume P = nRT / V

This rearrangement makes the inverse relationship explicit: P scales linearly with n and T but inversely with V. At V = 5 L = 0.005 m³ with the same n and T, the formula gives P = 1247.1 / 0.005 = 249 420 Pa (249.4 kPa) – exactly twice the default pressure for exactly half the default volume, matching the Pressure readout when the volume slider is set to 5.

Boyle's law (constant T and n) P₁V₁ = P₂V₂

When T and n are held fixed, the product PV is constant. With state 1 at the simulator default (P₁ = 124.7 kPa, V₁ = 10 L), the product P₁V₁ = 1247.0 kPa·L = 1247.1 J. Moving to state 2 at V₂ = 5 L gives P₂ = 1247.1 / 0.005 = 249.4 kPa; moving to state 2 at V₂ = 20 L gives P₂ = 1247.1 / 0.020 = 62.4 kPa. The PV readout reports 1247.1 J at every slider position under these conditions, bearing out the invariant.

PV product (isothermal invariant) PV = nRT

The PV readout in the simulator directly displays this product in joules. At the default state it reads 1247.1 J; at n = 1.0 mol, T = 300 K it reads 2494.2 J; at n = 0.5 mol, T = 600 K it also reads 2494.2 J, because both changes double nRT by the same factor. The equivalence between doubling n and doubling T in their effect on the PV product is a direct algebraic consequence of PV = nRT.


Key Variables

Symbol Name Unit Meaning
PPressurePa (kPa in readout)Force per unit area exerted by gas on the piston and walls
VVolumem³ (L in slider)Space occupied by the gas inside the cylinder
nAmount of substancemolNumber of moles of gas molecules present
RGas constantJ/(mol·K)Universal constant, 8.314 J/(mol·K)
TTemperatureKAbsolute temperature; held fixed during an isothermal process
PVPV productJEquals nRT; invariant for fixed n and T (shown in PV readout)

Real World Examples

How do bicycle pumps and pneumatic tools exploit the ideal gas law?

A bicycle pump is a piston-cylinder device operating on exactly the same physics the simulator captures. When the rider presses the handle, the piston reduces the air volume inside the barrel. At the moment the internal pressure exceeds the tyre pressure, the valve opens and gas flows in, slightly raising the tyre pressure with each stroke. The engineering question for pump designers is how much force the rider must apply per stroke, which depends directly on the pressure reached at the minimum stroke volume.

With n = 0.5 mol, T = 300 K, and V compressed from 10 L to 5 L, the Pressure readout climbs from 124.7 kPa to 249.4 kPa, requiring twice the piston force for the same cross-sectional area. Pneumatic nail guns and air compressors scale the same relationship to smaller volumes and higher mole counts, reaching gauge pressures of 600–900 kPa (roughly 6–9 atm), where the hyperbolic rise in the P–V diagram becomes steep enough that small additional compression produces large pressure increments.

The PV readout, locked at 1247.1 J for those default conditions, confirms that the nRT product sets a ceiling on how much pressure a fixed mass of gas at a fixed temperature can reach for any given minimum volume. Pump designers work within this constraint by increasing n (denser fills) or T (heated compression stages) when higher delivery pressures are needed.

Why does a diesel engine ignite fuel without a spark plug?

Diesel engines compress air to roughly 1/16 to 1/25 of its original volume before injecting fuel. At such compression ratios the ideal gas law predicts large pressure increases; a real engine also heats the gas through compression (closer to adiabatic than isothermal), and the temperature spike is what ignites the diesel fuel on contact. The isothermal simulator holds T fixed, so it isolates the pressure side of PV = nRT.

Setting V to 2 L (the minimum slider position) with n = 0.5 mol and T = 300 K puts the Pressure readout at approximately 623.6 kPa, about five times the default 10 L reading of 124.7 kPa. A diesel cylinder starts at a much larger displacement and compresses far beyond those slider bounds, reaching temperatures above 700-900 K during the compression stroke, well above diesel's autoignition threshold near 250°C.

The Temperature slider lets you see the thermal component separately: raising T from 300 K to 600 K at V = 10 L doubles the Pressure readout from 124.7 kPa to 249.4 kPa. In a real diesel cycle both effects compound simultaneously, which is why compression-ignition engines achieve combustion temperatures and cylinder pressures far beyond what either effect alone would predict from the simulator's isothermal baseline.

How do scuba tanks store enough gas for a 45-minute dive?

A standard scuba tank holds roughly 12 litres of internal volume and is pressurised to about 200 bar (20 000 kPa). At that pressure the ideal gas law predicts the tank contains the equivalent of 2400 litres of air at atmospheric pressure, enough for a typical 45-minute recreational dive. The key variable is n: packing more moles into the same volume raises pressure proportionally.

The simulator's moles slider (0.1 to 2.0 mol) captures this linear scaling. At V = 10 L and T = 300 K, doubling n from 0.5 mol to 1.0 mol doubles the Pressure readout from 124.7 kPa to 249.4 kPa and doubles the PV readout from 1247.1 J to 2494.2 J. Scuba tanks apply this relationship at extreme mole densities: a 200 bar fill means the gas inside is compressed to about 1/200 of its free-air volume.

Dive regulators then perform the inverse step, expanding that high-pressure gas to ambient pressure through a two-stage reduction. Each stage is a controlled expansion along a pressure-volume curve: the same hyperbolic path the P-V diagram traces when the volume slider moves from 2 L toward 20 L. The regulator's job is to keep the delivered pressure near 1 atm regardless of how much gas remains in the tank, which it achieves by exploiting the same PV = nRT relationship in reverse.


Further Reading