Smog

Smog preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.2 • Viewed 424 times • Downloaded 40 times • Run 0 times
Download the 'Smog' 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 formation of photochemical smog over time. Nitrogen dioxide (NO2) and volatile organic compounds (VOC) are primary pollutants that are released into the atmosphere as a result of fossil fuel combustion. In the presence of oxygen (O2) and sunlight, they undergo chemical reactions that form ozone (O3) and photochemical oxidants (Ox), which are the principal components of smog.

HOW IT WORKS

The primary pollutants, NO2 and VOC, are emitted at rates designated by the user. When nitrogen oxide (NO2) is the only primary pollutant present, the following reactions occur:

(1) NO2 + sunlight = NO + O (nitrogen dioxide breaks down) (2) O + O2 + sulight = O3 (ozone is created) (3) NO + O3 = O2 + NO2 (ozone is destroyed)

When VOC is present in addition to NO2, the following reaction replaces reaction (3) above:

(4) NO + VOC = Ox (photochemical oxidants are created)

So, the presence of VOC causes a build-up of ozone in the atmosphere and leads to the formation of photochemical oxidants, which together are what we call smog. The chemical reaction rates of (1) and (2) are dependent on sunlight, so higher levels of sunlight cause this reaction to occur faster. When there is no sunlight, these reactions do not occur.

HOW TO USE IT

You can adjust several variables that will affect the behavior of the model:

"nitrogen-dioxide" - the number of NO2 molecules created during each tick "volatile-organic-compounds" - the number of VOC molecules created during each tick "sunlight-intensity" - the level of sunlight (0 - 100)

You can also choose the conditions under which the model will run:

When the "day-night-cycle" switch is OFF, the sunlight level will remain the same over time, at the level that the user selected. When the switch is ON, the level of sunlight will change over time, going from 0 at "night" to the user's selected setting during the "day."

When the "pollutants-cycle" switch is OFF, the emissions rates for NO2 and VOC will remain the same over time, at the level that the user selected. When the switch is ON, the emissions rate will change over time going from 0 at "night" to the user's selected setting during the "day." This reflects the fact that most emission-creating activities occur during daylight hours.

When the "atmosphere-inversion" switch is OFF, molecules that reach the edge of the screen disappear. This simulates a situation in which normal air flow causes dispersion of pollutants away from their source. When the switch is ON, molecules that reach the edge of the screen bounce back into the screen area. This reflects a situation in which a temperature inversion in the atmosphere prevents pollutants from dispersing.

When you are ready to run the model, click the "Setup" button, then click "Go."

THINGS TO NOTICE

The model assumes that the supply of oxygen (O2) is infinite. This is a realistic assumption for the reactions occuring in this model. Oxygen makes up about 21% of the atmosphere--that's 210,000 parts per million (ppm). Dangerous levels of smog are on the order of 0.4 ppm. In order to make the number of oxygen molecules in the model be in realistic proportion to the pollutant molecules, there would have to be millions of them, which is not feasible. So instead of using O2 turtles, the model assumes that O2 is always available.

THINGS TO TRY

Try each of the switches separately, then try them together. Compare the results.

Comments and Questions

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

Click to Run Model

; This model simulates the formation of photochemical smog over time. 

globals [
  earth-top      ;; y-coordinate that splits earth from atmosphere
  timeofday      ;; time of day in hours (0-24)
  sunlight       ;; level of sunlight (0-100)
  p-rate         ;; adjuster for emission rate of pollutants (0-1)
  NO2-rate       ;; rate of NO2-splitting reaction
  O3-rate        ;; rate of O3-formation reaction
  sunrise        ;; time at which sun rises
  sunset ]       ;; time at which sun sets

patches-own [
  patch-type ]   ;; 0 = earth, 1 = buildings, 2 = sky

breed [VOC]   ;; volatile organic chemicals
breed [NO2]   ;; nitrogen dioxide
breed [NO]    ;; nitrogen oxide
breed [O1]    ;; oxygen radicals
breed [O2]    ;; oxygen
breed [O3]    ;; ozone
breed [Ox]    ;; photochemical oxidants


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;; SETUP PROCEDURES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to Setup
  clear-all
  set-default-shape VOC "dot"   ;; set default shapes for all turtle breeds
  set-default-shape NO2 "dot"
  set-default-shape O3 "dot"
  set-default-shape NO "dot"
  set-default-shape O1 "dot"
  set-default-shape O2 "dot"  
  set-default-shape Ox "dot"  
  setup-world
  set sunrise 420
  set sunset 1140
  set timeofday 0                ;; reset clock 
  reset-ticks                    ;; reset tick counter
end 

