SELLC Physics Lab

Pressure, volume & temperature

All simulations

One equation, PV = nRT, and the three laws that are usually taught as if they were three. Clamp one variable, drive a second, and the third has no say in the matter. Boyle, Charles and Gay-Lussac are not separate results here — they are three slices of one surface, and the surface is drawn. The work integral is accumulated along the path the piston actually travels and checked against the closed form; van der Waals runs alongside to show where the whole idea stops being true. Or take the box off the rails entirely: in sandbox mode you set any two of the three, drag the piston with the mouse whenever the volume is one of them, and go wherever you like — which is the only way to see that W and Q depend on the route you took while ΔU and ΔS do not.

The cylinder

Quasi-static, reversible

The gas column height is affine in V across the drawn 0.2–5.0 L range — a 6 % floor keeps the gas visible at the bottom stop, so equal volume changes give equal piston travel, but the column is not proportional to V and the origin is off the bottom of the scale. The weight stack is the pressure the piston has to hold up; on the isochoric process the piston is locked instead, and the load becomes irrelevant. In sandbox mode the piston grows a grip whenever the volume is yours to set — pull it and the gas follows in real time. The molecules are decorative — honest particle dynamics live on the ideal gas particle box, where the pressure is measured from collisions rather than assumed from this equation.

×1

State right now

Process
Invariant
Held constant
Driven
Pressure P
Volume V
Temperature T
Amount n
Mass
Density ρ
Molar volume V/n

The equation of state

P·V
n·R·T
Z = PV/nRT (ideal)
Z (van der Waals, same V and T)

The ideal Z is 1 to the last digit and always will be — it is the equation of state divided by itself, a tautology rather than a result, so it carries no badge. The van der Waals Z beside it is the one worth watching: it is a second equation of state evaluated at the same V and T, and it goes green only while the ideal law is within 1 % of it.

The three invariants

Boyle P·V
Charles V/T
Gay-Lussac P/T

On the three clamped processes exactly one of these is green — the one that process holds still — and watching which two move is the whole point: each historical “law” is just the statement that one of these stops changing when you clamp the right variable. On the adiabatic process none of them is green, because none of them is constant: that is precisely what makes it the odd one out.

One surface, three projections

PV — Boyle's plane

  • Current process
  • Isotherms at fixed T
  • van der Waals, same V and T
  • Present state
  • Anchor ∫P dV is measured from
Every dashed curve is P = nRT/V at one fixed T — a hyperbola, not a straight line, which is why Boyle's law took a barometer and two years to find. The adiabat crosses them, and crosses them more steeply by exactly the factor γ.

PT — Gay-Lussac's plane

  • Current process
  • Isochores at fixed V
  • Present state
Constant volume gives a straight line through the origin. That intercept is not a curve-fitting artefact — extrapolating it is how absolute zero was first located, a century before anyone could get near it.

VT — Charles's plane

  • Current process
  • Isobars at fixed P
  • Present state
Same geometry, different clamp: at constant pressure the volume is proportional to absolute temperature, so the isobars are also rays from the origin. A lower pressure is a steeper ray.

The PVT surface

  • Surface mesh (isotherms × isochores)
  • Current process, drawn on the surface
  • Present state
The three planes above are shadows of this. A state of the gas is a point on the surface and cannot be anywhere else — that is the entire content of an equation of state. Each process is a curve drawn on the surface, and the blue highlight shows which one you are on. Pressure runs upward and is scaled linearly to the largest value on the patch, which is why the sheet climbs so hard toward small V. The patch is drawn over 0.2–5.0 L and 100–1000 K; the adiabatic process has no temperature bound, so from a hot, large-volume start it can run past the top of that range, and the state dot then rides the edge rather than sitting on the surface. The warning strip says so when it happens, and the readouts stay correct.

The physics

One equation, three laws

The equation of state ties the three variables together so that only two of them are ever free:

PV = nRT

Fix one and you have a two-variable relationship, which is what each of the classical laws is:

  • Boyle (1662) — at fixed T, PV is constant. Halve the volume, double the pressure.
  • Charles (1787) — at fixed P, V/T is constant.
  • Gay-Lussac (1802) — at fixed V, P/T is constant.

They were found separately, over 140 years, by people who could not clamp the third variable as easily as a slider does. Seeing all three invariants on screen at once, with exactly one of them frozen, is the modern shortcut.

Why the temperature must be absolute

Charles and Gay-Lussac are proportionalities, and a proportionality has to pass through zero. In °C they do not; in kelvin they do. The rays converging on the origin in the PT and VT planes are what defines the kelvin scale, not a consequence of it.

The adiabat, and why it is steeper

Take the heat away and the gas must pay for its expansion work out of its own internal energy, so it cools as it expands. Combining dU = −PdV with the equation of state gives

PVγ = constant, TVγ−1 = constant

with γ = cp/cv. Because γ > 1 the adiabat falls away faster than the isotherm through the same point — steeper by exactly the factor γ in logarithmic slope. That single fact is what makes a heat engine possible, and it is the geometry the heat-engine page walks around.

Work, and the check on it

Work done by the gas is the area under its path in the PV plane:

W = ∫ P dV

The readout labelled numerical is that integral accumulated by composite Simpson along the path the piston actually travelled. The interval count is adaptive — scaled both to how much of the volume range a segment covers and to how many e-foldings of V it crosses, because the integrand's curvature climbs steeply toward small volumes. A per-frame nudge usually costs the minimum two intervals, rising to a handful down near the bottom stop where the same step in V is a much larger fraction of V; a jump across the whole range gets several hundred. The one labelled closed form is the textbook result for the same process:

  • isothermal — W = nRT ln(V2/V1)
  • isobaric — W = PΔV
  • isochoric — W = 0, exactly
  • adiabatic — W = (P1V1P2V2)/(γ−1)

They are computed by completely different routes and the gap between them is on screen, divided by max(|Wclosed|, nRT1) rather than by Wclosed alone — the closed form passes through zero every time the sweep re-crosses the anchor volume, and a bare relative error there would divide a small constant by almost nothing. Because ∫P dV along a fixed process curve depends only on its endpoints, sweeping out and back returns the accumulator to the same value every time it passes a given volume — if it drifted, the quadrature would be wrong.

Where this stops being true

An ideal gas is a gas of point particles that do not attract each other. Real molecules have volume, which resists compression, and attract, which assists it. Van der Waals put both in by hand:

P = nRT/(Vnb) − an2/V2

b is the excluded volume per mole, a the strength of the attraction. The two terms pull opposite ways, and which one wins is visible on the readout: at the extreme corner these sliders allow — n at maximum, T = 100 K, V at minimum — carbon dioxide comes out 39 % below the ideal pressure, attraction winning, while helium comes out 2 % above it, because helium barely attracts anything and all that is left is the bulk of the atoms refusing to be squeezed.

The compressibility factor Z = PV/nRT is identically 1 for the ideal law by construction — a tautology, not a result. The number worth watching is the van der Waals Z beside it. One thing these sliders deliberately cannot reach is the Vnb singularity where van der Waals gives up entirely: at their most extreme setting the volume is still about 23 times the excluded volume, because real molecules are genuinely very small.

Path functions and state functions

ΔU and ΔS depend only on where the gas is. W and Q depend on how it got there. Along a single named process that distinction is invisible, because there is only one route — which is why the guided mode cannot show it and the sandbox can.

Go from 1 L at 300 K to 3 L at 600 K two different ways. Expand cold and then heat at the new volume, and the gas does 111.26 J of work. Heat first and expand hot afterwards, and it does 222.51 J — twice as much, because it pushes the piston at twice the pressure the whole way. Both routes end at the same P, V and T; both give ΔU = 253.18 J and ΔS = 0.9558 J/K, to the last digit. Only the work differs, and the heat differs with it.

That is not a quirk of bookkeeping — it is why W and Q are written with a δ rather than a d, and it is the whole reason a heat engine can exist: go out along one route and back along another and the areas do not cancel. Close the loop in the sandbox and ΔU and ΔS come back to zero while W does not; what is left over is that loop's work per cycle.

Which cycle you get is decided by the variable you told to follow, because that fixes which two legs are available to you:

  • P follows — you move V and T, so the legs are isotherms and isochores. Four of them is a Stirling cycle.
  • V follows — you move P and T, so the legs are isotherms and isobars. Four of them is an Ericsson cycle.
  • T follows — you move P and V, so the legs are isobars and isochores, and the loop is a plain rectangle on the PV plane.

None of these is the hardware. A real Stirling engine carries a regenerator between its isochoric legs, which is what lets it approach Carnot; the heat-engine page models that explicitly and shows what the regenerator is worth. What you can walk here is the cycle, not the machine.

