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

#include <ProcessRoutingGR6J.h>

Inheritance diagram for ProcessRoutingGR6J:
ProcessOutflow Process

Public Member Functions

 ProcessRoutingGR6J (WaterContainer *container)
 
void SetParameters (const ProcessSettings &processSettings) override
 
void Reset () override
 
void Finalize () override
 
double * GetValuePointer (std::string_view name) override
 
vecDouble GetChangeRates () override
 
- Public Member Functions inherited from ProcessOutflow
 ProcessOutflow (WaterContainer *container)
 
bool IsValid () const override
 
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 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
 

Protected Attributes

const float * _exchangeFactor
 
const float * _routingCapacity
 
const float * _uhBaseTime
 
const float * _exchangeThreshold
 
const float * _expStoreCoeff
 
vecDouble _stuh1
 
vecDouble _stuh2
 
vecDouble _uh1Ord
 
vecDouble _uh2Ord
 
double _r
 
double _rexp
 
double _qr
 
double _qrexp
 
double _qd
 
double _processStorage
 
- Protected Attributes inherited from Process
string _name
 
WaterContainer_container
 
TimeMachine_timeMachine {nullptr}
 
std::vector< std::unique_ptr< Flux > > _outputs
 

Detailed Description

GR6J routing (Pushpalatha et al., 2011): two unit hydrographs feeding a non-linear (power) routing store and an exponential store in parallel, plus a direct flow, with a threshold-based groundwater exchange.

The uh_input brick accumulates PR = (Pn − Ps) + Perc each timestep. GetRates() computes Q in a read-only fashion (no buffer/store mutation) so the solver can call it multiple times without corrupting state. The UH buffers and both routing stores are advanced exactly once per timestep in Finalize().

  • UH1 (length ceil(X4)) receives 90% of PR; its output is split 0.6 → power routing store, 0.4 → exponential store.
  • UH2 (length ceil(2*X4)) receives 10% of PR (direct branch).
  • Groundwater exchange (added to all three branches): F = X2 × (R/X3 − X5)
  • Power routing store (committed in Finalize): R ← max(0, R + 0.6·UH1_out + F) QR = R × (1 − (1 + (R/X3)⁴)^(−1/4)); R ← R − QR
  • Exponential store (committed in Finalize; may go negative): Rexp ← Rexp + 0.4·UH1_out + F QRExp = gr6j::ExponentialStoreOutflow(Rexp, X6); Rexp ← Rexp − QRExp
  • Direct flow: QD = max(0, UH2_out + F)
  • Total: Q = max(0, QR + QRExp + QD) → outlet

Member Function Documentation

◆ _recomputeUH()

void ProcessRoutingGR6J::_recomputeUH ( )
protected

Recompute UH ordinates and resize buffers based on current X4.

◆ Finalize()

void ProcessRoutingGR6J::Finalize ( )
overridevirtual

Advance UH buffers and both routing stores once per timestep.

Reimplemented from Process.

◆ GetChangeRates()

vecDouble ProcessRoutingGR6J::GetChangeRates ( )
nodiscardoverridevirtual

Get the change rates of the process.

Returns
vector of change rates.

Overridden to bypass the empty-container short-circuit: the bottomless exponential store discharges even when the container is empty.

Reimplemented from Process.

◆ GetRates()

vecDouble ProcessRoutingGR6J::GetRates ( )
overrideprotectedvirtual

Get the rates of the process.

Returns
vector of rates.

Read-only: computes Q from current buffer/store state without modifying it. State advancement happens in Finalize() exactly once per timestep.

Implements Process.

◆ GetValuePointer()

double * ProcessRoutingGR6J::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.

◆ RegisterProcessSettings()

void ProcessRoutingGR6J::RegisterProcessSettings ( SettingsModel * modelSettings)
static

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

◆ Reset()

void ProcessRoutingGR6J::Reset ( )
overridevirtual

Reset all the fluxes connected to the process.

Reimplemented from Process.

◆ SetParameters()

void ProcessRoutingGR6J::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: