Skip to content

Commit

Permalink
fix(exchange obs): fixed building of obs package for exchange package…
Browse files Browse the repository at this point in the history
…s (through MFSimulation) (#1363)

* fix(exchange obs): fixed building of obs package through MFSimulation class

* fix(exchange obs): updated comments

* fix(exchange obs): test coverage for exchange obs
  • Loading branch information
spaulins-usgs authored Feb 28, 2022
1 parent aa0baac commit 14d4615
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
33 changes: 27 additions & 6 deletions autotest/t505_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@ def test_multi_model():
)

# gwf-gwf
gwfgwf_data = [[(0, 0, ncol - 1), (0, 0, 0), 1, 0.5, 0.5, 1.0, 0.0, 1.0]]
gwfgwf_data = []
for col in range(0, ncol):
gwfgwf_data.append(
[(0, 0, col), (0, 0, 0), 1, 0.5, 0.5, 1.0, 0.0, 1.0]
)
gwfgwf = flopy.mf6.ModflowGwfgwf(
sim,
exgtype="GWF6-GWF6",
Expand All @@ -279,6 +283,17 @@ def test_multi_model():
filename="flow1_flow2.gwfgwf",
)

# Observe flow for exchange
gwfgwfobs = {}
obs_list = []
for col in range(0, ncol):
obs_list.append([f"exchange_flow_{col}", "FLOW-JA-FACE", (col,)])
gwfgwfobs["gwfgwf.output.obs.csv"] = obs_list
fname = "gwfgwf.input.obs"
gwfgwf.obs.initialize(
filename=fname, digits=25, print_input=True, continuous=gwfgwfobs
)

# Create gwt model
sourcerecarray = [("WEL-1", "AUX", "CONCENTRATION")]
gwt = get_gwt_model(
Expand Down Expand Up @@ -629,14 +644,20 @@ def test_binary_read():
dstruct = flopy.mf6.data.mfstructure.MFDataItemStructure()
dstruct.is_cellid = False
dstruct.name = "fake"
dstruct.data_items = [None,]
dstruct.data_items = [
None,
]
mfstruct = flopy.mf6.data.mfstructure.MFDataStructure(
dstruct, False, 'ic', None
dstruct, False, "ic", None
)
mfstruct.data_item_structures = [dstruct,]
mfstruct.path = ["fake", ]
mfstruct.data_item_structures = [
dstruct,
]
mfstruct.path = [
"fake",
]

md = flopy.mf6.coordinates.modeldimensions.ModelDimensions('test', None)
md = flopy.mf6.coordinates.modeldimensions.ModelDimensions("test", None)
pd = flopy.mf6.coordinates.modeldimensions.PackageDimensions(
[md], None, "."
)
Expand Down
4 changes: 2 additions & 2 deletions flopy/mf6/modflow/mfsimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,13 +1024,13 @@ def load_package(
self._mvt_file_num += 1
return mvt_file
else:
# create package
# get package object from file type
package_obj = self.package_factory(ftype, "")
# create package
package = package_obj(
self,
filename=fname,
pname=dict_package_name,
add_to_package_list=False,
parent_file=parent_package,
loading_package=True,
)
Expand Down

0 comments on commit 14d4615

Please sign in to comment.