NetLogo Models Library:
Note: If you download the NetLogo application, every model in the Models Library is included.
This model is a 3D version of the 2D model GasLab Single Collision; 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.
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 --- 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, those that are more than 15 are red, while all in those in-between 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: - COLLISION-ANGLE: Sets the angle that separates the pink and blue particles before the collision. - REFLECTION-ANGLE: 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 "REFLECTION-ANGLE", but this model allows you to experiment with them one by one. This angle is called THETA in the code of the model. - INIT-PINK-SPEED (or BLUE): Sets the initial speed of the pink (or blue) particle. - PINK-MASS (or BLUE): Sets the mass of the pink (or blue) particle.
Other settings: - SHOW-CENTER-OF-MASS?: If ON, the center of mass of the system will be shown in gray. - WIGGLE?: If ON, the initial particles will be placed in a random location to start.
Buttons for running the model: - SETUP - RUN-MODE: Chooses between ONE COLLISION (just one run), ALL-COLLISION-ANGLES (loops through all the collision angles with 15-degrees steps) and ALL-REFLECTION-ANGLES (loops through all the reflection angles with 15-degrees 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 COLLISION-ANGLE = 180 (directly across from each other) and REFLECTION-ANGLE = 90, it looks as if the two particles miss each other. What is happening?
With REFLECTION-ANGLE = 45 degrees, the particles go off at right angles. Why? Draw a picture of what is happening at the moment of collision.
With REFLECTION-ANGLE = 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 reflection-angle 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 COLLISION-ANGLE and a REFLECTION-ANGLE and choose ONE-COLLISION to see one particular collision.
Choose a COLLISION-ANGLE and choose ALL-REFLECTION-ANGLES to cycle through all of the angles of reflection.
Choose a REFLECTION-ANGLE and choose ALL-COLLISION-ANGLES 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 y-axis and the other on the x-axis, (COLLISION-ANGLE = 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 Maxwell-Boltzmann distribution?
Since there are not yet different topologies in NetLogo 3D we have to make sure that the particles don't go over the edge of the world using explicit bounds checking code.
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 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 email@example.com.
This is a 3D version of the 2D model GasLab Single Collision.