-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhrupondhr.f
218 lines (189 loc) · 10.2 KB
/
hrupondhr.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
subroutine hrupondhr
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine routes water and sediment through ponds in the HRUs
!! in a subdaily time step
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! bp1(:) |none |1st shape parameter for pond surface area
!! |equation
!! bp2(:) |none |2nd shape parameter for the pond surface area
!! |equation
!! hhqday(:) |mm H2O |surface runoff generated each hour of day
!! |in HRU
!! hru_ha(:) |ha |area of HRU in hectares
!! ihru |none |HRU number
!! latno3(:) |kg N/ha |amount of NO3-N in lateral flow in HRU for
!! |the day
!! minpgw(:) |kg P/ha |soluble P loading to reach in groundwater
!! no3gw(:) |kg N/ha |nitrate loading to reach in groundwater
!! pnd_fr(:) |none |fraction of HRU/subbasin area that drains
!! |into ponds
!! pnd_no3(:) |kg N |amount of nitrate originating from surface
!! |runoff in pond at beginning of day
!! pnd_no3g(:) |kg N |amount of nitrate originating from
!! |groundwater in pond at beginning of day
!! pnd_no3s(:) |kg N |amount of nitrate originating from lateral
!! |flow in pond at beginning of day
!! pnd_orgn(:) |kg N |amount of organic N originating from
!! |surface runoff in pond at beginning of day
!! pnd_orgp(:) |kg P |amount of organic P originating from
!! |surface runoff in pond at beginning of day
!! pnd_psed(:) |kg P |amount of mineral P attached to sediment
!! |originating from surface runoff in pond at
!! |beginning of day
!! pnd_solp(:) |kg P |amount of soluble P originating from surface
!! |runoff in pond at beginning of day
!! pnd_solpg(:)|kg P |amount of soluble P originating from
!! |groundwater in pond at beginning of day
!! pnd_vol(:) |m^3 H2O |volume of water in pond
!! pndflwo |m^3 H2O |volume of water flowing out of pond on day
!! pndsedo |metric tons |sediment leaving pond during day
!! pndsep |m^3 H2O |seepage from pond on day
!! qdr(:) |mm H2O |net water loading from HRU to main channel
!! sedminpa(:) |kg P/ha |amount of active mineral phosphorus sorbed to
!! |sediment in surface runoff in HRU for day
!! sedminps(:) |kg P/ha |amount of stable mineral phosphorus sorbed to
!! |sediment in surface runoff in HRU for day
!! sedorgn(:) |kg N/ha |amount of organic nitrogen in surface runoff
!! |in HRU for the day
!! sedorgp(:) |kg P/ha |amount of organic phosphorus in surface runoff
!! |in HRU for the day
!! sedyld(:) |metric tons |daily soil loss caused by water erosion in HRU
!! shallst(:) |mm H2O |depth of water in shallow aquifer
!! surqno3(:) |kg N/ha |amount of NO3-N in surface runoff in HRU for
!! |the day
!! surqsolp(:) |kg P/ha |amount of soluble phosphorus in surface runoff
!! |in HRU for the day
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! latno3(:) |kg N/ha |amount of NO3-N in lateral flow in HRU for the
!! |day
!! minpgw(:) |kg P/ha |soluble P loading to reach in groundwater
!! no3gw(:) |kg N/ha |nitrate loading to reach in groundwater
!! pndflwi |m^3 H2O |volume of water flowing into pond on day
!! pndsedin |metric tons |sediment entering pond during day
!! qdr(:) |mm H2O |net water loading from HRU to main channel
!! sedminpa(:) |kg P/ha |amount of active mineral phosphorus sorbed to
!! |sediment in surface runoff in HRU for day
!! sedminps(:) |kg P/ha |amount of stable mineral phosphorus sorbed to
!! |sediment in surface runoff in HRU for day
!! sedorgn(:) |kg N/ha |amount of organic nitrogen in surface runoff
!! |in HRU for the day
!! sedorgp(:) |kg P/ha |amount of organic phosphorus in surface runoff
!! |in HRU for the day
!! sedyld(:) |metric tons |daily soil loss caused by water erosion in HRU
!! shallst(:) |mm H2O |depth of water in shallow aquifer
!! surqno3(:) |kg N/ha |amount of NO3-N in surface runoff in HRU for
!! |the day
!! surqsolp(:) |kg P/ha |amount of soluble phosphorus in surface runoff
!! |in HRU for the day
!! twlpnd |mm H2O |water lost through seepage from ponds on
!! |day in HRU
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! cnv |none |conversion factor (mm/ha => m^3)
!! j |none |HRU number
!! pndsa |ha |surface area of pond on current day
!! xx |none |fraction of HRU not draining into ponds
!! yy |none |fraction of water leaving pond on day
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! SWAT: pond
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
integer :: j
real :: cnv, pndsa, xx, yy
j = 0
j = ihru
if (pnd_fr(j) > 0.01) then
do k=1,nstep
cnv = 0.
cnv = hru_ha(j) * 10.
!! calculate area of HRU covered by pond
pndsa = 0.
pndsa = bp1(j) * pnd_vol(j) ** bp2(j)
!! calculate water flowing into pond for day
! pndflwi = qdr(j) * 10. * (hru_ha(j) * pnd_fr(j) - pndsa)
! qdr(j) = qdr(j) - qdr(j) * pnd_fr(j)
pndflwi = hhqday(k) * 10. * (hru_ha(j) * pnd_fr(j) - pndsa) !! urban modeling by J.Jeong
hhqday(k) = hhqday(k) - hhqday(k) * pnd_fr(j) !! urban modeling by J.Jeong
!! calculate sediment loading to pond for day
! pndsedin = sedyld(j) * (pnd_fr(j) - pndsa / hru_ha(j))
! sedyld(j) = sedyld(j) - sedyld(j) * pnd_fr(j)
pndsedin = hhsedy(j,k) * (pnd_fr(j) - pndsa / hru_ha(j)) !! urban modeling by J.Jeong
hhsedy(j,k) = hhsedy(j,k) - hhsedy(j,k) * pnd_fr(j) !! urban modeling by J.Jeong
!! compute nitrogen and phosphorus levels in pond at beginning
!! of day: equation 29.1.1 in SWAT manual
if (pnd_solp(j) < 1.e-6) pnd_solp(j) = 0.0
if (pnd_psed(j) < 1.e-6) pnd_psed(j) = 0.0
if (pnd_orgp(j) < 1.e-6) pnd_orgp(j) = 0.0
if (pnd_solpg(j) < 1.e-6) pnd_solpg(j) = 0.0
if (pnd_orgn(j) < 1.e-6) pnd_orgn(j) = 0.0
if (pnd_no3(j) < 1.e-6) pnd_no3(j) = 0.0
if (pnd_no3s(j) < 1.e-6) pnd_no3s(j) = 0.0
if (pnd_no3g(j) < 1.e-6) pnd_no3g(j) = 0.0
xx = 0.
xx = pnd_fr(j) * hru_ha(j)
pnd_solp(j) = pnd_solp(j) + (surqsolp(j) + sedminpa(j)) * xx
pnd_psed(j) = pnd_psed(j) + sedminps(j) * xx
pnd_orgp(j) = pnd_orgp(j) + sedorgp(j) * xx
pnd_solpg(j) = pnd_solpg(j) + minpgw(j) * xx
pnd_orgn(j) = pnd_orgn(j) + sedorgn(j) * xx
pnd_no3(j) = pnd_no3(j) + surqno3(j) * xx
pnd_no3s(j) = pnd_no3s(j) + latno3(j) * xx
pnd_no3g(j) = pnd_no3g(j) + no3gw(j) * xx
!! compute amount of nutrients not passing through ponds
xx = 0.
xx = 1. - pnd_fr(j)
sedorgn(j) = sedorgn(j) * xx
surqno3(j) = surqno3(j) * xx
latno3(j) = latno3(j) * xx
no3gw(j) = no3gw(j) * xx
sedorgp(j) = sedorgp(j) * xx
sedminpa(j) = sedminpa(j) * xx
sedminps(j) = sedminps(j) * xx
surqsolp(j) = surqsolp(j) * xx
minpgw(j) = minpgw(j) * xx
call pondhr(j,k)
!! compute water leaving pond
hhqday(k) = hhqday(k) + pndflwo / cnv
!! compute sediment leaving pond
hhsedy(j,k) = hhsedy(j,k) + pndsedo
!! compute nutrients leaving pond
if (pndflwo > 1.e-10) then
yy = 0.
yy = pndflwo / (pnd_vol(j) + pndflwo)
sedorgn(j) = sedorgn(j) + pnd_orgn(j) * yy / hru_ha(j)
surqno3(j) = surqno3(j) + pnd_no3(j) * yy / hru_ha(j)
latno3(j) = latno3(j) + pnd_no3s(j) * yy / hru_ha(j)
no3gw(j) = no3gw(j) + pnd_no3g(j) * yy / hru_ha(j)
sedorgp(j) = sedorgp(j) + pnd_orgp(j) * yy / hru_ha(j)
sedminps(j) = sedminps(j) + pnd_psed(j) * yy / hru_ha(j)
surqsolp(j) = surqsolp(j) + pnd_solp(j) * yy / hru_ha(j)
minpgw(j) = minpgw(j) + pnd_solpg(j) * yy / hru_ha(j)
!! adjust nutrient content in pond
pnd_orgn(j) = pnd_orgn(j) * (1. - yy)
pnd_no3(j) = pnd_no3(j) * (1. - yy)
pnd_no3g(j) = pnd_no3g(j) * (1. - yy)
pnd_no3s(j) = pnd_no3s(j) * (1. - yy)
pnd_orgp(j) = pnd_orgp(j) * (1. - yy)
pnd_psed(j) = pnd_psed(j) * (1. - yy)
pnd_solp(j) = pnd_solp(j) * (1. - yy)
pnd_solpg(j) = pnd_solpg(j) * (1. - yy)
pnd_chla(j) = pnd_chla(j) * (1. - yy)
end if
!! add pond seepage to shallow aquifer convert from m^3 to mm
shallst(j) = shallst(j) + pndsep / cnv
!! compute seepage depth for HRU water balance
twlpnd = pndsep / cnv
if (hhqday(k) < 0.) hhqday(k) = 0.
if (hhsedy(j,k) < 0.) hhsedy(j,k) = 0.
end do
end if
return
end