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