Skip to main content

LinearResistance

Bidirectional flow proportional to the level difference between the connected basins.

1 Schematic

Code
include("../../../utils/plot_connector_schematic.jl")
plot_connector_schematic(:LinearResistance)

2 Allowed connectivity

The diagram below shows which node types are allowed directly upstream (left) and downstream (right) of this node. This is a connectivity illustration, not a valid simulation model.

Code
include("../../../utils/plot_node_connectivity.jl")
plot_node_connectivity("LinearResistance")

3 Tables

3.1 Static

Code
include("../../../utils/gen_docs_table.jl")
table_from_schema(
    Ribasim.Schema.LinearResistance.Static;
    restrictions = Dict(:max_flow_rate => "non-negative"),
)
column type unit optional default restriction
node_id Int32 - x - -
resistance Float64 s m⁻² x - -
max_flow_rate Float64 m³ s⁻¹ ✓ Inf non-negative
control_state String - ✓ - -

4 Equations

A LinearResistance connects two Basins together. The flow between the two Basins is determined by a linear relationship, up to an optional maximum flow rate:

\[ Q_\text{linear\_resistance} = \phi\mathrm{clamp}\left(\frac{h_a - h_b}{R}, -Q_{\max}, Q_{\max}\right) \]

Here \(h_a\) is the water level in the incoming Basin and \(h_b\) is the water level in the outgoing Basin. \(R\) is the resistance of the link, and \(Q_{\max}\) is the maximum flow rate. Water flows from high to low; either direction is possible. \(\phi\) is the reduction factor which makes the flow go smoothly to \(0\) as the upstream water depth (as determined by the flow direction) goes from depth_threshold to the Basin bottom.

For depth_threshold see Solver settings.

5 Behavior in allocation

Allocation cannot set the flow of a LinearResistance directly: like in the simulation, the flow follows from the water levels on either side of it. Allocation predicts this flow with a simplified version of the equations above, so the flow that allocation planned, in allocation_flow.nc, can differ from the simulated flow in flow.nc.

A FlowDemand on a LinearResistance can only be met when allocation can raise the flow by changing the water levels, for instance by steering an allocation-controlled Pump or Outlet upstream.

With a route priority for LinearResistance nodes, see allocation settings, allocation can be made to prefer or avoid routing water through them.