The 2D simulation of grain growth, with and without the addition of foreign particles, is handled using a Monte-Carlo method whereby a grain's orientation is changed randomly and the new orientation is always accepted if it is energetically favoured. If not, a probability function is utilized, which takes into consideration the system's temperature, and then the orientation is either accepted or rejected.
The Program:
5 user-defined variables are used and can be changed before compilation:
A special procedure is used to translate the orientation matrix into a 2-colour matrix which identifies nearest-neighbour grains having the same orientation and marks them with a grain boundary as well as all other unit cells with no similar-orientation neighbours.
This latter matrix is drawn in black and white. (Black being the brain boundary as well as the foreign paricle unit cells).
Each grain is then randomly selected and a new orientation is randomly chosen. The previous state energy is calculated as well as the proposed state one. The program examines each of the specific cell's neares neighbours, each neighbour whose orientation is different adds a unit of energy. A neighbour having the same orientation adds no energy. The sum is added and represents the cells' energetic contribution (dE). If the new state has a lower energy it is accepted. Otherwise a probability function, taking into account both the energy and the temperature (TEMP), is calculated (exp(-dE/TEMP)). A random number is generated, if its value is less then the calculated value, the new orientation is accepted.
This procedure is repeated for all the grain cells exept those having
foreign particles. They are not concidered since they are not allowed,
in this program, to move.
After all the cells have been considered, the new grain boundaries
are found and displayed.
The orientation change of the cells is a Monte-Carlo step. The number of which is defined in the MCS variable.
Edge conditions are avoided by having each side be a continuation of
the opposite one.
The program uses the OpenGL library of graphic commands for C.
List of procedures:
For an animated example click here.