Code
%run ../../utils/plot_node_connectivity.py
import matplotlib.pyplot as plt
fig = plot_all_node_connectivity()
plt.show()
plt.close(fig)
The diagram and tables below show the validation rules applied to the input to the Julia core before running the model. Some node types have more complex connectivity validation than shown here. See the Junction and UserDemand pages for their additional rules.
The diagram below shows every allowed upstream and downstream node type for each node type that can have flow links. Each group has its own nodes, with upstream neighbors on the left, downstream neighbors on the right, and flow directed from left to right. This is a connectivity illustration, not a valid simulation model.
The tables below show the minimum and maximum numbers of incoming and outgoing neighbors for each node type, per link type. ∞ means there is no upper bound.
from ribasim.validation import link_neighbor_amount
for link_type in ("flow", "control", "listen"):
node_bounds = link_neighbor_amount[link_type]
print(f"\n## {link_type.title()} links\n")
print("| Node type | in_min | in_max | out_min | out_max |")
print("|:----------|-------:|-------:|--------:|--------:|")
for node_type, bounds in node_bounds.items():
values = ["∞" if value == 2**63 - 1 else str(value) for value in bounds]
print(f"| {node_type} | {' | '.join(values)} |")
print()| Node type | in_min | in_max | out_min | out_max |
|---|---|---|---|---|
| Basin | 0 | ∞ | 0 | ∞ |
| ContinuousControl | 0 | 0 | 0 | 0 |
| DiscreteControl | 0 | 0 | 0 | 0 |
| FlowBoundary | 0 | 0 | 1 | 1 |
| FlowDemand | 0 | 0 | 0 | 0 |
| Junction | 0 | ∞ | 0 | ∞ |
| LevelBoundary | 0 | ∞ | 0 | ∞ |
| LevelDemand | 0 | 0 | 0 | 0 |
| LinearResistance | 1 | 1 | 1 | 1 |
| ManningResistance | 1 | 1 | 1 | 1 |
| Observation | 0 | 0 | 0 | 0 |
| Outlet | 1 | 1 | 1 | 1 |
| PidControl | 0 | 0 | 0 | 0 |
| Pump | 1 | 1 | 1 | 1 |
| TabulatedRatingCurve | 1 | 1 | 1 | 1 |
| Terminal | 1 | ∞ | 0 | 0 |
| UserDemand | 1 | ∞ | 1 | 1 |
| Node type | in_min | in_max | out_min | out_max |
|---|---|---|---|---|
| Basin | 0 | 1 | 0 | 0 |
| ContinuousControl | 0 | 0 | 1 | ∞ |
| DiscreteControl | 0 | 0 | 1 | ∞ |
| FlowBoundary | 0 | 0 | 0 | 0 |
| FlowDemand | 0 | 0 | 1 | 1 |
| Junction | 0 | 0 | 0 | 0 |
| LevelBoundary | 0 | 0 | 0 | 0 |
| LevelDemand | 0 | 0 | 1 | ∞ |
| LinearResistance | 0 | 1 | 0 | 0 |
| ManningResistance | 0 | 1 | 0 | 0 |
| Observation | 0 | 0 | 0 | 0 |
| Outlet | 0 | 2 | 0 | 0 |
| PidControl | 0 | 1 | 1 | 1 |
| Pump | 0 | 2 | 0 | 0 |
| TabulatedRatingCurve | 0 | 1 | 0 | 0 |
| Terminal | 0 | 0 | 0 | 0 |
| UserDemand | 0 | 0 | 0 | 0 |
| Node type | in_min | in_max | out_min | out_max |
|---|---|---|---|---|
| Basin | 0 | 0 | 0 | ∞ |
| ContinuousControl | 1 | ∞ | 0 | 0 |
| DiscreteControl | 1 | ∞ | 0 | 0 |
| FlowBoundary | 0 | 0 | 0 | ∞ |
| FlowDemand | 0 | 0 | 0 | ∞ |
| Junction | 0 | 0 | 0 | ∞ |
| LevelBoundary | 0 | 0 | 0 | ∞ |
| LevelDemand | 0 | 0 | 0 | ∞ |
| LinearResistance | 0 | 0 | 0 | ∞ |
| ManningResistance | 0 | 0 | 0 | ∞ |
| Observation | 0 | 0 | 0 | 0 |
| Outlet | 0 | 0 | 0 | ∞ |
| PidControl | 1 | ∞ | 0 | 0 |
| Pump | 0 | 0 | 0 | ∞ |
| TabulatedRatingCurve | 0 | 0 | 0 | ∞ |
| Terminal | 0 | 0 | 0 | ∞ |
| UserDemand | 0 | 0 | 0 | ∞ |
Junction nodes in Junction / static, which divide the flow or supply a UserDemand, have additional connectivity rules, which are given on the Junction page.
Pump and Outlet can receive two control links, in which case one must be from a FlowDemand, and the other from a control node.
Besides connectivity, the Julia core checks the input values and the combinations of values. A model that violates one of these rules is not run, and the log lists the offending nodes. The rules below are grouped by topic. Each node page documents its own parameters; this overview lists the checks that go beyond a single column.
node_id occurs once in the Node table, and every node ID in another table exists in the Node table and has the node type of that table.Variable tables of ContinuousControl and DiscreteControl are exempt, since the same variable can be listened to multiple times, for instance with a different look_ahead.control_states must be controlled by DiscreteControl; otherwise use a row without control_state.starttime is before the endtime.reduced_implicit_solve = true is only allowed for solver algorithms that support it (see solver settings).intervention_interval is positive and finite, and the allocation timesteps satisfy 0 < dtmin ≤ dtmax, with dt positive if given. A dtmin, dtmax or dt larger than the intervention_interval is reduced to it, with a warning.compression_level is between 0 and 9, and significant_bits between 0 and 52.Basin / state table, is not below the lowest level of the Basin profile.Basin / concentration_external.cyclic_time is used.min_upstream_level that is not below the Basin bottom.profile_width and profile_slope are not both zero, also not after a control state update.controlled_variable.compound_variable_id in its variable table.allocation_controlled set to true. Flow is only from the primary network into a secondary network, not between secondary networks.max_flow_rate, also in every control state.return_factor is between 0 and 1, and return_factor and min_level are equal for all demand priorities. The min_level of a UserDemand that takes water from a Basin is empty or not below the Basin bottom.See the Junction connectivity rules for the rules on Junction groups and on the Junctions that divide the flow, including the rules on their fractions.