|
hydrobricks
|
#include <Reach.h>
Classes | |
| struct | RoutingState |
Public Types | |
| enum class | Scheme { None , Lag , Muskingum , MuskingumCunge } |
Public Member Functions | |
| Reach (Subbasin *subbasin) | |
| void | Initialize () |
| void | SetChannelRouting (const ChannelRoutingSettings &settings) |
| double | RouteUpstream (double inflowVolume, double timeStepInDays) |
| double | RouteLocal (double localVolume, double timeStepInDays) |
| bool | RoutesLocalRunoff () const |
| void | Reset () |
| void | SaveAsInitialState () |
| Subbasin * | GetSubbasin () const |
| Scheme | GetScheme () const |
| double | GetLength () const |
| double | GetSlope () const |
| double | GetWidth () const |
| double | GetManning () const |
| double | GetCelerity () const |
| double | GetCelerityForDischarge (double dischargeM3s) const |
| double | GetMuskingumX () const |
| double | GetTravelTimeInDays () const |
| int | GetSubreachCount () const |
| double | GetInflow () const |
| double | GetOutflow () const |
| double | GetStorage () const |
Static Public Member Functions | |
| static Scheme | SchemeFromString (const string &name) |
| static string | SchemeToString (Scheme scheme) |
Protected Attributes | |
| Subbasin * | _subbasin |
| Scheme | _scheme = Scheme::None |
| bool | _routeLocal = false |
| double | _length = 0 |
| double | _slope = 0 |
| const float * | _celerity = nullptr |
| const float * | _celerityExponent = nullptr |
| const float * | _referenceDischarge = nullptr |
| const float * | _x = nullptr |
| const float * | _width = nullptr |
| const float * | _manning = nullptr |
| double | _celerityOverride = NAN_D |
| double | _xOverride = NAN_D |
| double | _widthOverride = NAN_D |
| double | _manningOverride = NAN_D |
| double | _inflow = 0 |
| double | _outflow = 0 |
| RoutingState | _main |
| RoutingState | _local |
The channel reach of a subbasin: the main channel from the point where the upstream subbasins enter to the subbasin outlet. It routes the volume arriving from upstream (m3 per time step) to the outlet, where the subbasin's own runoff joins it.
Four routing schemes exist: instantaneous (the inflow leaves the reach in the same step), a pure translation (lag), the Muskingum method and Muskingum-Cunge. The first three use a celerity: the model-wide parameter (which a subbasin property may override reach by reach), optionally varying with the discharge through a power law. Muskingum-Cunge instead derives the celerity and the weighting factor from the channel geometry (length, slope, width and Manning roughness) and the discharge of the step, so its parameters are measured rather than calibrated. A Muskingum-Cunge reach is also divided into sub reaches short enough for the wave to be resolved (the Ponce and Theurer criterion), the sub reaches being routed in series.
The subbasin's own runoff joins at the outlet by default. With 'route_local_runoff' it is routed too, through half the reach: generated uniformly along the reach, it travels half of it on average.
|
strong |
The routing schemes: how the inflow of a time step is spread over the following ones.
|
explicit |
Create the reach of a subbasin.
| subbasin | The subbasin the reach belongs to (its outlet is the reach outlet). |
|
nodiscard |
Get the celerity of this reach at the reference discharge [m/s]: the subbasin property when present, else the model-wide parameter, else 1.
|
nodiscard |
Get the celerity of this reach at a given discharge [m/s].
With the Muskingum-Cunge scheme it comes from the Manning relation for a wide channel: the kinematic celerity is 5/3 of the flow velocity. With the other schemes it is the reference celerity scaled by the discharge ratio raised to 'celerity_exponent' (0, the default, keeps it constant). The result is clamped to a plausible range for a river so that a vanishing discharge cannot give an unbounded travel time.
| dischargeM3s | The discharge [m3/s]; a non-positive value returns the reference celerity. |
|
inlinenodiscard |
Get the volume that entered the reach in the current time step [m3]: the upstream inflow, plus the sub basin's own runoff when it is routed.
|
inlinenodiscard |
Get the reach length [m] (0 when the subbasin has no 'length' property).
|
nodiscard |
Get the Manning roughness in use for this reach [s/m^(1/3)]: the subbasin property when present, else the model-wide parameter. Used by the Muskingum-Cunge scheme only.
|
nodiscard |
Get the Muskingum weighting factor in use for this reach [-]: the subbasin property when present, else the model-wide parameter, else 0.2. The Muskingum-Cunge scheme computes its own instead.
|
inlinenodiscard |
Get the volume that left the reach in the current time step [m3].
|
inlinenodiscard |
Get the routing scheme.
|
inlinenodiscard |
Get the reach slope [m/m] (0 when the subbasin has no 'slope' property).
|
inlinenodiscard |
Get the volume in transit in the reach [m3], in both the main channel and the local-runoff branch.
|
inlinenodiscard |
Get the subbasin the reach belongs to.
|
inlinenodiscard |
Get the number of sub reaches the main channel is divided into for the routing. Always 1 except with the Muskingum-Cunge scheme, and only once the first time step has fixed it.
|
nodiscard |
Get the travel time of the reach at the reference discharge [days]: length / celerity (0 without a length). With Muskingum-Cunge the celerity is the one the geometry gives at that discharge; with the other schemes it is the celerity parameter, which is defined at that same discharge.
|
nodiscard |
Get the channel width in use for this reach [m]: the subbasin property when present, else the model-wide parameter. Used by the Muskingum-Cunge scheme only.
| void Reach::Initialize | ( | ) |
Read the reach geometry from the subbasin properties ('length' [m], 'slope' [-], 'width' [m] and 'manning' [s/m^(1/3)]) when present, as well as the reach-specific routing parameters ('celerity' [m/s] and 'muskingum_x' [-]) overriding the model-wide ones.
| void Reach::Reset | ( | ) |
Reset the reach to its initial state (nothing in transit, or the saved initial state).
| double Reach::RouteLocal | ( | double | localVolume, |
| double | timeStepInDays ) |
Route the subbasin's own runoff, for the current time step. Called once per step, after the subbasin is processed. Without 'route_local_runoff' the runoff is returned unchanged (it joins at the outlet); with it, the runoff travels half the reach.
| localVolume | The subbasin's own runoff [m3 per time step]. |
| timeStepInDays | The time step [days]. |
|
inlinenodiscard |
Check whether the subbasin's own runoff is routed through (half) the reach.
| double Reach::RouteUpstream | ( | double | inflowVolume, |
| double | timeStepInDays ) |
Route the volume arriving from the upstream subbasins through the reach, for the current time step. Called once per step, before the subbasin is processed.
| inflowVolume | The volume entering the reach from upstream [m3 per time step]. |
| timeStepInDays | The time step [days]. |
| void Reach::SaveAsInitialState | ( | ) |
Save the current state as the initial state restored by Reset().
|
static |
Parse a routing scheme name.
| name | The name of the scheme ('none', 'lag', 'muskingum' or 'muskingum_cunge'). |
|
static |
Get the canonical name of a routing scheme.
| scheme | The scheme. |
| void Reach::SetChannelRouting | ( | const ChannelRoutingSettings & | settings | ) |
Set the channel routing scheme and bind the model-wide routing parameters.
| settings | The channel routing settings of the model. |