Skip to content

Commit e67b7c9

Browse files
committed
Merge from 2012rev681
2 parents b8164ff + 152db7a commit e67b7c9

30 files changed

+225
-156
lines changed

VERSIONS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
VERSION_MAJOR 2012
2-
VERSION_MINOR 670
2+
VERSION_MINOR 681
33
VERSION_PATCH

src/apex_day.f

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ subroutine apex_day
119119
!! changes for Mike Winchell if apex.swt files has a different start date than the SWAT run
120120
if (ifirsta(inum1) == 1) then
121121
do
122-
read (112+inum1,*) idapa(inum1), iypa(inum1), flodaya(inum1),
122+
read (400+inum1,*) idapa(inum1), iypa(inum1), flodaya(inum1),
123123
& seddaya(inum1), orgndaya(inum1), orgpdaya(inum1), no3daya(inum1),
124124
& minpdaya(inum1)
125125
if(idapa(inum1) == id1 .and. iypa(inum1) == iyr) exit
@@ -149,7 +149,7 @@ subroutine apex_day
149149
varoute(21,ihout) = 0.0
150150
varoute(22,ihout) = 0.0
151151
if (curyr /= nbyr .and. iida /= idal) then
152-
read (112+inum1,*) idapa(inum1), iypa(inum1), flodaya(inum1),
152+
read (400+inum1,*) idapa(inum1), iypa(inum1), flodaya(inum1),
153153
& seddaya(inum1), orgndaya(inum1), orgpdaya(inum1), no3daya(inum1),
154154
& minpdaya(inum1)
155155
endif

src/carbon_new.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ real*8 Function fnetmin(poold, R1, R2, hc, dummy, poolm, xinorg, cc1)
238238
else
239239
NPsoil = (sol_mass * sol_n(k,j) / 100.)/ sol_orgp(k,j)
240240
end if
241-
sol_orgp(k,j) = dmin1(sol_orgp(k,j), 25.)
241+
!sol_orgp(k,j) = dmin1(sol_orgp(k,j), 25.) !commented 110118 Armen K
242242
CPsoil = CNsoil * NPsoil
243243

244244
if (sol_rsd(k,j) > 0.00001) then

src/command.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ subroutine command
169169
case (13)
170170
call apex_day
171171
case (14)
172-
call saveconc
172+
if (curyr > nyskip) call saveconc
173173
case (17)
174174
call routeunit
175175
call sumhyd

src/filter.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ subroutine filter
313313
if (remove1 > 100.) remove1 = 100.
314314
if (remove1 < 0.) remove1 = 0.
315315

316-
remove21 = 29.3 + 0.51 * surq_remove2
316+
remove2 = 29.3 + 0.51 * surq_remove2
317317
if (remove2 > 100.) remove2 = 100.
318318
if (remove2 < 0.) remove2 = 0.
319319

src/hhnoqual.f

+4-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ subroutine hhnoqual
157157
cbodcon = 0.
158158
o2con = 0.
159159
wtrtot = wtrin + hrchwtr(ii)
160-
if (ii == 1) then
160+
if (wtrtot > 0.01) then
161+
if (ii == 1) then
161162
algcon = (algin * wtrin + algae(jrch) * hrchwtr(ii)) / wtrtot
162163
orgncon = (orgnin * wtrin + organicn(jrch) * hrchwtr(ii))
163164
& / wtrtot
@@ -185,9 +186,10 @@ subroutine hhnoqual
185186
solpcon = (dispin * wtrin + hsolp(ii-1) * hrchwtr(ii)) / wtrtot
186187
cbodcon = (cbodin * wtrin + hbod(ii-1) * hrchwtr(ii)) / wtrtot
187188
o2con = (disoxin * wtrin + hdisox(ii-1) * hrchwtr(ii)) / wtrtot
189+
end if
188190
end if
189191

190-
if (algcon < 1.e-6) algon = 0.0
192+
if (algcon < 1.e-6) algcon = 0.0
191193
if (orgncon < 1.e-6) orgncon = 0.0
192194
if (nh3con < 1.e-6) nh3con = 0.0
193195
if (no2con < 1.e-6) no2con = 0.0

src/hhwatqual.f

+6-5
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ subroutine hhwatqual
241241
wtrin = 0.
242242
wtrin = hhvaroute(2,inum2,ii) * (1. - rnum1)
243243

