This page was automatically generated by NetLogo 3.0. Questions, problems? Contact

The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.

MaterialSim Grain Growth

created with NetLogo

view/download model file: MaterialSim Grain Growth.nlogo

Most materials are not continuous arrangements of atoms, but rather composed of thousands or millions of microscopic crystals, known as grains. This model shows how the configuration and sizes of these grains change over time. Grain size is a very important characteristic for evaluating the mechanical properties of materials; it is exhaustively studied in metallurgy and materials science.

Usually this kind of study is made by careful analysis and comparison of pictures taken in microscopes, sometimes with the help of image analysis software. Recently, as the processing power of computers has increased, a new and promising approach has been made possible: computer simulation of grain growth. Anderson, Srolovitz et al. proposed the most widely known and employed theory for computer modeling and simulation of grain growth, using the Monte Carlo method. Instead of considering the grains as spheres, and being obliged to make numerous geometrical approximations, Anderson proposed that the computer would simulate the behavior of each individual atom in the system. Each atom would follow a very simple rule: it will always try to have, in its immediate neighborhood, as many atoms as possible with the same orientation as it.

This model is part of the MaterialSim (Blikstein & Wilensky, 2004) curricular package. To learn more about MaterialSim, see

The basic algorithm of the simulation is simple: atoms are trying to be as stable as possible. Their stability is based on the number of equal neighbors: the more equal neighbors (i.e. atoms with the same orientation) an atom has, the more stable it is. If it has many different neighbors, it is unstable, and not likely to be in that position for long, because during the simulation atoms will try to relocate to more stable positions. Therefore, the steps are:

1) Choose a random atom.
2) Calculate its present energy (which is correlated with the stability). This calculation is done by simply counting the number of different neighbors.
3) Randomly choose a new orientation for the chosen atom, amongst the orientations of its neighbors. We still don't know if that new attempted orientation will be maintained. We have to calculate the energy in this new situation in order to know.
4) Calculate the free energy of the chosen element with the new, tentative orientation. Again, we just count the number of different neighbors.
5) Comparison of the two values for free energy: the lowest value "wins", i.e., the less different neighbors an atom have, more stable it is.
6) Repeat steps 1-6.

The ANNEALING-TEMPERATURE slider controls the probability of maintaining an re-orientation which yields more instability. The FRACTION-ELEMENT-2 slider defines the percentage of second-phase particles to be created when the user setups the simulation. Those particles and not movable and are not subject to grain growth. Atoms see those particles as a different neighbor.

Note that the actual number of atoms is small compared to a real metal sample. Also, real materials are three-dimensional, while this model is 2D.

(1) Simulation starting point:
IMPORT IMAGE: Resets the simulation, and imports an image file in the JPG, BMP, GIF or PNG file formats. The image will be automatically resized to fit into the view, but maintaining its original aspect ratio. Note that the image MUST HAVE THE SAME ASPECT RATIO AS THE VIEW. In other words, if the view is square, the image should be square as well. Prior to importing the image, it is recommended to clean it up using an image editing software (increase contrast, remove noise). Try to experiment various combinations of values for the WIDTH and HEIGHT sliders, the view's size and the patch size to get the best results.
START WITH RANDOM ARRANGEMENT: Resets the simulation, and starts it with a random orientation for each atom.
GO-ONCE: Runs the simulation, one time step at a time.
GO: Runs the simulation continuously until either the GO button is pressed again, or just one grain survives.

(2) Change the shape of the atoms
The ATOM-SHAPE chooser has many different shapes, such as circle, hexagon, line, circle with spikes, thin line, and square.
After choosing the ATOM-SHAPE, click on APPLY to change the shape. This can also be done during the simulation.

(3) Draw grains
You can draw grains with the mouse, using different brush sizes and colors. The DRAW button activates drawing, the ERASE ALL button erases the screen and sets all the atoms to red, the BRUSH-SIZE slider controls the radius of the brush and the DRAW-COLOR chooser changes the numeric value of the drawing color.

(4) Run simulation
GO: runs the simulation continuously
GO ONCE: runs the simulation, one step at a time.

Simulation size
WIDTH: x (horizontal) dimension of the sample.
HEIGHT: y (vertical) dimension of the sample

