Skip to content

Commit

Permalink
fix(mfmodel): fix get_ims_package (#2272)
Browse files Browse the repository at this point in the history
This fixes MFModel.get_ims_package which is a method that returns the relevant IMS through the simulation name files's solution group block.
  • Loading branch information
martclanor authored Aug 6, 2024
1 parent 4aab493 commit 576cefe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions autotest/test_mf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,9 @@ def test_multi_model(function_tmpdir):
assert rec_array[0][3] == model_names[1]
assert rec_array[1][1] == "transport.ims"
assert rec_array[1][2] == model_names[2]
assert gwf1.get_ims_package() is gwf2.get_ims_package()
assert gwf1.get_ims_package().filename == "flow.ims"
assert gwt.get_ims_package().filename == "transport.ims"
# test ssm fileinput
gwt2 = sim2.get_model("gwt_model_1")
ssm2 = gwt2.get_package("ssm")
Expand Down
12 changes: 8 additions & 4 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,11 +1275,15 @@ def get_ims_package(self):
-------
IMS package : ModflowIms
"""
solution_group = self.simulation.name_file.solutiongroup.get_data()
solution_group = self.simulation.name_file.solutiongroup.get_data(0)
for record in solution_group:
for model_name in record[2:]:
if model_name == self.name:
return self.simulation.get_solution_package(record[1])
for name in record.dtype.names:
if name == "slntype" or name == "slnfname":
continue
if record[name] == self.name:
return self.simulation.get_solution_package(
record.slnfname
)
return None

def get_steadystate_list(self):
Expand Down

0 comments on commit 576cefe

Please sign in to comment.