244-
if (hrtwtr(ii) / (idt * 60.) > 0.01) then
244+
if (hrtwtr(ii) / (idt * 60.) > 0.01.and.hdepth(ii) > 0.01) then
245245
!! concentrations
246246
!! initialize inflow concentrations
247247
chlin = 0.
@@ -275,7 +275,7 @@ subroutine hhwatqual
275275
if (ammoin < 1.e-6) ammoin = 0.0
276276
if (nitritin < 1.e-6) nitritin = 0.0
277277
if (nitratin < 1.e-6) nitratin = 0.0
278-
if (orgnpin < 1.e-6) orgnpin = 0.0
278+
if (orgpin < 1.e-6) orgpin = 0.0
279279
if (dispin < 1.e-6) dispin = 0.0
280280
if (cbodin < 1.e-6) cbodin = 0.0
281281
if (disoxin < 1.e-6) disoxin = 0.0
@@ -292,7 +292,8 @@ subroutine hhwatqual
292292
cbodcon = 0.
293293
o2con = 0.
294294
wtrtot = wtrin + hrchwtr(ii)
295-
if (ii == 1) then
295+
if (wtrtot > 0.01) then
296+
if (ii == 1) then
296297
algcon = (algin * wtrin + algae(jrch) * hrchwtr(ii)) / wtrtot
297298
orgncon = (orgnin * wtrin + organicn(jrch) * hrchwtr(ii))
298299
& / wtrtot
@@ -320,8 +321,8 @@ subroutine hhwatqual
320321
solpcon = (dispin * wtrin + hsolp(ii-1) * hrchwtr(ii)) / wtrtot
321322
cbodcon = (cbodin * wtrin + hbod(ii-1) * hrchwtr(ii)) / wtrtot
322323
o2con = (disoxin * wtrin + hdisox(ii-1) * hrchwtr(ii)) / wtrtot
323-
end if
324-
324+
end if
325+
endif
325326
if (algcon < 1.e-6) algcon = 0.0
326327
if (orgncon < 1.e-6) orgncon = 0.0
327328
if (nh3con < 1.e-6) nh3con = 0.0

src/hmeas.f

+5-4
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ subroutine hmeas
103103
end do
104104

105105
return
106-
! 5200 format (7x,300f8.3)
107-
! 5300 format (i4,i3,300f8.3)
108-
5200 format (7x,1800f8.3)
109-
5300 format (i4,i3,1800f8.3)
106+
107+
!5200 format (7x,1800f8.3)
108+
!5300 format (i4,i3,1800f8.3)
109+
5200 format (7x,1900f8.3) !! for Pouya
110+
5300 format (i4,i3,1900f8.3) !! for Pouya
110111
end

src/main.f

+5-3
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ program main
4747

