University of Maryland Physics Education Research Group
|
Physics Software from the UMd PERG: Thermo -- A Gas in a Box Simulation |
E. F. Redish, G. Norkus, and J. B. Harold
University of Maryland, College Park
Download File (165 KB)
Brief description
THERMO is a statistical mechanics simulation that allows you to investigate a wide variety of equilibrium
and non-equilibrium phenomena. You can display the motion of up to 1100 particles in a box moving
under a variety of forces: hard sphere collisions with each other, external fields, and friction when they
collide with the wall.
Pedagogical utility
THERMO lets students visualize the motion of particles in a gas. The initialization choices
allow the student to see how the system naturally evolves from a regular pattern into the most
probable (Maxwell-Boltzmann) distribution. The view of the velocity (or energy) distribution shows
that the distribution is not static, but fluctuates in time.
The program allows a wide variety of investigations with different circumstances. In addition,
position and velocity data can be written out to files to be analyzed off-line. This makes
THERMO valuable as a tool for student independent explorations or projects.
Appropriate for
- High-school physics
- Introductory algebra-based physics
- Introductory calculus-based physics
- Statistical physics and thermodynamics
Screen view
Fig. 1: A screen view of THERMO with display of the distribution of particle speeds.
Availability
The code may be downloaded by clicking here.
(165K)
The file is a zip file. Unpack it using WinZip.
You will then find the following files in your directory:
- readme.txt (1K) -- Read this file for a brief overview
- thermo.exe (175K) -- The main executable
- instruct.txt (18K) -- A set of text instructions describing the program
- helpfile.txt (12K) -- The helpfile read by the program's context-sensitive help
- settings.txt (1K) -- A useful set of starting values that can be loaded by the program
If you are running under Windows, be certain the computer knows where the file is and what directory it is in. To check this, right click on the program icon and choose "Properties." On the tab "program" make sure the full address of the program is correct. The "start-up directory" should be the directory containing the program.
Technical information
The program follows the paths of up to 1100 particles moving in a box. When particles enter the same pixel,
they are transformed to their CM frame and their velocities are rotated by a random angle. They are then
transformed back to the lab frame.
A variety of "mean field" forces may be applied, including gravity, electric, and magnetic. All the field
only act on the individual particles. The particles do not interact with each other by any except contact
forces. (So particles are assumed to be charged for their interaction with the electric and magnetic fields,
but the particle-particle interactions are ignored.)
The path of a single particle can be displayed while all the others remain present but invisible, This is
useful for demonstrating the meaning of the mean free path. The mean free path may also be calculated,
but the calculation is done by noting at each collision the distance each particle has traveled and averaging.
This biases the calculation at the beginning since only one side of the distribution is seen. The MFP
approaches the true value from below.
An "ergodic" average may be taken by writing out the velocity data repetitively at times separated by
long enough intervals that the distribution re-randomizes itself. The resulting time average shows
fluctuations characteristic of the total number of velocities rather than the total number of particles.
The distribution may be read from the saved data using the program HISTOGRAM. Note that the
Maxwell-Boltzmann distribution in two dimensions has a phase space factor of v instead of v^2!
The left and right sides of the box may be identified to simulate flow in a tube. The parameter FRICTION
can be set so that each collision with an upper or lower wall reduces in a loss of some fraction of the
particle's horizontal momentum.
Associated materials
A microlab is available that uses THERMO for a one or two hour session. There are also a number of
homework problems available that use THERMO. These will be made available through the Web in the
near future. In the meantime, contact the
Contact person
E. F. Redish, University of Maryland, College Park, MD 20742;
phone: 301-405-6120, fax: 301-314-9531, e-mail: redish@physicsk.umd.edu
Program help
You can get help by pressing < F1 > . If a menu or submenu item is selected, the help will give
information on that item. Otherwise, it will give general help information.
Select the menu bar at top by using the cursor keys, the highlighted letter, or by clicking
on the entry using the mouse.
Select a menu entry or toggle its value by highlighting it and pressing < enter > or by
clicking on it with the mouse.
The environmental status (forces, etc.) is displayed on the Status bar at the bottom of screen.
The running of the simulation is started and stopped by pressing < spacebar > .
Use < esc > or click mouse off the menu - to step back off menus.
When a number is needed by a menu or submenu item
- Press < enter > to get the value-entry window.
- Key in your value.
- Press < enter > to set it, or < esc > to cancel and return to original value.
Menu entries:
Indents indicate menu level.
- KEYIN: This option lets you bring up a screen on which you can set most of the parameters
of the program at the same time. WARNING: Resets simulation unless reset type is set to "Off".
- FORCE: This option lets you turn on a variety of forces including external fields, friction
with the walls, and hard sphere interactions between the particles.
- Gravity: This option lets you turn on a uniform gravitational field pointing downward. All the particles have the same mass. The value of g can be set from the "Set Forces" submenu.
- E Field: This option lets you turn on a uniform electric field pointing to the right. All the particles have the same charge. The value of E can be set from the "Set Forces" submenu. The electromagnetic interactions of the particles with each other are ignored.
- B Field: This option lets you turn on a uniform magnetic field pointing into the screen. All the particles are taken to have the same charge. The value of B can be set from the "Set Forces" submenu. The electromagnetic interactions of the particles with each other are ignored.
- Friction: This option lets you turn friction on or off. With friction on, a particle striking a wall loses a fraction of the component of its velocity parallel to the wall. Set the fraction using "Set Forces".
- Collisions: This option lets you turn on hard sphere collisions between particles. Two particles only collide when they enter the same pixel. The scattering angle is random in their CM frame. The probability of a collision may be reduced below 1 using the option "Set Friction" in "Set Forces".
- Set Forces: This option lets you set the parameters that control the various forces.
- Set Friction: This option lets you set the fraction of the particle's velocity that it loses when it strikes a wall. Only the component of v parallel to the wall is affected.
- Set Collision Prob: This option lets you set the probability that two particles will collide when they enter the same pixel. Reducing the probability below 1 corresponds to making the particles smaller.
- Set Gravity: This option lets you set the strength of the gravitational field. The particles are taken to have mass 1 and the field points down.
- Set Efield: This option lets you set the strength of the electric field. The particles are taken to have charge 1 and the field points to the right. The EM interactions of the particles are ignored.
- Set Bfield: This option lets you set the strength of the magnetic field.
The particles are taken to have charge 1 and the field points into screen. The EM interactions of the
particles are ignored.
- SCREEN: This option lets you set a variety of display and calculational options including:
Histogram, Trace, Sound, Box Clear, and Reset.
- Histogram: This option lets you display a histogram. The histogram shows the number of particles
vs. either energy or speed (magnitude of velocity).
- Turn On/Off: Selecting this option toggles the display of the histogram on or off.
- Set X Scale: This option lets you change the range of values displayed on the abscissa. The minimum value is always 0. You may enter a value for the maximum.
- Set Y Scale: This option lets you change the range of values displayed on the ordinate. The minimum value is always 0. You may enter a value for the maximum.
- Histogram Type: This option lets you select whether the histogram is plotted as a function of energy or speed.
- Number of Cycles: This option lets you select how often the histogram, Kinetic Energy, and Mean Free Path
calculations are updated. Note that for smaller cycle numbers, the calculations are done more frequently.
As a result, the simulation will appear to proceed more slowly.
- Box Clear: Selecting this will clear the box. This is useful in Trace mode. It erases the path being
displayed but does not cause a reset. When you start the simulation it will continue from where you left off.
- Sound: This option lets you turn sound on and off. When sound is on, the machine "clicks"
whenever any pair collide.
- CALC: This option lets you set the Number of Particles, the Box Size, and toggle on or off Wrap X
(pipe simulation mode), and the calculation of the Mean Free Path.
- DATA: This option lets you read/write the program settings and the particle data to/from a file.
- Reset: This option lets you restart the simulation in a variety of configurations.
- Set Start Position: This option lets you choose where in the box the center of the group of particles will appear upon reset. Select this option by pressing , then choose the position using the mouse or cursor keys, following the instructions that appear on your screen.
- Random Square: Starts the particles off in a small square. Their x and y velocities are (independently) randomly distributed between 0 and 1.
- Random Circle: Starts the particles off in a small circle. Their x and y velocities are (independently) randomly distributed between 0 and 1.
- Mono Circle: Starts the particles off along a small circle. Their velocities are all directly radially outward and their speeds all equal 1.
- Mono Square: Starts the particles off in a small square. All the particles have the same velocity (speed equals 1).
- Trace: Allows you to view a single particle while all the rest are made invisible. The path that the particle follows is shown as a visible track.
- Wrap X: Turning this on sets the left and right walls as being the same wall. A particle encountering the right wall will not reflect, but will reappear on the left without changing its velocity. When is on, a particle can move to the left or right forever without turning around. Turning on and simulates the motion of a fluid in a pipe.
- Mean Free Path: When this option is on, the program calculates the mean free path by summing the distance particles travel between collisions. Since the sum only changes when particles collide, the value will start small and grow, approaching the expected value only slowly. The first few collisions occur before the particles have had a chance to travel very far, thus biasing the calculated MFP towards zero at the start.
- Particle Number: This option lets you change the number of particles in the simulation. To see the maximum number permitted with your memory configuration, see the entry on the KeyIn Screen.
- Dimensions of Box: This option lets you adjust the dimensions of the box. If the box is enlarged in the middle of a simulation, the particles will remain where they were and the box will expand around them. If the box is made smaller, the program doesn't know where to put the particles, so it will reset them according to the last reset type chosen.
- Box Width: This option lets you reset the width of the box.
- Box Height: This option lets you reset the height of the box.
- QUIT: Choose this to leave the program and return to DOS.