Clever Quest Lab ← Labs

Ideal Gas

Squeeze, heat and fill a box of bouncing particles and watch the gas law appear.

Drag the piston (the grey bar) or use the Volume slider. Keyboard: ← → piston, ↑ ↓ heat/cool, Space play/pause, . step, R reset.

Readouts (simulation units)

Pressure p
–
Volume V
–
Particles N
–
Temperature T
–
p · V
–
N · k · T
–
pV / NkT (1 = ideal gas law)
–
Work on gas W
0
Heat added Q
0

p–V diagram

measured   isotherm   adiabat

Speed distribution

light   heavy   Maxwell–Boltzmann (2D)

Presets

Each process preset restarts the gas, waits a moment for the pressure reading and then runs on its own.

Gas

Thermostat

Off: the box is insulated, so only the piston and the Heat/Cool buttons change the energy.

Piston

How to use it

The box holds a gas made of small discs that fly in straight lines and bounce off each other and off the walls. The right-hand wall is a piston. Drag it, or move the Volume slider, to squeeze the gas or let it expand. Heat and Cool add or remove energy, and the Gas sliders add or remove particles. The readouts show pressure p, volume V, particle number N and temperature T, and compare p·V with N·k·T. For an ideal gas the two are equal; here they agree to within a few percent.

Start with the presets. Each process preset sets up the gas and runs one textbook process while the p–V diagram draws its curve next to the theoretical one.

Controls

How it works

Every particle moves in a straight line. When two discs overlap while approaching, they exchange momentum along the line joining their centres. That is an elastic collision: total momentum and kinetic energy are unchanged. A particle that hits the piston bounces with its speed measured relative to the piston, so a piston moving inward sends particles back faster (work heats the gas) and a retreating piston slows them down.

The simulation is two-dimensional, which changes the units. “Volume” V is the area of the box, and pressure p is force per unit length of wall. A light particle has mass 1, the box is 6 units tall and up to 10 wide, and the Boltzmann constant k is 1, so temperature is measured in energy units. Pressure is the momentum handed to the walls, divided by time and wall length, averaged over the last few time units. Temperature is the mean kinetic energy per particle, because in two dimensions each particle has two degrees of freedom carrying ½kT each:

pV = NkT,    kT = ⟨½mv²⟩

Speeds follow the two-dimensional Maxwell–Boltzmann distribution, drawn as the curve over the histogram:

f(v) = (mv / kT) · exp(−mv² / 2kT),    mean speed = √(πkT / 2m)

With the thermostat on, a slow compression is isothermal and follows pV = constant. With it off, no heat flows and the process is adiabatic: pVγ = constant with γ = 2 for this flat gas (for a monatomic gas in three dimensions γ = 5/3). The internal energy is U = NkT, and it changes by the work W done on the gas plus the heat Q added, which the readouts track.

Things to try

Frequently asked questions

Why is pV not exactly equal to NkT?

Two reasons. With a few hundred particles the pressure fluctuates, because wall hits arrive at random. And the discs have a size: if they cover a fraction η of the box, the pressure is higher by a factor of about 1 + 2η. For 300 light particles in the full box that is close to 3 %. Squeeze a crowded box and the excess grows, just as real gases depart from the ideal law at high density.

Why does compressing a gas heat it?

A particle that bounces off a wall moving toward it leaves faster than it arrived, like a ball hit by a bat. Many such bounces raise the mean kinetic energy, which is the temperature.

What is Brownian motion?

In 1827 the botanist Robert Brown saw tiny particles from pollen grains jiggling in water. In 1905 Albert Einstein explained the jiggling as the result of uneven bombardment by molecules. The large particle here is pushed around in the same way.

How does the thermostat work?

It rescales all speeds by a factor very close to 1 many times per time unit, nudging the temperature toward the target. It stands in for walls kept at a fixed temperature.

More free games and simulators