NetLogo User Community Models
by Dylan Evans (Submitted: 06/09/2003)
WHAT IS IT?
This is a model of cooling, intended to illustrate the laws of thermodynamics. In this simple universe, an iron block (grey) sits in a cloud of gas (black). Particles turn red when excited, and back to black or grey when unexcited. The first law of thermodynamics states that energy is conserved, so the total number of excited particles remains constant throughout. The distribution of excited particles changes, however, as the particles jostle each other and transfer their energy to each other. Monitors and graphs show the temperature and entropy of the system (the iron block) and the surroundings (the gas) as the iron block cools down.
HOW IT WORKS
Patches represent particles and turtles represent units of energy. Each time step, energy is transferred from one particle to an adjacent particle on a random basis.
HOW TO USE IT
Click the SETUP button to charge the iron block with an amount of energy specified by the ENERGY slider.
Click the GO button to start the simulation. The simulation then runs for 500 time clicks and stops.
The ONE-STEP button allows you to step through the simulation one turn at a time.
The COOL button cools the iron block by turning one excited particle in the system OFF and turning one unexcited particle in the surroundings ON.
The HEAT button heats the iron block by turning one unexcited particle in the system ON and turning one excited particle in the surroundings OFF.
THINGS TO NOTICE
The second law of thermodynamics states that the total entropy of the universe can never decrease. In this model, however, it does occasionally decrease by a small amount. This is because the second law of thermodynamics is a statistical law, and in small systems such laws are less reliable. The universe in this model is very small, consisting only of 1681 particles (100 iron particles, and 1581 gas particles), and so the second law is not so reliable here. The second law should really say that the total entropy of the universe is merely UNLIKELY to decrease, with the degree of improbability depending on the size of the system. Of course, the real universe is so large that the second law is never likely to be contravened.
When the system (the iron block) and the surroundings are at thermal equilibrium, the total entropy of the universe will have reached its maximum point.
THINGS TO TRY
Try varying the amount of energy in the universe. What effect does this have on the reliability of the second law?
EXTENDING THE MODEL
Try changing the energy slider so that more than 49 units of energy can be poured into the iron block at the start. What happens to the temperature of the iron block under those conditions? Can you make sense of the result?
The model uses an approximation for calculating entropy that is only valid for large systems. The best way to calculate the entropy would be to use Boltzmann's equation, S = k ln W. Assuming k to be 1, and W to be equal to N! / Noff! Non!, this equation simplifies to S = ln N! - (ln Noff! + ln Non!). Try coding this way of calculating entropy. Does it corroborate the approximation used here?
Look at the DISPERSE routine in the Procedures window. Can you work out what this routine is doing and why it is necessary?
BOILING, HEAT DIFFUSION and THERMOSTAT
CREDITS AND REFERENCES
This model was written by Dylan Evans (© Dylan Evans, 2003) http://www.dylan.org.uk.
(back to the NetLogo User Community Models)