Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

msw.CouplerMapping should evaluate the well package only if msw.Sprinkling class is present #1056

Closed
HendrikKok opened this issue May 27, 2024 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@HendrikKok
Copy link
Contributor

When generating the coupled id's, the well package is evaluated to look for groundwater extraction nodes. If after generating the MetaSWAP model, the msw.Sprinkling package is popped from the model, the coupling still includes the sprinkling nodes. Since the corresponding sprinkling input is not generated, this results in MetaSWAP errors.

A more robust method would be to evaluate the well package only when Sprinkling package is present in model.

@HendrikKok HendrikKok added bug Something isn't working enhancement New feature or request labels May 27, 2024
@github-project-automation github-project-automation bot moved this to 📯 New in iMOD Suite May 27, 2024
@Huite
Copy link
Contributor

Huite commented May 27, 2024

Doesn't this belong in primod, in the imod-coupler repo instead?
(The code is currently duplicated and share between here and there, I think)

@JoerivanEngelen JoerivanEngelen moved this from 📯 New to 🏗 In Progress in iMOD Suite Oct 30, 2024
@JoerivanEngelen JoerivanEngelen self-assigned this Oct 30, 2024
@JoerivanEngelen JoerivanEngelen moved this from 🏗 In Progress to 🧐 In Review in iMOD Suite Oct 30, 2024
@JoerivanEngelen
Copy link
Contributor

JoerivanEngelen commented Oct 30, 2024

This PR #1259 fixes this in a different way: mappings are generated upon writing the model, therefore this wouldn't be an issue anymore.

JoerivanEngelen added a commit that referenced this issue Nov 1, 2024
Fixes #1255 and #1056

# Description
This is part 2 of the metaswap refactoring on the iMOD Python side. The
goal of this step was to require a Mf6Wel object at ``write`` instead of
at init. For this I was struggling quite a lot with Linkov's principle
and the resulting mypy errors. In the end, I resorted to requiring all
arguments for the write method for each package. This results in a bit
of a weird situation, where a ``None`` has to be provided for the
``mf6_dis`` and ``mf6_wel`` arguments to the ``write`` of an individual
no even using these args. I don't think this is a major hickup for
users, as they are nearly always writing with ``model.write`` directly,
and not writing individual packages manually.

Though not perfect, I think this is certainly a big improvement to the
current situation.

In total, this PR:

- Removes the mf6 packages as attributes from ``Sprinkling`` and
``CouplerMapping``. This makes dumping the metaswap packages easier.
This affects the files ``imod.msw.sprinkling.py`` and
``imod.msw.coupler_mapping.py``.
- Updates the ``Sprinkling`` and ``CouplerMapping`` class to ask
MODFLOW6 packages at ``write`` instead of at ``__init__``. This affects
``imod.msw.sprinkling.py``, ``imod.msw.coupler_mapping.py``, and
``imod.msw.model.py``
- Updates the signatures
- Implements a ``regrid_like`` for the Sprinkling package. Affects
``imod.msw.sprinkling.py``.
- Adds a test to regrid a MetaSWAP model and its coupled MODFLOW6 model.
The ``Mf6Wel`` package has to be created manually now after regridding.

# Checklist
- [x] Links to correct issue
- [x] Update changelog, if changes affect users
- [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737``
- [x] Unit tests were added
- [ ] **If feature added**: Added/extended example
@github-project-automation github-project-automation bot moved this from 🧐 In Review to ✅ Done in iMOD Suite Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: ✅ Done
Development

No branches or pull requests

3 participants