Wflow.jl icon indicating copy to clipboard operation
Wflow.jl copied to clipboard

support Qout=Qin in lake rating curve tables (hq)

Open shartgring opened this issue 9 months ago • 1 comments

Feature type

Adding new functionality

Improvement Description

Currently, a rating curve table (hq) consists of corresponding discharge values in m³/s. It would be nice to add functionality where the lake/reservoir outflow equals the inflow. This information can be added in the rating curve table by, for example, using -1 as a flag in the hq-csv file.

Using the example in the docs:

H
394,    43,     43,     43,     43
394.01, 44.838, 44.838, 44.838, 44.838
394.02, 46.671, 46.671, 46.671, 46.671
394.03, 48.509, 48.509, 48.509, 48.509
394.04, -1, -1, -1,-1
394.05, -1, -1,-1, -1

This would mean that, when H > 394.05, Qout = Qin for this particular lake

Implementation Description

update takes inflow as an argument. This could therefore be used in the calculation of outflow. Consider:

if lake.outflowfunc[i] == -1
            outflow =
                interpolate_linear(lake.waterlevel[i], lake.hq[i].H, lake.hq[i].Q[:, doy])
            outflow = min(outflow, storage_input)

In lake.hq[i].Q[:, doy], the row with discharges is used for the interpolate function. Adding a step in which all discharges equal to -1 in lake.hq[i].Q[:, doy] are replaced by inflow would yield the suggested result. Older models would not contain -1 in the rating curve table, and therefore this new functionality would be backwards compatible with older models.

Another option would be to add a check where if outflow = -1 then outflow = inflow. However, that may not work due to the interpolate function used to compute outflow which would interpolate -1 and a positive discharge in boundary cases for the storage level

I am not sure if this functionality would work for negative inflows to the lakes. Negative inflows can occur in limited cases, for example when using pits and local-inertial for river routing, right?

Additional Context

No response

shartgring avatar May 18 '24 10:05 shartgring