StarLogo Project:

Molecules

WHAT IS IT?

This project presents a (highly simplified) model of gas molecules in a box. The box is divided into two sections with a small hole between the two sections.

HOW TO USE IT

Click the setup button to set up the box and the molecules. Click the go button to start the simulation.

The size slider controls the width of the left section of the box. (The total width of the box is 100 units.) The number slider controls the number of gas molecules. (Note: Changes in the sliders do not take effect until the next setup.)

The color-count blue monitor reports the number of molecules in the left section of the box. The color-count violet monitor reports the number of molecules in the right section of the box.

THINGS TO NOTICE

If you let the program run long enough, the molecules should distribute themselves throughout the box. For example, if the size slider is set to 10, then roughly 10% of the molecules should be in the left section of the box after a while.

The program adds a slight "wiggle" to the movement of the molecules to make sure that they do not get "trapped" in a repetitive cycle of motion.

The molecules bounce off of the walls and partitions of the box, but they do interact with one another. Obviously, this is a very simplified model.

EXPLORATIONS

Change the central partition into a "piston" and make it move when molecules collide with it.

Allow molecules to have different velocities (use the JUMP primitive). Make molecules collide with one another. Make sure to conserve energy and momentum.

STARLOGO FEATURES

The program color-codes the molecules (blue in the left section, violet in the right section) to make it easier to count the number of molecules in each section of the box (using the color-count primitive).

The box is drawn in two different shades of red: one shade for the vertical walls, a slightly lighter shade for the horizontal walls. The reason: when a molecule bounces off a wall, different formulas are used to calculate the molecule's change in heading, depending on whether the wall is vertical or horizontal.

Run StarLogo Molecules program

Back to Project List

Back to StarLogo Homepage