-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistrib_bmps.f
200 lines (163 loc) · 8.39 KB
/
distrib_bmps.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
subroutine distributed_bmps
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine calls routines for urban BMPs in the subbasin
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! hhqday(:) |mm H2O |surface runoff generated each hour of day
!! |in HRU
!! hru_ha(:) |ha |area of HRU in hectares
!! ihru |none |HRU number
!! ubntss(:) |metric tons |TSS loading from urban impervious cover
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ubntss(:) |metric tons |TSS loading from urban impervious cover
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! cnv |none |conversion factor (mm/ha => m^3)
!
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! SWAT: sand_filter
!! SWAT: sed_pond
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
implicit none
integer :: kk,sb,ii
real :: sub_ha,bmpfr
real, dimension(3,0:nstep) :: sf_totalflw,sf_totaltss,ri_totalflw
real, dimension(3,0:nstep) :: ri_totaltss
real, dimension(3,0:nstep) :: sfflw,sfsed,riflw,rised !dimensions: 1=inflow/outflow, 2=pond id, 3=time step
real, dimension(3,0:nstep) :: spqm3,spsed,ftqm3,ftsed,riqm3
sb = inum1
sub_ha = da_ha * sub_fr(sb)
sf_totalflw = 0.; sf_totaltss = 0.
ri_totalflw = 0.; ri_totaltss = 0.
sfflw = 0.; sfsed = 0.; riflw = 0.; rised = 0.;bmpfr=0.
spqm3 = 0.; spsed=0.;ftqm3=0.;ftsed=0.;riqm3=0.
!initialize daily recharge from distributed BMPs
bmp_recharge(sb) = 0.
!---------------------------------
! sedimentation-filtration basin
if(num_sf(sb)>=1.and.hrnopcp(sb,nstep)<96) then
do kk=1,num_sf(sb)
!fraction urban runoff to the sed-fil
sfflw(1,1:nstep) = sub_ubnrunoff(sb,1:nstep) * sf_fr(sb,kk) !mm
sfsed(1,1:nstep) = sub_ubntss(sb,1:nstep) * sf_fr(sb,kk) !tons
!total inflow to sedfils
sf_totalflw(1,:) = sf_totalflw(1,:) + sfflw(1,:) !mm
sf_totaltss(1,:) = sf_totaltss(1,:) + sfsed(1,:) !tons
if (iyr>sf_iy(sb,kk) .or.
& (iyr==sf_iy(sb,kk).and.i_mo>=sf_im(sb,kk))) then
if(sf_typ(sb,kk)==2) then !partial scale
call sand_filter(kk,sfflw,sfsed)
spqm3(:,:) = 0.
spsed(:,:)=0.
ftqm3(:,:) = sfflw(:,:) * ((sub_ha - ft_sa(sb,kk) !m3
& / 10000.) *10.)
ftsed(:,:) = sfsed(:,:) !tons
!total (aggregated) outflow from sedfils
sf_totalflw(2,:) = sf_totalflw(2,:) + sfflw(2,:)
& + sfflw(3,:) !mm
sf_totaltss(2,:) = sf_totaltss(2,:) + ftsed(2,:)
& + ftsed(3,:) !tons
elseif(sf_typ(sb,kk)==1) then !full scale
!first route through sedimentation pond
call sed_pond(kk,sfflw,sfsed)
spqm3(:,:) = sfflw(:,:) * ((sub_ha - sp_sa(sb,kk)
& / 10000.) *10.)
spsed(:,:) = sfsed(:,:)
! add bypass flow to total (aggregated) outflow
sf_totalflw(2,:) = sf_totalflw(2,:) + sfflw(3,:)
sf_totaltss(2,:) = sf_totaltss(2,:) + sfsed(3,:)
! outflow from the sedimentation basin goest to sand filter
sfflw(1,:) = sfflw(2,:)
sfsed(1,:) = sfsed(2,:)
! then the outflow from sed pond goes to sand filter
call sand_filter(kk,sfflw,sfsed)
ftqm3(:,:) = sfflw(:,:) * ((sub_ha - ft_sa(sb,kk)
& / 10000.) *10.) !m3
ftsed(:,:) = sfsed(:,:) !tons
!total (aggregated) outflow from sedfils
sf_totalflw(2,:) = sf_totalflw(2,:) + sfflw(3,:)
& + sfflw(2,:) !mm
sf_totaltss(2,:) = sf_totaltss(2,:) + sfsed(3,:)
& + sfsed(2,:) !tons
else !sedimentation pond only
call sed_pond(kk,sfflw,sfsed)
ftqm3(:,:) = 0.
ftsed(:,:)=0.
spqm3(:,:) = sfflw(:,:) * ((sub_ha - sp_sa(sb,kk)
& / 10000.) *10.)
spsed(:,:) = sfsed(:,:)
!total (aggregated) outflow from sedfils
sf_totalflw(2,:) = sf_totalflw(2,:) + sfflw(3,:)
& + sfflw(2,:)
sf_totaltss(2,:) = sf_totaltss(2,:) + sfsed(3,:)
& + sfsed(2,:)
endif
else
! skip bmp simulation before it's constructed
!total (aggregated) outflow from sedfils
sf_totalflw(2,:) = sf_totalflw(2,:) + sfflw(1,:)
sf_totaltss(2,:) = sf_totaltss(2,:) + sfsed(1,:)
endif
!print out bmp result in bmp-sedfil.out
do ii=1,nstep
write(77778,'(5i6,30f12.3)') iyr,iida,ii,sb,kk,spqm3(1,ii),
& spqm3(2,ii),spqm3(3,ii),spsed(1,ii)*1000.,spsed(2,ii)*1000.,
& spsed(3,ii)*1000.,ftqm3(1,ii),ftqm3(2,ii),ftqm3(3,ii),
& ftsed(1,ii)*1000.,ftsed(2,ii)*1000.,ftsed(3,ii)*1000.
end do
end do
endif
!---------------------------------
! retention-irrigation (RI)
if(num_ri(sb)>=1.and.hrnopcp(sb,nstep)<96) then !72 hours draw-down plus another day (24hrs)
do kk=1,num_ri(sb)
! skip the pond that has zero inflow
if (ri_fr(sb,kk)==0) cycle
!fraction urban runoff to the RI
riflw(1,1:nstep) = sub_ubnrunoff(sb,1:nstep) *
& ri_fr(sb,kk)
rised(1,1:nstep) = sub_ubntss(sb,1:nstep) * ri_fr(sb,kk)
! total inflow to RIs
ri_totalflw(1,1:nstep) = ri_totalflw(1,1:nstep)
& + riflw(1,1:nstep)
ri_totaltss(1,1:nstep) = ri_totaltss(1,1:nstep)
& + rised(1,1:nstep)
! skip bmp simulation before it's constructed
if (iyr>ri_iy(sb,kk) .or.
& (iyr==ri_iy(sb,kk).and.i_mo>=ri_im(sb,kk))) then
call ri_pond(kk,riflw,rised)
riqm3(:,:) = riflw(:,:)* ((sub_ha - sp_sa(sb,kk)
& / 10000.) *10.)
else
riflw(2,:) = riflw(1,:)
rised(2,:) = rised(1,:)
end if
do ii=1,nstep
!aggregate individual pond effluents in subbasin
ri_totalflw(2,ii) = ri_totalflw(2,ii) + riflw(2,ii)
ri_totaltss(2,ii) = ri_totaltss(2,ii) + rised(2,ii)
end do
do ii=1,nstep
write(77779,'(5i6,30f12.3)') iyr,iida,ii,sb,kk,riqm3(1,ii),
& riqm3(2,ii),riqm3(3,ii),rised(1,ii)*1000.,rised(2,ii)*1000.,
& rised(3,ii)*1000.
end do
end do
endif
! allocate bmp inflow/outflow to subbasin surface runoff volume
sub_ubnrunoff(sb,1:nstep) = sub_ubnrunoff(sb,1:nstep) -
& sf_totalflw(1,1:nstep) - ri_totalflw(1,1:nstep) +
& sf_totalflw(2,1:nstep) + ri_totalflw(2,1:nstep)
sub_ubntss(sb,1:nstep) = sub_ubntss(sb,1:nstep) -
& sf_totaltss(1,1:nstep) - ri_totaltss(1,1:nstep) +
& sf_totaltss(2,1:nstep) + ri_totaltss(2,1:nstep)
return
end