NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo User Community Models

(back to the NetLogo User Community Models)


by George W. Dombi (Submitted: 07/02/2007)

[screen shot]

Download Gas_Distillation
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)


This model is like one in a series of GasLab models.It uses the same basic rules for simulating the behavior of gases. Each model integrates different features in order to highlight different aspects of gas behavior.

The basic principle of the models is that gas particles are assumed to have two elementary actions: they move and they collide - either with other particles or with any other objects such as walls.

This model is illustrates gas distillation, separating gases of different masses it also shows the relationship between temperature and pressure in a fixed volume gas container.


The particles are modeled as hard balls with no internal energy except that which is due to their motion. Collisions between particles are elastic. On the hot-side, molecules are heated and boil up into the condenser-side when they cool.

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.
6. If a particle finds itself on or very close to a wall of the container, it "bounces" -- that is, reflects its direction and keeps its same speed.

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. If ONE-SIDE? is set to ON, only the left wall will be heated, while the other three walls remain yellow.

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

This model also uses Gravity as a way to bring the gas molecules to the bottom of the
condenser part of the apparatus.


Initial settings:
- NUMBER-OF-PARTICLES: number of particles within in the box

The SETUP button will set these initial conditions.
The GO button will begin the simulation.

Other Settings:
- OUTSIDE TEMPERATURE: temperature of the outside of the box and the wall of the box.
- ONE SIDE?: heats only the left wall if enabled. the other walls are colored yellow, and do not affect the energy of the particles that bounce into it.
- COLLIDE?: Turns collisions between particles on and off.
- GRAVITY-ACCELERATION: Increases the amount of force on the particles.

- PRESSURE: the pressure of the gas particles in the box
- WALL HITS PER PARTICLE: number of times that each particle hit the walls
- AVERAGE SPEED: average speed of the particles.
- AVERAGE ENERGY: average kinetic energy of the particles.

- SPEED COUNTS: plots the number of particles in each range of speed.
- SPEED HISTOGRAM: speed distribution of all the particles. The gray line is the average value, and the black line is the initial average.
- ENERGY HISTOGRAM: distribution of energies of all the particles, calculated as m*(v^2)/2.
- PRESSURE VS. TIME: plots average pressure of the inside of the box over time.
- TEMPERATURE VS. TIME: plots particle temperature inside the box over time and wall temperature over time.
- WALL HITS PER PARTICLE: plots average wall hits per particle over time.


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

How does adding heat to the wall affect the particle behavior?

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?

How does gravity affect the rate of boiling?


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

Try to increase the wall hits per particle.


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

Close off the right side of the box. 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?


Notice how the collisions are detected by the turtles and how the code guarantees the same two particles do not collide twice. What happens if we let the patches detect them?

Problems with this model: The gas does not return to the initial volume. The future goal of this work is to model a liquid being distilled. This has an additional challenge that water has internal cohesion between molecules which a gas does not.
This type of molecular force has yet to be implamented.


This model was based on the NetLogo GasLab Heat Box model originally written by Wilensky, U. (2003). Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Current version composed by George W. Dombi, 7/1/2007 with some coding help from James Steiner.

(back to the NetLogo User Community Models)