Skip to content

feat(dfns): improve child bindings - #379

Merged
wpbonelli merged 5 commits into
MODFLOW-ORG:developfrom
wpbonelli:feat/dfns-file-links
Oct 5, 2026
Merged

wpbonelli merged 5 commits into
MODFLOW-ORG:developfrom
wpbonelli:feat/dfns-file-links

Conversation

@wpbonelli

Copy link
Copy Markdown
Member

An MF6 simulation has a tree of input files. The simulation namefile lists models, exchanges and solutions. Each model namefile lists packages. Packages may point to utilities, such as time series or observations. Until now the DFN spec described a file, and the schema's corresponding File field, as just a path, with nothing saying what it points to.

Make the target explicit so the spec can fully express how the simulation's components bind to one another. Allow a File field to name the component it corresponds to. For example, ts6_filename in gwf-chd names utl-ts. Most of these point to a single type, with namefile entries being an exception: a model's fname column can point to any package, and the ftype column next to it picks which. Add a File.component_ftype attribute too, to name another field playing this role. And add ftype to all components. These are unique per package from a hydrologic perspective, but not per DFN (variants such as gwf-rcha and gwf-rch have the same ftype)

wpbonelli and others added 5 commits October 3, 2026 14:40
Add File.component (a selector over component names, types and
subtypes, resolved among the owning component's children) and
File.component_ref (a sibling naming the target's ftype token), plus
File.mode_keyword for name-file entries, which have no FILEIN.

Selectors and parents share one vocabulary: add admits() and
covering_selector(), make Dfns.children() use admits() so list and
type/subtype parents work, and add Dfns.ftype()/ftype_family() to map
ftype tokens to components, array-based variants included.

A concrete package parent (utl-tvk's gwf-npf) now resolves to that
package's model for model-scoped dims.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Link subpackage file records from the legacy `# flopy subpackage`
keys, plus a small table for what those miss (sfr/lak tab6, ssm
spc6), and turn name-file filename columns into linked Files. Check
every `# mf6 subpackage` line is covered.

Derive each linked component's parent from the components linking it,
as the simplest covering selector, replacing infer_parent's guess:
e.g. utl-ts/obs/ncf/spc become `package`, utl-tvk `gwf-npf`, utl-ats
`sim-tdis`, gwf-gnc `[exg-gwfgwf, gwf-nam]`. This needs the whole
corpus, so migrate.py and Dfns.load now go through migrate_corpus().

Also make sim-nam's tdis6 required: mf6 fails without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Name-file links resolve a token like DIS6 or GWF6-GWF6 to a component.
That mapping was a naming-convention guess in the schema (Dfns.ftype);
make it data instead: ComponentBase.ftype, set by the migration, with
array-based variants sharing their base's token as mf6 does
(InputLoadType.f90).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sibling it names holds an ftype token, not a component name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
utl-spc, utl-spca, utl-tas and utl-ncf derived 'package' as their parent,
though only a few packages link them. Name those packages instead, checked
to admit every linker. Note in the spec that links are exact and a derived
parent may admit more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpbonelli wpbonelli added this to the 1.10.0 milestone Oct 5, 2026
@wpbonelli wpbonelli added the enhancement New feature or request label Oct 5, 2026
@wpbonelli
wpbonelli marked this pull request as ready for review October 5, 2026 12:25
@wpbonelli
wpbonelli merged commit 42eea48 into MODFLOW-ORG:develop Oct 5, 2026
15 checks passed
@wpbonelli
wpbonelli deleted the feat/dfns-file-links branch October 5, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant