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: Reading flows from binary budget file for steady stress period of zero length #1939

Closed
mbakker7 opened this issue Aug 31, 2023 · 0 comments · Fixed by #1966
Closed

bug: Reading flows from binary budget file for steady stress period of zero length #1939

mbakker7 opened this issue Aug 31, 2023 · 0 comments · Fixed by #1966
Assignees
Labels
Milestone

Comments

@mbakker7
Copy link
Contributor

mbakker7 commented Aug 31, 2023

I have a MF6 model consisting of two stress periods. First stress period is steady with length 0. Second stress period is transient. I can read the heads from the binary heads file with Flopy. But when I read the flow from the binary budget file, I can not read the budget for the steady stress period. The times function also doesn't return the first time. But I can read the budget data by specifying the step and period, so it is all stored. It all works fine when the steady stress period has length rather than 0. But it is nice to specify a transient stress period that starts at 0 (i.e., the first stress period has zero length).

import numpy as np
import flopy as fp 

modelname = 'bugtest'
modelws = './bugtest'
sim = fp.mf6.MFSimulation(sim_name='bugtest', 
                          version='mf6', 
                          exe_name='../bin/mf6', 
                          sim_ws=modelws, 
                         )

tdis = fp.mf6.ModflowTdis(simulation=sim, 
                          nper=2, 
                          perioddata=[(0, 1, 1), (10, 10, 1)], 
                         )

ims = fp.mf6.ModflowIms(simulation=sim, 
                        complexity='SIMPLE',
                       )

gwf = fp.mf6.ModflowGwf(simulation=sim, 
                        modelname=modelname, 
                        save_flows=True,
                       )

dis = fp.mf6.ModflowGwfdis(model=gwf, 
                           nlay=1, nrow=1, ncol=10, delr=1, delc=10, top=10, botm=0
                          ) 

npf = fp.mf6.ModflowGwfnpf(model=gwf, 
                           icelltype=[0], 
                           k=10,
                          )

ic = fp.mf6.ModflowGwfic(model=gwf, 
                         strt=0,
                        )

wel = fp.mf6.ModflowGwfwel(model=gwf, 
                           stress_period_data={0: 0, 1: [[(0, 0, 0), -1]]},
                          )

sto = fp.mf6.ModflowGwfsto(model=gwf, 
                           ss=1e-4,
                           steady_state={0: True},
                           transient={1: True},
                          )

chd = fp.mf6.ModflowGwfchd(model=gwf, 
                           stress_period_data={0: [[(0, 0, 9), 0]]},
                          )

oc = fp.mf6.ModflowGwfoc(model=gwf, 
                         budget_filerecord=f"{modelname}.cbc", 
                         head_filerecord=f"{modelname}.hds", 
                         saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")],
                        )
sim.write_simulation(silent=True)
success, _ = sim.run_simulation(silent=True) 
print('success: ', success)

hds = gwf.output.head()
cbb = gwf.output.budget()

Then the output is:

print(hds.get_times()) # gives correct times
print(hds.get_kstpkper()) # gives correct steps and periods
print(cbb.get_times()) # skips the first time
print(cbb.get_kstpkper()) # gives correct steps and periods
print(cbb.get_data(totim=0)) # gives empty list, which is wrong
print(cbb.get_data(kstpkper=(0, 0))) # returns correct values for step=0, period=0
@mbakker7 mbakker7 added the bug label Aug 31, 2023
@mbakker7 mbakker7 changed the title bug: Reading heads from binary budget file for steady stress period of zero length bug: Reading flows from binary budget file for steady stress period of zero length Sep 6, 2023
@wpbonelli wpbonelli added this to the 3.4.3 milestone Sep 25, 2023
@wpbonelli wpbonelli self-assigned this Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants