-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathalph.f
170 lines (155 loc) · 6.65 KB
/
alph.f
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
subroutine alph(iwave)
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine computes alpha, a dimensionless parameter that
!! expresses the fraction of total rainfall that occurs during 0.5h
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! amp_r(:,:) |none |alpha factor for rain(mo max 0.5h rain)
!! idg(:) |none |array location of random number seed
!! |used for a given process
!! idt |minutes |length of time step used to report
!! |precipitation data for sub-daily modeling
!! ievent |none |rainfall/runoff code
!! |0 daily rainfall/curve number technique
!! |1 daily rainfall/Green&Ampt technique/daily
!! | routing
!! |2 sub-daily rainfall/Green&Ampt technique/
!! | daily routing
!! |3 sub-daily rainfall/Green&Ampt/hourly routing
!! ihru |none |HRU number
!! iwave |none |flag to differentiate calculation of HRU and
!! |subbasin sediment calculation
!! |iwave = 0 for HRU
!! MUSLE(sedyld) each hru is calculated
!! | independently using hru area and
!! | adjusted channel length
!! |iwave = 1 subbasin # for subbasin
!! MUSLE is computed for entire subbasin
!! | using hru weighted KLSCP
!! i_mo |none |month being simulated
!! nstep |none |number of lines of rainfall data for each
!! |day
!! ovrlnd(:) |mm H2O |overland flow onto HRU from upstream
!! |routing unit
!! precipday |mm H2O |amount of water reaching soil surface in HRU
!! precipdt(:) |mm H2O |precipitation in time step for HRU
!! rndseed(:,:)|none |random number generator seed
!! snomlt |mm H2O |amount of snow melt in HRU on current day
!! sub_precip(:)|mm H2O |amount of water reaching soil surface in
!! |subbasin
!! sub_snom(:) |mm H2O |amount of snow melt in subbasin on day
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! al5 |none |fraction of total rainfall on day that occurs
!! |during 0.5h highest intensity rainfall
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ab |mm H2O |lowest value al5 can have
!! ajp |mm H2O |highest value al5 can have
!! j |none |HRU number
!! jj |none |counter
!! k |none |number of time steps equivalent to 30 minutes
!! kk |none |counter
!! preceff |mm H2O |amount of rainfall on day in HRU
!! rainsum |mm H2O |sum of rainfall during 30 min period
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! SWAT: Expo, Atri
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
integer, intent (in) :: iwave
integer :: j, k, kk, jj
real :: ab, ajp, preceff, rainsum
j = 0
j = ihru
ab = 0.02083
select case (ievent)
case(0, 1) !! daily rainfall, estimate al5
preceff = 0.
if (iwave > 0) then
!! subbasin sediment calculations
if (sub_precip(iwave) > sub_snom(iwave)) then
preceff = sub_precip(iwave) - sub_snom(iwave)
else
preceff = 0.
endif
else
!! HRU sediment calculations
if (precipday > snomlt) then
preceff = precipday - snomlt
else
preceff = 0.
endif
if (preceff > ovrlnd(j)) then
preceff = preceff - ovrlnd(j)
else
preceff = 0.
endif
endif
ajp = 0.
ajp = 1. - Expo(-125. / (preceff + 5.))
if (ised_det == 0) then
al5 = Atri(ab, amp_r(i_mo,hru_sub(j)), ajp, rndseed(idg(6),j))
else
al5 = amp_r(i_mo,hru_sub(j))
end if
case default !! subdaily rainfall, get from pcp data
if (idt <= 30) then
k = 0
k = 30 / idt
k = k - 1
do kk = 1, nstep+1-k
rainsum = 0.
do jj = 0, k
if (precipdt(kk+jj) > (snomlt+ovrlnd(j))/nstep) then
rainsum = rainsum + precipdt(kk+jj) - &
& (snomlt + ovrlnd(j)) / nstep
end if
end do
al5 = Max(al5,rainsum)
end do
if (subp(j) > 0.01) then
al5 = al5 / subp(j)
al5 = Min(al5,.99)
else
al5 = ab
end if
else
preceff = 0.
if (iwave > 0) then
!! subbasin sediment calculations
if (sub_precip(iwave) > sub_snom(iwave)) then
preceff = sub_precip(iwave) - sub_snom(iwave)
else
preceff = 0.
endif
else
!! HRU sediment calculations
if (precipday > snomlt) then
preceff = precipday - snomlt
else
preceff = 0.
endif
if (preceff > ovrlnd(j)) then
preceff = preceff - ovrlnd(j)
else
preceff = 0.
endif
endif
ajp = 0.
ajp = 1. - Expo(-125. / (preceff + 5.))
if (ised_det == 0) then
al5 = Atri(ab, amp_r(i_mo,hru_sub(j)), ajp, &
& rndseed(idg(6),j))
else
al5 = amp_r(i_mo,hru_sub(j))
end if
end if
end select
return
end