Linked Questions

Popular Questions

How to load an existing MODFLOW-USG model with flopy

Asked by At

I am trying to learn flopy, and I tried to load one of the MODFLOW-USG test cases. The test case is a 1-layer model with a nested grid and GNC package (example 01B). I did not modify the test case files distributed with MODFLOW-USG, and the test case ran fine with the run.bat file.

First I tried to follow the example for loading a name file using the flopy.modflow.mf module:

m = flopy.modflow.Modflow.load('flow.nam', version='mfusg')

But I got the following ValueError:

File "C:\Users\Kent\Anaconda3\lib\site-packages\flopy\modflow\mf.py", line 758, in load
  ml.check(f='{}.chk'.format(ml.name), verbose=ml.verbose, level=0)

File "C:\Users\Kent\Anaconda3\lib\site-packages\flopy\mbase.py", line 1121, in check
  level=level - 1)

File "C:\Users\Kent\Anaconda3\lib\site-packages\flopy\modflow\mfbas.py", line 185, in check
  neighbors = get_neighbors(self.ibound.array)

File "C:\Users\Kent\Anaconda3\lib\site-packages\flopy\utils\check.py", line 590, in get_neighbors
  nk, ni, nj = a.shape

ValueError: not enough values to unpack (expected 3, got 1)

Then I tried to load the DISU package following the example for the flopy.modflow.mfdisu module:

m = flopy.modflow.Modflow(version='mfusg')
disu = flopy.modflow.ModflowDisU.load('flow.disu', m)

But this gave me the following TypeError:

File "C:\Users\Kent\Anaconda3\lib\site-packages\flopy\modflow\mfdisu.py", line 622, in load
  fahl = Util2d.load(f, model, (n,), np.float32, 'fahl', ext_unit_dict)

File "C:\Users\Kent\Anaconda3\lib\site-packages\flopy\utils\util_array.py", line 2678, in load
  ext_unit = ext_unit_dict[cr_dict['nunit']]

TypeError: 'NoneType' object is not subscriptable

What is the correct way to load an existing MODFLOW-USG model with flopy?

Related Questions