Skip to content

Commit fe20e9e

Browse files
committed
Merge tag 'rev585_vanilla'
2 parents 1969634 + b9c121e commit fe20e9e

25 files changed

+192
-247
lines changed

src/allocate_parms.f

+3-3
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ subroutine allocate_parms
355355
allocate (fcst_reg(msub))
356356
allocate (harg_petco(msub))
357357
! allocate (hqd(nstep*3+1)) !! was 73, changed for urban
358-
allocate (hqdsave(msub,nstep*2)) !! was 49, changed for urban -> changed to 2d array J.Jeong 4/17/2009
359-
allocate (hsdsave(msub,nstep*2)) !! J.Jeong 4/22/2009
358+
allocate (hqdsave(msub,nstep*4)) !! was 49, changed for urban -> changed to 2d array J.Jeong 4/17/2009
359+
allocate (hsdsave(msub,nstep*4)) !! J.Jeong 4/22/2009
360360
!! allocate (hqd(73))
361361
!! allocate (hqdsave(msub,49))
362362
allocate (hru1(msub))
@@ -1184,7 +1184,7 @@ subroutine allocate_parms
11841184
allocate (qdayout(mhru))
11851185
allocate (rch_dakm(mxsubch))
11861186
allocate (rchrg(mhru))
1187-
allocate (rchrg_n(mhru))
1187+
allocate (rchrg_n(mhru)) !! amount of nitrate getting to the shallow aquifer
11881188
allocate (rchrg_dp(mhru))
11891189
allocate (re(mhru))
11901190
allocate (revapmn(mhru))

src/bmp_det_pond.f

+80-81
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ subroutine det_pond
6868
qpnd = dtp_ivol(sb) !m^3
6969
sedpnd = dtp_ised(sb) !tons
7070

71+
! Storage capacity under addon
72+
qaddon = (dtp_addon(sb,1) / dtp_parm(sb)) ** 3.
73+
& / (3.*ch_s(2,sb)) * pi !m3
74+
7175
!! iterate for subdaily flow/sediment routing
7276
do ii=1,nstep
7377

74-
qout = 0.; qovmax = 0
78+
qout = 0.; qovmax = 0; depaddon = 0.
7579
qin = hhvaroute(2,ihout,ii) + qpnd !m^3
7680
sedin = hhvaroute(3,ihout,ii) + sedpnd !tons
7781
if (qin>1e-6) then
@@ -86,92 +90,87 @@ subroutine det_pond
8690
!! skip to next time step if no ponding occurs
8791
if (qdepth<=0.0001) cycle
8892

