Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: gwf.modeltime.steady_state inconsistent with input/output #2117

Closed
aleaf opened this issue Mar 1, 2024 · 2 comments
Closed

bug: gwf.modeltime.steady_state inconsistent with input/output #2117

aleaf opened this issue Mar 1, 2024 · 2 comments
Assignees
Milestone

Comments

@aleaf
Copy link
Contributor

aleaf commented Mar 1, 2024

Describe the bug
The gwf.modeltime.steady_state attribute appears to be returning True for every period entered in the steady_state argument to ModflowGwfsto, regardless of whether the entry for that period is True or False. The actual STO input file written by Flopy does not seem to be affected by this.

To Reproduce

import flopy as fp
out_dir = 'tmp'
sim = fp.mf6.MFSimulation(sim_name='testsim',
                   version='mf6',
                   sim_ws=out_dir)
tdis_rc = [(1.0, 1, 1.0), (10.0, 120, 1.0), (10.0, 120, 1.0), (10.0, 120, 1.0)]
tdis = fp.mf6.ModflowTdis(sim, nper=len(tdis_rc),
                          perioddata=tdis_rc)
ims = fp.mf6.ModflowIms(sim)
gwf = fp.mf6.ModflowGwf(sim, modelname='testmodel')
dis = fp.mf6.ModflowGwfdis(gwf)
sto = fp.mf6.ModflowGwfsto(
    gwf,
    pname="sto",
    save_flows=True,
    iconvert=1,
    ss=1e-4,
    sy=0.2,
    steady_state={0: True, 1: False, 2: False, 3: False},
    transient={0:False, 1: True, 2: True, 3: True},
)
gwf.modeltime.steady_state
array([ True,  True,  True,  True])

Expected behavior

array([ True,  False,  False,  False])

More broadly, since a stress period can't be both steady-state and transient, maybe it would be better to refactor the Flopy input to a single steady_state dictionary of True/False values. Is there any reason why we wouldn't want to do this?

@aleaf
Copy link
Contributor Author

aleaf commented Mar 1, 2024

A related issue with loading a model: If the STO package isn't included in the load, gwf.modeltime.steady_state returns all True for each stress period.

sim.write_simulation()
loaded_sim = fp.mf6.MFSimulation.load('testsim', sim_ws=out_dir, load_only=['dis'])
loaded_gwf = loaded_sim.get_model('testmodel')
loaded_gwf.modeltime.steady_state

array([ True, True, True, True])

Maybe loaded_gwf.modeltime.steady_state should be None at this point to make it clear that the model doesn't have this information?

@wpbonelli wpbonelli added this to the 3.6.1 milestone Mar 2, 2024
spaulins-usgs added a commit that referenced this issue Mar 20, 2024
* fix(get_package and model_time): #2117, #2118

get_package now allows you to get package only by name or type, instead of always searching for a package both by name and type

model_time displays the correct steady state array and no longer gets confused if packages are named similar to the package type it is searching for

* fix(resolve merge conflict)

---------

Co-authored-by: scottrp <45947939+scottrp@users.noreply.github.com>
@spaulins-usgs
Copy link
Contributor

The first problem should now be fixed.

Regarding your second comment, the MF6 documentation states, "If the STO Package is not included for a model, then storage changes will not be calculated, and thus, the model will be steady state.". Given this, I think it is reasonable for flopy's modeltime.steady_state to be true when the STO package does not exist.

@wpbonelli wpbonelli modified the milestones: 3.6.1, 3.7.0 May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants