-
Notifications
You must be signed in to change notification settings - Fork 0
/
disasters.F90
88 lines (67 loc) · 1.74 KB
/
disasters.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
subroutine hurricane
! Subroutine for hurricane disasters
use globalvars
use functions
implicit none
real :: inicor, fincor ! Initial and final coral percentages
real :: randcor ! Determines which coral are removed
integer :: l, c ! Number of coral locations, arbiter of coral removal
integer :: i, j ! Looping integrs
integer, allocatable :: corloch(:,:) ! Holds coordinates of coral
! Initial coral percentage
inicor = percentcor(grid)
! Set severity of hurricane
if (disSevere .eq. 1) then
fincor = 0.8*inicor
else if (disSevere .eq. 2) then
fincor = 0.55*inicor
else if (disSevere .eq. 3) then
fincor = 0.4*inicor
else if (disSevere .eq. 4) then
fincor = 0.25*inicor
else
fincor = 0.1*inicor
end if
! Initializations
check = (coral .ne. 0.0)
c = 0
! Sends the count to an integer and allocates algaeloc
l = count(check)
allocate(corloch(2,l))
corloch = 0
! Do loops to find exact coordinates of coral
do i = 1, grid, 1
do j = 1, grid, 1
if (coral(i,j) .ne. 0) then
! Saves the locations
c = c + 1
corloch(1,c) = i
corloch(2,c) = j
end if
end do
end do
! Loop until sufficient coral is removed
do while (percentcor(grid) .gt. fincor)
call random_number(randcor)
randcor = randcor*float(c)
coral(corloch(1,nint(randcor)),corloch(2,nint(randcor))) = 0.0
end do
end subroutine
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine disease
! Subroutine for disease disasters
use globalvars
implicit none
! Determine number of days the plague lasts
if (disSevere .eq. 1) then
sickDays = 5
else if (disSevere .eq. 2) then
sickDays = 15
else if (disSevere .eq. 3) then
sickDays = 25
else if (disSevere .eq. 4) then
sickDays = 35
else
sickDays = 45
end if
end subroutine