Wflow version checks
Reproducible Example
see current behaviour, it's a simple design choice, but currently non-physical results occur.
Current behaviour
update_reservoir_outflow_obs caps outflow only by the amount of water available (storage_input), but applies no upper bound on storage:
function update_reservoir_outflow_obs(
reservoir_model::ReservoirModel,
i::Int,
boundary_vars::NamedTuple,
dt::Float64,
)
(; storage, outflow_obs) = reservoir_model.variables
(; precipitation, evaporation, inflow) = boundary_vars
storage_input = max(storage[i] / dt + precipitation - evaporation + inflow, 0.0)
outflow = min(outflow_obs[i], storage_input)
storage = (storage_input - outflow) * dt
return outflow, storage
end
Desired behaviour
Schematic should be clear that current behaviour (Red) should in reality, probably be more like desired behaviour (green) where reservoir max volume exceedance should trigger overflow/spilling like:
function update_reservoir_outflow_obs(
reservoir_model::ReservoirModel,
i::Int,
boundary_vars::NamedTuple,
dt::Float64,
)
(; storage, outflow_obs) = reservoir_model.variables
(; maximum_storage) = reservoir_model.parameters # Is maximum storage still in use?
(; precipitation, evaporation, inflow) = boundary_vars
storage_input = max(storage[i] / dt + precipitation - evaporation + inflow, 0.0)
outflow = min(outflow_obs[i], storage_input)
storage = (storage_input - outflow) * dt
if maximum_storage[i] != MISSING_VALUE
overflow = max(0.0, (storage - maximum_storage[i]) / dt)
storage -= overflow * dt
outflow += overflow
end
return outflow, storage
end
Additional Context
No response
Wflow version checks
I have checked that this issue has not already been reported.
I have checked that this bug exists on the latest version of Wflow.
Reproducible Example
see current behaviour, it's a simple design choice, but currently non-physical results occur.
Current behaviour
update_reservoir_outflow_obscaps outflow only by the amount of water available (storage_input), but applies no upper bound on storage:function update_reservoir_outflow_obs(
reservoir_model::ReservoirModel,
i::Int,
boundary_vars::NamedTuple,
dt::Float64,
)
(; storage, outflow_obs) = reservoir_model.variables
(; precipitation, evaporation, inflow) = boundary_vars
storage_input = max(storage[i] / dt + precipitation - evaporation + inflow, 0.0)
outflow = min(outflow_obs[i], storage_input)
storage = (storage_input - outflow) * dt
return outflow, storage
end
Desired behaviour
Schematic should be clear that current behaviour (Red) should in reality, probably be more like desired behaviour (green) where reservoir max volume exceedance should trigger overflow/spilling like:
Additional Context
No response