Skip to content

Commit

Permalink
Merge branch 'main' into add-examples-RibaMetaMod
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikKok committed Jul 5, 2024
2 parents 30d404c + af69c70 commit 84602a1
Show file tree
Hide file tree
Showing 5 changed files with 355 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/_quarto-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ book:
- coupler_ribamod_config.qmd
- coupler_ribamod_technical.qmd
- coupler_ribamod_preprocessing.qmd
- coupler_ribametamod_config.qmd
- coupler_ribametamod_technical.qmd
- coupler_ribametamod_preprocessing.qmd
- primod_api/index.qmd
- coupler_architecture.qmd
- coupler_release.qmd
Expand Down
5 changes: 5 additions & 0 deletions docs/_quarto-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ website:
- href: coupler_ribamod_config.qmd
- href: coupler_ribamod_technical.qmd
- href: coupler_ribamod_preprocessing.qmd
- section: "Ribasim - MetaSWAP - MODFLOW 6"
contents:
- href: coupler_ribametamod_config.qmd
- href: coupler_ribametamod_technical.qmd
- href: coupler_ribametamod_preprocessing.qmd
- href: primod_api/index.qmd
- href: coupler_architecture.qmd
- href: coupler_release.qmd
Expand Down
13 changes: 12 additions & 1 deletion docs/coupler_architecture.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ flowchart BT
ribasim_python[Ribasim Python] --> primod
imod-python[iMOD Python] --> primod
primod --> ribasim[Ribasim]
primod --> imodc
primod --> |couple tables|imodc
primod --> MetaSWAP
primod --> modflow6[MODFLOW 6]
ribasim --> imodc["iMOD Coupler"]
MetaSWAP --> imodc["iMOD Coupler"]
modflow6 --> imodc
```

Expand All @@ -63,6 +65,15 @@ while self.get_current_time() < self.get_end_time():

self.finalize()
```
### Logging of exchanged values

An integral task of an iMOD Coupler driver is to support the exchange of values between hydrological kernels.
Values exchanged by the coupler for a specific variable can optionally be written to file during the simulation for inspection.
These values are written as timeseries to separate files per variable.
In the initialization stage of the simulation a dictionary-like structure (ExchangeCollector class) is created which holds
a collection of labelled ExchangeLogger instances.
The initialization of an ExchangeLogger creates a netcdf file with dimensions `time` and `id`, a variable `time` with dimension (`time`)
and a variable `xchg` with dimensions (`time`, `id`). The time dimension is the unlimited dimension.

## Continuous Integration

Expand Down
184 changes: 184 additions & 0 deletions docs/coupler_ribametamod_config.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
title: Configuration
---

The configuration file is necessary to describe the model and its dependencies. It is in the [toml](https://toml.io/en/) format and should have a `.toml` extension.

```{=html}
<!--
Note that `toml` uses quote marks differently than `python`. Single quotes in
toml (`''`) are interpreted similarly to how python would interpret a rawstring
(`r''` or `r""`), whereas double quotes (`""`) are interpreted in a similar
manner to regular strings in python (`""` or `''`). This matters for paths on
Windows, for which we advice to use single quotes. -->
```
``` toml
timing = false
log_level = "INFO"
driver_type = "ribametamod"

[driver.kernels.modflow6]
dll = "./kernels/modflow6/libmf6.dll"
dll_dep_dir = "./kernels/modflow6"
work_dir = "./mf6_data"

[driver.kernels.metaswap]
dll = "./kernels/metaswap/MetaSWAP.dll"
dll_dep_dir = "./kernels/metaswap"
work_dir = "./metaswap"

[driver.kernels.ribasim]
dll = "./kernels/ribasim/bin/libribasim.dll"
dll_dep_dir = "./kernels/ribasim/bin"
config_file = "./ribasim_data/ribasim.toml"

[[driver.coupling]]
mf6_model = "GWF_1"
mf6_msw_node_map = "./exchanges/nodenr2svat.dxc"
mf6_msw_recharge_pkg = "rch_msw"
mf6_msw_recharge_map = "./exchanges/rchindex2svat.dxc"
mf6_msw_well_pkg = "well_msw"
mf6_msw_sprinkling_map_groundwater = "./exchanges/wellindex2svat.dxc"
rib_msw_ponding_map_surface_water = "./exchanges/msw_ponding.tsv"
rib_msw_sprinkling_map_surface_water = "./exchanges/msw_sw_sprinkling.tsv"
output_config_file = "C:\\Users\\leander\\AppData\\Local\\Temp\\pytest-of-leander\\pytest-1254\\test_ribametamod_two_basin_use0\\develop\\exchange_logging\\logging.toml"

[driver.coupling.mf6_active_river_packages]
riv_1 = "./exchanges/riv_1.tsv"

[driver.coupling.mf6_passive_river_packages]

[driver.coupling.mf6_active_drainage_packages]

[driver.coupling.mf6_passive_drainage_packages]
```

## Config schema

<!--
<font size=-1>
| name | description | type | default | enum | |
|------------|-------------|------------|------------|------------|------------|
| log_level | verbosity of logging | str | INFO | DEBUG, INFO, WARNING, ERROR, CRITICAL | |
| timing | profiling active?<br>if so, record timing | boolean | false | | |
| driver_type | chosen coupler implementation. Typically associated with the set of coupled kernels | str | | | |
| <b>driver.kernels.modflow6</b> | | | | | |
| dll | path to the MODFLOW 6 library file | str | | | |
| dll_dep_dir | optional path to the library's dependencies | str | \[..\] | | |
| workdir | path to the MODFLOW 6 working directory holding the simulation name file | str | | | |
| <b>driver.kernels.metaswap</b> | | | | | |
| dll | path to the MetaSWAP library file | str | | | |
| dll_dep_dir | optional path to the library's dependencies | str | \[..\] | | |
| workdir | path to the MetaSWAP working directory holding the <tt>parasim.inp name</tt> file | str | | | |
| <b>driver.kernels.ribasim</b> | | | | | |
| dll | path to the Ribasim library file | str | | | |
| config_file | path to the Ribasim config file | str | | | |
| <b>driver.coupling</b> | | | | | |
| mf6_model | name of the MODFLOW 6 model (within the simulation) to couple | str | | | |
| mf6_active_river_packages | dictionary of active MODFLOW 6 river packages with couple file | dict |
| mf6_passive_river_packages | dictionary of passive MODFLOW 6 river packages with couple file | dict |
| mf6_active_river_packages | dictionary of active MODFLOW 6 drainage packages with couple file | dict |
| mf6_passive_river_packages | dictionary of passive MODFLOW 6 drainage packages with couple file | dict |
</font>
-->

<font size=-1>
<table>
<thead><tr bgcolor="lightgray">
<td width=230> <b>name</b> </td>
<td><b>description</b></td>
<td width=75><b>type</b></td>
<td width=75><b> default</b></td>
<td> <b>enum </b> </td><td> </td>
</tr></thead>
<tbody>
<tr style="vertical-align:top">
<td> log_level </td><td> verbosity of logging </td><td> str </td><td> INFO </td><td> DEBUG, INFO, WARNING, ERROR, CRITICAL </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> timing </td><td> profiling active? if so, record timing </td><td> boolean </td><td> false </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> driver_type </td><td> chosen coupler implementation. Typically associated with the set of coupled kernels </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> <b>driver.kernels.modflow6</b> </td><td> </td><td> </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> dll </td><td> path to the MODFLOW 6 library file </td><td> str </td><td> </td><td> </td><td> </td></tr>
<tr style="vertical-align:top">
<td> dll_dep_dir </td><td> optional path to the library's dependencies </td><td> str </td><td> \[..\] </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> workdir </td><td> path to the MODFLOW 6 working directory holding the simulation name file </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> <b>driver.kernels.metaswap</b> </td><td> </td><td> </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> dll </td><td> path to the MetaSWAP library file </td><td> str </td><td> </td><td> </td><td> </td></tr>
<tr style="vertical-align:top">
<td> dll_dep_dir </td><td> optional path to the library's dependencies </td><td> str </td><td> \[..\] </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> workdir </td><td> path to the MetaSWAP working directory holding the <tt>parasim.inp name</tt> file </td><td> str </td><td> </td><td> </td><td> </td></tr>
<tr style="vertical-align:top">
<td> <b>driver.kernels.ribasim</b> </td><td> </td><td> </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> dll </td><td> path to the Ribasim library file </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> config_file </td><td> path to the Ribasim config file </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr><td><br></td></tr>
<tr style="vertical-align:top">
<td> <b>driver.coupling</b> </td><td> </td><td> </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> mf6_model </td><td> name of the MODFLOW 6 model (within the simulation) to couple </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> mf6_msw_node_map </td><td> file with MODFLOW 6 node to MetaSWAP svat mapping </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> mf6_msw_recharge_pkg </td><td> name of MODFLOW 6 recharge package for coupling with MetaSWAP </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> mf6_msw_recharge_map </td><td> file with MODFLOW 6 recharge index to MetaSWAP svat mapping </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> mf6_msw_well_pkg </td><td> name of MODFLOW 6 well package for coupling with MetaSWAP groundwater sprinkling </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> rib_msw_ponding_map_groundwater </td><td> file with Ribasim node index to MetaSWAP svat mapping for ponding </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> rib_msw_ponding_map_surface_water </td><td> file with Ribasim node index to MetaSWAP svat mapping for surface water sprinkling </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
<td> rib_msw_sprinkling_map_surface_water </td><td> file with Ribasim node index to MetaSWAP svat mapping for surface water sprinkling </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr><td><br></td></tr>
<tr style="vertical-align:top">
<td> mf6_active_river_packages </td><td> dictionary of active MODFLOW 6 river packages with couple file </td><td> dict </td>
<td>
<tr style="vertical-align:top">
<td> mf6_passive_river_packages </td><td> dictionary of passive MODFLOW 6 river packages with couple file </td><td> dict </td>
</tr>
<tr>
<tr style="vertical-align:top">
<td> mf6_active_river_packages </td><td> dictionary of active MODFLOW 6 drainage packages with couple file </td><td> dict </td>
</tr>
<tr style="vertical-align:top">
<td> mf6_passive_river_packages </td><td> dictionary of passive MODFLOW 6 drainage packages with couple file </td><td> dict </td>
</tr>
<tr style="vertical-align:top">
<td> output_config_file </td><td> <tt>.toml</tt> specifying kernel exchanges for which to record values to output files as timeseries </td><td> str </td><td> </td><td> </td><td> </td>
</tr>
<tr style="vertical-align:top">
</tbody>
</table>
</font>

Loading

0 comments on commit 84602a1

Please sign in to comment.