NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Sample Models/Earth Science/Unverified

Note: This model is unverified. It has not yet been tested and polished as thoroughly as our other models.

(back to the library)


[screen shot]

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


This model shows how lightning is generated. The process consists of two phases: the production of the electric field, and the air ionization to create the bolt. This model represents the latter phase.

Lightning is one of the most visually impressive and frequently occurring natural phenomena on Earth. However, very few people actually have a solid understanding of what causes lightning, how it works, and why it occurs. This model attempts to illustrate lightning strikes from beginning to end at the level of individual charges. The user will observe how the behavior and interaction of extremely small charges can lead to very powerful and visually impressive action of a lightning strike.

In order to thoroughly understand the phenomenon of lightning one must have a strong understanding of electrical physics and thermodynamics. In order to be accessible this model avoids such complicated topics and instead provides a more general basis for charge and particle behavior. The emphasis in this model is to understand lightning as it relates to individual charges, not the underlying forces behind the charges themselves.


How does lightning work?

The Earth (green squares) and sky (black squares) serve as the layout for the world. The cloud appears as a gray cloud-shape at the top of the skyline. Among these are three main attributes that influence the production of lightning: step leaders at the bottom of the clouds (blue negative circles), dust particles in the air (dark gray squares), and positive streamers on the surface of the Earth (red positive circles).

The initial cause of a lightning strike is a separation of charge within a cloud. Positively charged particles accumulate at the top of the cloud while negatively charged particles concentrate themselves at the bottom of the cloud. Within the cloud the charges move in a random manner; however, they are constrained to their charge regions. The negative charges in the bottom of the cloud have such a high concentration that they force the electrons on the Earth's surface deep into the ground. This also has the effect of pulling the positive charges in the Earth's surface.

As the strength of the electric field increases the air around the cloud breaks down and converts into plasma, or ionized air. The positive and negative components of the air itself are pulled apart and separated from each other. This separation allows the electrons to flow through the plasma much more easily than they could through normal air. As electrons flow through the plasma they force the air around them to become plasma in turn. In this way electrons in the cloud "burn out" paths towards the Earth. The paths are known as step leaders, and grow from cloud to ground in a tentacle-like manner.

Impurities in the air may cause some patches of air to turn into plasma more easily than others. Rather than direct lines from cloud to ground, lightning takes the path of least resistance. In this model this is illustrated by distribution of dust particles throughout the sky.

Streamers are the positive equivalent of the negative step leaders created by clouds. However, streamers are not self-sufficient and thus do not grow indefinitely towards the cloud. All objects on the Earth's surface will emit a streamer, though depending on the size and material of the object the streamer's length may vary. Streamers are released much more quickly than a step leader since they are much smaller and only extend a very limited distance.

Step leaders progress towards the ground until they encounter either the ground or a streamer. In both cases the "circuit" is completed and charge may flow freely between cloud and ground. The large concentration of positive charges on the Earth's surface flow very quickly through the plasma stream towards the sky and neutralize the electrons in the cloud. The flash of light that is seen is the rapid movement of charge through the air, exactly the same as the light you see during a spark of static electricity.

Once the massive negative charge in the cloud has been neutralized the flow of charge through the air comes to a stop. The plasma becomes de-ionized and once again becomes air as the step leaders are destroyed. The environment is now ready to begin the process anew.

How does the model work?

There are a series of breeds that live in the world that simulate lightning.

Trees - These are the trees on the Earth's surface. They stand above the Earth's surface and release positive streamers.

Positive Cloud Ions - These are the positive ions that bounce around the top of the cloud. As molecules of water evaporate, they collide into one another and exchange charges. Those with positive charges move to the top of the cloud.

Negative Cloud Ions - These are negatively charged ions at the bottom part of the cloud. They move around the cloud and become step leaders.

Positive Ground Ions - These are the positive ions on the Earth's surface. As the electric field forms around the cloud it pulls the positive charges to the top of the Earth's surface.

Step Leaders - These are the negative ions that branch out from the bottom of the cloud. The ions are drawn to the positive charge on the Earth's surface, particularly the positive streamers. These particles leave a path of ionized air as they travel; they tend to move towards the Earth's surface or impurities, such as dust, in the air. When the step leaders reach the Earth's surface, a positive streamer, or a tree, the path is closed and lightning strikes. There is a chance that the step leader will die and the path will fade.

Positive Streamers - These are the positive ions that branch upwards from the Earth's surface. They tend to move towards the electric field formed by the cloud or step leaders. If the positive streamer reaches the path of ionized air or connects with a step leader then lightning strikes.

These breeds live together following specific rules elaborated below: At every time step, each step leader moves towards the Earth ionizing a blue path of air along the way. This path is found using the following criteria: - if one of the immediate neighbors is a dust particle, there is a chance that it will move to that patch - if there is no dust, then if one of the patches in front of it is a positiveStreamer, it moves one step towards it - otherwise, the leader will move in a random direction towards the Earth's surface with the highest probably being directly downwards

After the step leaders have made one move we check their new position. If they have moved of the edge of the world, then their path fades. Some paths also fade by chance.

If the path does not fade we check to see if they have closed a connection by hitting any of a tree, a positive streamer, a positive streamer's path, or the Earth's surface. If so, then lightning strikes.

When lightning strikes, the patch at which the connection took place will turn yellow to indicate a connection. From there each patch will ask its neighbors to check if they've been ionized (or are a blue or violet color). If they have been ionized, they too will turn yellow and ask their neighbors about their color. If the neighboring patches have not been ionized they will turn white to highlight the glow of the lightning bolt. This cycle continues until the the surface of the Earth and the top of the cloud are reached. This indicates that the charge has been released, and the paths are removed from the world.

Since the positive streamers (from the ground) grow at a slower rate than the step leaders, after 40 ticks have passed the streamers begin to grow up by one step for every tick. The direction of their growth is random, but most likely in the upward direction.

The ions in the clouds shift their location to indicate the motion of the particles in the cloud.


SETUP button - sets up the step leaders, dust particles and positive streamers in the world

GO button - runs the model

STRENGTH-OF-FIELD slider - changes the strength of the electric field produced within the cloud

SIZE-OF-CLOUD slider - changes the size of the cloud

NUMBER-OF-TREES slider - changes the number of trees on the Earth's surface

DUST slider - changes the number of dust particles in the sky between the cloud and the Earth's surface

The model runs until all paths have died or a bolt of lightning has been produced.


Notice the charges on the earth's surface and how they relate to the cloud's field and position.

Notice how the trees and dust particles change the path taken from the cloud. The location and size of the trees influence the pull on the ionized air.

The positive streamers and the step-leaders have similar behavior as they grow; however, the speed, distance, and strategy in which they do so is quite different. Can you tell how these paths differ?


Try different settings for the strength of field. What do you notice about the amount of lightning that is formed?

How are the strength of field and size of the cloud related?

Does the cloud size have any effect on the lightning formed?

Does varying the amount of dust or impurities in the air have influence on the path taken by the step leaders?


Consider other features that influence lightning paths, such as lightning rods. How do these influence the path or amount of lightning produced?

The positive streamers have potential to grow towards the electric field of the cloud. How does their growth influence the paths?

Currently, the shape of the cloud does not affect the direction that a step leader starts out traveling. Modify the code to allow a user to change the shape of the cloud, and cause step leaders to progress perpendicularly from its surface.


"Climate Change" has some similarities. In both cases, there is a relationship to cloud behavior.

"Percolation" also has similar features to the way elements move through their world.


Wikipedia on Lightning:

How Stuff Works on Lightning:


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:


Copyright 2011 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)