Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mtssm): fix assumption that transient NSS data appears in first stress period #756

Merged
merged 66 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
a26832b
Explicit cast to np.array isn't preserved
emorway-usgs Aug 27, 2018
1bc1655
Fixes issue in LAK package _init_ routines when only a single lake is…
emorway-usgs Aug 27, 2018
1c28f66
Previous alteration worked for one lake, but didn't handle one stage …
emorway-usgs Aug 27, 2018
0b6a62e
Fix mis-statement
emorway-usgs Aug 29, 2018
c7c65e3
Merge branch 'develop' of github.com:modflowpy/flopy into develop
emorway-usgs Aug 29, 2018
7a9c37d
Merge branch 'develop' of github.com:modflowpy/flopy into develop
emorway-usgs Aug 30, 2018
b51cb22
LMT: Lacking support for keyword 'ALL' following Package_Flows keyword
emorway-usgs Aug 30, 2018
9ddafd1
Add precision for variable thkmin
emorway-usgs Aug 30, 2018
47d8fc2
PERLEN variable getting trucated by use of "G" (general form) when nu…
emorway-usgs Aug 30, 2018
f41a419
Switching printing of PERLEN in BTN from 10.6G to 10G
emorway-usgs Sep 5, 2018
66f137d
Merge branch 'develop' of github.com:modflowpy/flopy into develop
emorway-usgs Sep 5, 2018
c439d8f
Merge branch 'develop' of github.com:modflowpy/flopy into develop
emorway-usgs Oct 7, 2018
69c38a0
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 12, 2018
7fd67ef
Fix for issue #402 including a new test for checking mtlkt.py
emorway-usgs Oct 12, 2018
2a0fd4a
Remove apostrophe from comment (interferes with Travis build)
emorway-usgs Oct 12, 2018
fa15469
Rename test, another recent commit had the same name
emorway-usgs Oct 12, 2018
029a7d5
Remove argument from call to test
emorway-usgs Oct 12, 2018
c02f6c4
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 13, 2018
deb2336
Adding new example notebook for MT3D-USGS that uses SFT, LKT, and UZT…
emorway-usgs Oct 13, 2018
060c2a3
Fixed a typo, added link for docs/notebook_examples.md in a reasonabl…
emorway-usgs Oct 13, 2018
0fdf302
An errant capital letter in the new notebook, switched to lowercase
emorway-usgs Oct 13, 2018
dda4b57
Removing variable MXUZCON from mtuzt.py. Variable was in pre-release…
emorway-usgs Oct 30, 2018
50e08ef
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 30, 2018
a19b468
Indexes needed adjusting after removing un-used variable from Item 2 …
emorway-usgs Oct 30, 2018
9a90c3c
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 30, 2018
e0b3bf2
Fixing another index issue brought about by the removal of MXUZCON
emorway-usgs Oct 30, 2018
930ae10
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 30, 2018
cb5f318
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Nov 9, 2018
442df30
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Nov 27, 2018
43e7a60
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Jan 30, 2019
737866a
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Feb 7, 2019
49fe289
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Mar 9, 2019
2bf4668
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Mar 14, 2019
3f3d2ea
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Mar 17, 2019
eed6c70
test(t012_test.py): Account for UZT -> UZT2 input file changes
emorway-usgs Mar 18, 2019
2ff2626
test(t012_test.py): Adapt flopy src to new UZT2 input requirements
emorway-usgs Mar 18, 2019
326b26b
docs(releasenotes): update releasenotes with UZT2 fix
emorway-usgs Mar 18, 2019
bf3b094
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Mar 22, 2019
6b0c779
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Apr 2, 2019
7498568
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Apr 15, 2019
248f5d6
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs May 22, 2019
57f78bb
fix(Mt3dUzt): remove frivilous code
emorway-usgs May 22, 2019
bc0368b
docs(releasenotes): update releasenotes with UZT instantiation fix
emorway-usgs May 22, 2019
2b0e394
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs May 22, 2019
db23721
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Jun 27, 2019
17797d0
fix(mtuzt): iuzbnd improperly written
emorway-usgs Jun 28, 2019
04a99b7
fix(mtuzf1): user comments not accounted for on uzgag line
emorway-usgs Jul 3, 2019
e48c596
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Jul 3, 2019
d8edc13
fix(mtuzf1.py): user comments not accounted for on uzgag line
emorway-usgs Jul 3, 2019
367a98e
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Jul 11, 2019
0f2d9b2
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Jul 29, 2019
669c44c
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Aug 23, 2019
c14c2d8
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 3, 2019
0a8b4db
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 7, 2019
004e69f
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 25, 2019
5dd17b6
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 28, 2019
3590896
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Oct 31, 2019
c4fd9ad
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Dec 3, 2019
1fcb747
Merge branch 'develop' of github.com:modflowpy/flopy into new_develop
emorway-usgs Dec 5, 2019
067ce8a
fix(mtssm): fix assumption that transient NSS data appears in first s…
emorway-usgs Dec 10, 2019
0a4f727
fix(mtssm): handle for AttributeError exception
emorway-usgs Dec 11, 2019
6b43449
fix(t068): missing dependency
emorway-usgs Dec 11, 2019
542f0de
rename(t068): make test filename marginally more descriptive
emorway-usgs Dec 11, 2019
01c10d5
fix(mtssm): remove try-except
emorway-usgs Dec 11, 2019
18a52ec
fix(mtssm): Oy vey
emorway-usgs Dec 12, 2019
3a30545
fix(mtssm): correct addition of src/snks over all stress periods
emorway-usgs Dec 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions autotest/t068_test_ssm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""
Test MT3D model creation and file writing
"""

import os
import warnings
import flopy
import numpy as np


def test_mt3d_ssm_with_nodata_in_1st_sp():
model_ws = os.path.join('.', 'temp', 't068')

nlay, nrow, ncol = 10, 10, 10
perlen = np.zeros((10), dtype=np.float) + 10
nper = len(perlen)

ibound = np.ones((nlay,nrow,ncol), dtype=np.int)

botm = np.arange(-1,-11,-1)
top = 0.

# creating MODFLOW model

model_ws = 'data'
modelname = 'ssm_ex2'

mf = flopy.modflow.Modflow(modelname, model_ws=model_ws, version='mfnwt')
dis = flopy.modflow.ModflowDis(mf, nlay=nlay, nrow=nrow, ncol=ncol,
perlen=perlen, nper=nper, botm=botm, top=top,
steady=False)

bas = flopy.modflow.ModflowBas(mf, ibound=ibound, strt=top)
upw = flopy.modflow.ModflowUpw(mf, hk=100, vka=100, ss=0.00001, sy=0.1)
oc = flopy.modflow.ModflowOc(mf)
nwt = flopy.modflow.ModflowNwt(mf)

# recharge
rchrate = {}
rchrate[0] = 0.0
rchrate[5] = 0.001
rchrate[6] = 0.0

rch = flopy.modflow.ModflowRch(mf, rech=rchrate, nrchop=3)

# define itype
itype = flopy.mt3d.Mt3dSsm.itype_dict()
ssm_data = {}

# Now for the point of this test: Enter SSM data sometime
# after the first stress period (this was crashing flopy
# version 3.2.13
ghb_data = {}
ghb_data[2] = [(4, 4, 4, 0.1, 1.5)]
ssm_data[2] = [(4, 4, 4, 1.0, itype['GHB'], 1.0, 100.0)]
ghb_data[5] = [(4, 4, 4, 0.25, 1.5)]
ssm_data[5] = [(4, 4, 4, 0.5, itype['GHB'], 0.5, 200.0)]

for k in range(nlay):
for i in range(nrow):
ghb_data[2].append((k, i, 0, 0.0, 100.0))
ssm_data[2].append((k, i, 0, 0.0, itype['GHB'], 0.0, 0.0))

ghb_data[5] = [(4, 4, 4, 0.25, 1.5)]
ssm_data[5] = [(4, 4, 4, 0.5, itype['GHB'], 0.5, 200.0)]
for k in range(nlay):
for i in range(nrow):
ghb_data[5].append((k, i, 0, -0.5, 100.0))
ssm_data[5].append((k, i, 0, 0.0, itype['GHB'], 0.0, 0.0))


ghb = flopy.modflow.ModflowGhb(mf, stress_period_data=ghb_data)

# create MT3D-USGS model
mt = flopy.mt3d.Mt3dms(modflowmodel=mf, modelname=modelname, model_ws=model_ws)
btn = flopy.mt3d.Mt3dBtn(mt, sconc=0, ncomp=2, sconc2=50.0)
adv = flopy.mt3d.Mt3dAdv(mt)
ssm = flopy.mt3d.Mt3dSsm(mt, stress_period_data=ssm_data)
gcg = flopy.mt3d.Mt3dGcg(mt)

# Write the output
mf.write_input()
mt.write_input()

# confirm that MT3D files exist
assert os.path.isfile(os.path.join(model_ws, '{}.{}'.format(mt.name, btn.extension[0]))) is True
assert os.path.isfile(os.path.join(model_ws, '{}.{}'.format(mt.name, adv.extension[0]))) is True
assert os.path.isfile(os.path.join(model_ws, '{}.{}'.format(mt.name, ssm.extension[0]))) is True
assert os.path.isfile(os.path.join(model_ws, '{}.{}'.format(mt.name, gcg.extension[0]))) is True

return


if __name__ == '__main__':
test_mt3d_ssm_with_nodata_in_1st_sp()


16 changes: 12 additions & 4 deletions flopy/mt3d/mtssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def __init__(self, model, crch=None, cevt=None, mxss=None,
ncol = model.ncol
nlay = model.nlay
ncomp = model.ncomp
nper = model.nper

# Create a list of SsmPackage (class defined above)
self.__SsmPackages = []
Expand Down Expand Up @@ -225,11 +226,18 @@ def __init__(self, model, crch=None, cevt=None, mxss=None,
if mxss is None:
# Need to calculate max number of sources and sinks
self.mxss = 0
mxss_kper = 0

# Do not assume first key (stress period 0) has data, it may
# not. Cycle through stress periods looking for one w/ data
if self.stress_period_data is not None:
self.mxss += np.sum(
self.stress_period_data.data[0].itype == -1)
self.mxss += np.sum(
self.stress_period_data.data[0].itype == -15)
for i in range(nper):
if i in self.stress_period_data.data:
mxss_kper += np.sum(
self.stress_period_data.data[i].itype == -1)
mxss_kper += np.sum(
self.stress_period_data.data[i].itype == -15)
self.mxss = max(self.mxss, mxss_kper)

if isinstance(self.parent.btn.icbund, np.ndarray):
self.mxss += (self.parent.btn.icbund < 0).sum()
Expand Down