Crystallization Moving

Crystallization Moving preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

atoms 

Tagged by Reuven M. Lerner over 11 years ago

chemistry and physics 

Tagged by Reuven M. Lerner over 11 years ago

crystallization 

Tagged by Reuven M. Lerner over 11 years ago

metals 

Tagged by Reuven M. Lerner over 11 years ago

states of matter 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 369 times • Downloaded 99 times • Run 0 times
Download the 'Crystallization Moving' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model simulates the movement of metal atoms as a system crystallizes. It is very similar to the Crystallization Basic model, except here the atoms are free to move about. They randomly move in any direction that is not already occupied by something else, such as another atom or a wall. Therefore, in order to allow movement, there must be empty spaces between atoms. Initially these empty spaces, or voids, are randomly distributed, as they would be in a liquid metal.

The first atoms to crystallize have a random orientation. However, when a liquid atom about to crystallize is next to an already crystallized atom, the liquid atom orients itself with the solid atom, thus creating a crystal. As more and more atoms solidify, the crystals grow. Within each crystal, all the atoms are oriented with one another, but within the entire metal, all the crystals have random orientations. Each individual crystal is called a grain. When two crystals grow up next to each other, they form what is called a grain boundary.

When a metal is stressed, such as when it is pulled from both ends, deformations occur in the crystal structure. As more stress is applied, these deformations pass through the crystal structure, allowing the metal to bend. Grain boundaries prevent deformations from flowing through the metal. Therefore, pieces of metal with fewer grain boundaries tend to be ductile, while pieces of metal with more grain boundaries tend to be brittle.

(Note that the actual number of atoms is small compared to a real metal sample and the metal is only two-dimensional. In addition, the movement of the atoms is limited to discrete patch sizes.)

HOW TO USE IT

Buttons:
SETUP: Resets the simulation, and sets the metal to the correct size.
GO-ONCE: Runs the simulation for one time step.
GO: Runs the simulation continuously until either the GO button is pressed again, or all of the atoms are frozen.

Sliders:
BOX-WIDTH: How many atoms wide the metal is.
FILL-PERCENTAGE: What percentage of the box contains atoms. Smaller values allow for more movement.
ROOM-TEMP: Varies the temperature of the room.
INIT-METAL-TEMP: Varies the initial temperature of the metal.
MELTING-TEMP: Varies the temperature at which the metal solidifies.

Monitors:
AVE-METAL-TEMP: Monitors the average temperature of all the atoms.

Switches:
HISTOGRAM?: Turns the histogram plotting on and off. Turning off the histogram speeds up the model.

Graphs:
AVERAGE METAL TEMPERATURE: Plots the average temperature of all the metal over time.
NUMBER SOLIDIFIED: Plots how many metal atoms are below the melting temperature over time.
TEMPERATURES: Histograms how many atoms are in each temperature range. (Note that the colors of the histogram match the actual colors of the atoms.)

THINGS TO TRY

Set BOX-WIDTH to 15, FILL-PERCENTAGE to 85, and leave the rest of the sliders at their initial values (ROOM-TEMP at 20, INIT-METAL-TEMP at 1550, and MELTING-TEMP at 500). Run the entire simulation by clicking on SETUP and GO, and then waiting for the metal to completely crystallize. Repeat this several times. What happens to the empty spaces between the atoms? How do you think this would affect the properties of the overall metal?

Now set BOX-WIDTH to 29 and leave the rest of the settings how they were in the previous paragraph. As before, run the entire simulation by clicking on SETUP and GO, and then waiting for the metal to completely crystallize. What are some things that are different this time? What stayed the same?

Set ROOM-TEMP to -20, INIT-METAL-TEMP to 1550, and MELTING-TEMP to 1500. Leave BOX-WIDTH at 29 and FILL-PERCENTAGE at 85. Now run the entire simulation. What happens to the empty spaces between the atoms? Why is this different from the previous simulations? How do you think this would affect the properties of the overall metal?

EXTENDING THE MODEL

This model prevents more than one atom from occupying the same space. However, in three dimensions, atoms are able to move over one another. Change the code so turtles can move to any space inside the boundaries. What does the resulting crystal look like? Can you imagine what this would look like in three dimensions?

Some metal applications require that the metal's grains form long strips across the metal. To achieve this, only one side of the metal is cooled. This causes all of the crystals to begin on one side of the metal, and consequently grow across its length. This is called directional solidification. In the Procedures window, change the code so one side of the room is much cooler than the rest.

NETLOGO FEATURES

In NetLogo, a turtle's heading specifies which direction the turtle's shape appears. However, in this model, turtles must move in a direction unrelated to their shape direction. To circumvent this, SETXY was used to move the turtles instead of FD.

Note how we can draw a multi-colored histogram. The HISTOGRAM primitive can only draw in one color at a time, but we work around this by calling it over and over again, plotting only one bar each time, and changing the pen color each time.

With every time step, each atom's temperature changes to the average of everything around it. To do this, each turtle has an agent set of all of its neighboring turtles that is updated each time the turtles move. In addition, each turtle has an agent set of all the patches surrounding it that is also updated. Any white patches in the set are on the outside wall. Therefore, the new temperature is taken as the average of the temperatures of the neighbor list, plus the room temperature multiplied by the number of white patches in the set. Therefore, turtles on the edge of the metal will average in the room temperature to their temperature, but other turtles will not.

RELATED MODELS

Crystallization Basic
Crystallization Directed

CREDITS AND REFERENCES

Original implementation: Carrie Hobbs, for the Center for Connected Learning and Computer-Based Modeling.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

COPYRIGHT AND LICENSE

Copyright 2002 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ 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 uri@northwestern.edu.

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Comments and Questions

Click to Run Model

turtles-own
[
  temp               ;; specific turtle's temperature
  turtle-neighbors   ;; set of surrounding turtles
]

globals
[
  ave-metal-temp   ;; shows average temperature of all metal
  num-frozen       ;; keeps track of how many atoms are frozen
  temp-range       ;; for histogram
  colors           ;; used both to color turtles, and for histogra
  pens             ;; keeps track of all the histogram's pen names
]

to setup
  clear-all
  set colors sentence (white - 1) [cyan sky blue violet magenta red]
  set pens []
  set temp-range (init-metal-temp - melting-temp) / (length colors - 1)

  ask patches with [(abs pycor >= box-width / 2) or
                    (abs pxcor >= box-width / 2)]
  [ set pcolor white ]

  ;; fill room to desired percentage
  ask patches
  [
    if ((fill-percentage > random-float 100) and (pcolor != white))
    [
      sprout 1
      [
        set shape "T"
        set temp init-metal-temp
        set turtle-neighbors (turtles at-points [[1 0] [0 1] [-1 0] [0 -1]])
        set-color
      ]
    ]
  ]
  set ave-metal-temp init-metal-temp
  reset-ticks
end 

to go
  ;; stop if all turtles are below melting temp
  if (max ([temp] of turtles) < melting-temp)[ stop ]
  ;; otherwise...
  set num-frozen 0
  ask turtles [ move ]
  ask turtles [ rotate ]
  ask turtles [ cool-turtles ]
  ask turtles [ set-color ]
  set ave-metal-temp (mean [temp] of turtles)
  tick
end 


;; turtles procedure -- if metal is liquid, move to a randomly
;; selected neighboring patch that is not already occupied

to move
  if (temp > melting-temp)
  [
    let move-choices neighbors4 with [(pcolor != white) and (not any? turtles-here)]
    if any? move-choices
    [
      move-to one-of move-choices
    ]
  ]
end 


;; turtle procedure -- if metal is liquid and it is next to a solid,
;; change its heading to that of the solid; otherwise, just rotate
;; randomly

to rotate
  set turtle-neighbors turtles at-points [[1 0] [0 1] [-1 0] [0 -1]]
  if (temp > melting-temp)
  [
    let frozen-neighbors (turtle-neighbors with [temp <= melting-temp])
    ifelse (any? frozen-neighbors)
      [ set heading ([heading] of (one-of frozen-neighbors)) ]
      [ rt random-float 360 ]
  ]
end 


;; turtle procedure -- sets turtle's temp to ave temp of all
;; neighboring turtles and patches added turtle's own temp in twice so
;; it changes more slowly

to cool-turtles
  let walled-sides neighbors4 with [pcolor = white]
  let total-temp ((sum [temp] of turtle-neighbors) +
                  (room-temp * (count walled-sides) + temp))
  let total-num ((count turtle-neighbors) + (count walled-sides) + 1)
  set temp (total-temp / total-num)
end 


;; turtle procedure

to set-color
  ; create index ranging from 1 to 8 for all melting colors
  let index (floor ((temp - melting-temp) / temp-range)) + 1
  ifelse (index < 0 )
  [
    set color white - 1
    set num-frozen (num-frozen + 1)
  ]
  [
    if index >= length colors
    [ set index (length colors) - 1 ]
    set color item index colors
  ]
end 


; Copyright 2002 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Crystallization Moving Download this version

Attached files

File Type Description Last updated
Crystallization Moving.png preview Preview for 'Crystallization Moving' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.