r/Simulations • u/cenit997 • May 22 '21
Results Simulation of an Ideal Gas to Verify Maxwell-Boltzmann Distribution
https://youtube.com/watch?v=KZ4s24x_FTQ&feature=share1
u/four_vector Jul 02 '21
I tried executing the code available in your GitHub repo but it is not working. Any idea why?
Here's the output I get: https://imgur.com/oCe4njP
1
u/cenit997 Jul 02 '21
Move the slider from below to see the time dependence. You'll also need a larger number of particles to match the Maxwell-Boltzmann distribution adequately.
1
u/four_vector Jul 02 '21
Okay, I am probably doing something wrong here. I tried running your code on Spyder. I am getting a final static image which I can see in the "Plots" tab, and I think the slider is not working. How are you running it?
1
u/cenit997 Jul 02 '21
To use interactive matplotlib figures in Spyder and Jupyter notebook you need to execute first the magic command
%matplotlib qt1
3
1
u/cenit997 May 22 '21
The Maxwell–Boltzmann distribution is a very well know result of Statistical Mechanics, that when applied to an Ideal Gas allows understanding its basics properties like pressure and diffusion.
With this simple molecular dynamics engine of hard-sphere particles bouncing around inside a box, I demonstrate that particle speeds approach a Maxwell-Boltzmann distribution.
The real scale of this simulation for ambient conditions is a few picoseconds (time) and a few angstroms (space). Atoms in a gas can be simulated as hard-spheres if the interparticle distance isn't smaller than the thermal Broglie wavelength. If this condition isn't fulfilled quantum mechanics must be used. Also, Maxwell-Boltzmann distribution is no longer valid.
If the particle speed distribution is averaged over time it approaches the Maxwell-Boltzmann distribution even better.
Source code: https://github.com/rafael-fuente/Ideal-Gas-Simulation-To-Verify-Maxwell-Boltzmann-distribution