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

VKCB called with (nlay) instead of (nlay - 1) in flopy/modflow/mflpf.py line 205 #233

Closed Olsthoorn closed 7 years ago

Olsthoorn commented 7 years ago

in /flopy/modflow/mflpf.py line 205, Util3D is called to generate a 3D array for vkcb. However it's called with nlay instead of lay - 1

Suggested correction see below:

   # TO 170728 bug in flopy nlay must be nlay-1
   #  Old
   #self.vkcb = Util3d(model, (nlay, nrow, ncol), np.float32, vkcb,
   #                    name='vkcb', locat=self.unit_number[0])

   # New:
    self.vkcb = Util3d(model, (nlay-1, nrow, ncol), np.float32, vkcb,
                        name='vkcb', locat=self.unit_number[0])
langevin-usgs commented 7 years ago

Hi Theo, I took a look at this, and while there might be a benefit to using nlay - 1 as the size, it could break existing scripts. I think its best to leave this as is. The information in laycb[nlay-1] will never be written or loaded because dis.laycbd[nlay-1] is always zero. If I'm mistaken, and this is indeed an error, then please reopen this issue. I did add some existing clarification to the docstring as: "Note that if an array is passed for vkcb it must be of size (nlay, nrow, ncol) even though the information for the bottom layer is not needed."