Water Cycle MSU

No preview image

1 collaborator

Default-person MSU ACMES (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 179 times • Downloaded 5 times • Run 0 times
Download the 'Water Cycle MSU' 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

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals [
  vapor-incrementer
  cloud-line      ;; y coordinate of bottom row of cloud
  surface        ;; y coordinate of top row of earth
  top-of-cloud
  bottom-of-cloud
  mountain-incrementer
  runoff-mover
  vapor-mover
  rain-incrementer ;;tell me when to delete cloud
  cloudsize
  hitCloud?
  isRaining?
  makeCloud?
  sideCloudSize
  climate
  cloudInPosition?
  cloudYcor
  cloudDeleter
  cloudrain
  rainxcor
  infiltratexcor
  isInfiltrating?
  firstCloud
  firstCloudXCor
  leftFirstCloud
]

breed [trees my-tree]
breed [fishes fish]
breed [cacti cactus]
breed [rivers river]
breed [boats boat]
breed [clouds cloud]
breed [rainfall rain]
breed [lakes lake]
breed [suns sun]
breed [vapors vapor]
breed [mountain-peak mountain]
breed [mountain-body mountain1]
breed [runoff run1]
breed [ponds pond]
breed [water infiltration]
breed [vegetations vegetation]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setup Procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; ;;;;;; Setup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to reset
  clear-all
  set cloudDeleter 0
  set cloudInPosition? false
  set climate "temperate"
  set LandTemperature 60
  set Relative_humidity 70
  set AirTemperature 45
  set MountainTemperature 33
  set LakeTemperature 55
   set runoff-mover 1
  set sideCloudSize 56
  set makeCloud? false
  set isRaining? 0
  set hitCloud? false
  set vapor-incrementer 45
  set cloudsize 70
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; set global variable values
  set cloud-line 100
  set surface -30; set the height of the earth
  set top-of-cloud 86
  set bottom-of-cloud 72

   ask patches [
    if pycor = surface ;; set color of the earth surface with input number of positive streamers
      [set pcolor green - 1]
    if pycor > (cloud-line - 1)
      [set pcolor gray]    ;;set color of the cloud
    if pycor > surface and pycor < cloud-line
      [set pcolor blue]  ;; set color of the sky
    if pycor < surface
      [set pcolor green] ;; set color of the earth
    if pycor < -70 and pycor > -100 ;; set groundwater
       [set pcolor brown]
    if pxcor > -70 and pxcor < 70 and pycor < -80
        [set pcolor blue + 1]
    ;;set up mountain
    if pycor < 20 and pxcor < -75 and pycor > surface
       [set pcolor gray - 2]
    ;;lake
    if pycor < surface and pxcor > 60 and pycor > -55
    [set pcolor blue + 1]
  ]

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; create the trees in the meadow based on the slider value for the number of trees
  create-trees 30 [
    set shape "grass"
    set size (5)
    setxy random(50) - 25 (surface + size / 2)
  ]

  create-trees 10 [
    set shape "myPineTree"
    set size random(10) + 30
    setxy random(70) - 110 (surface - random(5) - 20)
  ]

  create-ponds 1 [
    set shape "circle"
    set size 9
    setxy -70 -85
    set color blue + 1
  ]
   create-ponds 1 [
    set shape "circle"
    set size 9
    setxy 70 -85
    set color blue + 1
  ]

  create-vegetations 4[
    set shape "rabbit"
    set size random(2) + 5
    setxy random(90) - 110 (surface - random(15) - 25)
  ]
  create-vegetations 4[
    set shape "bug"
    set size random(2) + 2
    setxy random(70) - 110 (surface - random(15) - 20)
  ]

  ;;create rainfall
  create-rainfall 14[
    set shape "line"
    set size 5
    setxy random(7 * 7) - (117) 70 + random(10)
    set heading 180
    set color blue + 1
  ]

  ;;create lake/ocean
  create-lakes 1[
    set shape "circle"
    set size 50
    setxy 60 surface
    set color blue + 1
  ]

  create-vapors 14[
    set shape "dot"
    set size 5
    setxy 75 + (sideCloudSize / 2) - random(vapor-incrementer) surface
    set color red + 2
  ]

  ;;create sun
  create-suns 1 [
    set shape "sun"
    set color yellow
    set size 20
    setxy 90 75
  ]

  create-mountain-peak 1[
    set shape "triangle"
    set size 30
    set color white
    setxy -109 30
  ]

  create-mountain-peak 1[
    set shape "triangle"
    set size 30
    set color white
    setxy -90 30
  ]

  create-mountain-body 1[
    set shape "triangle"
    set size 70
    set color gray - 2
    setxy -95 surface + 21.5
  ]
  create-mountain-body 1[
    set shape "triangle"
    set size 70
    set color gray - 2
    setxy -76 surface + 21.5
  ]

     create-clouds 1 [
    set heading 0
    set shape "cloud3"
    set size 90
    setxy -90 75
    set color grey
    set cloudYCor ycor
    set firstCloudXCor xcor
    set leftFirstCloud (firstCloudXCor - (size / 3))
  ]
  set firstCloud one-of clouds

  create-clouds 1 [
    set heading 0
    set shape "cloud3"
    set size 86
    setxy 75 35
    set color white - 1
  ]

  create-lakes 1[
    set color blue
    set size 80
    set heading 360
    set shape "rectangle"
    setxy 60 surface + 13
  ]

  create-runoff 14[
    set color blue + 1
    set shape "dot"
    set size 5
    setxy -109 40
  ]
   create-runoff 14[
    set color blue + 1
    set shape "dot"
    set size 5
    setxy -89 40
  ]

  create-water 14[
    set color blue + 1
    set shape "line"
    set heading 180
    set size 8
    setxy random(50) - 25 surface - 10
  ]
  reset-ticks
end 




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Runtime Procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  ifelse (landTemperature < 32)
  [
    ask patches[
    if pycor = surface
      [set pcolor white]
    if pycor < surface
      [set pcolor white]
      if pycor <= surface and pxcor > 60 and pycor > -55
    [set pcolor blue + 1]
      if pycor < -65 and pycor > -100 ;; set groundwater
       [set pcolor brown]
    if pxcor > -70 and pxcor < 70 and pycor < -80
        [set pcolor blue + 1]
    ]

  ]
  [
    ask patches[
      if pycor <= surface
      [
        set pcolor green
      ]
      if pycor <= surface and pxcor > 60 and pycor > -55
    [set pcolor blue + 1]
      if pycor < -70 and pycor > -100 ;; set groundwater
       [set pcolor brown]
    if pxcor > -70 and pxcor < 70 and pycor < -80
        [set pcolor blue + 1]
    ]
  ]
    try-rain
    try-runoff
    try-infiltrate
    try-vapor
    move-cloud-temperate
    if ticks mod (11 - floor (Relative_humidity / 10)) = 0 [
      if (isRaining? = 0 and climate = "temperate")[
        create-rain
    ]
      create-infiltration
      runoff-maker
    ]
  ifelse LandTemperature  >= 0[
    if makeCloud? = true[
      create-cloud
    ]
    if ticks mod (floor (Relative_humidity / 10) + 1) = 0 [
      create-vapor
    ]
    set vapor-mover 1
  ]
  [
    set vapor-mover 0
  ]
  tick
end 

;;Has the rain go down

to try-rain
  ask rainfall[
    ifelse ycor >= surface [
      if AirTemperature < 25[
        set ycor ycor - 2 ]
      if AirTemperature >= 25 and AirTemperature < 50[
        set ycor ycor - 3 ]
      if AirTemperature >= 50[
        set ycor ycor - 4 ]
    ]
    [
      set infiltratexcor xcor
      set isInfiltrating? true
      die
    ]
  ]
  if count rainfall = 0 [
    set isInfiltrating? false
  ]
end 

to try-vapor
  ask vapors[
    ifelse ycor + (LakeTemperature / 4) < 30 [
      if ycor != -60[
      set ycor ycor + (LakeTemperature / 4) / 3
      ]
    ]
    [
      set hitCloud? true
      die
    ]
  ]
    if hitCloud? = true[
    ask clouds[
    if (color = white - 1)[
          ifelse (size + 5 <= 70)[
            set size size + 1
            set vapor-incrementer size
            set sideCloudSize size
          ]
          [
            set vapor-incrementer 0
            set size 70
            set xcor 74
            set hitCloud? false
            set makeCloud? true
          ifelse (climate = "temperate")
          [
            set color white
          ]
          [
            set color grey
          ]
        ]
    ]
    ]
    ]
end 

to create-vapor
   create-vapors 14[
    set shape "dot"
    set size 5
    setxy 80 + (sideCloudSize / 2) - random(vapor-incrementer) surface
    set color red + 2
  ]
end 

;;Creates rain so there is a continuous supply

to create-rain

    ifelse (is-turtle? firstCloud)
    [
      ask firstCloud[
        set firstCloudXCor xcor
      ]
      create-rainfall 14[
        set shape "line"
        set size 5
      ifelse (firstCloudXCor - (cloudsize / 3) < -120)
      [
        set leftFirstCloud -120
      ]
      [
        set leftFirstCloud firstCloudXCor - (cloudsize / 3)
      ]
        setxy leftFirstCloud + random((cloudsize / 7) * 5) cloudYcor + random(5)
        set color blue + 1
        set heading 180
      ]
    ]
    [
    if LandTemperature < 33 and AirTemperature > 32 and AirTemperature <= 75[

        create-rainfall 14[
    set shape "line"
    set size 5
    setxy random((cloudsize / 5) * 7) - (80) cloudYcor + random(5)
    set color blue + 1
    set heading 180
    ]
      ask rainfall[
        if ycor < surface + 35[

    set shape "dot"
    set size 5

    set color white
    set heading 180
    ]
    ]
  ]


  if LandTemperature > 32 and AirTemperature < 33 [

        create-rainfall 14[
    set shape "dot"
    set size 5
    setxy random((cloudsize / 5) * 7) - (80) cloudYcor + random(5)
    set color white
    set heading 180
    ]
      ask rainfall[
        if ycor < surface + 35[

    set shape "line"
    set size 5

    set color blue + 1
    set heading 180
    ]
    ]
  ]


    if AirTemperature < 33[
    create-rainfall 14[
    set shape "dot"
    set size 5
    setxy random((cloudsize / 5) * 7) - (80) cloudYcor + random(5)
    set color white
    set heading 180
    ]
    ]
    if AirTemperature >= 33 and AirTemperature <= 75[
        create-rainfall 14[
    set shape "line"
    set size 5
    setxy random((cloudsize / 5) * 7) - (80) cloudYcor + random(5)
    set color blue + 1
    set heading 180
    ]
    ]
  ]
    make-cloud-smaller


    if Relative_humidity > 50
    [create-rainfall 14[
    set shape "line"
    set size 5
    setxy random((cloudsize / 5) * 7) - (80) cloudYcor + random(5)
    set color blue + 1
    set heading 180
    ]
  ]
  ask rainfall[
  if AirTemperature > 75 and Relative_humidity < 50[
      die]
    if Relative_humidity = 0[
      die]
  ]
end 

to make-cloud-smaller
  if (Relative_humidity > 75)
  [
    set cloudDeleter cloudDeleter + 1
  ]
  ifelse (cloudDeleter < 3 and Relative_humidity > 75)
  [
  ]
  [
    set cloudDeleter 0
    ask clouds[
      if color = grey[
        if (ycor + 4 <= 75)
        [
          set ycor ycor + 4
          set xcor xcor - 4
          set cloudYCor ycor
        ]
        ifelse (size - 4 >= 20)
        [
          set size size - 4
          set cloudsize cloudsize - 4
          set xcor xcor - 1
        ]
        [
          set cloudsize 70
          set isRaining? 1
          die
        ]
      ]
    ]
  ]
end 

to try-runoff
  if (climate = "temperate")[
    ask runoff [
      ifelse ycor - runoff-mover >= surface - 3
      [
        ifelse MountainTemperature < 33[
          die]
        [
        set ycor ycor - (runoff-mover / 2.5) - (MountainTemperature / 150)
        set xcor xcor + (random(runoff-mover + .5)) / 2.5
      ]]
      [
        if color != green[
          set xcor xcor + runoff-mover
        ]
      ]
      if xcor > 70
      [die]
  ]
  ]
  if LandTemperature < 33 [
    ask runoff[
      if xcor > -42 [
        die]
    ]
  ]
end 

to runoff-maker

    if MountainTemperature < 33[
    create-runoff 1[
      set color white
      set shape "dot"
      set size 5
      setxy -109 40
      if xcor < -30 [
        die]
    ]
  ]
    if MountainTemperature >= 33[
       create-runoff 5[
      set color blue + 1
      set shape "dot"
      set size 5
      setxy -109 40
    ]]
     if MountainTemperature < 33[
    create-runoff 1[
      set color white
      set shape "dot"
      set size 5
      setxy -89 40
      if xcor < -30 [
        die]
    ]
  ]
    if MountainTemperature >= 33[
       create-runoff 5[
      set color blue + 1
      set shape "dot"
      set size 5
      setxy -89 40
    ]]
  if LandTemperature > 33[
  create-runoff 8[
      set color blue + 1
      set shape "dot"
      set size 5
      setxy -54 -20
    ]
  ]
end 

to try-infiltrate
  ask water[
    ifelse ycor - runoff-mover >= -80[
      set ycor ycor - runoff-mover
    ]
    [
      die
    ]
  ]
end 

to create-infiltration
  if (climate = "temperate") and LandTemperature > 32[
  create-water (LandTemperature / 5)[
    set color blue + 1
    set shape "line"
    set heading 180
    set size 8
    setxy random(150) - 80 surface - 12
  ]
  ]
end 

to move-cloud-temperate
  ask clouds[
    if color = white[
      ifelse xcor - 2 > -20[
        set xcor xcor - 4
      ]
      [
        ask clouds[
          if color = grey
          [die]
          if color = white[
            set cloudSize size
          ]
        ]
        set color grey
        set xcor xcor + 3
        set cloudInPosition? true
        set isRaining? 0
        set cloudYcor ycor
      ]
    ]
  ]
end 

to create-cloud
create-clouds 1[
          set color white - 1
          set size 0
          set shape "cloud3"
          set heading 0
          setxy 75 25
          set sideCloudSize size
        ]
  set makeCloud? false
end 

There is only one version of this model, created almost 6 years ago by MSU ACMES.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.