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 Atmosphere

[screen shot]

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


In this model, a gaseous atmosphere is placed above the surface of a "planet". The model explores the behavior of gas molecules that have an external force acting on them (gravity), and therefore are no longer considered an ideal gas. This is the eighth in a sequence of models from the "Connected Chemistry" curriculum, exploring the behavior of gases. The Connected Chemistry curriculum was initially developed as part of the Modeling Across the Curriculum (MAC) Project:


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 they find themselves on the same patch (the NetLogo world is composed of a grid of small squares called patches). 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. 6) If a particle is on or very close to the surface of the planet (the yellow line at the bottom), it "bounces" -- that is, reflects its direction and keeps its same speed.

In this model, the effect of gravity is calculated as follows: every particle is given additional velocity downward during each clock tick, as it would get in a gravitational field. The particles bounce off the "ground". They disappear if they reach the top of the world, as if they had escaped the planet's gravitational field. The percentage of lost particles is shown in the PERCENT LOST PARTICLES monitor.


Initial settings: - NUMBER-OF-PARTICLES: number of gas particles - INIT-PARTICLE-SPEED: initial speed of each particle


The SETUP button will set the initial conditions. The GO button will run the simulation. - INCREASE-GRAVITY: incrementally increases value of the gravitational acceleration - DECREASE-GRAVITY: incrementally increases value of the gravitational acceleration - CLEAR TRACE: removes the traces of the particle paths.

Other settings: - COLLIDE?: Turns collisions between particles on and off. - TRACE?: Traces the path of one of the particles.

Monitors: - AVERAGE SPEED: average speed of the particles. - ACCELERATION FROM GRAVITY: acceleration from the force of gravity on each particle. - PERCENT LOST PARTICLES: percentage of particles that have disappeared off the top of the world.

Choosers: 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).


Try to predict what the model view will look like after a while, and why.

Watch the path of one particle. What can you say about its motion? Turn COLLIDE? off and see if there are any differences.

Watch the change in density distribution as the model runs.

The atmosphere up high is thinner than down low. Why?

Is the temperature of the lower atmosphere the same as the upper atmosphere?


What happens when gravity is increased or decreased?

Change the initial number, speed and mass. What happens to the density distribution?

What factors affect how many particles escape this planet?

Does this model come to some sort of equilibrium? How can you tell when it has been reached?

Try and find out if the distribution of the particles in this model is the same as what is predicted by conventional physical laws. Is this consistent, for instance, with the fact that high-altitude places have lower pressure (and thus lower density of air)? Why are they colder?

Try making gravity negative.


Find a way to plot the relative "temperature" of the gas as a function of distance from the planet.

Try this model with particles of different masses. You could color each mass differently to be able to see where they go. Are their distributions different? Which ones escape most easily? What does this suggest about the composition of an atmosphere?

The fact that particles escape when they reach a certain height isn't completely realistic, especially in the case when the particle was about to turn back towards the planet. Improve the model by allowing particles that have "escaped" to re-enter the atmosphere once gravity pulls them back down. How does this change the behavior of the model? Keeping track of actual losses (particles which reached the escape velocity of the planet) would be interesting. Under what conditions will particles reach escape velocity at all?

Make the "planet" into a central point instead of a flat plane.

This basic model could be used to explore other situations where freely moving particles have forces on them -- e.g., a centrifuge or charged particles (ions) in an electrical field.


Because of the influence of gravity, the particles follow curved paths. Since NetLogo models time in discrete steps, these curved paths must be approximated with a series of short straight lines. This is the source of a slight inaccuracy where the particles gradually lose energy if the model runs for a long time. The effect is as though the collisions with the ground were slightly inelastic. Increasing the variable "vsplit" can reduce the inaccuracy, but the model will run slower.


This model is modified from those in the GasLab suite and curriculum. See, in particular, the models "Gas in a Box" and "Gravity Box", which is a modified version of the "Atmosphere" model, with a ceiling on the atmosphere.

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 2006 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)