Skip to content
New issue

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

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

Already on GitHub? # to your account

feature: allow get_ts() to get auxiliary variables from the budget file #2270

Open
cneyens opened this issue Jul 22, 2024 · 0 comments
Open
Assignees
Milestone

Comments

@cneyens
Copy link

cneyens commented Jul 22, 2024

Is your feature request related to a problem? Please describe.
Unless I'm missing something, it is currently not possible to read time-series of auxiliary variables from the cell-by-cell budget file using the get_ts() method. Darcy fluxes ('DATA-SPDIS') and saturated thickness ('DATA-SAT') are saved to the budget file as auxiliary variables, but get_ts() only returns the q variable, which in those cases is set to a dummy value of zero.

Example code
import flopy
ws = './mymodel'
name = 'mymodel'
sim = flopy.mf6.MFSimulation(sim_name=name, sim_ws=ws, exe_name='mf6')
tdis = flopy.mf6.ModflowTdis(sim)
ims = flopy.mf6.ModflowIms(sim)
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
dis = flopy.mf6.ModflowGwfdis(gwf, nrow=10, ncol=10)
ic = flopy.mf6.ModflowGwfic(gwf)
npf = flopy.mf6.ModflowGwfnpf(gwf, save_specific_discharge=True)
chd = flopy.mf6.ModflowGwfchd(gwf, stress_period_data=[[(0, 0, 0), 1.],
                                                     [(0, 9, 9), 0.]])
budget_file = name + '.bud'
head_file = name + '.hds'
oc = flopy.mf6.ModflowGwfoc(gwf,
                          budget_filerecord=budget_file,
                          head_filerecord=head_file,
                          saverecord=[('HEAD', 'ALL'), ('BUDGET', 'ALL')])
sim.write_simulation(silent=True)
sim.run_simulation(silent=True)

head = gwf.output.head().get_data()
bud = gwf.output.budget()

# this only returns the dummy q variable
bud.get_ts(idx=(0,5,5), text='DATA-SPDIS')

Describe the solution you'd like
A way for get_ts() to retrieve the values of one (or all) auxiliary variables for a given record. Perhaps all aux variables are always returned, or the user gets to set some sort or variable argument in get_ts() which defaults to 'q'?

Describe alternatives you've considered
For specific discharge, loop over the required times and get the full gridded values using get_data(text='DATA-SPDIS', totim=t)[0], then use flopy.utils.postprocessing.get_specific_discharge() and subset the required cell id.

Additional context
Flopy v3.8.0

@wpbonelli wpbonelli added this to the 3.9.0 milestone Aug 6, 2024
@wpbonelli wpbonelli self-assigned this Aug 6, 2024
@wpbonelli wpbonelli modified the milestones: 3.9, 3.10 Sep 4, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants