NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Curricular Models/Connected Chemistry

(back to the library)

Connected Chemistry 2 Changing Pressure

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This model explores the relationship between the number of gas particles in a fixed-volume container -- a bike tire -- and the pressure of the gas in that container. This model is part of the "Connected Chemistry" curriculum which explore the behavior of gases.

Most of the models in the Connected Chemistry curriculum use the same basic rules for simulating the behavior of gases. Each model highlights different features of how gas behavior is related to gas particle behavior.

In all of the models, gas particles are assumed to move and to collide, both with each other and with objects such as walls.

In this model, the gas container (a bike tire represented by a yellow box) has a fixed volume. The user can set the initial number of gas particles, and can also "pump" additional particles into the box through a valve on the left wall.

This model helps students study the representations of gas pressure in the model and the dynamics of the gas particles that lead to increases and decreases in pressure. In this model, students can also look at the relationship between number of particles and pressure. When the particles hit the walls they change their color temporarily. These models have been adapted from the model GasLab Pressure Box.


Particles are modeled as perfectly elastic with no energy except their kinetic energy, due to their motion. Collisions between particles are elastic.

The exact way two particles collide is as follows: 1. Two turtles "collide" when they find themselves on the same patch. 2. A random axis is chosen, as if they are two balls that hit each other and this axis is the line connecting their centers. 3. 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. 4. Each turtle is assigned its new velocity, energy, and heading. 5. 5. If a turtle finds itself on or very close to a wall of the container, it "bounces," reflecting its direction but keeping its speed.


Buttons: SETUP - sets up the initial conditions set on the sliders. GO/STOP - runs and stops the model. ADD-PARTICLES - "pumps" additional particles into the tire while the simulation is running.

Sliders: INITIAL-NUMBER - sets the number of gas particles in the box when the simulation starts. NUMBER-TO-ADD - the number of gas particles released into the box when the ADD-PARTICLES button is pressed.

Monitors: CLOCK - number of clock cycles that GO has run. NUMBER - the number of particles in the box. PRESSURE - the total pressure in the box.

Plots: PRESSURE VS TIME - plots the pressure in the box over time. NUMBER VS TIME - plots the number of particles in the box over time.

Initially, the particles are not moving. Therefore the initial pressure is zero. When the particles start moving, they repeatedly collide, exchange energy and head off in new directions, and the speeds are dispersed -- some particles get faster, some get slower. When they hit the wall they change their heading, but not their speed.

  1. Adjust the INITIAL-NUMBER slider.
  2. Press the SETUP button
  3. Press GO/STOP and observe what happens.
  4. Adjust the NUMBER-TO-ADD slider.
  5. Press the ADD PARTICLES button.
  6. Observe the relationship between the Number vs. Time graph and Pressure vs. Time.


Can you relate what you can see happening to the particles in the box with changes in pressure?

Why does the pressure change over time, even when the number of particles is the same? How long does it take for the pressure to stabilize?

What happens to the wall hits per particle when particles are added to the box?

In what ways is this model an incorrect idealization of the real world?

What is the relationship between particle number and pressure? Is it reciprocal, linear, quadratic, or exponential?


Try different settings, especially the extremes. Are the particles behaving in a similar way? How does this affect the pressure?

You can pen-down a particle through the command center or by using the turtle menus. What do you notice about a particle's path when there more and fewer particles in the box?

How can you make the pressure monitor read 0?

Why is there a delay between when particles are added (using ADD PARTICLES) and when the pressure goes up?

Can you make the pressure graph smooth? Can you do it in more than one way?

Sometimes, when going up in an elevator, airplane or up a mountain we feel a 'popping' sensation in our ears. This is associated with changes in pressure. Can you relate between this model and these changes in pressure? Are the temperature and volume constant in this situation?

Pressure waves (expanding wavefronts of gas particles) are used to describe other phenomena in nature. What changes in the model could be made to represent pressure waves from explosions, sounds, breaking the sound barrier, etc...


Add a histogram showing all the particles speeds throughout the run of the model.

Add a switch that would continuously add particles to the box?

Make a hole in the box and observe what happens to the pressure.


See GasLab Models See other Connected Chemistry models.


This model is part of the Connected Chemistry curriculum. See

We would like to thank Sharona Levy and Michael Novak for their substantial contributions to this model.


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:

To cite the Connected Chemistry curriculum as a whole, please use:


Copyright 2004 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit 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

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED 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 REC-0126227.

(back to the NetLogo Models Library)