Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add logging to Modflow 6 simulation #492

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

Closed
1 of 8 tasks
Manangka opened this issue Dec 11, 2023 · 1 comment · Fixed by #1484
Closed
1 of 8 tasks

Add logging to Modflow 6 simulation #492

Manangka opened this issue Dec 11, 2023 · 1 comment · Fixed by #1484

Comments

@Manangka
Copy link
Collaborator

Manangka commented Dec 11, 2023

In GitLab by @JoerivanEngelen on Jul 25, 2023, 17:41

Add logging to:

  • Initialization?
  • Writing
  • Dump
  • Validation?
  • Modflow 6 run stdout
  • Time discretization
  • Solver settings
  • (Future: Model exchanges?)
@Manangka Manangka changed the title [PLACEHOLDER] - for issue #492 Add logging to Modflow 6 simulation Dec 12, 2023
@Manangka Manangka reopened this Dec 12, 2023
@github-project-automation github-project-automation bot moved this to 📯 New in iMOD Suite Feb 1, 2024
@JoerivanEngelen
Copy link
Contributor

@Manangka mentioned, the Modflow 6 stdout can be easily added to the logging as follows:

    def run(self, mf6path: Union[str, Path] = "mf6") -> None:
    ...
        with imod.util.cd(self.directory):
            result = subprocess.run(mf6path, capture_output=True)
            imod.logging.logger.info(result.stdout.decode())
            if result.returncode != 0:
                raise RuntimeError(
                    f"Simulation {self.name}: {mf6path} failed to run with returncode "
                    f"{result.returncode}, and error message:\n\n{result.stdout.decode()} "
                )

This has the downside afaik, that things are logged only when the simulation is terminated. Which is useful, but not when you are running a long simulation and want to know its progress.

@JoerivanEngelen JoerivanEngelen moved this from 📯 New to 🤝 Accepted in iMOD Suite Mar 29, 2024
@JoerivanEngelen JoerivanEngelen moved this from 🤝 Accepted to 📝Refined in iMOD Suite Dec 20, 2024
JoerivanEngelen added a commit that referenced this issue Mar 10, 2025
Fixes #492

# Description
Adds some simple logging to the simulation object. I didn't add solver
settings, these are listed in the .ims file. I also didn't add stdout of
MODFLOW6, as this is already logged in the LIST file and would require
some extra work.

Furthermore some boyscouting: fix some easy-to-fix issues raised by
Sonarcloud:

- Remove unreachable return statements
- Don't use caps in variable's name

# Checklist
- [x] Links to correct issue
- [x] Update changelog, if changes affect users
- [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737``
- [ ] Unit tests were added
- [ ] **If feature added**: Added/extended example
@github-project-automation github-project-automation bot moved this from 📝Refined to ✅ Done in iMOD Suite Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants