Gas
Box and piston
Large particle
View
More information about gases, temperature and Brownian motion
Ideal gas and Brownian motion: atoms in a box
A gas is countless atoms flying about and bouncing off each other and the walls. Put a few hundred of them in a box and watch temperature, pressure and the gas laws appear from nothing but collisions. Push the piston, heat the walls, lift a partition between two gases, or drop in a large particle and see it jitter like the pollen grains Robert Brown saw under his microscope. Pick an example, or set up your own gas in the sections below. The atoms are hard discs in a two-dimensional box, 24 nm wide and 18 nm high, drawn to scale, and every collision is elastic. The tiles show the temperature, the pressure measured from the atoms' bounces on the walls over the last 20 ps, the area, and PA / NkT, which is 1 for an ideal gas. Drag the piston (the right wall) to compress or expand the gas, or let it cycle; with insulated walls the gas heats up as it is squeezed (adiabatic), with thermal walls it keeps the walls' temperature (isothermal). Lift the partition, or tap it, to let two gases diffuse into each other. Turn on Large particle to watch Brownian motion, and tap an atom to trace its zigzag path. The charts compare the speeds with the Maxwell–Boltzmann distribution and follow the temperature, the pressure, the P–V diagram, the large particle's mean squared displacement or the mixing. Play, Step (2 ps) and Back run the simulation; Speed sets how many picoseconds play in a second. With Sound on, every atom that hits the piston ticks, so the ticking grows with the pressure.
How it works
- Pick an example, or choose a gas, the number of atoms and the temperature under Gas. Press Play to set the atoms moving.
- Read the tiles: the temperature, the pressure measured from the atoms' bounces on the walls, the area and PA / NkT, which is 1 for an ideal gas.
- Drag the piston or let it cycle to compress the gas, make the walls thermal to heat or cool it, add a second gas and lift the partition to watch them diffuse.
- Turn on Large particle to see Brownian motion and its mean squared displacement, tap an atom to trace its path, and record a video with the ticking of the atoms on the piston.
Pressure from collisions
Every time an atom bounces off a wall it pushes the wall with an impulse of twice its momentum towards the wall, 2mv⊥. Trillions of such knocks a second add up to a steady push: the pressure. The app adds up every bounce over the last 20 ps and divides by the length of the walls and the time. In two dimensions pressure is a force per unit length, measured in N/m (here mN/m), and the ideal-gas law reads PA = NkT, where A is the area, N the number of atoms and k Boltzmann's constant. Double the atoms, the temperature or halve the area, and the pressure doubles.
Temperature and the Maxwell–Boltzmann distribution
Temperature measures how fast the atoms move. By the equipartition theorem every degree of freedom holds ½kT of energy on average; an atom moving in a plane has two, so its mean kinetic energy is ⟨½mv²⟩ = kT. The speeds are spread out: collisions shuffle the energy until the speeds follow the Maxwell–Boltzmann distribution, in two dimensions f(v) = (mv/kT) e^(−mv²/2kT). Start every atom at the same speed and watch the histogram relax to the curve within a few collisions. In a mixture the heavy atoms move slower, but both gases end up with the same mean energy.
Compressing a gas: isothermal and adiabatic
A piston that moves into the gas speeds up every atom that hits it, so compressing a gas does work on it. With insulated walls that energy stays in the gas and it heats up: for a two-dimensional gas of single atoms TA stays the same and PA² too, so halving the area doubles the temperature. With thermal walls the extra energy flows out and the temperature stays put: PA stays the same (Boyle's law). The P–V diagram draws both curves, the isotherm and the adiabat. Move the piston fast and the gas heats up more than the adiabat allows, a sign that the process is irreversible.
Brownian motion and diffusion
In 1827 the botanist Robert Brown saw tiny particles from pollen grains jiggle endlessly in water. In 1905 Albert Einstein explained why: the particle is kicked at random by the molecules around it, so it wanders in a random walk whose mean squared displacement grows in proportion to time, ⟨Δr²⟩ = 4Dt in two dimensions. The app compares the large particle's path with Langevin's formula, which also gives the straight, ballistic start. Atoms of two gases mix the same way: lift the partition and they diffuse into each other at the rate the kinetic theory predicts.
Frequently asked questions
Why is the box two-dimensional?
A flat box shows every atom at once and lets a computer follow every collision exactly at 60 frames a second. All the laws carry over with small changes: an atom has two degrees of freedom instead of three, so ⟨½mv²⟩ = kT instead of 3/2 kT, the pressure is a force per length instead of per area, and the ideal-gas law reads PA = NkT. Real two-dimensional gases exist too, such as atoms adsorbed on the surface of graphite, and films of molecules floating on water, whose surface pressure is measured in mN/m.
Why is the measured pressure a little higher than the ideal-gas law predicts?
Because the atoms take up room. An ideal gas is made of points, while the app's atoms are discs with the real sizes of noble gas atoms, a few per cent of the box. They collide more often than points would and so push harder. Henderson's equation of state for hard discs, PA / NkT = (1 + φ²/8) / (1 − φ)² with φ the share of the area the discs cover, predicts the difference, and the measured pressure follows it. Fewer atoms, a bigger box or helium bring PA / NkT close to 1. Van der Waals made the same correction for real gases in 1873.
What is Boltzmann's constant?
It turns temperature into energy: k = 1.380649 × 10⁻²³ J/K. At room temperature, 300 K, kT is about 4.1 × 10⁻²¹ J, which is why helium atoms there move at about 1.1 km/s in two dimensions (the root-mean-square speed √(2kT/m)) and xenon atoms at only about 0.2 km/s. Multiplied by Avogadro's number it gives the gas constant R = 8.314 J/(mol·K) of PV = nRT.
Why do the speeds spread out even when every atom starts at the same speed?
Because collisions share the energy unevenly. When two atoms collide at an angle, one usually leaves faster and the other slower, while their total energy stays the same. After a few collisions per atom the speeds settle into the most likely distribution, the Maxwell–Boltzmann distribution, and stay there except for small fluctuations. Ludwig Boltzmann showed in 1872 that collisions drive any distribution towards this one, the first step towards understanding entropy.
How fast does it run?
The atoms move at their real speeds, hundreds of metres a second, but the box is only 24 nm wide, so an atom crosses it in tens of picoseconds (1 ps = 10⁻¹² s). Speed sets how many picoseconds play in a second of the animation: at 5 ps/s the simulation runs about 200 billion times slower than real life. Step moves 2 ps and Back goes back up to 200 ps.
Can I use the picture?
Yes. Save gives a PNG at the size you choose, and the pencil opens the picture in the PictorX photo editor with the box, the walls, the piston, each gas's atoms, the large particle and its trail, the speed histogram, the chart and the labels on layers of their own, and the example's name as editable text. In the editor itself it is under Apps ▸ Science ▸ Physics ▸ Ideal Gas & Brownian Motion, where the same settings, seed and time give the same picture. Everything runs in your browser.
Ideal Gas & Brownian Motion: how do I record a video?
Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device. Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner. The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF. For the sound, choose the app's own sounds or one of three music tracks: calm, bright or beat.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor