Conservation of Mass

Conservation of Mass preview image

1 collaborator

Kryan_pic Kelly Ryan (Author)

Tags

chemical reactions 

Tagged by Kelly Ryan over 4 years ago

chemistry 

Tagged by Kelly Ryan over 4 years ago

conservation of mass 

Tagged by Kelly Ryan over 4 years ago

synthesis 

Tagged by Kelly Ryan over 4 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 523 times • Downloaded 59 times • Run 0 times
Download the 'Conservation of Mass' modelDownload this modelEmbed this model

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


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [reactantAs reactantA] ; this is a synthesis reaction with two reactants and one product
breed [reactantBs reactantB]
breed [products product]

to setup
  clear-all ; clear.
  set-default-shape reactantAs "circle" ; set shapes for the three turtles.
  set-default-shape reactantBs "circle"
  set-default-shape products "circle molecule"
  
  create-reactantAs amount-of-reactantA ; slider reactantA sets number of green reactantA turtles, placed randomly.
    [set color green
      set size 1
      setxy random-xcor random-ycor]
  create-reactantBs amount-of-reactantB ; slider reactantB sets number of blue reactantB turtles, placed randomly.
    [set color blue
      set size 1
      setxy random-xcor random-ycor]
  reset-ticks ; resets ticks.
end 

to go ; begins reactant behavior.
  ask turtles 
    [right random-float 15 - random-float 15 fd 1] ; turtles move randomly.
    if count reactantAs = 0 [show "reaction complete!" stop] 
    ; checks if reactantA is gone, gives message to observer, and stops reaction.
    if count reactantBs = 0 [show "reaction complete!" stop] 
    ; checks if reactantB is gone, gives message to observer, and stops reaction.
  react ; calls sub-routine react.
  tick ; adds one tick.
end 

to react ; sub-routine which allows the reactants to create a product.
  ask one-of reactantAs ; asks one of the reactantAs to determine if it shares a space with a reactantB.
    [if any? reactantBs in-radius 1
    [set breed products ; if reactantA and reactantB share the same space, reactantA becomes the product with size 2.
      set size 2
     ask one-of reactantBs in-radius 1 [die]]]; at the same time as reactantA becomes the product, reactantB dies.
end 

; kellyryanscience@gmail.com

There is only one version of this model, created over 4 years ago by Kelly Ryan.

Attached files

File Type Description Last updated
Conservation of Mass.png preview Preview for 'Conservation of Mass' over 4 years ago, by Kelly Ryan Download

This model does not have any ancestors.

This model does not have any descendants.