Skip to content

bug: Error retrieving model top array when using mfsplit.split_model(split_array) #2726

@jptraylor

Description

@jptraylor

Describe the bug
When i run mfsplit.split_model(split_array) it returns an error as follows:

MFDataException: An error occurred in data element "top" model "nhp1320_0" package "dis". The error occurred while setting data in the "__init__" method.
Additional Information:
(1) Unable to open file C:\C_projects\C_VAW100\model\mf6\scripts\external\top.0.dat.  Make sure the file is not locked and the folder exists.
(2) Error occurred while adding dataset "top" to block "griddata"

I think the issue is that it seems like mfsplit.split_model() is not concatenating the base model top array path correctly. It is true that the above path is not correct, but i should be C:\C_projects\C_VAW100\model\mf6\scripts..\model\model.calibration\external\top.dat.

To Reproduce
Steps to reproduce the behavior:
My code is:

cwd = os.getcwd()
sys.path.append("../model/model.calibration/")
base_dir = get_base_dir()
parallel_dir = get_parallel_dir()

base_sim = flopy.mf6.MFSimulation.load(
    sim_ws=base_dir,
    )

gwf_model = base_sim.get_model()
nrow = gwf_model.modelgrid.nrow
ncol = gwf_model.modelgrid.ncol
nr_domains = 6
mfsplit = Mf6Splitter(base_sim)
split_array = np.zeros((nrow, ncol), dtype=int)
for irow in range(nrow):
    for icol in range(ncol):
        isub = np.floor(icol / (ncol / nr_domains))
        split_array[irow, icol] = isub
parallel_sim = mfsplit.split_model(split_array)

Expected behavior
I expect mfsplit.split_model(split_array) to run without error and correctly path to the top array and any other array that is external in the base model.

Screenshots

Image Image

Desktop (please complete the following information):

  • OS: Windows 11 version 23H2
  • Browser na
  • flopy version 3.9.0.dev2

Additional context
I built the base model using modflow-setup which writes strings for the file paths as follows
OPEN/CLOSE '.\external\top.dat' FACTOR 1.0
i tried changing them to
OPEN/CLOSE external\top.dat FACTOR 1.0
but still got the exact same error

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions