Skip to main content

regional_model

regional_model

Steps shared by the regional models of all water authorities, vrij afwaterend and peilbeheerst alike.

add_lhm_forcing sets the forcing, add_inflows adds the foreign inflows and the RWZIs, and finish_regional_model lays out the model, gives it the summer and winter levels, and writes, runs and checks it. The pipelines of both kinds of water authorities call them, see pipeline/07_add_dynamic_forcing.py and ribasim_nl.workflow.

Functions

Name Description
add_inflows Add the measured foreign inflows, the RWZIs, and the LHM fractions.
add_lhm_forcing Add the meteo of the LHM, and its groundwater budgets as drainage, infiltration and surface runoff.
finish_regional_model Lay out, write, validate and run the model, use its final state as initial state, and check its results.
read_lhm_budgets The daily LHM budgets that cover the simulation period, at the time at which their day starts.

add_inflows

regional_model.add_inflows(model, authority, output_dir)

Add the measured foreign inflows, the RWZIs, and the LHM fractions.

Parameters

Name Type Description Default
model Model model required
authority str water authority, of which ribasim_nl.transboundary_inflow adds the foreign inflows required
output_dir Path directory of the model, of which meta/RWZI_coordinates_lhm_coverage.geojson gets the RWZIs required

Returns

Name Type Description
Model the model with inflows

add_lhm_forcing

regional_model.add_lhm_forcing(
    model,
    output_dir,
    *,
    sprinkling,
    assign_fractions=False,
    fraction_prefix=None,
)

Add the meteo of the LHM, and its groundwater budgets as drainage, infiltration and surface runoff.

The budgets per Basin are written to mfms_budgets.arrow in output_dir, for later verification, and their assignment is plotted to results/assign_validation.png.

Parameters

Name Type Description Default
model Model model of which all Basins have a meta_categorie required
output_dir Path directory of the model required
sprinkling Literal['primary', 'secondary'] Basins from which sprinkling from surface water is drawn; the vrij afwaterend models draw it from the primary Basins, the peilbeheerst models from the secondary (bergend) Basins required
assign_fractions bool compute the (sub-)fractions of the budgets, see AssignOfflineBudgets.compute_budgets False
fraction_prefix str | None prefix of the fractions, the waterbeheercode of the authority None

Returns

Name Type Description
Model the model with forcing

finish_regional_model

regional_model.finish_regional_model(
    model,
    toml_file,
    authority,
    *,
    snap,
    steady_state_regression=False,
)

Lay out, write, validate and run the model, use its final state as initial state, and check its results.

The layout only changes the geometry, after all parametrization: the Basin areas are made valid, without slivers (see Model.clean_basin_area), snap routes the links along the waterways known for the authority, after which the BGT profile of ManningResistances follows their new links (see update_manning_resistance_reach), the RWZIs discharge on the links into their Basins (see #860), and nodes and links are moved apart. Then the model gets the summer and winter levels of the peilgebieden of the authority, see ribasim_nl.seasonal_levels. The results get performance.xlsx and output_controle.gpkg.

Parameters

Name Type Description Default
model Model parametrized model required
toml_file Path TOML file to write the model to required
authority str water authority, as named in the koppeltabel of the observations required
snap Callable[[Model], Model] function that snaps the links and Basins to the waterways required
steady_state_regression bool also write, run and check the dry and wet steady state variants False

Returns

Name Type Description
Model the model with its final state as initial state

read_lhm_budgets

regional_model.read_lhm_budgets(path=LHM_BUDGETS)

The daily LHM budgets that cover the simulation period, at the time at which their day starts.

The day before STARTTIME is included, since it lasts until LHM_DAY_START on the first day. As Basin forcing is constant between its times, the forcing of an LHM day applies over the same period as in the LHM, without using rain that falls later. The forcing then changes at LHM_DAY_START and the other forcing at midnight, which made the solver of the regional models about 6% slower.