modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
517 stars 313 forks source link

SEAWAT; Itype==-1 and itype==-15 not counted as sink/sources #48

Closed bdestombe closed 9 years ago

bdestombe commented 9 years ago

The cells with itype==-1 and itype==15 are counted by the SEAWAT routine as sink/sources. Not by flopy.

in flopy\mt3d\mtssm.py lines: 50 - 59, to:

self.stress_period_data = mflist(self, model=self.parent.mf,
                                         data=stress_period_data)

self.__maxssm = np.sum(self.stress_period_data.data[0].itype == -1)
self.__maxssm += np.sum(self.stress_period_data.data[0].itype == -15)

#        self.__maxssm = 0
#if (self.parent.btn.icbund != None):

if isinstance(self.parent.btn.icbund, np.ndarray):
    self.maxssm += (self.parent.btn.icbund < 0).sum()
for p in self.__SsmPackages:
    print 'label', p.label
    print 'instance', p.instance
    if ((p.label == 'BAS6') and (p.instance != None)):
        self.__maxssm += (p.instance.ibound < 0).sum()
    elif p.instance != None:
        self.__maxssm += p.instance.ncells()

Also moved the function call that assigns the stress_period_data variable upwards. That garantees that the stress_period_data is in mflist format.

langevin-usgs commented 9 years ago

Hey Bas, this doesn't work as is. Did you define a dtype attribute for the SSM package?

langevin-usgs commented 9 years ago

Never mind. I saw the dtype lines below. I had to move them up above the mflist constructor.

langevin-usgs commented 9 years ago

Try it out now, Bas. It is implemented on the develop branch. Thanks for the contribution!

bdestombe commented 9 years ago

Thanks Chris! Ah yes, forgot to mention the dtype thing.