pub struct Tank {
pub min_level: f64,
pub max_level: f64,
pub initial_level: f64,
pub diameter: f64,
pub min_volume: f64,
pub volume_curve: Option<String>,
pub mix_model: MixModel,
pub mix_fraction: f64,
pub bulk_coeff: f64,
pub overflow: bool,
pub head_pattern: Option<String>,
}Expand description
A storage node whose head evolves over time (§2.4.4).
Fields§
§min_level: f64Minimum operating level above bottom elevation (m).
max_level: f64Maximum operating level above bottom elevation (m).
initial_level: f64Initial water level above bottom elevation (m).
diameter: f64Diameter of cylindrical tank (m); used when vol_curve is None.
min_volume: f64Explicit minimum volume (m³); if > 0, overrides the value computed
from diameter and min_level.
volume_curve: Option<String>Optional volume curve ID (kind = TankVolume).
mix_model: MixModelWater mixing model used inside this tank.
mix_fraction: f64Inlet-zone volume fraction; meaningful only for TwoCompartment.
bulk_coeff: f64Bulk reaction rate coefficient (overrides global).
overflow: boolWhether tank can overflow (spill above max_level).
head_pattern: Option<String>Optional pattern ID modulating head over time for fixed-head operation.
Implementations§
Source§impl Tank
impl Tank
Sourcepub fn bottom_elevation(&self, node_elevation: f64) -> f64
pub fn bottom_elevation(&self, node_elevation: f64) -> f64
Bottom elevation = node elevation − min_level (§2.4.4).
Sourcepub fn head_from_level(&self, node_elevation: f64, level: f64) -> f64
pub fn head_from_level(&self, node_elevation: f64, level: f64) -> f64
Hydraulic head from the current level (§2.4.4).
$H = \text{bottom_elevation} + \text{level}$
Sourcepub fn area(&self, level: f64, curves: &[Curve]) -> f64
pub fn area(&self, level: f64, curves: &[Curve]) -> f64
Cross-section area $A$ at the given level (§2.4.4).
- Cylindrical tank: $A = \pi d^2 / 4$ (constant).
- Volume-curve tank: $A(h) = dV/dh$ approximated at
levelvia the finite-difference slope of the two bracketing curve points.
curves is the full network curve table; vol_curve is resolved by ID.
Sourcepub fn volume_from_level(&self, level: f64, curves: &[Curve]) -> f64
pub fn volume_from_level(&self, level: f64, curves: &[Curve]) -> f64
Volume corresponding to level using the volume curve (§2.4.4),
or the cylindrical approximation when no curve is present.
Sourcepub fn level_from_volume(&self, volume: f64, curves: &[Curve]) -> f64
pub fn level_from_volume(&self, volume: f64, curves: &[Curve]) -> f64
Level corresponding to volume (inverse of volume_from_level).
For cylindrical tanks: $h = V / A$. For volume-curve tanks: binary-search the curve for the bracketing segment and invert the linear segment.