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.1.0 • Viewed 702 times • Downloaded 26 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]
patches-own[hit]


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

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 < (100 - %-of-non-spruce-trees)
        [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
            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
            setxy pxcor + random-float 0.5 pycor + random-float 0.5
            ]]
         ]]

  create-beetles 150
  [setup-beetles]

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

to setup-d-trees-seedling
            set shape "tree2"
            set size 0.25
            set color rgb 0 85 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 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

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


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

  tick
end 


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

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

to infest                                      ;Beetles detect trees avaiable in radius of 1.5. then migrate to one of the available spruces.
  ask beetles
     [let target-tree one-of spruces with [size > 0.5] in-radius 1.5     ;infest tree larger than 0.5
  ifelse target-tree != nobody
    [move-to target-tree
       hatch 2 [set age 0]                  ;If a beetle infests a mature tree, hatches 2 offspring and then dies.
          if random 100 < Temperature-increase * 2 [hatch 1 [set age 0]] ;If temperature increases, hatch one more beetle at the defined rate.
          die
        ]
    [ set age age + 1]                      ;If a beetle does not infests a mature tree, age increases 1
  ]
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]
    [ set color rgb redness 110 0]
  ]
end 

to seedling                                  ;seed new green trees at 5 percentage. the higher the seedling rate, the less likely the beetle population crashes.
  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 < 50
     [let tree-ratio count spruces / (count spruces + count d-trees + 1)
     ifelse tree-ratio * 100 < (100 - %-of-non-spruce-trees)
        [sprout-spruces 1
          [setup-spruces-seedling]]
        [sprout-d-trees 1
          [setup-d-trees-seedling]]
      ]]]

  if (100 - %-of-non-spruce-trees) = 100 [ask d-trees [die]]        ;clear other tree when diversity is low
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 

; Copyright and credit: developed by Lin Xiang at Weber State University. Last revised by Lin Xiang at University of Kentucky in 2019.

; lxiang75@gmail.com ; lin.xiang@uky.edu

There are 6 versions of this model.

Uploaded by When Description Download
lin xiang 12 months ago adjust the parameter of beetle flight distance Download this version
lin xiang about 1 year ago update the existing settings Download this version
lin xiang over 1 year ago reset the initial parameters Download this version
lin xiang almost 2 years ago Fix bug Download this version
lin xiang almost 3 years ago Add in forest size Download this version
lin xiang over 3 years ago Initial upload Download this version

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.