Assumptions and limits

  • Quasi-static and reversible. Every state on the path is an equilibrium state. A real piston moved fast enough leaves the gas non-uniform, and none of these curves apply.
  • Closed system. n is constant during a sweep. No leaks, no chemistry, no phase change — and no condensation, however far below the critical temperature you push it.
  • γ is treated as a constant. It is not: vibrational modes unfreeze as a polyatomic gas heats, so the tabulated room-temperature γ for CO₂ and water vapour is wrong by a few per cent at the top of the temperature range.
  • Van der Waals is itself only a correction, not the truth. It is qualitatively right about why the ideal law fails and quantitatively mediocre near the critical point.
  • The molecules in the cylinder are decorative. Their count tracks n and their jitter tracks √T, but they are not integrated. The page that does that honestly is the ideal gas particle box.

What to try

  1. Watch one invariant freeze. Leave it isothermal and let it run — the page arrives already sweeping, so the button reads Pause. (If your system asks for reduced motion it starts paused instead; press Play.) Boyle's P·V sits still while the other two columns move; switch to isobaric and the green badge moves to Charles. Nothing else about the model changed — only which variable is clamped.
  2. Find absolute zero. Switch to isochoric and look at the PT plane. Every isochore is a straight line aimed at the origin. Extrapolating that line is, historically, how absolute zero was located.
  3. Make the adiabat steeper than the isotherm. Set the process to adiabatic with helium (γ = 5/3), then switch the gas to carbon dioxide (γ = 1.289) and watch the curve flatten toward the isotherm it would become if γ were 1.
  4. Check the work integral. On any process, watch the residual readout while the sweep runs. The accumulated ∫P dV and the closed form are reached by completely different routes, and the gap between them stays around 3 parts in 1010 on the isotherm and 2 parts in 109 on the helium adiabat — the steepest curve available — without growing over a dozen sweeps. On the isobar it falls to a few parts in 1015 — machine precision, because Simpson integrates a constant exactly and nothing is left but rounding, which is also why that one figure creeps by a factor of a few over a dozen sweeps while the others do not move at all.
  5. Do no work at all. On the isochoric process the closed form is exactly zero, and the numerical integral has to agree because every dV is zero. Q and ΔU are then equal — all the heat goes into internal energy.
  6. Break the ideal gas. Choose carbon dioxide and switch on the van der Waals comparison. At the page defaults the two curves stay close and the warning strip stays silent for the whole sweep — the gap runs from 0.08 % at 5 L to 2.1 % at 0.2 L, visible on the plot but not alarming. Now push n to its maximum and T down to 100 K, and drive the volume to 0.2 L: the real-gas pressure falls 39 % below ideal, Z drops to about 0.61, and the warning strip names both the departure and the reduced conditions that caused it.
  7. Watch the correction change sign. Hold that extreme corner and step through the gases. Water vapour reads Z ≈ 0.37 and carbon dioxide ≈ 0.61 — both below 1, because intermolecular attraction is helping you compress. Helium reads ≈ 1.02, above 1, because it barely attracts and only the finite size of the atoms is left. Two corrections competing, and the sign tells you which one won.
  8. Take two routes to the same place. Switch to sandbox mode with the page defaults still in place — 0.0406 mol of air — leave pressure as the variable that follows, and set V = 1 L, T = 300 K. (All four numbers below scale with n, and ΔU and ΔS also scale with cv, so a different working fluid moves them.) Press Start measuring from here. Now expand to 3 L and then heat to 600 K: W = 111.26 J. Re-anchor back at 1 L and 300 K and do it the other way round — heat to 600 K first, then expand to 3 L: W = 222.51 J. Same endpoint, same ΔU = 253.18 J, same ΔS = 0.9558 J/K, twice the work.
  9. Run a cycle by hand. From that same anchor, walk all four legs: expand to 3 L, heat to 600 K, compress back to 1 L, cool back to 300 K. You are exactly where you started and the readouts say so — ΔU and ΔS are back at zero. W is −111.26 J: you spent more work compressing the gas hot than you recovered expanding it cold, so this loop is a Stirling cycle run backwards — a heat pump, driven by you. Now walk the same four states the other way round — heat to 600 K first, expand to 3 L, cool to 300 K, compress to 1 L — and W comes out +111.26 J. Same four corners, opposite direction, and it is an engine.

Why an engineer should care

Everything on this page is the layer underneath a compressor curve, a relief-valve set point and a nameplate rating. A vessel that is fine at 20 °C and gets left in the sun is a Gay-Lussac problem; a receiver sized on ideal-gas assumptions and run near its critical point is the departure that Z measures. The reason to push a model until it breaks in a simulator is that the alternative venue is worse.