Home Download Help Resources Extensions FAQ References Contact Us Donate Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Japanese Spanish 
NetLogo Models Library:

Note: If you download the NetLogo application, every model in the Models Library is included. 
This model is a 2D version of the 3D model GasLab Two Gas; it is one in a series of GasLab models. They use the same basic rules for simulating the behavior of gases. Each model integrates different features in order to highlight different aspects of gas behavior.
The basic principle of the models is that gas particles are assumed to have two elementary actions: they move and they collide  either with other particles or with any other objects such as walls.
This model is the simplest gas model in the suite of GasLab models. The particles are moving and colliding with each other with no external constraints, such as gravity or containers. In this model, particles are modeled as perfectly elastic ones with no energy except their kinetic energy  which is due to their motion. Collisions between particles are elastic. Particles are colored according to their speed  blue for slow, green for medium, and red for high.
The basic principle of all GasLab models is the following algorithm (for more details, see the model "GasLab Gas in a Box"):
1) A particle moves in a straight line without changing its speed, unless it collides with another particle or bounces off the wall. 2) Two particles "collide" if their surfaces touch. In this model, the time at which any collision is about to occur is measured, and particles move forward until the first pair to collide touch one another. They are collided, and the cycle repeats. 3) The vector of collision for the particles describes the direction of the line connecting their centers. 4) The particles exchange momentum and energy only along this line, conforming to the conservation of momentum and energy for elastic collisions. 5) Each particle is assigned its new speed, direction and energy.
CLOSE: closes the door separating the two chambers
NUMMAGENTAS and NUMCYANS: the number of gas particles of each type.
As in most NetLogo models, the first step is to press SETUP. It puts in the initial conditions you have set with the sliders. Be sure to wait till the SETUP button stops before pushing GO. The GO button runs the models again and again. This is a "forever" button.
Monitors: MAGENTAS IN LEFT CHAMBER, CYANS IN RIGHT CHAMBER, AVERAGE SPEED MAGENTA and CYAN, and AVERAGE ENERGY MAGENTA and CYAN help you track the changes after the "door" has been opened.
Plots:  Average Speeds: Shows the change in average speed for each type of particle.  Average Energy: Shows the change in average energy for each type of particle.
Initially, all the particles have the same speed but random directions. Therefore the first histogram plots of speed and energy should show only one column each. As the particles repeatedly collide, they exchange energy and head off in new directions, and the speeds are dispersed  some particles get faster, some get slower, and the plot will show that change.
What variables affect how quickly the model reaches a new equilibrium when the wall is removed?
Why does the average speed for each color decrease as the model runs with the wall in place, even though the average energy remains constant?
What happens to the relative energies and speeds of each kind of particle as they intermingle? What effect do the initial speeds and masses have on this relationship?
Does the system reach an equilibrium state?
Do heavier particles tend to have higher or lower speeds when the distribution of energy has reached equilibrium?
Is it reasonable to consider this box "insulated"?
Calculate how long the model takes to reach equilibrium with different sizes of windows (holding other parameters constant).
Calculate how long the model takes to reach equilibrium with different particle speeds.
Set the number of cyan particles to zero. This is a model of a gas expanding into a vacuum. This experiment was first done by Joule, using two insulated chambers separated by a valve. He found that the temperature of the gas remained the same when the valve was opened. Why would this be true? Is this model consistent with that observation?
Try some extreme situations, to test your intuitive understanding:  masses the same, speeds of the two particles very different.  speeds the same, masses very different.  a very small number of one kind of particle  almost, but not quite a vacuum. What happens to those few particles, and how do they affect the other kind?
Try relating quantitatively the ratio of the equilibrium speeds of both gases after the wall is opened to the ratio of the masses of both gases. How are they related?
Monitor pressure in the right and left chambers.
Monitor temperature in the right and left chambers.
Replace the partition wall with a moveable piston, so that the two kinds of particles can push against each other without intermingling. Do they arrive at a different equilibrium then?
Replace the partition wall with a surface that can transmit energy.
Add the histograms of energy and speed distribution (such as found in the "Free Gas" model).
Notice the use of the histogram
primitive.
When making 3D shapes, both sides of a shape must be defined or else one side becomes transparent. We use this feature to create a box with opaque inside walls and fencelike outside walls. For more information about 3D shapes, see the NetLogo User Manual.
This was one of the original Connection Machine StarLogo applications (under the name GPCEE) and is now ported to NetLogo as part of the Participatory Simulations project.
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 2007 Uri Wilensky.
This work is licensed under the Creative Commons AttributionNonCommercialShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/byncsa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This is a 3D version of the 2D model GasLab Two Gas.
(back to the NetLogo Models Library)