The Entropy Simulation

INTRODUCTION

The Entropy Simulation simulates the motion of a group of two-dimensional "atoms", modelled as hard discs, bouncing around in a square box. The atoms can be given different radii and masses; the box walls can be adiabatic or isothermal; the box can be made to contract or expand at a range of speeds; and the box can be increased in size suddenly.

As well as showing an animation of the atoms moving around, the simulation can display the following graphs (each point on which is accumulated over a user-configurable averaging time):

  • The First Law Graph shows the heat Q supplied to the system, the work W done on the system, and the internal energy U, as functions of time.
  • The KE(t) graph shows the mean KE of the atoms as a function of time.
  • The P(t) graph shows the mean pressure as a function of time.
  • The P(A) graph shows the mean pressure as a function of box area.
  • The PA(t) graph shows the product of the pressure and area as a function of time.
  • The PA^2(t) graph shows the product of the pressure and the square of the area as a function of time.
  • The Speeds graph shows the probability distribution of atomic speeds.
  • The Integral dQ/T graph shows the integral of dQ/T since the simulation began, where dQ is the heat supplied to the system in an infinitesimal time interval and T is the temperature.
  • The A(t) graph shows the box area as a function of time.

These features allow the study of many aspects of kinetic theory and thermodynamics including: the ideal and non-ideal gas laws; the law of equipartition; adiabatic and isothermal expansions and compressions, quasistatic and non-quasistatic; how the pressure and area are related during adiabatic and isothermal expansions and compressions; free expansions; the nature of the first law; the behaviour of mixtures of gases; reversibility and the arrow of time; the approach to the Maxwell-Boltzmann distribution; the change in the integral of dQ/T as the system is taken around a thermodynamic cycle; Brownian motion; ...

About the only obvious quantity that the simulation cannot calculate directly is the entropy.

INSTALLATION

The easiest way to try the simulation is to download and run one of the binaries below. On Linux, you will have to make the binary executable (using the chmod u+x filename command or your graphical file manager) before you can run it.

Warning: downloading and running programs you find on the web is dangerous. Even if the programmers are acting in good faith, somebody may have broken in to their website and modified the programs. If you are dubious, download the source code in either gzipped tar or zip format, unpack it, read through it carefully, and compile the program yourself.

To improve portability, these executables have the necessary parts of the Qt and qwt libraries compiled in statically. On Linux, however, differences in other shared libraries (mainly freetype and X11) make the executable programs less portable than one might hope. If none of the executables provided here works on your system, you'll have to download the source in either gzipped tar or zip format, unpack it, and compile the simulation yourself.

For instructions on compiling the entropy simulation, see the INSTALL.LINUX and INSTALL.WIN32 files. I do not have a Mac and have not provided OSX compilation instructions or executables; if you work out how to build the simulation on OSX, please let me know.

HISTORY

The first version of the entropy simulation was written almost 15 years ago, after Professor Keith Barnham told me about the problems faced by first-year undergraduate physics students at Imperial College London, who were meeting thermodynamics and kinetic theory for the first time. It was Keith who suggested that a computer simulation might help make some of the concepts more concrete and who specified more or less what he wanted; my job was to make his ideas practical and write the code.

The original simulation was written in Fortran 77 (the only language I knew at the time), with a graphical user interface cobbled together using the xtpanel library and pieces of the gnuplot plotting program. It worked, but only just and only on the Unix workstations our department used at the time. A few years later, a student (whose name I am ashamed to say I have forgotten) ported the simulation code to Windows and wrote a more professional (but Windows-only) user interface. This was used as part of our first-year course for a number of years, but was eventually dropped and has languished since then.

This year, as an excuse to teach myself GUI programming, I went back to the original F77 code and started again. The Fortran was translated into C++ and an entirely new open-source cross-platform user interface written. The new GUI is based on the non-commercial edition of the Qt4 GUI library and the open-source qwt plotting library.

IDEAS FOR USE

A worksheet similar to the one that was used at Imperial College can be found in the doc directory of the source distribution. It is aimed at first-year university students who know the basics of kinetic theory, Boltzmann factors, the Maxwell-Boltzmann distribution, the first law of thermodynamics, the ideal gas law, the isothermal and adiabatic expansion formulae, and the principle of equipartition, but have not yet been taught about the second law, entropy, thermodynamic engines, or Carnot cycles. The students were asked to work through the exercises in an organised way, keeping notes as they went. The whole exercise used to take them two or three hours.

COPYRIGHT

The Entropy Simulation
Copyright © 2009 William Matthew Colwyn Foulkes

Email:
Address: W.M.C. Foulkes
  Department of Physics
  Imperial College London
  South Kensington Campus
  London SW7 2AZ
  United Kingdom

The Entropy Simulation illustrates various concepts in thermodynamics and the kinetic theory of gases

LICENSING

The Entropy Simulation program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have find a copy of the GNU General Public License included with the source code. If not, see http://www.gnu.org/licenses/ .

The cross-platform graphical user interface was written using version 4 (specifically 4.5.1) of the non-commercial edition of the Qt library. The non-commercial edition of the Qt library is released under both the GNU LESSER GENERAL PUBLIC LICENSE version 2.1 (LGPL 2.1) and the GNU GENERAL PUBLIC LICENSE, version 3 (GPL 3).

The graphing widgets (the Plot and A4QwtPlot classes) were based on work of the Qwt project. The Qwt library and associated programs are available under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) with the following exceptions:

  1. Widgets that are subclassed from Qwt widgets do not constitute a derivative work.
  2. Static linking of applications and widgets to the Qwt library does not constitute a derivative work and does not require the author to provide source code for the application or widget, use the shared Qwt libraries, or link their applications or widgets against a user-supplied version of Qwt.
  3. If you link the application or widget to a modified version of Qwt, then the changes to Qwt must be provided under the terms of the LGPL in sections 1, 2, and 4.
  4. You do not have to provide a copy of the Qwt license with programs that are linked to the Qwt library, nor do you have to identify the Qwt license in your program or documentation as required by section 6 of the LGPL.