hydrobricks
Loading...
Searching...
No Matches
ProcessRoutingHBV Class Reference

#include <ProcessRoutingHBV.h>

Inheritance diagram for ProcessRoutingHBV:
ProcessOutflow Process

Public Member Functions

 ProcessRoutingHBV (WaterContainer *container)
 
bool IsValid () const override
 
void SetParameters (const ProcessSettings &processSettings) override
 
void Reset () override
 
void Finalize () override
 
vecDouble GetChangeRates () override
 
double * GetValuePointer (std::string_view name) override
 
- Public Member Functions inherited from ProcessOutflow
 ProcessOutflow (WaterContainer *container)
 
int GetConnectionCount () const override
 
- Public Member Functions inherited from Process
 Process (WaterContainer *container)
 
virtual void Validate () const
 
virtual void SetHydroUnitProperties (HydroUnit *unit, Brick *brick)
 
virtual void AttachForcing (Forcing *)
 
void AttachFluxOut (std::unique_ptr< Flux > flux)
 
int GetOutputFluxCount () const
 
FluxGetOutputFlux (size_t index) const
 
virtual bool ToAtmosphere () const
 
virtual bool NeedsTargetBrickLinking () const
 
virtual void StoreInOutgoingFlux (double *rate, int index)
 
void ApplyChange (int connectionIndex, double rate, double timeStepInDays)
 
virtual vecDoublePt GetStateVariables ()
 
const string & GetName () const
 
void SetName (const string &name)
 
void SetTimeMachine (TimeMachine *timeMachine)
 
WaterContainerGetWaterContainer () const
 
virtual void SetTargetBrick (Brick *)
 
virtual bool LinksMultipleTargets () const
 
virtual void AddTargetBrickWithWeights (Brick *, const std::vector< Brick * > &)
 
virtual bool IsLateralProcess () const noexcept
 
bool HasOutputFluxes () const noexcept
 
bool HasWaterContainer () const noexcept
 

Static Public Member Functions

static void RegisterProcessSettings (SettingsModel *modelSettings)
 
- Static Public Member Functions inherited from ProcessOutflow
static void RegisterProcessSettings (SettingsModel *modelSettings)
 
- Static Public Member Functions inherited from Process
static std::unique_ptr< ProcessFactory (const ProcessSettings &processSettings, Brick *brick)
 
static bool RegisterSettings (SettingsModel *modelSettings, const string &processType)
 
static bool HasParameter (const ProcessSettings &processSettings, std::string_view name)
 
static const float * GetParameterValuePointer (const ProcessSettings &processSettings, std::string_view name)
 

Protected Member Functions

vecDouble GetRates () override
 
void _recomputeUH ()
 
- Protected Member Functions inherited from Process
double GetSumChangeRatesOtherProcesses () const
 

Static Protected Member Functions

static double _cumulativeWeight (double t, double maxbas)
 

Protected Attributes

const float * _maxbas
 
vecDouble _stuh
 
vecDouble _uhOrd
 
double _lastMaxbas
 
double _previousContent
 
double _processStorage
 
- Protected Attributes inherited from Process
string _name
 
WaterContainer_container
 
TimeMachine_timeMachine {nullptr}
 
std::vector< std::unique_ptr< Flux > > _outputs
 

Detailed Description

HBV transformation function: triangular unit-hydrograph routing (MAXBAS).

The routing brick accumulates the runoff components (e.g. upper and lower zone outflows) each timestep. The total is convolved with a triangular weighting function of base maxbas [d]:

  • cumulative weights C(t) = 2(t/m)^2 for t <= m/2
  • C(t) = 1 - 2(1 - t/m)^2 for m/2 < t <= m
  • ordinates w_j = C(j) - C(j-1), j = 1..ceil(m)

With maxbas <= 1 the inflow is passed through within the timestep.

The process maintains a delivery schedule (_stuh): each slot holds the water due to leave that many timesteps from now. GetRates() is read-only (the solver can call it multiple times without corrupting state) and returns the amount due this timestep plus the same-step share of the current inflow. The schedule is advanced exactly once per timestep in Finalize(), based on the committed amounts: the actually received inflow is distributed over the ordinates and any difference between the scheduled and the actual delivery (solver stage averaging, rate constraints) is carried over to the next timestep, so no water gets stranded in the routing container.

Member Function Documentation

◆ _cumulativeWeight()

double ProcessRoutingHBV::_cumulativeWeight ( double t,
double maxbas )
staticprotected

Cumulative triangular weighting function.

◆ _recomputeUH()

void ProcessRoutingHBV::_recomputeUH ( )
protected

Recompute the UH ordinates and resize the buffer based on the current maxbas.

◆ Finalize()

void ProcessRoutingHBV::Finalize ( )
overridevirtual

Advance the delivery schedule once per timestep, using the committed amounts.

Reimplemented from Process.

◆ GetChangeRates()

vecDouble ProcessRoutingHBV::GetChangeRates ( )
inlinenodiscardoverridevirtual

Get the change rates of the process.

Returns
vector of change rates.

Bypasses the empty-container shortcut of the base class: the scheduled delivery typically drains the whole container content within the timestep, which would zero the rates at later solver stages and halve the delivery. The container constraints still prevent any negative content.

Reimplemented from Process.

◆ GetRates()

vecDouble ProcessRoutingHBV::GetRates ( )
overrideprotectedvirtual

Get the rates of the process.

Returns
vector of rates.

Read-only: computes the scheduled delivery from the current schedule state without modifying it. Schedule advancement happens in Finalize().

Implements Process.

◆ GetValuePointer()

double * ProcessRoutingHBV::GetValuePointer ( std::string_view name)
overridevirtual

Get the value pointer for a given element.

Parameters
namename of the element to get.
Returns
pointer to the value of the given element.

Reimplemented from ProcessOutflow.

◆ IsValid()

bool ProcessRoutingHBV::IsValid ( ) const
nodiscardoverridevirtual

Check that everything is correctly defined.

Returns
true if everything is correctly defined.

Reimplemented from ProcessOutflow.

◆ RegisterProcessSettings()

void ProcessRoutingHBV::RegisterProcessSettings ( SettingsModel * modelSettings)
static

Register the process settings (parameters and logging defaults) in the settings model.

Parameters
modelSettingsThe settings model to register the parameters in.

◆ Reset()

void ProcessRoutingHBV::Reset ( )
overridevirtual

Reset all the fluxes connected to the process.

Reimplemented from Process.

◆ SetParameters()

void ProcessRoutingHBV::SetParameters ( const ProcessSettings & processSettings)
overridevirtual

Assign the parameters to the process.

Parameters
processSettingssettings of the process containing the parameters.

Reimplemented from Process.


The documentation for this class was generated from the following files: