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

#include <ProcessRoutingGR4J.h>

Inheritance diagram for ProcessRoutingGR4J:
ProcessOutflow Process

Public Member Functions

 ProcessRoutingGR4J (WaterContainer *container)
 
void SetParameters (const ProcessSettings &processSettings) override
 
void Reset () override
 
void Finalize () override
 
double * GetValuePointer (std::string_view name) 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 vecDouble GetChangeRates ()
 
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
 

Static Protected Member Functions

static double _sh1 (double t, double x4)
 
static double _sh2 (double t, double x4)
 

Protected Attributes

const float * _exchangeFactor
 
const float * _routingCapacity
 
const float * _uhBaseTime
 
vecDouble _stuh1
 
vecDouble _stuh2
 
vecDouble _uh1Ord
 
vecDouble _uh2Ord
 
double _r
 
double _qr
 
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

GR4J routing: unit-hydrograph convolution + non-linear routing store.

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

  • UH1 (length ceil(X4)) receives 90% of PR
  • UH2 (length ceil(2*X4)) receives 10% of PR
  • Groundwater exchange: F = X2 × (R/X3)^3.5
  • Routing store update (committed in Finalize): R ← max(0, R + UH1_out + F) QR = R × (1 − (1 + (R/X3)⁴)^(−1/4)) R ← R − QR
  • Direct flow: QD = max(0, UH2_out + F)
  • Total: Q = QR + QD → outlet

Member Function Documentation

◆ _recomputeUH()

void ProcessRoutingGR4J::_recomputeUH ( )
protected

Recompute UH ordinates and resize buffers based on current X4.

◆ Finalize()

void ProcessRoutingGR4J::Finalize ( )
overridevirtual

Advance UH buffers and routing store once per timestep.

Reimplemented from Process.

◆ GetRates()

vecDouble ProcessRoutingGR4J::GetRates ( )
overrideprotectedvirtual

Get the rates of the process.

Returns
vector of rates.

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

Implements Process.

◆ GetValuePointer()

double * ProcessRoutingGR4J::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 ProcessRoutingGR4J::RegisterProcessSettings ( SettingsModel * modelSettings)
static

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

◆ Reset()

void ProcessRoutingGR4J::Reset ( )
overridevirtual

Reset all the fluxes connected to the process.

Reimplemented from Process.

◆ SetParameters()

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