pub trait HydroModel: Send {
type Params: Serialize + for<'de> Deserialize<'de> + Clone + Send;
// Required methods
fn new(params: Self::Params) -> Self;
fn step(&mut self, forcing: &Forcing, dt_h: f64);
fn discharge(&self) -> f64;
fn state(&self) -> Value;
fn reset(&mut self);
fn name(&self) -> &'static str;
fn params(&self) -> &Self::Params;
fn params_mut(&mut self) -> &mut Self::Params;
}Expand description
The core trait every distributed hydrological model implements.
Each model owns its parameter struct (associated type Params)
and its internal state. The platform calls
step once per time-step and reads
discharge for the outlet hydrograph in m³/s.
Implementations are expected to be deterministic given (params, state,
forcing) so that calibration can rely on reproducibility.
Required Associated Types§
Required Methods§
Sourcefn new(params: Self::Params) -> Self
fn new(params: Self::Params) -> Self
Construct a model instance with the given parameters and default (cold-start) state.
Sourcefn discharge(&self) -> f64
fn discharge(&self) -> f64
Current discharge at the basin outlet, in m³/s. Read after each
step to assemble the hydrograph.
Sourcefn state(&self) -> Value
fn state(&self) -> Value
Serialize the internal state (soil moisture, storages, …) as JSON for warm-restart across events or runs.
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Model display name (e.g. "新安江", "TOPMODEL") — see also
ModelType::name.
Sourcefn params_mut(&mut self) -> &mut Self::Params
fn params_mut(&mut self) -> &mut Self::Params
Mutable access to the parameter struct (used by calibrators to apply a new candidate vector between runs).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl HydroModel for ApicontModel
impl HydroModel for ApicontModel
Source§fn new(params: <ApicontModel as HydroModel>::Params) -> ApicontModel
fn new(params: <ApicontModel as HydroModel>::Params) -> ApicontModel
Build a fresh model with an empty antecedent store (sm = 0) and zero
outlet discharge.
Source§fn step(&mut self, f: &Forcing, dt_h: f64)
fn step(&mut self, f: &Forcing, dt_h: f64)
Advance one step of length dt_h (hours).
Enforces strict mass balance P = ea + drain + Δsm:
fill → ET (ea = min(PET, sm)) → exponential API drain
(drain = (1 − k) · sm) → linear-reservoir routing
(Q ← cs · Q + (1 − cs) · mm_to_m3s(drain, ...)).
Source§fn reset(&mut self)
fn reset(&mut self)
Reset the store and discharge to zero (a dry, pre-storm initial condition).
Source§fn params(&self) -> &<ApicontModel as HydroModel>::Params
fn params(&self) -> &<ApicontModel as HydroModel>::Params
Shared reference to the parameter struct.
Source§fn params_mut(&mut self) -> &mut <ApicontModel as HydroModel>::Params
fn params_mut(&mut self) -> &mut <ApicontModel as HydroModel>::Params
Exclusive reference to the parameter struct (for online updates).