From 93e4287c773896f0c4c1553c0ac8997d0b175aae Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Fri, 9 Feb 2024 15:52:00 +0100 Subject: [PATCH] Review comments and correct rebasing omissions --- core/src/parameter.jl | 3 ++- core/src/schema.jl | 1 + docs/core/equations.qmd | 2 +- python/ribasim/ribasim/schemas.py | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/parameter.jl b/core/src/parameter.jl index 92f9a916e..b4f0fcb1b 100644 --- a/core/src/parameter.jl +++ b/core/src/parameter.jl @@ -197,7 +197,8 @@ Requirements: node_id: node ID of the LinearResistance node active: whether this node is active and thus contributes flows -resistance: the resistance to flow; Q = Δh/resistance +resistance: the resistance to flow; `Q_unlimited = Δh/resistance` +max_flow_rate: the maximum flow rate allowed through the node; `Q = clamp(Q_unlimited, -max_flow_rate, max_flow_rate)` control_mapping: dictionary from (node_id, control_state) to resistance and/or active state """ struct LinearResistance <: AbstractParameterNode diff --git a/core/src/schema.jl b/core/src/schema.jl index 67a1288ca..da9c61421 100644 --- a/core/src/schema.jl +++ b/core/src/schema.jl @@ -164,6 +164,7 @@ end node_id::Int active::Union{Missing, Bool} resistance::Float64 + max_flow_rate::Union{Missing, Float64} control_state::Union{Missing, String} end diff --git a/docs/core/equations.qmd b/docs/core/equations.qmd index e58b845d2..2630806e6 100644 --- a/docs/core/equations.qmd +++ b/docs/core/equations.qmd @@ -277,7 +277,7 @@ $$ Q = \mathrm{clamp}(\frac{h_a - h_b}{R}, -Q_{\max}, Q_{\max}) $$ {#eq-basinflow} -Here $h_a$ is the water level in the first basin, $h_b$ is the water level in the second basin. +Here $h_a$ is the water level in the first basin and $h_b$ is the water level in the second basin. $R$ is the resistance of the link, and $Q_{\max}$ is the maximum flow rate. A `LinearResistance` makes no assumptions about the direction of the flow: water flows from high to low. diff --git a/python/ribasim/ribasim/schemas.py b/python/ribasim/ribasim/schemas.py index 51372b5ef..c907d6d54 100644 --- a/python/ribasim/ribasim/schemas.py +++ b/python/ribasim/ribasim/schemas.py @@ -105,6 +105,7 @@ class LinearResistanceStaticSchema(_BaseSchema): node_id: Series[int] = pa.Field(nullable=False) active: Series[pa.BOOL] = pa.Field(nullable=True) resistance: Series[float] = pa.Field(nullable=False) + max_flow_rate: Series[float] = pa.Field(nullable=True) control_state: Series[str] = pa.Field(nullable=True)