Boltzmann distribution
In this program, a Monte Carlo simulation is used to demonstrate how a Boltzmann distribution is established as the most probable distribution of a thermodynamic system. As a model system, interacting particles are used that occupy equidistant energy levels, as found in a quantum mechanical harmonic oscillator. The Boltzmann distribution itself is not programmed into the program. It arises automatically as the most probable distribution of the particles to the energy levels. For this purpose, the particles are constantly redistributed statistically, whereby the total energy is always maintained. This is achieved by a randomly selected particle absorbing an energy quantum while another randomly selected particle emits the quantum. The distance between the energy levels, number of particles and temperature can be set. A uniform distribution or the occupation of a single level is used as the initial condition. The occupation number of the energy levels is displayed, i.e. the number of particles that are in each level, or in other words the number of particles that have exactly this energy. Once the Boltzmann distribution has been established, the distribution no longer changes significantly, even though the individual particles are constantly exchanging energy quanta with each other. It is possible to study the behavior of the system under very different conditions, e.g. high/low temperature, large/small number of particles, small/large distances between the energy levels.
Operation
The parameters of the system are selected at the top left (total number of particles, distance between the energy levels in milli-electron volts(meV) and temperature in Kelvin). As initial distribution you can choose between the occupation of a single level E = kB*T or an approximate uniform distribution up to the energy 2*KB*T. After pressing the "Start" button, particles are redistributed according to the scheme described above. The exchanged energy quanta correspond to the energy between two energy levels(dE). If "Allow large steps" is ticked, larger energy quanta (integer multiples of dE) are also exchanged. The slider is used to set the frequency of the energy exchange (repopulation). It can be varied between single reshuffles per second (slow) up to 20 million reshuffles per second (fast). The upper limit for the energy scale is entered at the bottom left and you can select whether the display should be vertical or horizontal. After starting, the actual temperature of the distribution is displayed, as the desired temperature cannot always be realized exactly by the initial occupation. Via the menu it is possible to save and print the graph and to select the font size and character set. If you position the cursor directly on an energy level, the current occupation number of this level is displayed, i.e. the number of particles that currently have this specific energy.
Numerical realization
When the program starts, the appropriate total energy of the system for the desired temperature is calculated using the Planck distribution. The particles are then distributed to the energy levels as desired so that the total energy is matched as precisely as possible. The redistribution is carried out with the help of random numbers (more precisely pseudo-random numbers). The program knows the energy level of each individual particle. For each redistribution, two particles are selected at random, which then exchange an energy quantum, i.e. one particle moves up the energy scale while the other moves down by the same energy. The occupation of the energy levels is determined for each image by counting.