Skip to main content

hydr_structures/structures/pump/
outlet.rs

1//! Free delivery outlet that bounds the lift from below.
2
3use crate::structures::{StructureError, StructureInputErrorKind};
4
5/// Delivery outlet that discharges to atmosphere at a fixed common-datum elevation.
6///
7/// A running pump lifts to `max(receiving stage, elevation_m)`. A dry receiver whose bed lies at
8/// or below the outlet then takes delivery.
9#[derive(Clone, Debug, PartialEq)]
10pub struct PumpFreeOutlet {
11    /// Common-datum elevation at which delivery leaves the pipe at atmospheric pressure, in metres.
12    pub elevation_m: f64,
13    /// Evidence that the outlet discharges freely at this elevation and that the curve's head
14    /// argument holds there.
15    pub evidence: String,
16}
17impl PumpFreeOutlet {
18    pub(crate) fn check(&self) -> Result<(), StructureError> {
19        if !self.elevation_m.is_finite() {
20            return Err(StructureError::input(
21                StructureInputErrorKind::Definition,
22                format!(
23                    "free outlet elevation_m={}: supply a finite common-datum outlet elevation",
24                    self.elevation_m
25                ),
26            ));
27        }
28        crate::structures::definition::text(&self.evidence, "free outlet evidence")
29    }
30}