Home▸Physics & Mechanics▸Molecular Diffusion of Gases (2D)

Molecular Diffusion of Gases (2D)

Interactive 2D random-walk simulation of two gas species diffusing and mixing across a partition. Adjust temperature and molecular mass ratio and watch the diffusion coefficient and mixing entropy respond live.

Physics & Mechanics2DEasy60 FPS📱 Mobile-adapted⇄ 3D version
2d-3d-molecular-diffusion-gas ↗ Open standalone

This 2D companion to the 3D gas-effusion race models the same physics from a different angle: instead of a ballistic race to a boundary, hundreds of light and heavy gas particles perform a thermal random walk inside a shared box, starting on opposite sides of a removable partition. Once the partition lifts, the two species interdiffuse and mix, with step sizes set by a diffusion coefficient D ∝ √(T/m) — so the light species (small molar mass) always spreads faster than the heavy one, exactly as Graham's law predicts. Adjust temperature and the heavy-to-light mass ratio and watch the live diffusion-coefficient readouts and the mixing-entropy meter climb from a sharp partition line toward a uniformly blended gas.

⚙ Under the hood

Interactive 2D random-walk simulation of two gas species diffusing across a removable partition, with diffusion coefficient and mixing entropy responding live to temperature and molecular mass ratio.

Molecular DiffusionGas DynamicsThermodynamicsGraham's Law

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)