Skip to main content

hydr_structures/structures/
output.rs

1//! Explicit physical regime and proposal-only output labels.
2
3use super::{DirectionPolicy, FlowDirection, StructureHeads};
4
5/// Concrete evaluated constitutive model identity.
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum StructureLawKind {
8    /// HDS-5 culvert under inlet or outlet control.
9    Culvert,
10    /// Hydrostatic pressure-strip integral across a thin rectangular aperture.
11    HydrostaticRectangularGate,
12    /// Fixed-orientation bounded pump reference curve.
13    Pump,
14    /// Fully submerged opening.
15    SubmergedOrifice,
16    /// Suppressed sharp-crested rectangular overflow with adopted Villemonte correction.
17    SuppressedRectangularWeir,
18}
19/// Physical classification before ideal flap blocking.
20#[derive(Clone, Copy, Debug, PartialEq, Eq)]
21pub enum StructureRegime {
22    /// Explicit zero opening isolates the endpoints without evaluating hydraulic heads.
23    GateClosed,
24    /// No supported wet donor lies above the gate sill.
25    GateBelowSill,
26    /// The wetted aperture carries only an atmospheric free strip.
27    FreeGateAperture,
28    /// The wetted aperture contains both submerged and atmospheric free strips.
29    MixedGateAperture,
30    /// Both wet heads cover the complete original opening.
31    SubmergedGateAperture,
32    /// Evaluated supported running pump query, including declared zero-flow support.
33    PumpCurve,
34    /// Explicit stopped isolation makes hydraulic heads uninfluential.
35    PumpIsolated,
36    /// Eligible fully submerged unequal-head opening.
37    SubmergedOrifice,
38    /// Eligible rectangular overflow without submerged tailwater.
39    FreeWeirOverflow,
40    /// Eligible rectangular overflow with positive tailwater above crest.
41    SubmergedWeirOverflow,
42    /// No supported wet donor above the weir crest.
43    BelowCrest,
44    /// Eligible wet stages are exactly equal above the controlling elevation.
45    EqualHeads,
46    /// Culvert discharge certainly follows the inlet-control headwater.
47    CulvertInletControl,
48    /// Culvert discharge certainly follows the outlet-control headwater.
49    CulvertOutletControl,
50    /// Both control discharges overlap within their enclosures, so either can govern.
51    CulvertControlTie,
52    /// No wet donor stands above its culvert invert.
53    CulvertBelowInvert,
54    /// The heads drive flow into an end without a declared culvert inlet.
55    CulvertUndeclaredEnd,
56    /// The element's condition closes the structure. Exact zero discharge under every head.
57    Closed,
58}
59/// Proposal status, without donor availability or transfer acceptance.
60#[derive(Clone, Copy, Debug, PartialEq, Eq)]
61pub enum StructureStatus {
62    /// Running positive proposal in the immutable pump orientation.
63    PumpRunning,
64    /// Supported running query in the declared zero-flow region.
65    PumpShutoff,
66    /// Explicit isolation excludes forward siphoning and reverse flow.
67    PumpStoppedIsolated,
68    /// Nonzero constitutive law evaluated in the proposed direction.
69    Active,
70    /// Explicit physical zero, classified by the separate regime.
71    PhysicalZero,
72    /// Supported proposed direction is blocked by the declared ideal flap.
73    FlapBlocked,
74}
75/// Original evaluated law operands, including running pump shutoff. Isolated branches expose no fabricated heads.
76#[derive(Clone, Debug, PartialEq)]
77pub enum StructureHydraulicOperands {
78    /// Culvert control heads above the bed and the certified per-barrel discharge.
79    Culvert {
80        /// Donor stage above the inlet bed elevation (invert without sediment), in metres.
81        headwater_m: f64,
82        /// Receiver stage above the outlet bed elevation (invert without sediment), in metres. Zero for a free outfall.
83        tailwater_m: f64,
84        /// `(lower, upper)` enclosure of the discharge of one barrel, in m³/s.
85        barrel_discharge_m3_per_s: (f64, f64),
86    },
87    /// Evaluated hydrostatic-aperture geometry and independent arithmetic witnesses.
88    HydrostaticRectangularGate(super::GateHydraulicOperands),
89    /// Evaluated running/shutoff pump query and full normalization evidence.
90    Pump(super::PumpHydraulicOperands),
91    /// Fully submerged orifice differential-head operands.
92    SubmergedOrifice {
93        /// Positive difference of original supported wet stages, in metres.
94        head_gap_m: f64,
95        /// Natural logarithm of the proposed SI discharge magnitude.
96        log_discharge_magnitude: f64,
97    },
98    /// Free suppressed-weir overflow operands.
99    FreeWeir {
100        /// Positive original donor-stage height above crest, in metres.
101        upstream_head_m: f64,
102        /// Natural logarithm of the proposed SI discharge magnitude.
103        log_discharge_magnitude: f64,
104    },
105    /// Submerged suppressed-weir overflow operands.
106    SubmergedWeir {
107        /// Positive original donor-stage height above crest, in metres.
108        upstream_head_m: f64,
109        /// Positive original receiver-stage height above crest, in metres.
110        downstream_head_m: f64,
111        /// Independently positive direct original-stage difference, in metres.
112        head_gap_m: f64,
113        /// Represented Hd/Hu ratio, including rounded endpoints zero/one.
114        submergence_ratio: f64,
115        /// Stable factor 1+r/(1+sqrt(r)).
116        correction_k: f64,
117        /// Natural logarithm of the proposed SI discharge magnitude.
118        log_discharge_magnitude: f64,
119    },
120}
121/// Immutable instantaneous proposal. This quantity is never an accepted or availability-limited transfer.
122#[derive(Clone, Debug, PartialEq)]
123pub struct StructureOutput {
124    /// Original passive or explicit device operation, held during proposal evaluation.
125    pub operation: super::StructureOperatingPoint,
126    /// Ordered element index.
127    pub element: usize,
128    /// Complete original endpoint support and declared identities.
129    pub input: StructureHeads,
130    /// Concrete coefficient/law identity within the immutable batch definition.
131    pub law: StructureLawKind,
132    /// Immutable ideal flap/direction declaration.
133    pub direction_policy: DirectionPolicy,
134    /// Physical regime before flap blocking.
135    pub regime: StructureRegime,
136    /// Active, physical-zero, or explicitly blocked proposal.
137    pub status: StructureStatus,
138    /// Nominal physical direction, retained for blocked flows.
139    pub proposed_direction: Option<FlowDirection>,
140    /// Proposed signed discharge in m³/s. Positive means A to B.
141    pub discharge_m3_per_s: f64,
142    /// Evaluated operands, absent for physical zeros, flap blocking, and isolated operations.
143    pub hydraulic_operands: Option<StructureHydraulicOperands>,
144}
145
146/// Exact elapsed support of a held-head proposal, without an evolving trajectory claim.
147#[derive(Clone, Copy, Debug, PartialEq)]
148pub struct HeldHeadInterval {
149    /// Finite nonnegative elapsed start in seconds.
150    pub start: f64,
151    /// Finite strictly later elapsed end in seconds.
152    pub end: f64,
153}
154/// Original held-head signed Q*dt proposal, without donor or paired-component admission.
155#[derive(Clone, Debug, PartialEq)]
156pub struct HeldHeadVolumeOutput {
157    /// Exact original interval.
158    pub interval: HeldHeadInterval,
159    /// Immutable original instantaneous proposal.
160    pub proposal: StructureOutput,
161    /// Original signed discharge-times-duration product in m³.
162    pub volume_m3: f64,
163}