Skip to main content

HydroModel

Trait HydroModel 

Source
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() per time-step and reads discharge() for the outflow hydrograph.

Required Associated Types§

Source

type Params: Serialize + for<'de> Deserialize<'de> + Clone + Send

Model-specific parameters (serializable for config persistence).

Required Methods§

Source

fn new(params: Self::Params) -> Self

Construct a model instance with the given parameters (default state).

Source

fn step(&mut self, forcing: &Forcing, dt_h: f64)

Advance one time-step given the forcing (precipitation, PET, temperature).

Source

fn discharge(&self) -> f64

Current discharge at the basin outlet (m³/s).

Source

fn state(&self) -> Value

Serialize internal state for warm-restart across events.

Source

fn reset(&mut self)

Reset internal state to default (cold start).

Source

fn name(&self) -> &'static str

Model display name (e.g. “新安江”, “TOPMODEL”).

Source

fn params(&self) -> &Self::Params

Read-only access to parameters.

Source

fn params_mut(&mut self) -> &mut Self::Params

Mutable access to parameters (for calibration).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§