Skip to content

Commit

Permalink
fix(gridgen): fixed writing of mf6 disu package (#680)
Browse files Browse the repository at this point in the history
* Added tests for the to_disu6() and to_disv6() Gridgen methods
* Closes #678
  • Loading branch information
langevin-usgs authored Oct 17, 2019
1 parent dc87007 commit ff43c7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions autotest/t061_test_gridgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ def test_gridgen():
mu = flopy.modflow.Modflow(version='mfusg', structured=False)
disu = g.get_disu(mu)

# test writing a modflow 6 disu package
fname = os.path.join(cpth, 'mymf6model.disu')
g6.to_disu6(fname)
assert os.path.isfile(fname), \
'MF6 disu file not created: {}'.format(fname)

# test writing a modflow 6 disv package
fname = os.path.join(cpth, 'mymf6model.disv')
g6.to_disv6(fname)
assert os.path.isfile(fname), \
'MF6 disv file not created: {}'.format(fname)

return


Expand Down
4 changes: 2 additions & 2 deletions flopy/utils/gridgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ def to_disu6(self, fname, writevertices=True):
"""

gridprops = self.get_gridprops()
gridprops = self.get_gridprops_disu6()
f = open(fname, 'w')

# opts
Expand Down Expand Up @@ -1338,7 +1338,7 @@ def to_disu6(self, fname, writevertices=True):
# celldata -- not optimized for redundant vertices yet
f.write('BEGIN CELL2D\n')
iv = 1
for n in range(nodes):
for n in range(gridprops['nodes']):
xc, yc = self.get_center(n)
s = ' {} {} {} {} {} {} {} {}\n'.format(n + 1, xc, yc, 4, iv,
iv + 1, iv + 2,
Expand Down

0 comments on commit ff43c7c

Please sign in to comment.