panden.py:93-96:
if ds.transport:
ssm_sources = list(ds.attrs.get("ssm_sources", []))
if riv.package_name not in ssm_sources:
ds.attrs["ssm_sources"] = [*ssm_sources, riv.package_name]
flopy assigns a fresh unique package_name to each ModflowGwfriv instance — riv_0 for the first, riv_1 for the second (verified on flopy 3.11.0.dev0). So on a second call against the same gwf, riv.package_name is a name never seen before, the guard cannot match, and ssm_sources grows to ['riv_0', 'riv_1'].
The guard does work in the scenario it was presumably written for — rerunning the script with a freshly built flow model, where the name resets to riv_0.
The larger problem behind it: a second call on the same gwf silently attaches a second RIV package carrying the same stress-period data, doubling the pond conductance, with no warning. Guarding the SSM list does not prevent that.
Suggested direction: detect an existing RIV package on gwf and either replace it or raise, rather than deduplicating by name after the fact.
Found while writing the test suite; the test pins the fresh-model scenario (one entry after two builds), not the same-gwf one.
panden.py:93-96:flopy assigns a fresh unique
package_nameto eachModflowGwfrivinstance —riv_0for the first,riv_1for the second (verified on flopy 3.11.0.dev0). So on a second call against the samegwf,riv.package_nameis a name never seen before, the guard cannot match, andssm_sourcesgrows to['riv_0', 'riv_1'].The guard does work in the scenario it was presumably written for — rerunning the script with a freshly built flow model, where the name resets to
riv_0.The larger problem behind it: a second call on the same
gwfsilently attaches a second RIV package carrying the same stress-period data, doubling the pond conductance, with no warning. Guarding the SSM list does not prevent that.Suggested direction: detect an existing RIV package on
gwfand either replace it or raise, rather than deduplicating by name after the fact.Found while writing the test suite; the test pins the fresh-model scenario (one entry after two builds), not the same-gwf one.