89-
!! Calculate weir outflow
90-
do k=1,dtp_numstage(sb)
93+
if (dtp_stagdis(sb)==0) then
94+
!! Calculate weir outflow
95+
do k = 1, dtp_numstage(sb)
9196
qstage = 0.
92-
! height to the top of addon from bottom
93-
depaddon = depaddon + dtp_addon(sb,k)
94-
if (k>1) depaddon = depaddon + dtp_depweir(sb,k-1)
95-
! volume below the current stage addon
96-
qaddon = (depaddon / dtp_parm(sb)) ** 3.
97-
& / (3.*ch_s(2,sb)) * pi !m3
98-
99-
!! Circular weir ?
100-
if (dtp_weirtype(sb,k)==2) then
101-
dtp_depweir(sb,k) = dtp_diaweir(sb,k) + dtp_addon(sb,k)
102-
end if
103-
104-
!! Fully submerged
105-
if (qdepth>dtp_depweir(sb,k)) then
106-
qdepth = qdepth - dtp_depweir(sb,k)
107-
if (dtp_weirtype(sb,k)==1) then
108-
watdepact = qdepth + dtp_depweir(sb,k) / 2
109-
warea = dtp_depweir(sb,k) * dtp_wrwid(sb,k)
110-
else
97+
98+
!! calculate weir discharge
99+
100+
if (dtp_weirtype(sb,k)==2) then
101+
!! Circular weir
102+
dtp_depweir(sb,k) = dtp_diaweir(sb,k) + dtp_addon(sb,k)
103+
104+
if (qdepth>dtp_depweir(sb,k)) then
105+
!! Fully submerged
106+
qdepth = qdepth - dtp_depweir(sb,k)
111107
watdepact = qdepth + dtp_diaweir(sb,k) / 2
112108
warea = 3.14159 * dtp_diaweir(sb,k) ** 2 / 4.
113-
end if
114-
115-
!! Estimate discharge using orifice equation
116-
qstage = dtp_cdis(sb,k) * 0.6 * warea *
117-
& sqrt(19.6 * watdepact) !m3/s/unit
118-
qstage = qstage * dtp_numweir(sb) * 60. * idt !m^3
119-
!Limit total outflow amount less than available water above addon
120-
if(qin-qstage<qaddon) qstage = qin - qaddon
121-
122-
!! Flow over the emergency weir
123-
if (k==dtp_numstage(sb)) then
124-
qstage = qstage + dtp_cdis(sb,k) * 1.84 *
125-
& dtp_totwrwid(sb) * (qdepth ** 1.5) * 60. * idt !m3/s
126-
end if
127-
qout = qout + qstage
128-
129-
!! Partially submerged
130-
else
131-
watdepact = qdepth - dtp_addon(sb,k) !! look for add on
132-
if (watdepact<0) watdepact = 0. !! created for add on
133-
if (dtp_weirtype(sb,k)==2) then
134-
dtp_wrwid(sb,k) = dtp_diaweir(sb,k) * 0.667
135-
end if
136-
!! Estimate weir/orifice discharge
137-
qstage = dtp_cdis(sb,k) * 1.84 * dtp_wrwid(sb,k) *
109+
110+
!! orifice equation
111+
qstage = dtp_cdis(sb,k) * 0.6 * warea *
112+
& sqrt(19.6 * watdepact) !m3/s/unit
113+
qstage = qstage * dtp_numweir(sb) * 60. * idt !m^3
114+
else
115+
!! Partially submerged
116+
watdepact = max(qdepth - dtp_addon(sb,k),0.)
117+
dtp_wrwid(sb,k) = dtp_diaweir(sb,k) * 0.667
118+
119+
!! weir/orifice discharge
120+
qstage = dtp_cdis(sb,k) * 1.84 * dtp_wrwid(sb,k) *
121+
& watdepact ** 1.5 !m3/s
122+
qstage = qstage * dtp_numweir(sb) * 60. * idt !m^3
123+
end if
124+
125+
else
126+
!! Rectangular weir
127+
watdepact = max(qdepth - dtp_addon(sb,k),0.)
128+
129+
!! Estimate weir/orifice discharge
130+
qstage = dtp_cdis(sb,k) * 1.84 * dtp_wrwid(sb,k) *
138131
& watdepact ** 1.5 !m3/s
139-
qstage = qstage * dtp_numweir(sb) * 60. * idt !m^3
140-
141-
!Limit total outflow amount less than available water above addon
142-
if(qin-qstage<qaddon) qstage = qin - qaddon
143-
144-
! Limit overflow amount to the volume above add-on level
145-
if(qin>qaddon) qovmax = qin - qaddon
146-
if(qstage>qovmax) qstage = qovmax
147-
148-
!! Use stage-discharge relationship if available
149-
if (dtp_stagdis(sb)==1) then
150-
select case(dtp_reltype(sb))
151-
case(1) !! 1 is exponential function
152-
qstage = dtp_coef1(sb) * exp(dtp_expont(sb) * qdepth) +
153-
& dtp_intcept(sb)
154-
case(2) !! 2 is Linear function
155-
qstage = dtp_coef1(sb) * qdepth + dtp_intcept(sb)
156-
case(3) !! 3 is logarthmic function
157-
qstage = dtp_coef1(sb) * log(qdepth) + dtp_intcept(sb)
158-
case(4) !! 4 is power function
159-
qstage = dtp_coef1(sb) * (qdepth**3) + dtp_coef2(sb) *
160-
& (qdepth**2) + dtp_coef3(sb) * qdepth + dtp_intcept(sb)
161-
case(5)
162-
qstage = dtp_coef1(sb)*(qdepth**dtp_expont(sb))+
163-
& dtp_intcept(sb)
164-
end select
165-
qstage = qstage * 60. * idt
166-
end if !! end of stage-discharge calculation
167-
qout = qout + qstage
168-
exit
169-
end if
132+
qstage = qstage * dtp_numweir(sb) * 60. * idt !m^3
133+
134+
end if
170135

