Skip to main content

Tank

Struct Tank 

Source
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: f64

Minimum operating level above bottom elevation (m).

§max_level: f64

Maximum operating level above bottom elevation (m).

§initial_level: f64

Initial water level above bottom elevation (m).

§diameter: f64

Diameter of cylindrical tank (m); used when vol_curve is None.

§min_volume: f64

Explicit 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: MixModel

Water mixing model used inside this tank.

§mix_fraction: f64

Inlet-zone volume fraction; meaningful only for TwoCompartment.

§bulk_coeff: f64

Bulk reaction rate coefficient (overrides global).

§overflow: bool

Whether 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

Source

pub fn bottom_elevation(&self, node_elevation: f64) -> f64

Bottom elevation = node elevation − min_level (§2.4.4).

Source

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}$

Source

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 level via the finite-difference slope of the two bracketing curve points.

curves is the full network curve table; vol_curve is resolved by ID.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Tank

Source§

fn clone(&self) -> Tank

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tank

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Tank

§

impl RefUnwindSafe for Tank

§

impl Send for Tank

§

impl Sync for Tank

§

impl Unpin for Tank

§

impl UnsafeUnpin for Tank

§

impl UnwindSafe for Tank

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.