Skip to content

Commit feefcc7

Browse files
committed
update(gwf2ag1_NWT_mf.f): updates to GWF2AG7AD that create a more robust check for tabfiles/not tabfiles
* updated autotesting to use github actions * removed travis autotesting setup
1 parent bfb166d commit feefcc7

File tree

5 files changed

+81
-101
lines changed

5 files changed

+81
-101
lines changed

.travis.yml

-66
This file was deleted.

MODFLOW-NWT/src/gwf2ag1_NWT_mf.f

+53-32
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ MODULE GWFAGMODULE
9090
REAL, SAVE, DIMENSION(:), POINTER :: DEMAND, SUPACT, SUPACTOLD
9191
REAL, SAVE, DIMENSION(:), POINTER :: ACTUAL
9292
REAL, SAVE, DIMENSION(:), POINTER :: ACTUALOLD
93+
INTEGER, SAVE, POINTER :: KPEROLD
9394
END MODULE GWFAGMODULE
9495

9596
SUBROUTINE GWF2AG7AR(IN, IUNITSFR, IUNITNWT)
@@ -127,6 +128,7 @@ SUBROUTINE GWF2AG7AR(IN, IUNITSFR, IUNITNWT)
127128
ALLOCATE (TSACTIVEGWET, TSACTIVESWET, NUMSWET, NUMGWET)
128129
ALLOCATE (TSGWALLUNIT, TSGWETALLUNIT, NSEGDIMTEMP)
129130
ALLOCATE (GSFLOW_flag_local)
131+
ALLOCATE (KPEROLD)
130132
GSFLOW_flag_local = 0
131133
! IF ( GSFLOW_flag > 0 ) GSFLOW_flag_local = GSFLOW_flag
132134
VBVLAG = 0.0
@@ -174,6 +176,7 @@ SUBROUTINE GWF2AG7AR(IN, IUNITSFR, IUNITNWT)
174176
NUMIRRDIVERSION = 0
175177
NUMIRRDIVERSIONSP = 0
176178
TRIGGERFLAG = 0
179+
KPEROLD = 0
177180
!
178181
!2 - --- IDENTIFY PACKAGE AND INITIALIZE AG OPTIONS.
179182
WRITE (IOUT, 1) IN
@@ -751,9 +754,7 @@ SUBROUTINE GWF2AG7RP(IN, IUNITSFR, KPER)
751754
! - -----------------------------------------------------------------
752755
USE GLOBAL, ONLY: IOUT, NCOL, NROW, NLAY, IFREFM
753756
USE GWFAGMODULE
754-
USE GWFSFRMODULE, ONLY: ISTRM, NSTRM, NSS, SEG, NUMTAB_SFR
755-
756-
757+
USE GWFSFRMODULE, ONLY: ISTRM, NSTRM, NSS
757758
IMPLICIT NONE
758759
! - -----------------------------------------------------------------
759760
! ARGUMENTS:
@@ -1082,15 +1083,6 @@ SUBROUTINE GWF2AG7RP(IN, IUNITSFR, KPER)
10821083
ISTARTSAVE = ISTART
10831084
end if
10841085
end do
1085-
!
1086-
! Set demand to specified diversion flows in SFR.
1087-
!
1088-
DO i = 1, NUMIRRDIVERSIONSP
1089-
iseg = IRRSEG(i)
1090-
if (iseg > 0 .and. IUNITSFR > 0) then
1091-
DEMAND(ISEG) = SEG(2, ISEG)
1092-
END IF
1093-
END DO
10941086
6 FORMAT(1X, /
10951087
+ 1X, 'NO IRRDIVERSION DATA OR REUSING IRRDIVERSION DATA ',
10961088
+ 'FROM LAST STRESS PERIOD ')
@@ -1111,29 +1103,66 @@ SUBROUTINE GWF2AG7AD(IN, KPER)
11111103
! SPECIFICATIONS:
11121104
! - -----------------------------------------------------------------
11131105
USE GWFAGMODULE
1114-
USE GWFSFRMODULE, ONLY: NSS, SEG, NUMTAB_SFR
1106+
USE GWFSFRMODULE, ONLY: NSS, SEG, NUMTAB_SFR, ISFRLIST
11151107
USE GLOBAL, ONLY: IUNIT
11161108
IMPLICIT NONE
11171109
! - -----------------------------------------------------------------
11181110
! ARGUMENTS:
11191111
INTEGER, INTENT(IN)::IN, KPER
11201112
!
1121-
INTEGER ISEG, i
1113+
INTEGER ISEG, i, ii, tabseg, istab
1114+
DOUBLE PRECISION :: TOTAL
11221115
! - -----------------------------------------------------------------
11231116
!
11241117
!1 - ------RESET DEMAND IF IT CHANGES
1125-
if ( NUMTAB_SFR > 0 ) DEMAND = 0.0
1118+
if (NUMTAB_SFR.ne.0) then
1119+
DO ii = 1, NUMTAB_SFR
1120+
tabseg = ISFRLIST(1, ii)
1121+
DEMAND(tabseg) = 0.0
1122+
END DO
1123+
endif
1124+
! RESET ALL DEMAND if new stress period
1125+
if (KPEROLD.ne.KPER) then
1126+
DEMAND = 0.0
1127+
endif
1128+
TOTAL = 0.0
11261129
DO i = 1, NUMIRRDIVERSIONSP
11271130
iseg = IRRSEG(i)
1128-
if (iseg > 0 .and. IUNIT(44) > 0) then
1131+
if (iseg > 0) then
1132+
if (IUNIT(44) > 0) then
11291133
! Because SFR7AD has just been called (prior to AG7AD) and MODSIM
11301134
! has not yet overwritten values in SEG(2,x), SEG(2,x) still
11311135
! contains the TABFILE values at this point.
1132-
IF ( NUMTAB_SFR > 0 ) DEMAND(ISEG) = SEG(2, ISEG)
1133-
SUPACT(ISEG) = 0.0
1134-
ACTUAL(ISEG) = 0.0
1135-
end if
1136-
END DO
1136+
if (NUMTAB_SFR.ne.0) then
1137+
! check if this segment has a tabfile associated with it
1138+
istab = 0
1139+
DO ii = 1, NUMTAB_SFR
1140+
tabseg = ISFRLIST(1, ii)
1141+
if (iseg.eq.tabseg) then
1142+
istab = 1
1143+
endif
1144+
END DO
1145+
! update demand if there is a tabfile or if it is a new
1146+
! stress period
1147+
if ((istab.eq.1) .OR. (KPEROLD.ne.KPER)) then
1148+
DEMAND(ISEG) = SEG(2, ISEG)
1149+
endif
1150+
! update demand if this is a new stress period
1151+
elseif (KPEROLD.ne.KPER) then
1152+
DEMAND(ISEG) = SEG(2, ISEG)
1153+
endif
1154+
IF (ETDEMANDFLAG > 0) SEG(2, ISEG) = 0.0
1155+
TOTAL = TOTAL + DEMAND(ISEG)
1156+
elseif (GSFLOW_flag_local == 1) then
1157+
end if
1158+
SUPACT(ISEG) = 0.0
1159+
ACTUAL(ISEG) = 0.0
1160+
END IF
1161+
END DO
1162+
! update kperold to track new stress periods and set data accordingly
1163+
if (KPEROLD.ne.KPER) then
1164+
KPEROLD = KPEROLD + 1
1165+
endif
11371166
!2 - ------SET ALL SPECIFIED DIVERSIONS TO ZERO FOR ETDEMAND AND TRIGGER
11381167
IF (ETDEMANDFLAG > 0 .OR. TRIGGERFLAG > 0) THEN
11391168
DO i = 1, NUMSEGLIST
@@ -2359,7 +2388,7 @@ SUBROUTINE DEMANDCONJUNCTIVE_UZF(kper, kstp, kiter)
23592388
external :: set_factor
23602389
double precision :: set_factor
23612390
! ---------------------------------------------------------------------
2362-
!
2391+
!
23632392
zerod7 = 1.0d-7
23642393
done = 1.0d0
23652394
dzero = 0.0d0
@@ -2571,8 +2600,8 @@ subroutine demandtrigger_sw(kper, kstp, kiter)
25712600
SEG(2, iseg) = 0.0
25722601
if (TIMEINPERIODSEG(ISEG) > IRRPERIODSEG(ISEG)) then
25732602
if (factor <= TRIGGERPERIODSEG(ISEG)) then
2574-
SEG(2, iseg) = DEMAND(iseg)
2575-
TIMEINPERIODSEG(ISEG) = done
2603+
SEG(2, iseg) = DEMAND(iseg)
2604+
TIMEINPERIODSEG(ISEG) = 0.0
25762605
end if
25772606
end if
25782607
if (TIMEINPERIODSEG(ISEG) - DELT < IRRPERIODSEG(ISEG))
@@ -2583,10 +2612,6 @@ subroutine demandtrigger_sw(kper, kstp, kiter)
25832612
k = IDIVAR(1, ISEG)
25842613
fmaxflow = STRM(9, LASTREACH(K))
25852614
IF (SEG(2, iseg) > fmaxflow) SEG(2, iseg) = fmaxflow
2586-
!
2587-
write(999,121)kper,kstp,kiter,factor,aetseg(iseg),petseg(iseg),
2588-
+ SEG(2, iseg),TIMEINPERIODSEG(ISEG)
2589-
121 format(3i5,5e20.10)
25902615
300 continue
25912616
deallocate (petseg, aetseg)
25922617
return
@@ -2810,10 +2835,6 @@ double precision function set_factor(l,aetold, pettotal,
28102835
if( factor > accel*etdif ) factor = accel*etdif
28112836
if( factor < etdif ) factor = etdif
28122837
if( factor < dzero ) factor = dzero
2813-
! open(222,file='debug.out')
2814-
! if(l==207)write(222,333)kiter,pettotal,aettotal,dq,det,aettotal,
2815-
! +aetold,factor
2816-
!333 format(i5,7e20.10)
28172838
set_factor = factor
28182839
end function set_factor
28192840
!

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# mfnwt
2-
[![Build Status](https://travis-ci.com/rniswon/mfnwt.svg?token=vEKgKzYeJvd2ZaJyNFiH&branch=develop)](https://travis-ci.com/rniswon/mfnwt)
2+
[![GSFLOW CI](https://github.com/rniswon/mfnwt/actions/workflows/ci.yml/badge.svg)](https://github.com/rniswon/mfnwt/actions/workflows/ci.yml)
33
MODFLOW-NWT - Version: 1.1.0
44
Newton Formulation for MODFLOW-2005
55

autotest/make_gfortran.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ def cleanup(srcdir, tempdir):
4949

5050
#call main -- note that this form allows main to be called
5151
#from python as a function.
52+
fflags = "--static " + "-ffree-line-length-512 " + "-ffixed-line-length-132 " + "-Wuninitialized " + "-O2"
5253
try:
54+
syslibs="-lc"
5355
pymake.main(srcdir, args.target, args.fc, args.cc, args.makeclean,
5456
args.expedite, args.dryrun, False, args.debug,
55-
args.subdirs, "--static", syslibs="-lc", arch=args.arch,
57+
args.subdirs, fflags, arch=args.arch,
5658
makefile=args.makefile)
5759
except AttributeError:
5860
pymake.main(srcdir, args.target, args.fc, args.cc, args.makeclean,
5961
args.expedite, args.dryrun, False, args.debug,
60-
args.subdirs, "--static", arch=args.arch,
62+
args.subdirs, fflags, arch=args.arch,
6163
makefile=args.makefile)
6264

6365
shutil.rmtree(srcdir)

etc/environment.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: mfnwt
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- numpy
6+
- pandas
7+
- pyshp
8+
- pycrs
9+
- matplotlib
10+
- coverage
11+
- appdirs
12+
- requests
13+
- affine
14+
- scipy
15+
- pandas
16+
- netcdf4
17+
- rasterio
18+
- fiona
19+
- descartes
20+
- pyproj
21+
- shapely
22+
- pycrs
23+
- geos=3.8.1

0 commit comments

Comments
 (0)