Skip to content

Commit

Permalink
fix(mtssm.py): handle 1st stress period with incrch equal to -1 (#780)
Browse files Browse the repository at this point in the history
* fix(mtssm.py): handle 1st stress period when no crch data

Initializes crch with a scalar of 0.0 rather than a Transient2d obj equal to 0
Using a test dataset from #743 that was demonstrating the problem
Updated an autotest to load and write an SSM file with no data specified for crch

#743

* fix(mtssm.py): fix multi-species handling of incrch
  • Loading branch information
emorway-usgs authored and langevin-usgs committed Jan 16, 2020
1 parent 088f147 commit f7886e2
Show file tree
Hide file tree
Showing 3 changed files with 20,988 additions and 12 deletions.
36 changes: 36 additions & 0 deletions autotest/t068_test_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,45 @@ def test_none_spdtype():
success, buff = mf.run_model(report=True)
assert success

def test_ssm_readwrite():

# Instantiate MODFLOW model
mf = flopy.modflow.Modflow()

# These dimensions work for the SSM file to be loaded
dis = flopy.modflow.ModflowDis(mf, nlay=10, nrow=118, ncol=153,
nper=100, delr=100, delc=100, perlen=1)
bas = flopy.modflow.ModflowBas(mf)

# Instantiate MT3D model
mt = flopy.mt3d.Mt3dms(modflowmodel=mf, modelname='tran_v1',
version='mt3d-usgs')
btn = flopy.mt3d.Mt3dBtn(mt)

# Point to ssm file for test load and write
pth = os.path.join('..','examples','data','ssm_load_test')
fl = os.path.join(pth, 'tran_v1_b1.ssm')

# Check that example input file with no data specified for crch works
# (file comes from: https://github.com/modflowpy/flopy/issues/743)
ssm = flopy.mt3d.Mt3dSsm.load(fl, mt)

# Change to dedicated work directory
cwd = os.getcwd()
if not os.path.exists(os.path.join('temp','t068_ssm_write')):
os.makedirs(os.path.join('temp','t068_ssm_write'))

os.chdir(os.path.join('temp','t068_ssm_write'))

# Ensure file is writeable
ssm.write_file()

# Return to starting directory
os.chdir(cwd)

if __name__ == '__main__':
test_mt3d_ssm_with_nodata_in_1st_sp()
test_none_spdtype()
test_ssm_readwrite()


Loading

0 comments on commit f7886e2

Please sign in to comment.