171-
172-
end do !! End of weir discharge calculations
136+
qout = qout + qstage
137+
end do
138+
139+
!Limit total outflow amount less than available water above addon
140+
if(qout>qin-qaddon) qout = max(qin - qaddon,0.)
141+
142+
!! Flow over the emergency weir
143+
watdepact = qdepth - (dtp_depweir(sb,1) + dtp_addon(sb,1))
144+
if (dtp_weirtype(sb,k)==1 .and. watdepact>0.) then
145+
qstage = dtp_cdis(sb,k) * 1.84 *
146+
& dtp_totwrwid(sb) * (watdepact ** 1.5) * 60. * idt !m3/s
147+
qout = qout + qstage
148+
end if
173149

174-
!! Check mss balance for flow
150+
151+
else
152+
!! Use stage-discharge relationship if available
153+
if (dtp_stagdis(sb)==1) then
154+
select case(dtp_reltype(sb))
155+
case(1) !! 1 is exponential function
156+
qout = dtp_coef1(sb) * exp(dtp_expont(sb) * qdepth) +
157+
& dtp_intcept(sb)
158+
case(2) !! 2 is Linear function
159+
qout = dtp_coef1(sb) * qdepth + dtp_intcept(sb)
160+
case(3) !! 3 is logarthmic function
161+
qout = dtp_coef1(sb) * log(qdepth) + dtp_intcept(sb)
162+
case(4) !! 4 is power function
163+
qout = dtp_coef1(sb) * (qdepth**3) + dtp_coef2(sb) *
164+
& (qdepth**2) + dtp_coef3(sb) * qdepth + dtp_intcept(sb)
165+
case(5)
166+
qout = dtp_coef1(sb)*(qdepth**dtp_expont(sb))+
167+
& dtp_intcept(sb)
168+
end select
169+
qout = qout * 60. * idt
170+
end if !! end of stage-discharge calculation
171+
end if
172+
173+
!! Check mass balance for flow
175174
if (qout>qin) then !no detention occurs
176175
qout = qin
177176
qpnd = 0.

src/bmp_sand_filter.f

+6-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ subroutine sand_filter(kk,flw,sed)
3838
& wetfsh,whd,sub_ha,dt,qcms,effct,effl,effg,effbr,vpipe,phead,hpnd,
3939
& tmpw,qloss,fsat,qpipe,mu,pipeflow,splw,hweir,tst,kb,qintns,qq,
4040
& qfiltr,sloss,spndconc,sedpnd,qpndi,qpnde,sedrmeff,sed_removed,
41-
& sedconc,qevap
41+
& sedconc,qevap,hrd
4242
real*8, dimension(:) :: qpnd(0:nstep),qsw(0:nstep),qin(0:nstep),
4343
& qout(0:nstep),fc(0:nstep),f(0:nstep)
4444
real, dimension(3,0:nstep), intent(inout) :: flw, sed
@@ -164,8 +164,9 @@ subroutine sand_filter(kk,flw,sed)
164164

