NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo Models Library:
Curricular Models/Connected Chemistry

(back to the library)

Connected Chemistry Rusting Reaction

[screen shot]

If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.)


This model simulates the behavior of oxygen gas particles in a closed container with solid iron. It is one in a series of Connected Chemistry models, that the same basic rules for simulating the behavior of gases and chemical reactions. Each model integrates different features in order to highlight different aspects of chemical reactions.

The basic principle of this rusting model is that oxygen gas particles are assumed to have three elementary actions: 1) they move, 2) they collide, - either with other gas particles or with any other objects such as non-reacting solid surfaces (walls), 3) and they can react with iron particles.

A basic representation of the oxidation reaction that occurs between oxygen particles and iron particles is 30<sub>2</sub> + 4Fe --> 2Fe<sub>2</sub>O<sub>3</sub>. This represents a chemical reaction that requires three oxygen molecules and 4 iron atoms as reactants to create two rust molecules. While this appears to be a single reaction, in reality, a series of intermediate compounds are created before rust as a product is formed. But this simplified chemical reaction, without intermediates is often presented in introductory chemistry units and courses as a way to make sense of the initial reactants and final products in a rusting reaction.

In our everyday experiences, iron will not rust spontaneously with oxygen. For iron to rust, three things are needed: iron, water and oxygen. When these three type of molecules are near each other, the water acts as a catalyst for the rust reaction, acting as a good electrolyte permitting easier electron flow between atoms.

A second lesson common everyday pathway for the rusting reaction occurs in the presence of high energy UV radiation, and requires no water catalyst. This is the rusting reaction that is believed to occur on the surface of Mars. The iron oxide on the surface of Mars accounts for much of its red-orange color.

Both of these pathways are represented in the model.

The catalytic role of water is simplified to be a geometric catalyst (a cluster of water molecules is represented by a blue patch). It keeps the necessary reactants (dissolved oxygen molecules) trapped in that for a longer period of time than would occur otherwise if they were a gas. This modeling assumption is different than representing the water an electron-transfer catalyst.

The contributing role of UV radiation is simplified to be a localized and temporary energy boost in the vibrational energy of the iron atoms, which in turn brings the reactants closer to the activation energy required for the reaction.


The gas particles are modeled as hard balls with no internal energy except that which is due to their motion. Solid particles are modeled as hard balls with internal energy represented as rotational energy. Collisions between particles are elastic.

The basic principle of all gas behavior in the Connected Chemistry models, including this one, is the following algorithm:

  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.
  3. A random axis is chosen, as if they are two balls that hit each other and this axis is the line connecting their centers.
  4. 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.
  5. Each particle is assigned its new velocity, energy, and heading.
  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.
  7. If a particle ever penetrates into the solid iron/rust matrix, it has moved too far forward in the last simulation time step, and is bounced back out to the closest open spot (patch).


Initial settings: INITIAL-GAS-TEMPERATURE: Sets the initial kinetic energy of each of the gas particles INITIAL-OXYGEN-MOLECULES: Sets the number of initial oxygen gas particles ACTIVATION-ENERGY: Sets the energy threshold required for a reaction to occur between the products. The sum of the energies of the reactants must exceed this level for a reaction to occur. IRON-BLOCK-GEOMETRY: Sets possible size and location of the iron block. RUST-FORMS-AT: Determines whether rust molecules form within the metal block or on the surface of it or both. MOUSE-INTERACTION: Gives the user options to "add water", "remove water", "remove rust", and "shine a UV beam on the iron".

The SETUP button will set the initial conditions. The GO/STOP button will run the simulation.


In this model, iron atoms adjacent to a patch with water and the necessary oxygen molecule reactants in it are pulled away from the iron metal block when rust forms. This leads to the deposition of rust above the surface of the iron as well as pitting of the iron block. This pitting effect occurs in reality.

As you drag away rust (using the mouse cursor), you expose more iron to the air, speeding up the rusting process.

The model demonstrates other emergent phenomena of when oxygen and iron react to form rust. Some of these phenomena include how surface area affects the rate of the reaction, how temperature of the reactants affects the rate of the reaction, and how a catalyst (such as water) can speed up the rate of a reaction. Other phenomena, such as atomic conservation in chemical reactions and limiting agents in chemical reactions are also visible in the model.


Explore different surface geometries of iron. How does the surface area affect the rate of the reaction?


Rust molecules could be knocked off the iron block when fast colliding molecules hit them.

Water could be modeled as particles (H<sub>2</sub>O molecules) instead of colored patches. Oil is often used as a protective layer for preventing the rusting of iron. Oil molecules (which repel water), but allow some oxygen through could be added to the model.

Salt water vs. fresh water could be added to the model, such that the salt water served as a better catalyst than fresh water.

UV light energy that is absorbed by the iron atom and converted to vibrational energy (particulate kinetic energy) could be reradiated as infra-red energy or conducted to particles in contact with each iron atom. Currently such energy remains trapped in the iron atom unless a chemical reaction happens.


This model shows a good way of preventing particles that bounce off the world-walls from penetrating the walls. By having a dynamic tick duration calculated every tick, it attempts that even the fastest moving particle never moves more than one patch per tick. The patch-ahead primitive can therefore always be used to check whether to change the heading of a particle that is ready to reflect or 'bounce' off of a wall.

When a gas particle is detected as having accidentally entered into the space of a patch that is a wall or has an iron particle in it, it is moved to the nearest open patch.


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