Hydrostatics¶
Module Reference¶
Hydrostatic pressure calculations for Fluidmec.
All dimensional quantities use SI units. Depth is measured positively downwards.
as_float_array
¶
as_float_array(value: ArrayLike, name: str) -> np.ndarray
Convert input to a finite floating-point array.
Source code in src/fluidmec/core/_validation.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
format_output
¶
format_output(result: ArrayLike) -> float | np.ndarray
Return a Python float for scalar results.
Source code in src/fluidmec/core/_validation.py
69 70 71 72 73 74 75 76 77 78 79 | |
validate_non_negative
¶
validate_non_negative(value: ArrayLike, name: str) -> np.ndarray
Validate non-negative numerical inputs.
Source code in src/fluidmec/core/_validation.py
41 42 43 44 45 46 47 48 49 50 51 52 | |
validate_positive
¶
validate_positive(value: ArrayLike, name: str) -> np.ndarray
Validate strictly positive numerical inputs.
Source code in src/fluidmec/core/_validation.py
27 28 29 30 31 32 33 34 35 36 37 38 | |
hydrostatic_pressure
¶
hydrostatic_pressure(depth: ArrayLike, density: ArrayLike = WATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY) -> float | np.ndarray
Calculate hydrostatic gauge pressure in Pa.
p = rho * g * h
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depth
|
ArrayLike
|
Depth below the fluid surface in m. |
required |
density
|
ArrayLike
|
Fluid density in kg/m³. |
WATER_DENSITY
|
gravity
|
ArrayLike
|
Gravitational acceleration in m/s². |
ENGINEERING_GRAVITY
|
Source code in src/fluidmec/core/hydrostatics.py
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 | |
absolute_pressure
¶
absolute_pressure(depth: ArrayLike, density: ArrayLike = WATER_DENSITY, surface_pressure: ArrayLike = ATMOSPHERIC_PRESSURE, gravity: ArrayLike = ENGINEERING_GRAVITY) -> float | np.ndarray
Calculate absolute hydrostatic pressure in Pa.
p_abs = p_surface + rho * g * h
Surface pressure must be absolute pressure.
Source code in src/fluidmec/core/hydrostatics.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
pressure_head
¶
pressure_head(pressure: ArrayLike, density: ArrayLike = WATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY) -> float | np.ndarray
Calculate pressure head in metres.
H = p / (rho * g)
Pressure is a signed gauge pressure in Pa.
Source code in src/fluidmec/core/hydrostatics.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
hydrostatic_depth
¶
hydrostatic_depth(pressure: ArrayLike, density: ArrayLike = WATER_DENSITY, surface_pressure: ArrayLike = ATMOSPHERIC_PRESSURE, gravity: ArrayLike = ENGINEERING_GRAVITY) -> float | np.ndarray
Calculate depth below the fluid surface in m.
h = (p_abs - p_surface) / (rho * g)
Both pressures must be absolute and in Pa.
Source code in src/fluidmec/core/hydrostatics.py
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 | |
pressure_difference
¶
pressure_difference(depth_1: ArrayLike, depth_2: ArrayLike, density: ArrayLike = WATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY) -> float | np.ndarray
Calculate signed pressure difference in Pa.
delta_p = rho * g * (h2 - h1)
Source code in src/fluidmec/core/hydrostatics.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
stratified_pressure
¶
stratified_pressure(depth: ArrayLike, density: ArrayLike, surface_pressure: float = 0.0, gravity: float = ENGINEERING_GRAVITY) -> np.ndarray
Calculate pressure in a variable-density fluid.
p(h) = p_surface + integral(rho * g * dh)
Uses cumulative trapezoidal integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depth
|
ArrayLike
|
One-dimensional depth coordinates in m. Must start at zero and increase strictly. |
required |
density
|
ArrayLike
|
Density at each depth in kg/m³. |
required |
surface_pressure
|
float
|
Pressure at depth zero in Pa. Default zero returns gauge pressure. |
0.0
|
gravity
|
float
|
Constant gravitational acceleration. |
ENGINEERING_GRAVITY
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Pressure at every supplied depth in Pa. |
Source code in src/fluidmec/core/hydrostatics.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |