Skip to content

Commit

Permalink
imod coupler API changes (#50)
Browse files Browse the repository at this point in the history
* imod coupler API changes

* Set appropriate classes for API docs
  • Loading branch information
Huite authored Mar 25, 2024
1 parent d811fd4 commit f4e995d
Show file tree
Hide file tree
Showing 5 changed files with 2,849 additions and 2,730 deletions.
9 changes: 7 additions & 2 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ quartodoc:
desc: Couple MetaSWAP and MODFLOW 6.
contents:
- MetaMod
- MetaModDriverCoupling
- title: RibaMod
desc: Couple Ribasim and MODFLOW 6.
contents:
- RibaMod
- ribamod.DriverCoupling
- RibaModActiveDriverCoupling
- RibaModPassiveDriverCoupling
- title: RibaMetaMod
desc: Couple Ribasim, MetaSWAP and MODFLOW 6.
contents:
- RibaMetaMod
- ribametamod.DriverCoupling
- RibaMetaDriverCoupling
- RibaModActiveDriverCoupling
- RibaModPassiveDriverCoupling
- MetaModDriverCoupling
17 changes: 4 additions & 13 deletions docs/coupler_metamod_config.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ work_dir = './msw_data'

# Inner model with sprinkling
[[driver.coupling]]
enable_sprinkling = true
mf6_model = 'inner_model'
mf6_msw_recharge_pkg = 'RCH_MSW'
mf6_msw_well_pkg = 'WELLS_MSW'
mf6_msw_node_map = './mappings_inner/nodenr2svat.dxc'
mf6_msw_recharge_map = './mappings_inner/rchindex2svat.dxc'
mf6_msw_sprinkling_map = './mappings_inner/wellindex2svat.dxc'
mf6_msw_sprinkling_map_groundwater = './mappings_inner/wellindex2svat.dxc'

# Outer model, without sprinkling
[[driver.coupling]]
enable_sprinkling = false
mf6_model = 'outer_model'
mf6_msw_recharge_pkg = 'RCH_MSW'
mf6_msw_node_map = './mappings_outer/nodenr2svat.dxc'
Expand Down Expand Up @@ -124,13 +122,6 @@ mf6_msw_recharge_map = './mappings_outer/rchindex2svat.dxc'

### driver.coupling

| | |
|---------------|----------------------------------------------------------------------------------------------------------------------|
| description | Whether to enable sprinkling, that is: enable extracting groundwater for irrigation. |
| type | bool |
| required | true |
: enable_sprinkling

| | |
|---------------|----------------------------------------------------------------------------------------------------------------------|
| description | Specifies the MODFLOW 6 model name to which MetaSWAP will be coupled. |
Expand Down Expand Up @@ -161,14 +152,14 @@ mf6_msw_recharge_map = './mappings_outer/rchindex2svat.dxc'

| | |
|---------------|----------------------------------------------------------------------------------------------------------------------|
| description | Path to the file specifying the mapping between MODFLOW 6 recharge cells and MetaSWAP svats. |
| description | Path to the file specifying the mapping between MODFLOW 6 recharge cells and MetaSWAP svats. |
| type | str |
| required | true |
: mf6_msw_recharge_pkg

| | |
|---------------|----------------------------------------------------------------------------------------------------------------------|
| description | Path to the file specifying the mapping between MODFLOW 6 wells and MetaSWAP svats. This setting is only required if `enable_sprinkling` is set to `true`. |
| description | Path to the file specifying the mapping between MODFLOW 6 wells and MetaSWAP svats. |
| type | str |
| required | false |
: mf6_msw_sprinkling_map
: mf6_msw_sprinkling_map_groundwater
11 changes: 8 additions & 3 deletions docs/coupler_metamod_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,16 @@
},
"outputs": [],
"source": [
"driver_coupling = primod.MetaModDriverCoupling(\n",
" mf6_model=\"GWF_1\",\n",
" mf6_recharge_package=\"rch_msw\",\n",
" mf6_wel_package=\"wells_msw\",\n",
")\n",
"\n",
"metamod = primod.MetaMod(\n",
" msw_model=msw_model,\n",
" mf6_simulation=simulation,\n",
" mf6_rch_pkgkey=\"rch_msw\",\n",
" mf6_wel_pkgkey=\"wells_msw\",\n",
" coupling_list=[driver_coupling],\n",
")"
]
},
Expand Down Expand Up @@ -1182,7 +1187,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
18 changes: 10 additions & 8 deletions docs/coupler_ribamod_preprocessing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ The following abbreviated example:
import ribasim
import geopandas as gpd
import imod

from primod.ribamod import DriverCoupling, RibaMod
import primod


ribasim_model = ribasim.Model.read("ribasim/ribasim.toml")
mf6_simulation = imod.mf6.Modflow6Simulation.from_file("modflow/GWF_1.toml")
basin_definition = gpd.read_file("ribasim_network.gpkg", layer="basin_areas")


driver_coupling = DriverCoupling(
driver_coupling_active = primod.RibaModActiveDriverCoupling(
mf6_model="GWF_1",
mf6_packages=["riv-1"],
basin_definition=basin_definition,
)
driver_coupling_passve = primod.RibaModPassiveDriverCoupling(
mf6_model="GWF_1",
mf6_active_river_packages=["riv-1"],
mf6_passive_drainage_packages=["drn-1", "drn-2"],
mf6_packages=["drn-1", "drn-2"],
basin_definition=basin_definition,
)

ribamod_model = RibaMod(
ribamod_model = primod.RibaMod(
ribasim_model=ribasim_model,
mf6_simulation=mf6sim,
coupling_list=[driver_coupling],
coupling_list=[driver_coupling_active, driver_coupling_passive],
)

ribamod_model.write(
Expand Down
Loading

0 comments on commit f4e995d

Please sign in to comment.