bark beetle epidemic

bark beetle epidemic preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (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 301 times • Downloaded 13 times • Run 0 times
Download the 'bark beetle epidemic' 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[beetles beetle]
breed[spruces spruce]
breed[d-trees d-tree]


beetles-own[age]
d-trees-own [age-d-tree]
spruces-own [age-tree ]
patches-own[hit]
globals [all-spruces]


;================================

to setup
  ca

  setup-patches

  ask patches
  [let tree-1 count spruces-here                                           ;find number of spruce trees
    let tree-2 count d-trees-here                                          ;find number of other trees
     if tree-1 = 0 and tree-2 = 0
      [ifelse random 100 < Tree-Diversity
        [sprout-spruces 1                                                  ;find number of spruce trees
          [set shape "2spruce"
            set size 2.25 - random-float 2.25                                                  ;spruce tree size
            set color rgb 0 110 0

            set age-tree random 100
            setxy pxcor + random-float 0.5 pycor + random-float 0.5        ;sightly randomize spruce tree positions
            ]]
         [sprout-d-trees 1
          [set shape "tree2"
            set size 1.5
            set color rgb 0 90 0
            set age-d-tree random 100
            setxy pxcor + random-float 0.5 pycor + random-float 0.5
            ]]
         ]]
  set all-spruces count spruces

  create-beetles 50
  [setup-beetles]

  reset-ticks
end 
;================================

to setup-d-trees-seedling
            set shape "tree2"
            set size 0.25
            set color rgb 0 85 0
            set age-d-tree 0
            setxy pxcor + random-float 0.5 pycor + random-float 0.5
end 

to setup-spruces-seedling
   set shape "2spruce"
            set size 0.25
            set age-tree 0
            set color rgb 0 110 0

            setxy pxcor + random-float 0.5 pycor + random-float 0.5 ;slightly randomize the tree position. This makes the forest look more natural but increase the max number of trees in a the simuation as each patch can have more than one trees.
end 

to setup-beetles                         ; set up initial beetle features, in which all beetles are at the age of 0
    set color 1
    set shape "bark-beetle"
    set size 0.3
    setxy (random-float 3)(random-float 3)
    set age 0
end 

to setup-patches                                           ;set patches to certain drought level
  ask patches [
    set pcolor 36 + random-float (0.5 + (0.5 * Severity-of-Drought))
    ]
end 

;=================================

to go
  tick

  tree-grow
  tree-death
  infest
  patch-count
  set-tree-color
  beetle-migrate
  temperature-control
  beetle-death
  seedling


  if count beetles = 0 [user-message ("There are no bark beetles in this forest.") stop]
end 


;==================================

to tree-grow                                  ; Spruces grow until size 2.25
  ask spruces
  [if size < 2.25 [set size size + 0.05 set age-tree age-tree + 1]]
  ask d-trees
  [if size < 1.5 [set size size + 0.025 set age-d-tree age-d-tree + 1]]
end 

to tree-death                               ;natural motality of trees
  ask d-trees
  [ if random 800 < 10 [die]]
  ask spruces
  [ if random 1000 < 10 [die]
  ]
end 

to patch-count                                ;count how many beetles on a patch, use the number of beetles to indicate severity of infestation
  ask patches
  [set hit 0
    let num-bug count beetles-here
    set hit (num-bug * (10 + (Severity-of-Drought * 5)))]
end 

to set-tree-color                            ;determine severity of infestation. The number of beetles are associated to the tree color
  ask spruces
  [let redness [hit] of patch-here
    ifelse redness > 200
    ;[ die ask beetles-here [die]] ;       when the spruce is killed, the infesting beetle larvea die. count one dead tree.
    [die ask beetles-here [setxy (xcor + random-float 1) (ycor + random-float 1)]]
    [ set color rgb redness 110 0]
  ]
end 

to seedling                                  ;seed new green trees at 2 percentage
  ask patches
  [let tree-1 count spruces-here
    let tree-2 count d-trees-here
     if tree-1 = 0 and tree-2 = 0
     [if random 1000 < 30
     [let tree-ratio count spruces / (count spruces + count d-trees + 1)
     ifelse tree-ratio * 100 < Tree-Diversity
        [sprout-spruces 1
          [setup-spruces-seedling]]
        [sprout-d-trees 1
          [setup-d-trees-seedling]]
      ]]]

  if Tree-Diversity = 100 [ask d-trees [die]]        ;clear other tree when diversity is low
end 

to infest                                      ;Beetles detect trees avaiable in radius of 4. then migrate to one of the available spruces. radius less than 4 will lead to more halt
  ask beetles
     [let target-tree one-of spruces with [size > 0.5] in-radius 4     ;infest tree larger than 0.5
  ifelse target-tree != nobody
    [face target-tree
      move-to target-tree
       hatch 2 [set age 0]                  ;If a beetle infests a mature tree, hatches 2 offspring and then dies.
       die
        ]
    [ set age age + 1]                      ;If a beetle does not infests a mature tree, age increases 1
  ]
end 

to beetle-death
  ask beetles with [age >= 2] [die]           ;If beetles with age of 2 or older die.
end 

to temperature-control                             ;Percentages of beetles die every year, related to the temperature increase.
  ask beetles
  [if random 100 > ((Temperature-increase * 2) + 50)
    [die]]
end 

to beetle-migrate
  ask beetles
  [
    setxy (xcor + random-float random 2) (ycor + random-float random 2)
    ]
end 

; developed by Lin Xiang at Weber State University

;lxiang75@gmail.com ; linxiang@weber.edu

There are 2 versions of this model.

Uploaded by When Description Download
lin xiang 8 months ago Add in forest size Download this version
lin xiang over 1 year ago Initial upload Download this version

Attached files

File Type Description Last updated
bark beetle epidemic.png preview Preview for 'bark beetle epidemic' over 1 year ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.