From 6e72ba418cd73a9a72983be3fa714f921b510b01 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Fri, 16 Jun 2023 13:11:11 +0200 Subject: [PATCH] allow one-directional outflow to LevelBoundary (#327) This came up in a model from @d2hydro (https://github.com/d2hydro/lhm-ribasim/issues/5#issuecomment-1593707186). FractionalFlow, FlowBoundary and TabulatedRatingCurve should be able to flow out into a LevelBoundary. This is slightly odd since in these cases the level of the level boundary does not matter, since the flow is always into the LevelBoundary as determined by the other side. So using a Terminal might make more sense there. Still, validation shouldn't block this since you may want a single boundary node that connects to multiple node types, some directed like this, some with resistance for which you need a level. --- core/src/validation.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/validation.jl b/core/src/validation.jl index f62551383..b5a71b1ea 100644 --- a/core/src/validation.jl +++ b/core/src/validation.jl @@ -36,12 +36,15 @@ neighbortypes(::Val{:Basin}) = Set(( :FlowBoundary, )) neighbortypes(::Val{:Terminal}) = Set{Symbol}() # only endnode -neighbortypes(::Val{:FractionalFlow}) = Set((:Basin, :FractionalFlow, :Terminal)) -neighbortypes(::Val{:FlowBoundary}) = Set((:Basin, :FractionalFlow, :Terminal)) +neighbortypes(::Val{:FractionalFlow}) = + Set((:Basin, :FractionalFlow, :Terminal, :LevelBoundary)) +neighbortypes(::Val{:FlowBoundary}) = + Set((:Basin, :FractionalFlow, :Terminal, :LevelBoundary)) neighbortypes(::Val{:LevelBoundary}) = Set((:LinearResistance, :ManningResistance)) neighbortypes(::Val{:LinearResistance}) = Set((:Basin, :LevelBoundary)) neighbortypes(::Val{:ManningResistance}) = Set((:Basin, :LevelBoundary)) -neighbortypes(::Val{:TabulatedRatingCurve}) = Set((:Basin, :FractionalFlow, :Terminal)) +neighbortypes(::Val{:TabulatedRatingCurve}) = + Set((:Basin, :FractionalFlow, :Terminal, :LevelBoundary)) neighbortypes(::Any) = Set{Symbol}() # TODO NodeV1 and EdgeV1 are not yet used