Skip to content

Commit

Permalink
fix(sourcedata.py; MFnwtModel): add _drop_thin_cells=False attribute …
Browse files Browse the repository at this point in the history
…to MFnwtModel for consistency with MF6model; only expand thin cells to the minimum thickness if drop_thin_cells=False; otherwise rounding errors can lead to inconsistent cell pinchouts
  • Loading branch information
aleaf committed Jul 9, 2024
1 parent 9fab1b8 commit 0179b73
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions mfsetup/mfnwtmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def __init__(self, parent=None, cfg=None,
# set the list file path
self.lst.file_name = [self.cfg['model']['list_filename_fmt'].format(self.name)]

# the "drop thin cells" option is not available for MODFLOW-2005 models
self._drop_thin_cells = False

# property arrays
self._ibound = None

Expand Down
20 changes: 11 additions & 9 deletions mfsetup/sourcedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,16 +1467,18 @@ def setup_array(model, package, var, data=None,
# botm[k][bathy != 0][inlayer] = lake_botm_elevations[inlayer]

# fix any layering conflicts and save out botm files
#if model.version == 'mf6' and model._drop_thin_cells:
botm = fix_model_layer_conflicts(top, botm,
minimum_thickness=min_thickness)
isvalid = verify_minimum_layer_thickness(top, botm,
np.ones(botm.shape, dtype=int),
min_thickness)
if not isvalid:
raise Exception('Model layers less than {} {} thickness'.format(min_thickness,
# only adjust layer elevations if we want to keep thin cells
# (instead of making them inactive)
if not model._drop_thin_cells:
botm = fix_model_layer_conflicts(top, botm,
minimum_thickness=min_thickness)
isvalid = verify_minimum_layer_thickness(top, botm,
np.ones(botm.shape, dtype=int),
min_thickness)
if not isvalid:
raise Exception('Model layers less than {} {} thickness'.format(min_thickness,
model.length_units))
# fill nan values adjacent to active cells to avoid cell thickness errors
# fill any nan values that are above or below active cells to avoid cell thickness errors
top, botm = fill_cells_vertically(top, botm)
# the top may have been modified by fill_cells_vertically
# update the top in the model
Expand Down

0 comments on commit 0179b73

Please sign in to comment.