Repository navigation
feat(swr): implement ModflowSwr1 write and load - #2866
Open
eacuellarq wants to merge 1 commit into
Open
eacuellarq wants to merge 1 commit into
eacuellarq wants to merge 1 commit into
Conversation
Replace the SWR1 stub, which could not write or load the package, with a complete implementation of every SWR1 input item (MODFLOW-NWT 1.3.0, SWR1 1.05), and register it in Modflow.load. * write_file and load for items 1-15, structures of every type, geometry types 1-5, tabfiles (ASCII and binary), observations, direct runoff * where the input instructions and gwf2swr7.f disagree, follow the code * validate() reports inconsistencies MODFLOW would stop on or misread * SwrExternal keeps lists and grids in OPEN/CLOSE files * optional zero-based KRCH/IRCH/JRCH (zero_based=True) * add the USGS SWR test problem 5 to examples/data/swr_sample05 Refs modflowpy#2389
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2389
flopy.modflow.ModflowSwr1was a stub:write_file()raisedNotImplementedError,load()did not parse the file, andswrwas notregistered in
Modflow.load. This PR replaces it with a full implementationof the SWR1 Process (MODFLOW-NWT 1.3.0 / SWR1 1.05).
What's included
write_fileandloadfor every input item (1–15): options, solvercontrols, reaches and connectivity, tabfiles (ASCII and binary, with the
time series loaded into
tabfiles[i]["data"]), observations, boundarytypes, rain/evap/lateral flow (lists or grids), geometry types 1–5
(including cross sections and tables), structures of every
ISTRTYPE(including operable structures and SFR coupling), stage, auxiliary
variables and direct runoff.
gwf2swr7.fdisagree (item 13a fieldorder, item 13b, item 4f
IOBSLOC2, undocumented options), the code isfollowed; the differences are listed in the module docstring.
validate()(run bywrite_file) reports input MODFLOW would stop on orsilently misread: reach/grid indices, non-symmetric connectivity,
structures connected to unconnected reaches,
TABDATAn/REACHnreferences, missing geometry fields, lines longer than the 200-character
Fortran buffer.
SwrExternalkeeps lists and grids in OPEN/CLOSE files; loading keepsOPEN/CLOSE references.
"swr"is registered inModflow.mfnam_packages.ModflowSwr1(m)).Index convention
Reach, layer, row and column numbers default to one-based, as in the
SWR1 manual, because reach numbers also appear in connectivity, structures,
observations and
REACHnreferences.zero_based=TruemakesKRCH/IRCH/JRCH zero-based like other FloPy packages. Happy to change the
default if preferred.
Tests (
autotest/test_swr.py)examples/data/swr_sample05, ~350 KB of inputs) and text-identicalload → write → load → write.
@pytest.mark.slow: load → write → run of the USGS problem givesbyte-identical
.hds, QAQ, group flow, stage and RIV outputs.mfnwt, the flood wave passes,and the binary outputs are read with
SwrStage/SwrExchange/SwrBudget.mfnwt, andround-tripped.
binary tabfiles.
Ran locally:
ruff check/ruff format --checkclean,codespellclean,pytest autotest/test_swr.py autotest/test_swr_binaryread.py17 passed.