loading...
running...
How to use
Pick a preset, or change the controls. Free piston mode lets the gas and Pext settle by themselves; Driven runs a slow compression-expansion cycle so the P-V graph draws a loop; Locked fixes the volume for pressure and speed-distribution experiments. Raise the wall coupling to make the gas follow the wall temperature (heating or cooling it), keep it at zero for an insulated gas. Try the one-speed start with collisions on and off. Drag to orbit, wheel to zoom. Space pauses, R resets. Re-run the numerical checks at the bottom.
The tank, piston, gauge and thermometer models and their textures were modelled and baked in Blender; Three.js r160 moves every molecule from the same kinetic model as the 2D lab. The dial reads the piston pressure and the mercury column the kinetic temperature.
The science
The gas is the kinetic-theory model: N point molecules of mass m move freely in a box (1 x 1 x X), bounce elastically off the walls, and change the piston's momentum at every hit. Pressure is nothing but this momentum transfer per area and time:
P = (1/A) Δp/Δt = N m <vx²> / V ⇒ P V = N k T, (3/2) k T = <½ m v²>
Units are chosen so that k = 1 and the cross-section is 1, so the numbers are pure kinetic theory, not a particular gas. Molecules are pointlike, so the gas is monatomic: three translational degrees of freedom, internal energy U = (3/2) N k T and heat-capacity ratio γ = 5/3.
Collisions. Real gases reach equilibrium because molecules collide. Here random pairs inside a small cell scatter isotropically with momentum and energy conserved (Bird's direct-simulation Monte Carlo idea), at a mean rate ν per molecule. With ν = 0 the molecules never exchange energy, so a gas that starts with one speed keeps it forever and a compression along x heats only the x motion (an effective γ = 3). With collisions the speeds relax to the Maxwell-Boltzmann law
f(v) = 4π (m / 2πkT)3/2 v² exp(-m v² / 2kT), <v> = √(8kT/πm), <v4>/<v²>² = 5/3
Walls and the first law. A thermal wall re-emits a molecule with a Maxwell flux distribution at the wall temperature Tw (probability = coupling), so heat flows in or out: Q is the kinetic energy gained in those events. The piston does work W on the gas in each collision. The ledger shows U - U0 = Q + W to round-off, because it is bookkeeping of the same events.
Processes. With insulated walls a slow compression follows T Vγ-1 = const (adiabatic, P V5/3 = const); with fully coupled walls the gas stays at Tw and P V = const (isothermal). The P-V graph draws both curves through the current state so you can see which one the path follows. The free piston obeys M dv/dt = -Pext A + gas impulses and is integrated with exact event-ordered collisions, so gas + piston + Pext V is conserved to round-off.
Checks. (1) P V = N k T with P from piston impulses and T from kinetic energy. (2) Measured mean speed against √(8kT/πm). (3) A one-speed gas relaxes to kurtosis 5/3. (4) Energy conservation for the free piston. (5) A slow adiabatic compression follows T2/T1 = (V1/V2)2/3.
Simplifications. No molecular volume or attraction (so no phase change), monatomic only, a square piston of unit area, isotropic scattering instead of a real cross-section, finite particle numbers so all readings fluctuate by about 1/√N.