to setup-world
  set earth-top -12
  set sunlight sunlight-intensity
  ask patches with [             ;; create grass
    pycor < earth-top ] [
    set patch-type 0
    set pcolor 64 ]
  ask patches with [
    pycor >= earth-top ] [        ;; create sky
    set patch-type 2 
    set pcolor scale-color sky sunlight 0 100 ]
  ask patches with [             ;; create buildings
    pycor >= earth-top and
    pycor <= earth-top + 1 and
    pxcor >= -8 and
    pxcor <= 8 ]
    [ set patch-type 1 
    set pcolor 3 ]
  ask patches with [
    pycor >= earth-top and
    pycor <= earth-top + 4 and
    pxcor >= 2 and
    pxcor <= 3 ]
    [ set patch-type 1 
    set pcolor 3 ]
  ask patches with [
    pycor >= earth-top and
    pycor <= earth-top + 6 and
    pxcor >= -1 and
    pxcor <= 1 ]
    [ set patch-type 1 
    set pcolor 3 ]    
  ask patches with [
    pycor >= earth-top and
    pycor <= earth-top + 2 and
    pxcor >= -5 and
    pxcor <= -3 ]
    [ set patch-type 1 
    set pcolor 3 ]
  ask patches with [
    pycor >= earth-top and
    pycor <= earth-top + 4 and
    pxcor > -4 and
    pxcor <= -3 ]
    [ set patch-type 1 
    set pcolor 3 ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;; RUNTIME PROCEDURES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to Go
  ifelse timeofday < 1440 [        ;; time progresses, one minute per tick
    set timeofday timeofday + 1 ][
    set timeofday 0]  
  update-sunlight
  ifelse pollutants-cycle [        ;; add primary pollutants to atmosphere
    cycle-pollutants]
    [add-pollutants]  
  ifelse atmosphere-inversion [    ;; move the pollutants around 
    run-pollutants-inversion]
    [run-pollutants]             
  run-reactions                    ;; perform chemical reactions on primary pollutants 
  tick
end 

to update-sunlight
  ifelse day-night-cycle [    
    if timeofday < sunrise or timeofday >= sunset [      ;; night
      set sunlight 0]
    if timeofday >= sunrise and timeofday < sunset [     ;; day
      set sunlight sunlight-intensity ]
  ]
    [set sunlight sunlight-intensity]
  ask patches with [
    patch-type = 2 ] [ 
    set pcolor scale-color sky sunlight 0 100 ]             ;; color sky according to sunlight level  
end 

to cycle-pollutants            ;;;;;;;;;; Add pollutants to the atmosphere in a cycle ;;;;;;;;;
  if timeofday < sunrise or timeofday >= sunset [            ;; night (no pollution)
    set p-rate 0]
  if timeofday >= sunrise and timeofday < sunset  [           ;; day (max pollution rate)
    set p-rate 1 ]
  create-NO2 p-rate * nitrogen-dioxide [
    set color brown
    setxy random-xcor earth-top + random-float max-pycor]
  create-VOC p-rate * volatile-organic-compounds [
    set color gray
    setxy random-xcor earth-top + random-float max-pycor]   
end 

to add-pollutants             ;;;;;;;;;; Add pollutants to the atmosphere (no cycle) ;;;;;;;;;
  create-NO2 nitrogen-dioxide [
    set color brown
    setxy 0 -6
    set heading -90 + random-float 180 ]
  create-VOC volatile-organic-compounds [
    set color gray
    setxy 0 -6 
    set heading -90 + random-float 180 ] 
end 

to run-pollutants-inversion    ;;;;;;;;;; Make pollutants move around, with atmospheric inversion ;;;;;;;;;
  ask turtles [
    let dist 0.5 * random-float 1
    ifelse can-move? dist
      [ fd dist ]
      [ set heading heading + 180 
        fd dist ]                     ;; if turtle hits the edge of the world, it turns around
    if ycor <= earth-top 
      [ set heading random-float 80 ] ;; if turtle hits ground, return it to atmosphere
  ]
end 

to run-pollutants              ;;;;;;;;;; Make pollutants move around (no inversion) ;;;;;;;;;
  ask turtles [
    let dist 0.5 * random-float 1
    ifelse can-move? dist
      [ fd dist ]
      [ die ]                  ;; if turtle hits the edge of the world, it dies
    if ycor <= earth-top 
      [ set heading random 80 ] ;; if turtle hits ground, return it to atmosphere
  ]
end 

to run-reactions                 ;;;;;;;;;;; Chemical reactions WITHOUT O2 turtles ;;;;;;;;;;
  set NO2-rate sunlight                   ;; set reaction rate for splitting NO2
  set O3-rate sunlight                    ;; set reaction rate for forming O3
  ask NO2 [                               ;; (1) SPLIT NO2 
    if random-float 200 < NO2-rate [        ;; roll dice to see if there'e enough energy for reaction
      set breed O1                            ;; if there is, convert the NO2 turtle to O1
      set color yellow
      hatch-NO 1 [                            ;; and create a new turtle that is NO
        set color orange 
        set heading random-float 360 ]]      
  ]
  ask O1 [                                ;; (2) CREATE OZONE
    if random-float 200 < O3-rate [         ;; roll dice to see if there's enough energy for reaction
        set breed O3                          ;; if there is, convert O1 turtle to O3
        set color violet
        set heading random-float 360 ]       
  ]
  ask NO [                                ;; (3) DESTROY OZONE
    if any? O3-here [                       ;; see if there are any O3 in the patch
      set breed NO2                           ;; if there are, convert NO turtle to NO2
      set color brown
      set heading random-float 360 ]  
    let reactant one-of O3-here               ;; destroy used up O3 turtle 
    if reactant != nobody [
      ask reactant [ die ]]
  ]  
  ask VOC [                               ;; (4) CREATE OXIDANTS
    if any? NO-here [                       ;; see if any NO are in the patch
      set breed Ox                            ;; if there are, convert VOC turtle to Ox
      set color red
      set heading random-float 360 ]     
    let reactant one-of NO-here               ;; destroy used up NO turtle
    if reactant != nobody [
      ask reactant [die]]
  ] 
end 





    

There is only one version of this model, created over 12 years ago by Madison Fitzpatrick.

Attached files

File Type Description Last updated
Smog.png preview Smog screenshot over 12 years ago, by Madison Fitzpatrick Download

This model does not have any ancestors.

This model does not have any descendants.