How to specify empty period blocks in MF6 OC package
Hi, I would like to end up with a block like this in the OC package file for MODFLOW-6 (as shown in the mf6 IO documentation):
# No output for stress periods 2 through 24
BEGIN PERIOD 2
END PERIOD
I can't figure out the right flopy input to achieve this. I've tried the following (where saverecord is a dictionary of entries by stress period to the saverecord argument of flopy.mf6.ModflowGwfoc:
saverecord[1] = None
saverecord[1] = []
saverecord[1] = [('head', 'none', None), ('budget', 'none', None)]
saverecord[1] = [('head', '', None), ('budget', '', None)]
saverecord[1] = [('head', '', ''), ('budget', '', '')]
saverecord[1] = [('head',None, None), ('budget', None, None)]
saverecord[1] = [None, None]
saverecord[1] = [('head',)]
The only other period specified is 0, which looks like this:
[('head', 'last', None), ('budget', 'last', None)]
Basically, I'd like to just write stress period zero and nothing else. Or be able to specify discrete periods of interest to be written.
Thanks!
@aleaf Verified the problem. I will get you a fix soon.
Thanks @spaulins-usgs !
@aleaf Please try the latest flopy code. I have merged in a fix that allows you to do create an empty block by assigning it an empty list. In the example below the "1: []" is setting the second stress period as an empty block.
oc_package = ModflowGwfoc(
model,
budget_filerecord=[("np001_mod.cbc",)],
head_filerecord=[("np001_mod.hds",)],
saverecord={0: [("HEAD", "ALL"), ("BUDGET", "ALL")], 1: []}
)
I'm running into a similar issue with the current develop (3.7.0.dev0). I'd like to disable all printing, which needs to be specified in the OC file as follows:
BEGIN period 1
END period 1
My attempt to create this in flopy is to specify any empty list:
oc = flopy.mf6.ModflowGwfoc(gwf, printrecord={0: []})
however, the resulting file doesn't contain BEGIN/END period 1 as expected to disable printing.
My workaround is to print the last timestep of the first stress period (which is done by default anyways), followed by an empty list:
oc = flopy.mf6.ModflowGwfoc(gwf, printrecord={0: [("BUDGET", "LAST")], 1: []})
which creates a workable OC file:
BEGIN period 1
PRINT BUDGET LAST
END period 1
BEGIN period 2
END period 2
@langevin-usgs, @jdhughes-usgs, I am looking for some clarification on this. Is OC the only package where an empty period 1 block is necessary to disable the setting? It seems like for all other period blocks, at least for the stress packages, an empty period 1 block does nothing and therefore should not be outputted.
Assuming I am correct and the behavior of the OC package is different form the other packages: Should we consistently (for all packages) output an empty period 1 block when an empty dataset is specified for period 1? Or should we have a special case where flopy can only output an empty period 1 block for the OC package?
I think that if a stress period has an empty list, then the user is intentionally asking for the period block to be included and empty. The OC Package may be the only case now where this behavior matters, but my feeling is that if an empty listed is provided, that the block should be written and empty.
@mwtoews, I just merged a PR that fixes the problem with an empty period 1 block.