Strong Acid

Strong Acid preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Mike Stieff (Author)

Tags

chemical reactions 

Tagged by Reuven M. Lerner almost 11 years ago

chemistry and physics 

Tagged by Reuven M. Lerner almost 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 267 times • Downloaded 59 times • Run 0 times
Download the 'Strong Acid' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

breed [ waters water ]          ;; water molecules
breed [ hydroxides hydroxide ]  ;; base molecules
breed [ hydroniums hydronium ]  ;; acid molecules

globals [
  pH
  base-added    ;; use to keep track of how much total base has been added
]

to setup
  clear-all
  set-default-shape waters "molecule2"
  set-default-shape hydroniums "molecule3"
  set-default-shape hydroxides "molecule1"
  create-waters 100           ;; creates constant volume of water in which to dilute acid
    [ set color blue ]
  create-hydroniums vol-acid  ;; creates VOL-ACID of hydronium ions
    [ set color green ]
  ask turtles                       ;; randomize position and heading of turtles
    [ setxy random-xcor random-ycor ]
  set base-added 0
  calculate-pH
  reset-ticks
  update-plots
end 

to go
  ask hydroxides [ react ]
  ask turtles
    [ fd 1                                        ;; move turtles around randomly
      rt random 10
      lt random 10 ]    ;; around the world
  tick
  calculate-pH
end 

;; adds hydroxide molecules to the solution

to add-base
  create-hydroxides vol-base
    [ set color red
      fd 1 ]
  set base-added base-added + vol-base
end 

;; hydroxide procedure

to react
  let partner one-of hydroniums-here   ;; see if there are any hydroniums here
  if partner != nobody                 ;; if one is found
    [ set breed waters                 ;; become water
      set color blue
      ask partner
        [ set breed waters             ;; partner becomes water too
          set color blue ] ]
end 

;; calculates the pH from the amount of the various ions in solution;
;; note that for simplicity the calculations don't take the true molar
;; concentration of water into account, but instead use an arbitrarily
;; chosen factor of 1000 to produce numbers lying in a reasonable range

to calculate-pH
  let volume count turtles
  let concH (count hydroniums / volume)
  let concOH (count hydroxides / volume)
  ifelse (concH = concOH)
    [ set pH 7 ]
    [ ifelse (concH > concOH)
      [ set pH (- log (concH / 1000) 10) ]
      [ let pOH (- log (concOH / 1000) 10)
        set pH 14 - pOH ] ]
end 

;; plotting procedures

to record-pH
  set-current-plot "Titration Curve"
  plotxy base-added pH
end 


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

There are 10 versions of this model.

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

Attached files

File Type Description Last updated
Strong Acid.png preview Preview for 'Strong Acid' about 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.