NetLogo User Community Models
by David Bowen (Submitted: 05/01/2007)
WHAT IS IT?
This model 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 has two gases, one with orange particles and the other with yellow, that are otherwise identical. The particles are moving and colliding with each other and with the container walls, but with no gravitational effects.. 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. The pressure on the left or red container wall is calculated as the change in momentum of the particles colliding with it.
HOW IT WORKS
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.
HOW TO USE IT
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.
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.
THINGS TO NOTICE
While all of the orange particles are initially on the left, and yellow on the right, the colors diffuse until they are evenly distributed. Initially, 100% of the particles on the left are orange, but this declines quickly to about the percent of all particles that are orange.
If ORANGE_STIONARY? is clicked to "On," how long does it take for the speed and energy distributions for the two colors to equalize? Compared to the initial speed, what speed to both colors come to?
What is happening to the numbers of particles of different speeds? Why are there more slow particles than fast ones?
Why does the average speed (avg-speed) drop? Does this violate conservation of energy?
Watch the particle whose path is traced in the drawing. Does the trace resemble Brownian motion? Can you recognize when a collision happens? What factors affect the frequency of collisions? What about the "angularity" of the path? Could you get it to stay "local" or travel all over the world?
In what ways is this model an "idealization" of the real world?
THINGS TO TRY
Both the fluctuations in the percent of the particles on the left that are orange and the fluctuations in pressure get larger for a lower number of particles. These are statistical effects.
Set all the particles in part of the world, or with the same heading -- what happens? Does this correspond to a physical possibility?
Try different settings, especially the extremes. Are the histograms different? Does the trace pattern change?
Are there other interesting quantities to keep track of?
Look up or calculate the REAL number, size, mass and speed of particles in a typical gas. When you compare those numbers to the ones in the model, are you surprised this model works as well as it does? What physical phenomena might be observed if there really were a small number of big particles in the space around us?
We often say outer space is a vacuum. Is that really true? How many particles would there be in a space the size of this computer?
EXTENDING THE MODEL
Could you find a way to measure or express the "temperature" of this imaginary gas? Try to construct a thermometer.
What happens if there are particles of different masses? (See "GasLab Two Gas" model.)
How would you define and calculate pressure in this "boundless" space?
What happens if the gas is inside a container instead of a boundless space? (See "Gas in a Box" model.)
What happens if the collisions are non-elastic?
How does this 2-D model differ from the 3-D model?
Set up only two particles to collide head-on. This may help to show how the collision rule works. Remember that the axis of collision is being randomly chosen each time.
What if some of the particles had a "drift" tendency -- a force pulling them in one direction? Could you develop a model of a centrifuge, or charged particles in an electric field?
Find a way to monitor how often particles collide, and how far they go, on average, between collisions. The latter is called the "mean free path". What factors affect its value?
In what ways is this idealization different from the one used to derive the Maxwell-Boltzmann distribution? Specifically, what other code could be used to represent the two-body collisions of particles?
If MORE than two particles arrive on the same patch, the current code says they don't collide. Is this a mistake? How does it affect the results?
Is this model valid for fluids in any aspect? How could it be made to be fluid-like?
Notice the use of the histogram primitive.
Notice how collisions are detected by the turtles and how the code guarantees that the same two particles do not collide twice. What happens if we let the patches detect them?
CREDITS AND REFERENCES
This model was written by David Bowen at Wayne State University, and is based on the GasLab models (a) Free Gas, (b) Gas in a Box, and (c) Pressure Box.
To refer to Free Gas, Gas in a Box, or Pressure Box models in academic publications, please use: Wilensky, U. (1997). NetLogo GasLab Free Gas (or other) model. http://ccl.northwestern.edu/netlogo/models/GasLabFreeGas (or other). Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
(back to the NetLogo User Community Models)