Physics Lab · Thermal physics
Thermal equilibrium
What changes when two systems at different temperatures can exchange energy, and what changes when they hold 1 or 100,000 particles each?
System A · left800 K
System B · right200 K
Number of particles in each system · 200 total
00000000Reset draws a fresh random seed; the same seed with the same settings replays the same energies and temperatures (the drawn dots follow your screen's frame timing; blank field: replay the current seed).Starts paused. With reduced motion enabled, the dots stay still while the physics, graphs and readouts keep running.
Particle speeds
Live histogram of the speeds of all particles on each side, with dashed reference curves at the measured temperatures.
One particle per side: no speed distribution to show.
Temperature history
Instantaneous kinetic temperatures versus simulation time, sampled every 0.1 s. The dashed grey line is , the mean kinetic temperature. The graph keeps the full run from reset.
Entropy of the energy split
ΔS = −44.2 kB, the Boltzmann entropy of the split of the energy between A and B, relative to its maximum (for , the most probable split). The graph shows it per particle, with ; the value beside the title is in .
Per particle, the deficit shrinks as grows, so large looks smooth and small noisy. In units of the equilibrium dips do not shrink: the fraction of equilibrium time with is at (exact). The total microcanonical entropy of the isolated system is constant; the plotted entropy can fall because it keeps only the energy split .
With one particle per side every energy split is equally likely ( is uniform on ). There is no most-probable macrostate, so the entropy of the split is flat: this is the limiting case.
Equilibrium statistics: measured next to exact
Counted from 0.1 s samples, only after a burn-in of 32.5 s. Neighbouring samples are strongly correlated (relaxation time ), so the error bar counts about one independent sample per . The exact values are tail probabilities of , which is distributed at equilibrium.
Fraction of time with equilibrating… (32.5 s)
Fraction of time at least as far from equilibrium as the start, equilibrating… (32.5 s)
Model limits. Energy moves by a Kac-type stochastic exchange between randomly chosen pairs (Kac, 1956): at random times a pair of particles, one from each side for heat exchange or two from the same side for mixing, rotates one pair of their mass-weighted velocity components, , by a small fixed angle. Pairs are chosen independently of position, so particles never collide; the dots pass through each other by design and bounce only off the walls of their own box. Molecular collisions and real wall atoms are not simulated. Each rotation conserves kinetic energy, so the total energy is conserved to machine precision. Because the rules are this simple, the statistics of the energy split are known exactly: the shaded band, the entropy axis and the exact readouts come from them. The relaxation time , set by the exchange rate and angle and the same at every , is a property of the model, not of a real gas. Changing , a temperature or a mass restarts the run with fresh random initial conditions.
Fluctuations and the second law
Heat flows from hot to cold on average. Start A hot and B cold and the energy split relaxes towards equal shares. Once there, the system is at equilibrium, and the macrostate entropy (the entropy of the energy split, in the entropy panel) goes down as often as it goes up. Large does not stop the dips. What it changes is their size relative to the system: an equilibrium dip is of order at every , while a macroscopic change, such as recreating the 800 K / 200 K difference, is of order (about at ).
The rules have no arrow of time. Each exchange rotates by or with equal probability, and the rotation undoes the one, so the exchange rules prefer no direction of time: the sequence of energy splits in an equilibrium run is just as likely played backwards. The arrow you see during relaxation comes from the improbable starting state, not from the rules.
Which entropy never decreases? The ensemble (Gibbs–Shannon) entropy, the entropy of the probability distribution over all the runs these settings could produce, never decreases here, and the mean entropy production is non-negative. Only a single run's macrostate entropy, the trace in the entropy panel, dips.
Undoing the initial difference. The second readout gives the exact fraction of equilibrium time spent at least as far from equilibrium as the start. For an 800 K / 200 K start it is 0.40 at , 0.208 at , and about at : not forbidden, but never going to be seen.
How big are the fluctuations?
At equilibrium the fraction of the energy held by A, , follows the distribution, so has standard deviation , whatever the masses. For :
| per side | |
|---|---|
| 1 | 289 K |
| 2 | 224 K |
| 10 | 109 K |
| 100 | 35.3 K |
| 1,000 | 11.2 K |
| 10,000 | 3.54 K |
| 100,000 | 1.12 K |
A reverse arrow breaks nothing. A momentary reverse-flow arrow is not a violation of anything. Single exchanges go both ways all the time, and at equilibrium the 2-second net arrow points as often as .
Fluctuations cannot be harvested. To exploit a lucky dip, a device must measure the state and later erase that record; measurement and erasure cost at least as much as the dip can deliver, so on average nothing is gained (Szilard's engine, Landauer's principle, Bennett's analysis).
What about fluctuation theorems? Fluctuation theorems are exact results about time-integrated entropy production, the entropy produced over a stretch of time under a specified ensemble of initial states and a specified protocol, not about the macrostate entropy at one moment. The one for two bodies exchanging heat (Jarzynski & Wójcik, 2004) needs canonical initial states, each body at a fixed temperature with a fluctuating energy. This model starts each side at exactly its set energy, so the page does not claim to show that theorem; the papers are listed below as further reading only.
A note on temperature
The displayed is the kinetic temperature (the Gibbs, or volume, temperature in two dimensions). The Boltzmann (surface) entropy gives for each side, and for the whole isolated system, whose Gibbs temperature is exactly ; that is why is called the mean kinetic temperature (Dunkel & Hilbert, 2014; Frenkel & Warren, 2015). With the surface temperatures, for heat passing from A to B is exactly the increment of the plotted . For a few particles, is an estimator of the energy, not a stable thermodynamic property.
Things to try
- Compare , and per side (slider, presets or Exact N): the same rules, from wild swings to an apparently flat line. At 100,000 per side the energy exchange runs in slow motion, while the drawn dots keep their true speeds as long as each frame takes under a quarter of a second; the speed note shows both rates.
- Set unequal masses, such as 4 u and 40 u: the speeds differ, but the equilibrium is the same.
- At , tick Show deviation from : the 3.5 K fluctuations are still there.
- Start both sides at equal temperatures: nothing flows on average, yet the fluctuations and the entropy dips continue.
Further reading
- Jarzynski & Wójcik, PRL 92, 230602 (2004)
- Evans, Cohen & Morriss, PRL 71, 2401 (1993)
- Evans & Searles, PRE 50, 1645 (1994)
- Gallavotti & Cohen, PRL 74, 2694 (1995)
- Crooks, PRE 60, 2721 (1999)
- Wang et al., PRL 89, 050601 (2002)
- Evans & Searles, Adv. Phys. 51, 1529 (2002)
- Dunkel & Hilbert, Nat. Phys. 10, 67 (2014)
- Frenkel & Warren, Am. J. Phys. 83, 163 (2015)
- Landauer, IBM J. Res. Dev. 5, 183 (1961)
- Bennett, Int. J. Theor. Phys. 21, 905 (1982)
- Kac, Proc. 3rd Berkeley Symp. Math. Stat. Prob. 3, 171 (1956)