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: 
If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.) 
This is one in a series of GasLab models that use the same basic rules for what happens when particles run into each other. Each one has different features in order to show different aspects of the behavior of gases.
This model is simplified to show the collision of only two particles, since this event is so hard to watch when there are many particles in the world: given the initial motions of two colliding particles, what can we learn about their final motions from the principles of conservation of momentum and energy?
The particles are modeled as hard balls with no internal energy except that which is due to their motion. Collisions between particles are elastic. Particles are colored according to speed wel blue for slow, green for medium, and red for high speeds.
Coloring of the particles is with respect to one speed (10). Particles with a speed less than 5 are blue, ones that are more than 15 are red, while all in those inbetween are green.
Particles behave according to the following rules: 1. A particle moves in a straight line without changing its speed, unless it collides with another particle or bounces off the wall. The particles are aimed to hit each other at the origin. 2. Two particles "collide" if they find themselves on the same patch (the world is composed of a grid of small squares called patches). 3. A random axis is chosen, as if they are two balls that hit each other and this axis is the line connecting their centers. 4. They exchange momentum and energy along that axis, according to the conservation of momentum and energy. This calculation is done in the center of mass system. 5. Each turtle is assigned its new velocity, energy, and heading. 6. If a turtle finds itself on or very close to a wall of the container, it "bounces"  that is, reflects its direction and keeps its same speed.
Initial settings:  COLLISIONANGLE: Sets the angle that separates the pink and blue particles before the collision.  REFLECTIONANGLE: Sets the angle of the axis connecting the particles' centers when they collide with respect to the vertical axis. To calculate the outcome of the collision, the speeds of the two particles are projected onto this new axis and the new speeds and headings are computed. Other GasLab models use random values for "REFLECTIONANGLE", but this model allows you to experiment with them one by one. This angle is called THETA in the code of the model.  INITPINKSPEED (or BLUE): Sets the initial speed of the pink (or blue) particle.  PINKMASS (or BLUE): Sets the mass of the pink (or blue) particle.
Other settings:  SHOWCENTEROFMASS?: If ON, the center of mass of the system will be shown in gray.
Buttons for running the model:  SETUP  RUNMODE: Chooses between ONE COLLISION (just one run), ALLCOLLISIONANGLES (loops through all the collision angles with 15degrees steps) and ALLREFLECTIONANGLES(loops through all the reflection angles with 15degrees steps).  GO
Monitors:  ENERGY OF PINK (or BLUE): Shows the current energy of the pink (or blue) particle.  SPEED OF PINK (or BLUE): Shows the current speed of the pink (or blue) particle.  AVERAGE SPEED: Shows the average of the speeds of the two particles.  TOTAL ENERGY: Shows the sum of the energies of the two particles.
Plots:  SPEEDS: speed of each of the particles over time.
With COLLISIONANGLE = 180 (directly across from each other) and REFLECTIONANGLE = 90, it looks as if the two particles miss each other. What is happening?
With REFLECTIONANGLE = 45 degrees, the particles go off at right angles. Why? Draw a picture of what is happening at the moment of collision.
With REFLECTIONANGLE = 0 degrees, the two particles reverse direction. Why?
What is the motion of the center of mass? What would you expect it to be?
Set the reflectionangle to zero. Draw a picture representing the two balls as they collide, with their two faces touching. Make the line connecting their centers be the same as theta. Draw vectors representing their motion.
While running the following situations note the paths of the two particles. Can you make sense of what they do? Is it what you expected?
Choose a COLLISIONANGLE and a REFLECTIONANGLE and choose ONECOLLISION to see one particular collision.
Choose a COLLISIONANGLE and choose ALLREFLECTIONANGLES to cycle through all of the angles of reflection.
Choose a REFLECTIONANGLE and choose ALLCOLLISIONANGLES to cycle through all of the angles of collision.
Have the masses of the two particles be different.
Have the initial speeds of the two particles be different.
Change the initial positions and headings of the two particles. As a simple case, set one on the yaxis and the other on the xaxis, (COLLISIONANGLE = 90) each one heading toward the origin. The center of mass is no longer stationary. Note its path. Is it what you would expect?
If the center of mass is not stationary, the two particles often have different speeds after they collide, even when they have identical initial speeds and masses! Why does this happen? How can this satisfy the conservation of both energy and momentum?
The fact that the velocities are not always the same after every kind of collision is essential to getting a distribution of velocities among identical particles after many collisions, which is what we observe with particles in a gas.
Does this seem like a reasonable model for colliding particles? When is it reasonably valid, and when is it decidedly NOT valid?
When two particles collide, should theta be picked randomly  each theta has an equal probability  or in some other way? Would this change the eventual velocity distribution among many particles?
After you have gotten used to observing and understanding these simple collisions, go to the "Free Gas" or "Gas in a Box" model. Especially watch the particle whose path is traced in gray. Does it make sense? Can you picture each collision?
Record the velocities of each particle after each collision. After you have several sets of velocities, look at the entire velocity distribution. What do you notice? Is it the MaxwellBoltzmann distribution?
This model was developed as part of the GasLab curriculum (http://ccl.northwestern.edu/curriculum/gaslab/) and has also been incorporated into the Connected Chemistry curriculum (http://ccl.northwestern.edu/curriculum/ConnectedChemistry/)
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 1997 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 model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECTBASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program)  grant numbers RED #9552950 and REC #9632612.
This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORKBASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs)  grant numbers REC #9814682 and REC0126227. Converted from StarLogoT to NetLogo, 2002.
(back to the NetLogo Models Library)