# Bark Beetle Epidemic--extended

Model was written in NetLogo 6.1.1
•
Viewed 259 times
•
Downloaded 39 times
•
Run 0 times

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 - Chance-to-grow-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 item random 3 ["tree1" "tree2" "tree3"] set size 1 + random-float 1 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 item random 3 ["tree1" "tree2" "tree3"] 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) ] end ;================================= to go tick tree-grow infest patch-count set-tree-color overwinter-mortality beetle-death beetle-migrate seedling if count beetles = 0 [user-message ("There are no bark beetles in this forest.") stop] if count beetles > 15000 [user-message ("There are too many 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 ]] ask d-trees [if size < 1.5 [set size size + 0.025 ]] end to infest ;Beetles detect trees avaiable in radius of bark beetle flight distance. then migrate to one of the available spruces. ask beetles [let target-tree one-of spruces with [size > 0.5] in-radius beetle-flight-distance ;infest tree larger than 0.5 ifelse target-tree != nobody [move-to target-tree hatch 4 [set age 0] ;If a beetle infests a mature tree, hatches 2 offspring and then dies. if random 100 < Percentage-of-population-complete-two-life-cycles [hatch 4 [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 * (200 / Number-of-beetles-to-kill-a-tree))] 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 [setxy (xcor + random-float 1) (ycor + random-float 1)]] [ set color rgb redness 110 0] ] end to seedling 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 [ifelse random 100 < Chance-to-grow-non-spruce-trees [sprout-d-trees 1 [setup-d-trees-seedling]] [sprout-spruces 1 [setup-spruces-seedling]] ]]] end to seedling-1 ;seed new green trees at 5 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 < 50 [let tree-ratio count spruces / (count spruces + count d-trees + 1) ifelse tree-ratio * 100 < (100 - Chance-to-grow-non-spruce-trees) [sprout-spruces 1 [setup-spruces-seedling]] [sprout-d-trees 1 [setup-d-trees-seedling]] ]]] if (100 - Chance-to-grow-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 at age of 2 or older die. end to overwinter-mortality ;Percentages of beetles survive over winter ask beetles [if random 100 > Percentage-of-beetles-surviving-over-winter [die]] end to beetle-migrate ask beetles [ set heading random 360 setxy (xcor + random-float random 2) (ycor + random-float random 2) ] end ; Copyright and Credits: Dr. Lin Xiang at University of Kentucky in 2019. ; Contact: lxiang75@gmail.com ; lin.xiang@uky.edu

There are 3 versions of this model.

This model does not have any ancestors.

This model does not have any descendants.