4848
use parm
4949
implicit none
50-
prog = "SWAT Sep 7 VER 2018/Rev 670"
50+
prog = "SWAT May 26 VER 2020/Rev 681"
5151
write (*,1000)
52-
1000 format(1x," SWAT2018 ",/,
53-
& " Rev. 670 ",/,
52+
1000 format(1x," SWAT2020 ",/,
53+
& " Rev. 681 ",/,
5454
& " Soil & Water Assessment Tool ",/,
5555
& " PC Version ",/,
5656
& " Program reading from file.cio . . . executing",/)
@@ -77,6 +77,8 @@ program main
7777
call std2
7878
call openwth
7979
call headout
80+
81+
!call sw_init
8082

8183
!! convert integer to string for output.mgt file
8284
subnum = ""

src/nrain.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ subroutine nrain
6969
no3pcp = .01 * rcn_d(hru_sub(j)) * precipday
7070
sol_nh3(2,j) = sol_nh3(2,j) + nh3pcp +
7171
& drydep_nh4_d(hru_sub(j))
72-
sol_no3(2,j) = sol_no3(2,j) + no2pcp +
72+
sol_no3(2,j) = sol_no3(2,j) + no3pcp +
7373
& drydep_no3_d(hru_sub(j))
7474
end select
7575

src/openwth.f

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ subroutine openwth
9393

9494
if (slrfile /= ' ') then
9595
!! open (137,file=slrfile,recl=800)
96-
open (137,file=slrfile,recl=15000)
96+
open (137,file=slrfile,recl=16000)
9797
read (137,5000) titldum
9898
end if
9999

100100
if (rhfile /= ' ') then
101101
!! open (138,file=rhfile,recl=800)
102-
open (138,file=rhfile,recl=15000)
102+
open (138,file=rhfile,recl=16000)
103103
read (138,5000) titldum
104104
end if
105105

106106
if (wndfile /= ' ') then
107107
!! open (139,file=wndfile,recl=800)
108-
open (139,file=wndfile,recl=15000)
108+
open (139,file=wndfile,recl=16000)
109109
read (139,5000) titldum
110110
end if
111111

src/potholehr.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ subroutine potholehr()
444444
if (iprint==3) then
445445
write (125,2000)i,j,curyr,k,pot_vol(j),potsa(j),spillo,potsep,
446446
& potev,sol_sw(j),potpcpmm,potflwi(j) / cnv,
447-
& potsedi(j) / hru_ha(j),potflow,potsedo / hru_ha(j)
447+
& potsedi(j) / hru_ha(j),potflwo,potsedo / hru_ha(j)
448448
endif
449449
450450
if (pot_vol(j) > 1.e-6) then

src/readatmodep.f

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ subroutine readatmodep
4343
if (atmofile /= ' ') then
4444
open (127,file=atmofile)
4545
do iii = 1, 5
46-
read (127,*) titldum
46+
read (127,5101) titldum
4747
end do
4848
else
4949
!! no filename present in file.cio - set defaults
@@ -89,6 +89,6 @@ subroutine readatmodep
8989
!1001 format (3i6)
9090
!1002 format (1200f10.3)
9191
!1000 format (8x,4f10.3)
92-
!5101 format (a80)
92+
5101 format (a80)
9393
return
9494
end

src/readfig.f

+3-3
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ subroutine readfig
325325
call caps(apex_in)
326326
! i = 0
327327
! i = inum1s(idum)
328-
open (112+inum1s(idum),file=apex_in,recl=350)
329-
do ii = 1, 10
330-
read (112+inum1s(idum),5200) titldum
328+
open (400+inum1s(idum),file=apex_in,recl=350)
329+
do ii = 1, 9
330+
read (400+inum1s(idum),5200) titldum
331331
end do
332332
!! code to read from apex output file
333333

src/readops.f

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ subroutine readops
9595
do
9696
mon = 0
9797
day = 0
98-
year = 0.
98+
iyear = 0.
9999
mgt_op = 0
100100
mgt1i = 0
101101
mgt2i = 0
@@ -203,7 +203,7 @@ subroutine readops
203203
ro_bmp_flos(iops,ihru) = mgt10 !! Flow
204204
ro_bmp_seds(iops,ihru) = mgt11 !! Sediment
205205
ro_bmp_pps(iops,ihru) = mgt12 !! Particulate P
206-
ro_bmp_sps(iops,ihru) = mg13 !! Soluble P
206+
ro_bmp_sps(iops,ihru) = mgt13 !! Soluble P
207207
ro_bmp_pns(iops,ihru) = mgt14 !! Particulate N
208208
ro_bmp_sns(iops,ihru) = mgt15 !! Soluble N
209209
ro_bmp_bacs(iops,ihru) = mgt16 !! Bacteria

src/readpnd.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ subroutine readpnd
276276
read (104,5100,iostat=eof) titldum
277277
if (eof < 0) exit
278278
if (titldum == ' '.or.titldum == 'Inputs used in')then
279-
vselsetlpnd = 10.0
279+
velsetlpnd = 10.0
280280
else
281281
backspace 104
282282
read (104,*,iostat=eof) pnd_d50

src/rechour.f

+3
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ subroutine rechour
195195
varoute(27,ihout) = varoute(27,ihout) + sedhr * 0. ! lag
196196
varoute(28,ihout) = 0. ! gravel
197197

198+
199+
QHY(ii,ihout,IHX(1)) = hhvaroute(2,ihout,ii) / (dthy * 3600.) !added by Jaehak for subdaily routing, 2019
200+
198201
end do
199202

200203
return

src/route.f

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ subroutine route
136136
if (ievent > 0) then
137137
do ii = 1, nstep
138138
hrtwtr(ii) = hrtwtr(ii) + qdbank / dfloat(nstep)
139+
hsdti(ii) = max(0.,hrtwtr(ii) / (dthy * 3600.)) !m3 -> m3/s
139140
end do
140141
end if
141142

src/rtday.f

-4
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,9 @@ subroutine rtday
159159
!! calculate volume of water leaving reach on day
160160
scoef = 0.
161161
rtwtr = 0.
162-
!scoef = 2. * det / (2. * rttime + det)
163162
scoef = det / (rttime + det)
164163
if (scoef > 1.) scoef = 1.
165164
rtwtr = scoef * (wtrin + rchstor(jrch))
166-
!new storage coefficient replacement
167-
rtwtr = vc * rcharea * 86400.
168-
rtwtr = dmin1 (rtwtr, wtrin)
169165
170166
!! calculate amount of water in channel at end of day
171167
rchstor(jrch) = rchstor(jrch) + wtrin - rtwtr

src/rthmusk.f

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ subroutine rthmusk
124124
125125
jrch = 0
126126
jrch = inum1
127+
hrtevp = 0
127128
128129
!! Compute storage time constant for reach
129130
xkm = 0.

0 commit comments

Comments
 (0)