Special features
ANNEALING-TEMP: changes the probability of non-favorable orientation flips to happen. A 10% value, for instance, means that 10% of non-favorable flips will be maintained. This mimics the effect of higher temperatures.
FRACTION-ELEMENT2: This slider controls the amount of dispersed second-phase particles throughout the sample. Those particles slow down or stop grain growth.

Grain measurement
MEASUREMENT-FREQUENCY: to increase the model's speed, the user can choose not to calculate grain size at every time step. If grain size is calculated at every ten time units (20, 30, 40 etc.), the performance is slightly increased. This only affects the plot and the monitors, but not the actual simulation.
MEASURE GRAINS NOW: if the MEASUREMENT-FREQUENCY is too large, and the user wants to evaluate grain size at a specific moment, this button can be used. Note that this does not alter the plot.

Plots and monitors
Grain Size (log-log): Grain size vs. time, in a log-log scale. Under normal conditions (ANNEALING-TEMP = 0 and FRACTION-ELEMENT-2 = 0), this plot should be a straight line with an angular coefficient of approximately 0.5.
SIMULATION TIME and LOG TIME: time steps of the simulation so far (and its log)
GRAIN SIZE and LOG GRAIN SIZE: grain size (is atoms) and its log.
GROWTH EXPONENT: the angular coefficient of the GRAIN SIZE plot. This number should approach 0.5 with ANNEALING-TEMP = 0 and FRACTION-ELEMENT2 = 0.

When you setup with a random orientation and run the simulation, notice that the speed of growth decreases with time. Toward the end of the simulation, you might see just two or three grains that fight with each other for along time. One will eventually prevail, but this logarithmic decrease of speed is an important characteristic of grain growth. That is why the GRAIN SIZE plot is a straight line in a "log-log" scale.
Notice also that if you draw two grains, one concave and one convex, their boundary will tend to be a straight line, if you let the simulation run long enough. Every curved boundary is unstable because many atoms at its interface will have more different than equal neighbors.

Increase the value of the ANNEALING-TEMP slider. What happens to the GRAIN SIZE plot, and to the boundaries' shapes?

Try to increase the FRACTION-ELEMENT2 slider to 5%. Then press START WITH RANDOM ARRANGEMENT and GO. What happens to grain growth? Now try several values (1, 3, 5, 7, 9%), for instance. What happens with the final grain size? What about the GRAIN SIZE plot and the GROWTH EXPONENT?

One advanced use of this model would be to get a digital picture of a real metallic sample, reduce noice and increase contrast with image editing programs, and load into this model using the IMPORT IMAGE button. Don't forget to update the WIDTH and HEIGHT sliders and the view's size to accommodate the picture, and also to change the patch size in order to be able to see the whole sample.

This models assumes that the misorientation between two grains has no effect on their growth rates. Two grains with a very similar crystallographic orientation have the same growth rate as grains which orientations differ by a lot. Try to take the angular misorientation into consideration.

When we insert second-phase particles, all of them have the same size. Try to create a slider that changes the size of the particles.

This model uses some special features:
It uses a hexagonal grid (as opposed to a square one)
it uses different shapes for different visualization purposes
and it uses the import-pcolors primitive to enable the image import capability.

Crystallization Basic
Crystallization Directed

?This model is part of the MaterialSim (Blikstein & Wilensky, 2004) curricular package. To learn more about MaterialSim, see

To refer to this model in academic publications, please use: Blikstein, P. and Wilensky, U. (2005). NetLogo MaterialSim Grain Growth model. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use: Copyright 2005 by Uri Wilensky. All rights reserved. See for terms of use.

Two papers describing the use of this model in education are:
Blikstein, P. & Wilensky, U. (2005) Less is More: Agent-Based Simulation as a Powerful Learning Tool in Materials Science. The IV International Conference on Autonomous Agents and Multiagent Systems. Utrecht, Netherlands.

Blikstein, P. & Wilensky, U. (2004) MaterialSim: An agent-based simulation toolkit for Materials Science learning. (PDF, 1.5 MB) Proceedings of the International Conference on Engineering Education. Gainesville, Florida.

The core algorithm of the model was developed at the University of Sao Paulo and published in: Blikstein, P. and Tschiptschin, A. P. Monte Carlo simulation of grain growth (II). Materials Research, Sao Carlos, 2 (3), p. 133-138, jul. 1999.
Available for download at: See also for more information (in Portuguese).