diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.json index faf4147c..4ba61bcd 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.json @@ -6,6 +6,10 @@ "multi": true, "subtype": "stress", "dims": { + "maxbound": { + "value": "maxbound", + "scope": "model" + }, "auxiliary": { "value": "len(auxiliary)" }, @@ -96,7 +100,14 @@ } }, "dimensions": { - "fields": {} + "fields": { + "maxbound": { + "type": "integer", + "longname": "maximum number of constant head cells in any stress period", + "description": "integer value specifying the maximum number of constant-head cells that will be specified for use during any stress period.", + "optional": true + } + } }, "period": { "fields": { diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.toml index 8cc498c2..52b0ef46 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.toml @@ -5,6 +5,10 @@ parent = "gwf-nam" multi = true subtype = "stress" +[dims.maxbound] +value = "maxbound" +scope = "model" + [dims.auxiliary] value = "len(auxiliary)" @@ -84,7 +88,11 @@ description = "turn off Newton for unconfined cells" optional = true developmode = true -[blocks.dimensions.fields] +[blocks.dimensions.fields.maxbound] +type = "integer" +longname = "maximum number of constant head cells in any stress period" +description = "integer value specifying the maximum number of constant-head cells that will be specified for use during any stress period." +optional = true [blocks.period.fields.head] type = "array" diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.yaml index db34c39f..db5b32fc 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-chdg.yaml @@ -5,6 +5,9 @@ parent: gwf-nam multi: true subtype: stress dims: + maxbound: + value: maxbound + scope: model auxiliary: value: len(auxiliary) naux: @@ -96,7 +99,13 @@ blocks: optional: true developmode: true dimensions: - fields: {} + fields: + maxbound: + type: integer + longname: maximum number of constant head cells in any stress period + description: integer value specifying the maximum number of constant-head cells that will be specified + for use during any stress period. + optional: true period: fields: head: diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.json index 42c0d61c..c98a1515 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.json @@ -6,6 +6,10 @@ "multi": true, "subtype": "stress", "dims": { + "maxbound": { + "value": "maxbound", + "scope": "model" + }, "auxiliary": { "value": "len(auxiliary)" }, @@ -107,7 +111,14 @@ } }, "dimensions": { - "fields": {} + "fields": { + "maxbound": { + "type": "integer", + "longname": "maximum number of drain cells in any stress period", + "description": "integer value specifying the maximum number of drains cells that will be specified for use during any stress period.", + "optional": true + } + } }, "period": { "fields": { diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.toml index dcc4ebe6..153e74c3 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.toml @@ -5,6 +5,10 @@ parent = "gwf-nam" multi = true subtype = "stress" +[dims.maxbound] +value = "maxbound" +scope = "model" + [dims.auxiliary] value = "len(auxiliary)" @@ -95,7 +99,11 @@ description = "cubic-scaling is used to scale the drain conductance" optional = true developmode = true -[blocks.dimensions.fields] +[blocks.dimensions.fields.maxbound] +type = "integer" +longname = "maximum number of drain cells in any stress period" +description = "integer value specifying the maximum number of drains cells that will be specified for use during any stress period." +optional = true [blocks.period.fields.elev] type = "array" diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.yaml index c4127277..ef3e4181 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-drng.yaml @@ -5,6 +5,9 @@ parent: gwf-nam multi: true subtype: stress dims: + maxbound: + value: maxbound + scope: model auxiliary: value: len(auxiliary) naux: @@ -115,7 +118,13 @@ blocks: optional: true developmode: true dimensions: - fields: {} + fields: + maxbound: + type: integer + longname: maximum number of drain cells in any stress period + description: integer value specifying the maximum number of drains cells that will be specified + for use during any stress period. + optional: true period: fields: elev: diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.json index 38a1a651..8d5950e0 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.json @@ -6,6 +6,10 @@ "multi": true, "subtype": "stress", "dims": { + "maxbound": { + "value": "maxbound", + "scope": "model" + }, "auxiliary": { "value": "len(auxiliary)" }, @@ -94,7 +98,14 @@ } }, "dimensions": { - "fields": {} + "fields": { + "maxbound": { + "type": "integer", + "longname": "maximum number of general-head boundaries in any stress period", + "description": "integer value specifying the maximum number of general-head boundary cells that will be specified for use during any stress period.", + "optional": true + } + } }, "period": { "fields": { diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.toml index 53e60e28..f7b5da47 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.toml @@ -5,6 +5,10 @@ parent = "gwf-nam" multi = true subtype = "stress" +[dims.maxbound] +value = "maxbound" +scope = "model" + [dims.auxiliary] value = "len(auxiliary)" @@ -82,7 +86,11 @@ longname = "export array variables to netcdf output files." description = "keyword that specifies input gridded arrays should be written to the model output NetCDF file with attributes that support using the generated file as a MODFLOW 6 simulation input. This option only has an effect when an output model NetCDF file is configured and the simulation is run in VALIDATE mode, otherwise it is ignored." optional = true -[blocks.dimensions.fields] +[blocks.dimensions.fields.maxbound] +type = "integer" +longname = "maximum number of general-head boundaries in any stress period" +description = "integer value specifying the maximum number of general-head boundary cells that will be specified for use during any stress period." +optional = true [blocks.period.fields.bhead] type = "array" diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.yaml index 4494d314..62fefd99 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-ghbg.yaml @@ -5,6 +5,9 @@ parent: gwf-nam multi: true subtype: stress dims: + maxbound: + value: maxbound + scope: model auxiliary: value: len(auxiliary) naux: @@ -97,7 +100,13 @@ blocks: simulation is run in VALIDATE mode, otherwise it is ignored. optional: true dimensions: - fields: {} + fields: + maxbound: + type: integer + longname: maximum number of general-head boundaries in any stress period + description: integer value specifying the maximum number of general-head boundary cells that will + be specified for use during any stress period. + optional: true period: fields: bhead: diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.json index 5a5a8cfa..3689622a 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.json @@ -6,6 +6,10 @@ "multi": true, "subtype": "stress", "dims": { + "maxbound": { + "value": "maxbound", + "scope": "model" + }, "auxiliary": { "value": "len(auxiliary)" }, @@ -94,7 +98,14 @@ } }, "dimensions": { - "fields": {} + "fields": { + "maxbound": { + "type": "integer", + "longname": "maximum number of river cells in any stress period", + "description": "integer value specifying the maximum number of rivers cells that will be specified for use during any stress period.", + "optional": true + } + } }, "period": { "fields": { diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.toml index 2a474691..836e249e 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.toml @@ -5,6 +5,10 @@ parent = "gwf-nam" multi = true subtype = "stress" +[dims.maxbound] +value = "maxbound" +scope = "model" + [dims.auxiliary] value = "len(auxiliary)" @@ -82,7 +86,11 @@ longname = "export array variables to netcdf output files." description = "keyword that specifies input gridded arrays should be written to the model output NetCDF file with attributes that support using the generated file as a MODFLOW 6 simulation input. This option only has an effect when an output model NetCDF file is configured and the simulation is run in VALIDATE mode, otherwise it is ignored." optional = true -[blocks.dimensions.fields] +[blocks.dimensions.fields.maxbound] +type = "integer" +longname = "maximum number of river cells in any stress period" +description = "integer value specifying the maximum number of rivers cells that will be specified for use during any stress period." +optional = true [blocks.period.fields.stage] type = "array" diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.yaml index 027a4817..e13bfbde 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-rivg.yaml @@ -5,6 +5,9 @@ parent: gwf-nam multi: true subtype: stress dims: + maxbound: + value: maxbound + scope: model auxiliary: value: len(auxiliary) naux: @@ -96,7 +99,13 @@ blocks: simulation is run in VALIDATE mode, otherwise it is ignored. optional: true dimensions: - fields: {} + fields: + maxbound: + type: integer + longname: maximum number of river cells in any stress period + description: integer value specifying the maximum number of rivers cells that will be specified + for use during any stress period. + optional: true period: fields: stage: diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.json index c434867f..520f53a8 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.json @@ -6,6 +6,10 @@ "multi": true, "subtype": "stress", "dims": { + "maxbound": { + "value": "maxbound", + "scope": "model" + }, "auxiliary": { "value": "len(auxiliary)" }, @@ -124,7 +128,14 @@ } }, "dimensions": { - "fields": {} + "fields": { + "maxbound": { + "type": "integer", + "longname": "maximum number of wells in any stress period", + "description": "integer value specifying the maximum number of wells cells that will be specified for use during any stress period.", + "optional": true + } + } }, "period": { "fields": { diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.toml index 45df9e11..189afdb3 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.toml @@ -5,6 +5,10 @@ parent = "gwf-nam" multi = true subtype = "stress" +[dims.maxbound] +value = "maxbound" +scope = "model" + [dims.auxiliary] value = "len(auxiliary)" @@ -110,7 +114,11 @@ longname = "export array variables to netcdf output files." description = "keyword that specifies input gridded arrays should be written to the model output NetCDF file with attributes that support using the generated file as a MODFLOW 6 simulation input. This option only has an effect when an output model NetCDF file is configured and the simulation is run in VALIDATE mode, otherwise it is ignored." optional = true -[blocks.dimensions.fields] +[blocks.dimensions.fields.maxbound] +type = "integer" +longname = "maximum number of wells in any stress period" +description = "integer value specifying the maximum number of wells cells that will be specified for use during any stress period." +optional = true [blocks.period.fields.q] type = "array" diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.yaml index e7d4febc..addb1820 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-welg.yaml @@ -5,6 +5,9 @@ parent: gwf-nam multi: true subtype: stress dims: + maxbound: + value: maxbound + scope: model auxiliary: value: len(auxiliary) naux: @@ -136,7 +139,13 @@ blocks: simulation is run in VALIDATE mode, otherwise it is ignored. optional: true dimensions: - fields: {} + fields: + maxbound: + type: integer + longname: maximum number of wells in any stress period + description: integer value specifying the maximum number of wells cells that will be specified + for use during any stress period. + optional: true period: fields: q: diff --git a/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py b/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py index 765b0db4..fbf0a75c 100644 --- a/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py +++ b/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py @@ -1464,47 +1464,7 @@ def to_v2_0_0_dev3(name: str, fields: OMD, meta: list[str]) -> v2.Component: else: existing_runtime_dims[dim_name] = v2.RuntimeDim(set_in="ar") - # Step 7: drop the vestigial `maxbound` DIMENSIONS input on READARRAYGRID - # ("G-variant") stress packages (gwf-chdg/drng/ghbg/rivg/welg and any future - # sibling built the same way). Confirmed directly in the MF6 Fortran source - # (src/Model/ModelUtilities/BoundaryPackageExt.f90, BndExtType%source_dimensions): - # - # if (this%readasarrays) then - # this%maxbound = this%dis%get_ncpl() - # else - # call mem_set_value(this%maxbound, 'MAXBOUND', this%input_mempath, ...) - # ... - # end if - # - # When READARRAYGRID is set, the whole branch that reads a user-supplied - # MAXBOUND from the input file is skipped unconditionally -- MAXBOUND is - # always overwritten with NCPL instead. A MAXBOUND entry in a real .chdg - # (etc.) file's DIMENSIONS block is accepted by the parser but silently - # has zero effect: not read, not logged, not validated. This is distinct - # from the ordinary (list-input) variant, where MAXBOUND is a real, - # required sizing dimension (`shape (maxbound)` on stress_period_data) -- - # only the READARRAYGRID variant's copy of this field is dead input. - # - # `memory.maxbound` (from the Step 4 stress-package template, above) is - # left untouched -- it still correctly documents the real runtime value - # (readonly, set_in="ar"), just no longer as something a caller provides. blocks = component.blocks - _options_fields = blocks["options"].fields if blocks and "options" in blocks else {} - _dims_fields = blocks["dimensions"].fields if blocks and "dimensions" in blocks else {} - if ( - isinstance(component, v2.Package) - and component.subtype == "stress" - and blocks - and "readarraygrid" in _options_fields - and "maxbound" in _dims_fields - ): - dims_block = blocks["dimensions"] - new_dims_fields = {k: v for k, v in dims_block.fields.items() if k != "maxbound"} - blocks = { - **blocks, - "dimensions": dims_block.model_copy(update={"fields": new_dims_fields}), - } - existing_input_dims.pop("maxbound", None) return component.model_copy( update={