165165
!soil water no more than saturation
166166
if (qsw(ii) > vfiltr) then
167-
qout(ii) = ksat * dt / 1000. * tsa * ffsa !m3
168-
qsw(ii) = vfiltr
167+
hrd = qsw(ii) / vfiltr
168+
qout(ii) = ksat * hrd * dt / 1000. * tsa * ffsa !m3
169+
qsw(ii) = qsw(ii) - qout(ii)
169170
qpnd(ii) = qpndi - qsw(ii) - qout(ii)
170171
else
171172
if (qpnd(ii)>=qpnd(ii-1).and.qout(ii-1)<0.001) then
@@ -243,7 +244,8 @@ subroutine sand_filter(kk,flw,sed)
243244
flw(3,ii) = qloss / (sub_ha *10000. - tsa) * 1000. !mm
244245

245246
Endif
246-
247+
! write(*,'(2i3,20f7.3)') iida, ii, qin(ii),qout(ii),qpnd(ii),
248+
! & qsw(ii),qloss
247249
!--------------------------------------------------------------------------------------
248250
! TSS removal
249251
sloss = 0.; sedrmeff = 0.

src/bmp_sed_pond.f

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ subroutine sed_pond(kk,flw,sed)
3535
real*8 :: tsa,mxvol,pdia,ksat,dp,sub_ha,mxh,hweir,phead,pipeflow
3636
real*8 :: qin,qout,qpnd,qpndi,sweir,spndconc,sedpnde,sedpndi,hpnd
3737
real*8 :: qweir, qtrns,qpipe,splw,sedconcweir,td,ksed,qevap
38-
real, dimension(3,nstep), intent(inout) :: flw, sed
38+
real, dimension(3,0:nstep), intent(inout) :: flw, sed
3939

4040
sb = inum1
4141
sub_ha = da_ha * sub_fr(sb)
@@ -72,7 +72,7 @@ subroutine sed_pond(kk,flw,sed)
7272
If (hpnd > mxh) Then
7373
hweir = max(0.,hpnd - mxh) !water depth over weir crest, m
7474
!weir overflow, m^3
75-
qweir = 1.8 * (splw - 0.2 * hweir) * hweir ** 1.5 *
75+
qweir = 3.33 * splw * hweir ** 1.5 *
7676
& idt * 60.
7777
hpnd = max(0.,(qpndi - qweir) / tsa) !m
7878
!overflow amount is no larger than surplus water above spillway height
@@ -105,11 +105,11 @@ subroutine sed_pond(kk,flw,sed)
105105
!Outflow through orifice pipe
106106
hpnd = qpnd / tsa !m
107107
phead = max(0.,hpnd * 1000. - pdia / 2.) !mm
108-
If (phead>pdia/2.) then
108+
! If (phead>pdia/2.) then
109109
qpipe = pipeflow(pdia,phead) * idt *60. !m^3
110-
else
111-
qpipe = qpnd * 0.1
112-
endif
110+
! else
111+
! qpipe = qout * 0.9
112+
! endif
113113

114114
!update out flow, m^3
115115
qout = qpipe

src/bmpinit.f

+25-20
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ subroutine bmpinit
7575
if (dtp_iyr(i)<=1000) dtp_iyr(i) = iyr
7676
if (dtp_evrsv(i)<=0) dtp_evrsv(i) = 0.1
7777
if (dtp_numweir(i)<=0) dtp_numweir(i) = 1
78-
if (dtp_numstage(i)<=0) dtp_numstage(i) = 2
78+
if (dtp_numstage(i)<=0) dtp_numstage(i) = 1
79+
if (dtp_numstage(i)>1) then
80+
do k=2,dtp_numstage(i)
81+
if (dtp_weirtype(i,k)==1) dtp_addon(i,k) = 0.
82+
end do
83+
endif
7984

80-
!! Estimating emergency spillway volumes if not entered by user
85+
!! Estimating design flow rate if not entered by user
8186
do k=1,dtp_numstage(i)
8287
if (dtp_flowrate(i,k)<=0.0) then
8388
dtp_flowrate(i,k) = 0.5 * 1000.0 * dtp_pcpret(i,k)
@@ -92,10 +97,9 @@ subroutine bmpinit
9297
end if
9398
end do
9499

95-
!! Separate cumulative flow information to individual weir stages
100+
!! Separate cumulative flow information to individual weir
96101
do k=2,dtp_numstage(i)
97-
dtp_flowrate(i,k) = (dtp_flowrate(i,k)
98-
& - sum(dtp_flowrate(i,1:k-1))) / dtp_numweir(i)
102+
dtp_flowrate(i,k) = dtp_flowrate(i,k) / dtp_numweir(i)
99103
end do
100104

101105
!!Estimate weir dimensions based on existing data
@@ -108,12 +112,22 @@ subroutine bmpinit
108112
call est_weirdim(dtp_wdratio(i,k),dtp_flowrate(i,k)
109113
& ,dtp_wrwid(i,k),dtp_depweir(i,k),dtp_cdis(i,k))
110114
end if
111-
else
112-
if (dtp_weirtype(i,k)==1) then !! reading user-entered data
115+
else !! read user-entered data
116+
if (dtp_weirtype(i,k)==1) then
113117
dtp_wrwid(i,k) = dtp_wdratio(i,k) * dtp_depweir(i,k)
114118
end if
115119
end if
116120
end do
121+
122+
!! divide rectangular weirs into multiple single stage weirs
123+
do k = 2, dtp_numstage(i)
124+
dtp_addon(i,k) = dtp_addon(i,k-1) + dtp_depweir(i,k-1)
125+
end do
126+
127+
do k = dtp_numstage(i), 2, -1
128+
dtp_wrwid(i,k) = dtp_wrwid(i,k) - dtp_wrwid(i,k-1)
129+
dtp_depweir(i,k-1) = dtp_depweir(i,k) + dtp_depweir(i,k-1)
130+
end do
117131
end if
118132

119133
!! Wet pond
@@ -230,8 +244,8 @@ subroutine bmpinit
230244
wqv = hwq / 12. * sub_ha_urb(i) * sf_fr(i,k) * 107639.104167 !ft3
231245
232246
if (sf_dim(i,k)==0) then
233-
write(77778,'(a46)') 'This SED-FIL size is automatically
234-
& estimated'
247+
write(77778,'(a46)') 'This SED-FIL size is automatically'
248+
& // ' estimated based on WQV.'
235249
!Determine pond size automatically based on City of Austin's Design Guideline 1.6
236250
if (sf_typ(i,k)==1.or.sf_typ(i,k)==3) then
237251
! full scale or sedimentation basin only
@@ -248,6 +262,7 @@ subroutine bmpinit
248262
! wqv/(4.+1.33*4.) * 0.093
249263

250264
end if
265+
sp_bpw(i,k) = 10. !m overflow weir width
251266
ft_pd(i,k) = 1524. !mm
252267
ft_dep(i,k) = 420. !mm
253268
ft_h(i,k) = 1200. !mm
@@ -285,17 +300,7 @@ subroutine bmpinit
285300

286301
!Orifice pipe for sand filter should be equal or larger than
287302
!sedimentation pond outlet pipe for full-type SedFils
288-
if (ft_pd(i,k)<sp_pd(i,k)) then
289-
write (*,*) " "
290-
write (*,*) "Urban BMP Warning!!"
291-
write (*,*) "In subbasin ", i
292-
write (*,*) "The outlet pipe diameter for sandfilter is"
293-
write (*,*) " larger than that for sedimentation basin."
294-
write (*,*) "The filter pipe diameter was automatically"
295-
write (*,*) "corrected to the pipe size of the "
296-
write (*,*) "sedimentation basin."
297-
ft_pd(i,k) = sp_pd(i,k)
298-
endif
303+
if (ft_pd(i,k)<sp_pd(i,k)) ft_pd(i,k) = sp_pd(i,k)
299304

300305
if (ft_dep(i,k)<100) ft_dep(i,k) = 100.
301306
if (sf_ptp(i,k)>1) sf_ptp(i,k) = 1

0 commit comments

Comments
 (0)