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 5 Temperature and 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 temperature of a gas and the pressure of a gas in a container with a fixed volume. This model is part of the "Connected Chemistry" curriculum which explores 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 number of particles can be varied initially and the temperature of the gas can be varied by warming and cooling the gas container walls.

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 the number of gas particles, the gas temperature, and the gas pressure. Alternatively, they can make changes to both the number of particles and the temperature of the gas, and see what the combined affects of these changes are on pressure. In addition, one can follow the average number of wall hits in one model clock tick. These models have been adapted from the model GasLab Pressure Box.


The particles are modeled as hard balls with no internal energy except that which is due to their motion. Collisions between particles are elastic. Collisions between the wall are not.

  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 they find themselves on the same patch.In this model, two turtles are aimed so that they will collide at the origin.
  3. An angle of collision for the particles is chosen, as if they were two solid balls that hit, and this angle 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, heading and energy.

As the walls of the box are heated, the sides of the walls will change color from a deep red (cool) to a bright red, to pink to a pale pink white (hot). The walls contain a constant heat value throughout the simulation.

The exact way particles gain energy from the walls of the box is as follows: 1. Particles check their state of energy (kinetic). 2. They hit or bounce off the wall. 3. They find wall energy and set their new energy to be the average of their old kinetic energy and the wall energy. 4. They change their speed and direction after the wall hit.


Buttons: SETUP - sets up the initial conditions set on the sliders. GO/STOP - runs and stops the model. WARM WALLS - incrementally warms the box walls each time it is pressed. COOL WALLS - incrementally cools the box walls each time it is pressed.

Sliders: NUMBER - sets the number of gas particles in the box when the simulation starts.

Choosers: SHOW-SPEED-AS-COLOR? allows you to visualize particle speed using a color palette. - The "blue-green-red" setting shows the lower half of the speeds of the starting population as blue, and the upper half as red. - The "violet shades" setting shows a gradient from dark violet (slow) to light violet (fast). - The "all green" setting shows all particles in green, regardless of speed. - The "custom color" setting, referenced in the Pedagogica version of this model, allows the user to modify the color of one or more particles, without having to worry that the particles will be recolored with each tick of the clock (as is the case for the other color options).

Switches: LABELS? turn particle id labels on or off.

Monitors: CLOCK - number of clock cycles that GO has run. PRESSURE - the total pressure in the box. GAS TEMP. - the temperature of gas. TOTAL KINETIC ENERGY - the total kinetic energy of the gas. AVERAGE SPEED - the average speed of the gas particles.

Plots: - TEMPERATURE VS. TIME: plots particle temperature inside the box over time. - AVERAGE. SPEEDS VS. TIME: plots average speed of the gas particles inside the box over time over time. - PRESSURE VS. TIME: plots the average gas pressure inside of the box over time.

  1. Adjust the INITIAL-NUMBER slider.
  2. Press the SETUP button
  3. Press GO/STOP and observe what happens.
  4. Wait until the gas temperature stabilizes.
  5. Press WARM WALLS or COOL WALLS a few times.
  6. Wait until the gas temperature stabilizes
  7. Observe the relationship between the Temperature vs. Time graph and Average Speeds vs. Time and Pressure vs. Time.


It takes a while for the gas temperature to stabilize after you press WARM WALLS or COOL WALLS.

Some particles move faster and slower than the average particles, at any gas temperature.


Try to get the inside temperature to reach the outside temperature. Is this possible?

How does adding heat to the box walls affect the speed of the particles?

What do you think temperature is a measure of in a gas?

How does adding heat to the box walls affect the pressure of the gas?

Why can't you stop the gas particles completely by cooling the walls?

How does the particle behavior or system response change with only one wall heated instead of all walls heated?

Does the system reach an equilibrium temperature faster when the wall is heated or cooled the same amount in comparison to the temperature of the particles?


Give the wall a mass and and see how that affects the behavior of the model.

Create two valves on either side to the wall that allow the user to "spurt" particles into the chambers to see how number of particles affects pressure.

Vary the width and length of the box, does this effect how fast the particle temperature changes?

What happens if you heat one wall and cool another wall?


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

(back to the NetLogo Models Library)