NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
3D/Sample Models/GasLab

(back to the library)

[screen shot]

Note: If you download the NetLogo application, every model in the Models Library is included.

WHAT IS IT?

This model is a 3D version of the 2D model GasLab Free 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. (The world is a torus which means that when a particle hits the edge of the world it "wraps" around to the other side. The box surrounding the world in the 3D view are not walls but simply mark the edges of the world where the particles will wrap.)

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.

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. 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.

HOW TO USE IT

Initial settings: - NUMBER-OF-PARTICLES: the number of gas particles. - TRACE?: Draws the path of one individual particle. - COLLIDE?: Turns collisions between particles on and off. - INIT-PARTICLE-SPEED: the initial speed of each particle -- they all start with the same speed. - PARTICLE-MASS: the mass of each particle -- they all have the same mass. - PARTICLE-COLOR: indicates the coloring scheme for the particles.

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: - PERCENT FAST, PERCENT MEDIUM, PERCENT SLOW monitors: percent of particles with different speeds: fast (red), medium (green), and slow (blue). - AVERAGE SPEED: average speed of the particles. - AVERAGE ENERGY: average kinetic energy of the particles.

Plots: - SPEED COUNTS: plots the number of particles in each range of speed (fast, medium or slow). - SPEED HISTOGRAM: speed distribution of all the particles. The gray line is the average value, and the black line is the initial average. The displayed values for speed are ten times the actual values. - ENERGY HISTOGRAM: the distribution of energies of all the particles, calculated as (m*v^2)/2. The gray line is the average value, and the black line is the initial average.

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

What is happening to the numbers of particles of different colors? Why are there more blue particles than red ones?

Can you observe collisions and color changes as they happen? For instance, when a red particle hits a green particle, what color do they each become?

Why does the average speed (avg-speed) drop? Does this violate conservation of energy?

This gas is in "endless space" -- no boundaries, no obstructions, but still a finite size! Is there a physical situation like this?

Watch the particle whose path is traced, notice how the path "wraps" around the world. 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

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?

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?

What happens if the collisions are non-elastic?

How does this 3D model differ from the 2D 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?

NETLOGO FEATURES

Notice the use of the histogram primitive.

CREDITS AND REFERENCES

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.

HOW TO CITE

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 AND LICENSE

Copyright 2006 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/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 Free Gas.

(back to the NetLogo Models Library)