Skip to content

Commit

Permalink
add reduction_factor to TabulatedRatingCurve
Browse files Browse the repository at this point in the history
If the rating curve prescribes large Q even when the upstream Basin is nearly empty, this leads to an incorrect water balance.
  • Loading branch information
visr committed Sep 11, 2023
1 parent 63dacb4 commit c3140bb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,13 @@ function formulate_flow!(
downstream_ids = outneighbors(graph_flow, id)

if active[i]
q = tables[i](get_level(p, upstream_basin_id, current_level, t))
hasindex, basin_idx = id_index(basin.node_id, upstream_basin_id)
@assert hasindex "TabulatedRatingCurve must be downstream of a Basin"
s = storage[basin_idx]
reduction_factor = clamp(s, 0.0, 10.0) / 10.0
q =
reduction_factor *
tables[i](get_level(p, upstream_basin_id, current_level, t))
else
q = 0.0
end
Expand Down

0 comments on commit c3140bb

Please sign in to comment.