Island Modeler

Island Modeler preview image

1 collaborator

Default-person Michael Novak (Author)

Tags

(This model has yet to be categorized with any tags)
Model group EcoWeb | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 176 times • Downloaded 11 times • Run 0 times
Download the 'Island Modeler' 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

globals [
  ocean-color
  
]

breed [rains rain]
breed [waves wave]
breed [plants plant]
patches-own [light elevation water salt]

rains-own [height]
plants-own [roots tubers leaves flowers sugars]

to setup
ca
  set ocean-color cyan - 2
  setup-elevation
  setup-plants
  setup-light
  setup-water
  setup-waves
  setup-shade
  ask patches [visualize-patches]
  ask plants [visualize-plants]
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;runtime procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  grow-plants
  ask patches [visualize-patches]
  ask plants [visualize-plants]
end 

to grow-plants
  ask plants [
    let my-water net-capture "water"
    let my-light net-capture "light"
    let my-elev net-capture "elev"
    let my-min-photosynthesis 0
    ifelse my-water < my-light [set my-min-photosynthesis my-water][set my-min-photosynthesis my-light]
    let my-photosynthesis-rate my-min-photosynthesis * my-elev
    set sugars sugars + my-photosynthesis-rate
  ]
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;visualization ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to visualize-patches
  if elevation <= 0 [set pcolor ocean-color]
  set plabel ""
  
  if viz = "none"      [if elevation > 0  [set pcolor scale-color red elevation 0 100] ]
  if viz = "elevation" [if elevation > 0  [set pcolor scale-color red elevation 0 100]]
  if viz = "water" [
    if water <= 0 and elevation > 0 [set pcolor black]
    if water > 0  [set pcolor scale-color blue water 0 100]; set plabel water]
  ]
  if viz = "salt" [
    if elevation > 0 and salt = 0 [set pcolor black]
    if elevation > 0 and salt > 0 [set pcolor scale-color gray salt 0 100]; set plabel water]
  ]
  if viz = "light" [
    if light = 0 and elevation > 0 [set pcolor gray - 0.5]
    if light = 25 and elevation > 0 [set pcolor gray - 0.25]
    if light = 50 and elevation > 0 [set pcolor gray]
    if light = 75 and elevation > 0 [set pcolor gray + 0.25]
    if light = 100 and elevation > 0 [set pcolor white]
  ]
end 

to visualize-plants
  ifelse sugars < 10 [set size sqrt (sugars / 10)][set size 1]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;setup island ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup-light 
  ask patches [set light 100]
end 

to setup-elevation
  ask patches [set elevation -1]
  repeat 5 [
    create-turtles 1 [
      set heading random 360
      forward 5 + random 20
      ask patch-here [set elevation (3000 + random 3000)]
      die
     ]
  repeat 5 [
    create-turtles 1 [
      set heading random 360
      forward 5 + random 20
      ask patch-here [set elevation (1000 + random 1000)]
      die
     ] 
  ]
  ]
  repeat 40 + random 20 [diffuse elevation random-float 0.75]
    let max-elevation max [elevation] of patches
  ask patches [set elevation 100 * elevation / max-elevation]
end 

to setup-plants
  ask patches [
   if elevation > 0 [
     sprout 1 [
       set breed plants
       set shape "square"
       set size sqrt (1 / 10)
       set color [0 255 0 150]
       set leaves 1
       set roots 1
       set tubers 0
       set flowers 0
       set sugars 0
     ]
   ] 
  ]
end 

to setup-water
  ask patches with [pxcor = min-pxcor] [
   sprout 80 [
     set breed rains
     set height 0
     set heading 90
     ]
   ]

   move-rains
   
   ask patches with [pycor = max-pycor] [
   sprout 80 [
     set breed rains
     set height 0
     set heading 180
     ]
   ]

   move-rains2
   
  let max-water max [water] of patches
  ask patches [set water 100 * water / max-water]
end 

to move-rains
   repeat 200 [
           
    ask rains [
  
       right random 5 left random 5
       fd 0.5 
      ; pendown
       if elevation < height and elevation > 100 [ set height height - random-float 2]
       if elevation >= height [
         ifelse random 100 < 5 [ set water water + 1 die]
         [set height elevation  ]
       ]
     
      if pxcor = max-pxcor or pycor = max-pycor or pycor = min-pycor [die]
  ]
    ]
    ask rains [die]
end 

to move-rains2
   repeat 200 [
           
    ask rains [
  
       right random 5 left random 5
       fd 0.5 
      ; pendown
       if elevation < height and elevation > 100 [ set height height - random-float 2]
       if elevation >= height [
         ifelse random 100 < 5 [ set water water + 1 die]
         [set height elevation  ]
       ]
     
      if pxcor = max-pxcor or pxcor = min-pycor or pycor = min-pycor [die]
  ]
    ]
    ask rains [die]
end 

to setup-waves
   ask patches [ifelse elevation <= 0 [set salt 100][set salt 0]]
   repeat 10
    [
      diffuse salt 0.5
   ask patches [ if elevation <= 0 [set salt 100]]
    ]
    ask patches [
      set salt (salt - 2 * water ) if salt < 0 [set salt 0]
    ]
end 

to setup-shade
  ask patches [set light 100]
  ask patches with [water > 25] [ 
    let shade-tree-light-reduction 25 * (random 3)
    if shade-tree-light-reduction > 0 and random 2 = 1
      [set light light - shade-tree-light-reduction]
    ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; reporters   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report net-capture [resource]
  let prefer-value 0
  let resource-value 0
  let captured-value 0
  if resource = "water" [set prefer-value plantA-water set resource-value water]
  if resource = "light" [set prefer-value plantA-light set resource-value light]
  if resource = "elevation"  [set prefer-value plantA-elev set resource-value elevation]
  if (abs (resource-value - prefer-value)) <= 25 [set captured-value .1]
  if (abs (resource-value - prefer-value)) <= 15 [set captured-value .2]
  if (abs (resource-value - prefer-value)) <= 5 [set captured-value .6]
  report captured-value
end 

There is only one version of this model, created over 3 years ago by Michael Novak.

Attached files

File Type Description Last updated
Island Modeler.png preview Preview for 'Island Modeler' over 3 years ago, by Michael Novak Download

This model does not have any ancestors.

This model does not have any descendants.