-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapex_day.f
192 lines (178 loc) · 8.49 KB
/
apex_day.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
subroutine apex_day
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine inputs measured loadings to the stream network for
!! routing through the watershed where the records are summarized on a
!! daily basis
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! id1 |julian date |first day of simulation in year
!! ievent |none |rainfall/runoff code
!! |0 daily rainfall/curve number technique
!! |1 sub-daily rainfall/Green&Ampt/hourly
!! | routing
!! |3 sub-daily rainfall/Green&Ampt/hourly routing
!! inum1 |none |reach number
!! ifirstr(:) |none |measured data search code
!! |0 first day of measured data located in file
!! |1 first day of measured data not located in
!! |file
!! ihout |none |hydrograph storage location number
!! inum1 |none |file number
!! iyr |year |current year of simulation (actual year)
!! mvaro |none |max number of variables routed through the
!! |reach
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! hhvaroute(2,:,:) |m^3 |volume of water
!! hhvaroute(3,:,:) |metric tons |sediment
!! hhvaroute(4,:,:) |kg N |organic N
!! hhvaroute(5,:,:) |kg P |organic P
!! hhvaroute(6,:,:) |kg N |NO3-N
!! hhvaroute(7,:,:) |kg P |mineral (soluble) P
!! hhvaroute(13,:,:)|kg |chlorophyll-a
!! hhvaroute(14,:,:)|kg N |NH3
!! hhvaroute(15,:,:)|kg N |NO2
!! hhvaroute(16,:,:)|kg |carbonaceous biological oxygen demand
!! hhvaroute(17,:,:)|kg |dissolved oxygen
!! hhvaroute(18,:,:)|# cfu/100ml |persistent bacteria
!! hhvaroute(19,:,:)|# cfu/100ml |less persistent bacteria
!! hhvaroute(20,:,:)|kg |conservative metal #1
!! hhvaroute(21,:,:)|kg |conservative metal #2
!! hhvaroute(22,:,:)|kg |conservative metal #3
!! ifirstr(:) |none |measured data search code
!! |0 first day of measured data located in
!! |file
!! |1 first day of measured data not located in
!! |file
!! varoute(2,:) |m^3 |volume of water
!! varoute(3,:) |metric tons |sediment
!! varoute(4,:) |kg N |organic N
!! varoute(5,:) |kg P |organic P
!! varoute(6,:) |kg N |NO3-N
!! varoute(7,:) |kg P |mineral (soluble) P
!! varoute(13,:) |kg |chlorophyll-a
!! varoute(14,:) |kg N |NH3
!! varoute(15,:) |kg N |NO2
!! varoute(16,:) |kg |carbonaceous biological oxygen demand
!! varoute(17,:) |kg |dissolved oxygen
!! varoute(18,:) |# bact |persistent bacteria
!! varoute(19,:) |# bact |less persistent bacteria
!! varoute(20,:) |kg |conservative metal #1
!! varoute(21,:) |kg |conservative metal #2
!! varoute(22,:) |kg |conservative metal #3
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! bactlpday |# cfu/100ml |loading of less persistent bacteria to
!! |reach on day
!! bactpday |# cfu/100ml |loading of persistent bacteria to reach
!! |on day
!! cbodday |kg |CBOD loading to reach on day
!! chladay |kg |chlorophyll a loading to reach on day
!! cmtl1day |kg |loading of conservative metal #1 to reach
!! |on day
!! cmtl2day |kg |loading of conservative metal #2 to reach
!! |on day
!! cmtl3day |kg |loading of conservative metal #3 to reach
!! |on day
!! disoxday |kg |dissolved oxygen loading to reach on day
!! floday |m^3 H2O |water loading to reach on day
!! idap |julian date |julian date of record
!! ii |none |counter
!! iyp |year |year of record
!! j |none |counter
!! minpday |kg P |soluble P loading to reach on day
!! nh3day |kg N |ammonia loading to reach on day
!! no2day |kg N |nitrite loading to reach on day
!! no3day |kg N |nitrate loading to reach on day
!! orgnday |kg N |organic N loading to reach on day
!! orgpday |kg P |organic P loading to reach on day
!! sedday |metric tons |sediment loading to reach on day
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
integer :: ii, j
do j = 1, mvaro
varoute(j,ihout) = 0.
if (ievent > 0) then
do ii = 1, nstep
hhvaroute(j,ihout,ii) = 0.
end do
endif
end do
!! read from apex measured file
!! check if idap/iyp are same
!! changes for Mike Winchell if apex.swt files has a different start date than the SWAT run
if (ifirsta(inum1) == 1) then
do
read (112+inum1,*) idapa(inum1), iypa(inum1), flodaya(inum1),
& seddaya(inum1), orgndaya(inum1), orgpdaya(inum1), no3daya(inum1),
& minpdaya(inum1)
if(idapa(inum1) == id1 .and. iypa(inum1) == iyr) exit
end do
ifirsta(inum1) = 0
endif
if (iypa(inum1) == iyr .and. idapa(inum1) == i) then
varoute(2,ihout) = flodaya(inum1)
varoute(3,ihout) = seddaya(inum1)
varoute(4,ihout) = orgndaya(inum1)
varoute(5,ihout) = orgpdaya(inum1)
varoute(6,ihout) = no3daya(inum1)
varoute(7,ihout) = minpdaya(inum1)
varoute(14,ihout) = 0.0
varoute(15,ihout) = 0.0
varoute(11,ihout) = 0.0
varoute(12,ihout) = 0.0
varoute(13,ihout) = 0.0
varoute(14,ihout) = 0.0
varoute(15,ihout) = 0.0
varoute(16,ihout) = 0.0
varoute(17,ihout) = 0.0
varoute(18,ihout) = 0.0
varoute(19,ihout) = 0.0
varoute(20,ihout) = 0.0
varoute(21,ihout) = 0.0
varoute(22,ihout) = 0.0
if (curyr /= nbyr .and. iida /= idal) then
read (112+inum1,*) idapa(inum1), iypa(inum1), flodaya(inum1),
& seddaya(inum1), orgndaya(inum1), orgpdaya(inum1), no3daya(inum1),
& minpdaya(inum1)
endif
else
varoute(2,ihout) = 0.0
varoute(3,ihout) = 0.0
varoute(4,ihout) = 0.0
varoute(5,ihout) = 0.0
varoute(6,ihout) = 0.0
varoute(7,ihout) = 0.0
varoute(14,ihout) = 0.0
varoute(15,ihout) = 0.0
varoute(11,ihout) = 0.0
varoute(12,ihout) = 0.0
varoute(13,ihout) = 0.0
varoute(14,ihout) = 0.0
varoute(15,ihout) = 0.0
varoute(16,ihout) = 0.0
varoute(17,ihout) = 0.0
varoute(18,ihout) = 0.0
varoute(19,ihout) = 0.0
varoute(20,ihout) = 0.0
varoute(21,ihout) = 0.0
varoute(22,ihout) = 0.0
endif
if (ievent > 0) then
do ii = 1, nstep
hhvaroute(2,ihout,ii) = flodaya(inum1) / real(nstep)
hhvaroute(3,ihout,ii) = seddaya(inum1) / real(nstep)
hhvaroute(4,ihout,ii) = orgndaya(inum1) / real(nstep)
hhvaroute(5,ihout,ii) = orgpdaya(inum1) / real(nstep)
hhvaroute(6,ihout,ii) = no3daya(inum1) / real(nstep)
hhvaroute(7,ihout,ii) = minpdaya(inum1) / real(nstep)
end do
end if
return
end