# bark beetle epidemic

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## DESIGN NOTES

- Starting # of beetles = 150
- Students can investigate a smaller or larger forest.
- Beetles can move up to 3 patches randomly in the forest every tick.
- Beetles only attack trees whose size is larger than 0.5
- The color of trees indicates the number of beetles infesting the tree.

## Module rules

The lifespan of a bark beetle is two hypothetical years (ticks). If it finds a proper host spruce tree, it produces two offspring and dies. If no host spruce trees are available, it dies at the age of 2.

Bark beetles only attack spruce trees whose size is larger than 0.5.

When the temperature increases, fewer bark beetles die in winter (at the end of a tick).

As temperature increases, more bark beetles may produce one more offspring.

When drought becomes severer, it takes fewer beetles to kill a host spruce tree.

No relationships are defined between temperature and severity of drought (even it is likely in reality).

The ratio of spruce and other trees in a forest is set and maintained by the Tree-Diversity slider.

## Things to notice

It is important to examine the spruce tree population when defining an outbreak.

The y-axis upper bound automatically adjusts to fit in the data. Make sure to check the y-axis bounds when interpreting data.

The year buttons "200", "400", and "600", can be used to set a successive investigation on a certain variable with the precise time interval of 200 years.

Bark beetle population may crash due to no available host trees in a reachable distance. It is not a programming error but a normal emergent event of the model. It will happen more or less depending on the settings you use.

## Related Models

Find more models at http://3dsciencemodeling.com

## CREDITS AND REFERENCES

This module is made by Dr. Lin Xiang at Weber State University. If you mention this model in a publication, we ask that you include the citations below.

Xiang, L. (2017). Bark Beetle Epidemic. Zoology Department, Weber State University, Ogden, UT.

## Comments and Questions

;; Bark beetle epidemic model. ;; ;; Coded in 2017 by Lin Xiang; Last revised in 2021 by Lin Xiang (lxiang75@gmail.com; lin.xiang@uky.edu) ; lxiang75@gmail.com ; lin.xiang@uky.edu ;; ;; If you mention this model in a publication, we ask that you include the citations below. ;; ;; Xiang, L. (2017). Bark Beetle Epidemic. Zoology Department, Weber State University, Ogden, UT. ;; ;;----------------------------------------- ;;CREATIVE COMMONS LICENSE ;;This code is distributed by Lin Xiang under a Creative Commons License: ;;Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) ;;https://creativecommons.org/licenses/by-sa/4.0/ ;; ;;----------------------------------------- breed[spruces spruce] breed[d-trees d-tree] breed[beetles beetle] beetles-own[age] patches-own[hit] globals [num-beetles dead-trees total-dead-trees] ;================================ 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] ifelse count beetles > 0 [set num-beetles count beetles][set num-beetles "There are no bark beetles in this forest."] 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) setxy (random-xcor)(random-ycor) set age 0 end to setup-patches ;set patches to certain drought level ask patches [ set pcolor 36.5 + random-float (0.5 + (0.5 * Severity-of-Drought)) ] end ;================================= to go ;if count beetles = 0 [set num-beetles "There are no bark beetles in this forest." stop] ifelse count beetles > 0 [set num-beetles count beetles][set num-beetles "There are no bark beetles in this forest." stop] tree-grow infest patch-count set-tree-color beetle-migrate temperature-control beetle-death seedling count-dead-trees 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 [set dead-trees dead-trees + 1 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 [ rt random 360 fd 1 + random 3 ] end to count-dead-trees set total-dead-trees dead-trees set dead-trees 0 end

There are 10 versions of this model.

This model does not have any ancestors.

This model does not have any descendants.