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

Public Member Functions

 Forcing (VariableType type)
 
void AttachTimeSeriesData (TimeSeriesData *timeSeriesData)
 
VariableType GetType () const
 
bool IsCumulative () const
 
double GetValue () const
 
void UpdateValue (double value)
 
void ResetUpdate ()
 
bool IsValid () const
 
void Validate () const
 

Protected Attributes

VariableType _type
 
TimeSeriesData_timeSeriesData
 
double _updatedValue {0.0}
 
bool _hasUpdatedValue {false}
 

Member Function Documentation

◆ AttachTimeSeriesData()

void Forcing::AttachTimeSeriesData ( TimeSeriesData * timeSeriesData)

Attach time series data to the forcing.

Parameters
timeSeriesDatapointer to the time series data.

◆ GetType()

VariableType Forcing::GetType ( ) const
inline

Get the type of the forcing.

Returns
the type of the forcing.

◆ GetValue()

double Forcing::GetValue ( ) const

Get the value of the forcing at the current time in the simulation. Returns the dynamic override if one has been set this timestep, otherwise the time-series value.

Returns
the value of the forcing.

◆ IsCumulative()

bool Forcing::IsCumulative ( ) const
inlinenodiscard

Check whether the forcing accumulates over the time step (a depth of water, given per step: precipitation, PET) rather than being an instantaneous or averaged value that does not depend on the step length (temperature, radiation).

Only a cumulative forcing may be divided by the step length to give a rate. The custom variables are treated as non-cumulative: their meaning is the user's, and scaling one that was not meant to be scaled would silently corrupt it.

Returns
true if the value is an amount accumulated over the time step.

◆ IsValid()

bool Forcing::IsValid ( ) const
nodiscard

Check if the forcing is valid. Verifies that time series data is attached.

Returns
true if the forcing is valid, false otherwise.

◆ ResetUpdate()

void Forcing::ResetUpdate ( )

Clear the dynamic override set by UpdateValue(). Called by ModelHydro at the end of each timestep via HydroUnit::ResetForcingUpdates().

◆ UpdateValue()

void Forcing::UpdateValue ( double value)

Override the forcing value for the current timestep. Called by a process (e.g. interception) to publish a derived quantity (e.g. En = E − P) so that downstream processes on the same HydroUnit see the updated value.

Parameters
valuethe override value.

◆ Validate()

void Forcing::Validate ( ) const

Validate the forcing. Throws an exception if the forcing is invalid.

Exceptions
ModelConfigErrorif validation fails.

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