Hard-Sphere Gas: Maxwell-Boltzmann Relaxation and Free-Expansion Entropy

A glass chamber with a removable divider. Spheres start in the left half at one speed; colour shows speed. Remove the divider and watch entropy and the speed distribution evolve. Drag to orbit.

Switch to 2D
Controls

Presets

Parameters

Quality

Camera

Divider

Model checks

The science

Idea. A gas of hard spheres confined to half a box has low entropy. Remove the divider and collisions spread the spheres over the whole box (entropy rises by N k ln 2 for an ideal gas) while collisions also reshuffle the speeds until they follow the Maxwell-Boltzmann law, whatever the starting speeds.

Model. Equal elastic hard spheres of diameter d in a unit cube with specular walls, reduced units m = kB = 1. Every sphere starts with the same speed v = √(3kT/m) (a non-equilibrium delta distribution) at random positions in the left half. Collisions swap the normal velocity component, v1' = v1 - ((v1 - v2)·n)n, found with a cell grid and a fixed small time step; total kinetic energy is conserved exactly, so kT does not drift. At equilibrium each velocity component is Gaussian with variance kT/m and the speed follows f(v) = 4π(2πkT/m)-3/2v²exp(-mv²/2kT). The configurational entropy shown is -∑p ln p over 8 slices in x; it should rise from ln 4 to ln 8, a gain of ln 2 = 0.693 per sphere (Miller-Madow bias correction used in the check).

Simplifications. The spheres are few (60-200), so fluctuations are large and the entropy only approaches ln 8 on average; the finite diameter adds excluded-volume corrections (hence the tolerance); the time step is fixed and overlaps are resolved by a small separation, not by exact event-driven dynamics; there is no gravity. Entropy here is the coarse-grained positional (Boltzmann-H style) entropy, not the Gibbs entropy of the full phase space, and the second law holds statistically, not for every individual run. Checks: the collision rule against the centre-of-mass reflection formula, a Kolmogorov-Smirnov test against the exact MB cdf, equipartition within 4 sigma, the free-expansion entropy gain against ln 2, and energy conservation.

Loading model...
Loading Blender model...
-
-
Made with 🟠 Blender · Three.js