A simple particle system

For no obvious reason, I had a sudden need to write a particle system that simulates a Maxwell-Boltzmann gas, which forms the basis for the kinetic theory of gases. The trick is to implement momentum-conserving collisions as the particles bang into each other. When setting the initial conditions, the particles get uniformly random velocity vectors. The cool and somewhat counterintuitive result is that regardless of the initial conditions, the system equilibrates to the asymmetric Maxwell-Boltzmann distribution, shown in the histogram below. The histogram shows the cumulative number of particles binned by speed. The colors follow a heat map, with the fastest particle speeds rendered with the hottest colors.

Maxwell-Boltzmann gas

Colliding particles and histogram of speeds.

Here's what the particle speed distribution looks like for four different kinds of atoms. My particles are qualitatively most similar to Xenon atoms and therefore model heavier atoms (those with higher atomic number).

Maxwell-Boltzmann noble gases

The speed probability density functions of the speeds of a few noble gases at a temperature of 298.15 K (25 °C).

Just something to entertain myself while we're snowed in.

Technorati Tags: Maxwell,Boltzmann,kinetic theory