Skip to content

Wave-Induced Dynamic Pressure

The fluidmec.waves.pressure module implements first-order wave-induced pressure, hydrostatic pressure decomposition, and monochromatic pressure-based wave reconstruction.

Coordinate convention

  • Horizontal coordinate x is positive in the propagation direction.
  • Vertical coordinate z is positive upwards.
  • Still water level is at z = 0.
  • The seabed is at z = -h.
  • All dimensional quantities use SI units.

Governing equations

The linearised unsteady Bernoulli equation gives

\[ p_g = -\rho gz-\rho\frac{\partial\phi}{\partial t}. \]

The hydrostatic gauge pressure is

\[ p_h=-\rho gz. \]

The pressure response factor is

\[ K_p=\frac{\cosh[k(z+h)]}{\cosh(kh)}. \]

The wave-induced pressure perturbation is

\[ p'=\rho gaK_p\cos\theta. \]

Total gauge pressure is

\[ p_g=p_h+p'. \]

Absolute pressure is

\[ p_{\mathrm{abs}}=p_{\mathrm{atm}}+p_g. \]

Wave-induced pressure must not be confused with the velocity-based dynamic pressure rho*U^2/2.

Pressure reconstruction

For a known monochromatic wave number,

\[ \eta=\frac{p'}{\rho gK_p}. \]

For pressure amplitude Pa,

\[ H=\frac{2P_a}{\rho gK_p}. \]

For peak-to-peak pressure range,

\[ H=\frac{\Delta p_{\mathrm{pp}}}{\rho gK_p}. \]

The default minimum accepted pressure response is 0.1. This limits the inverse correction gain to 10.

The threshold is configurable and is not a universal engineering standard. Low responses are rejected rather than silently clipped.

Basic usage

from fluidmec.waves import (
    solve_wave_number,
    wave_dynamic_pressure,
    wave_gauge_pressure,
    wave_absolute_pressure,
)

k = solve_wave_number(8.0, 20.0)

pd = wave_dynamic_pressure(
    1.0, 0.0, -5.0, 0.0, k, 20.0
)

pg = wave_gauge_pressure(
    1.0, 0.0, -5.0, 0.0, k, 20.0
)

pabs = wave_absolute_pressure(
    1.0, 0.0, -5.0, 0.0, k, 20.0
)

Sensor reconstruction

from fluidmec.waves import (
    extract_wave_pressure,
    solve_wave_number,
    surface_elevation_from_pressure,
)

k = solve_wave_number(8.0, 20.0)

pressure = extract_wave_pressure(
    measured_pressure=160000.0,
    z=-5.0,
    atmospheric_pressure=101325.0,
)

eta = surface_elevation_from_pressure(
    pressure, k, -5.0, 20.0
)

For gauge-pressure measurements, use an atmospheric reference of zero.

For absolute-pressure measurements, supply the appropriate measured atmospheric reference.

Numerical stability

The pressure response factor reuses the stable exponential depth factors implemented in fluidmec.waves.airy.

This avoids direct hyperbolic overflow at large kh.

Responses may underflow to zero at extreme depths. Such responses cannot be inverted and are rejected.

Nonfinite results are rejected throughout the pressure API.

Assumptions and limitations

  • First-order linear Airy wave theory.
  • Incompressible, inviscid and irrotational fluid.
  • Constant density and water depth.
  • No background current or surface tension.
  • No nonlinear velocity-head contribution.
  • No instantaneous free-surface stretching.
  • No cavitation or structural interaction model.
  • Fixed and known sensor elevation.
  • Known monochromatic wave number for reconstruction.
  • No automatic removal of tidal trends or sensor drift.
  • No irregular-wave spectral reconstruction.

The linear pressure field is evaluated within the mean water column. Near wave troughs, some evaluation points may lie above the instantaneous physical water surface.

Validation

The accompanying tests verify:

  • Hydrostatic pressure and pressure decomposition.
  • Analytical pressure response factors.
  • Unsteady Bernoulli consistency.
  • Horizontal and vertical momentum equations.
  • Pressure periodicity.
  • Deep-water and shallow-water limits.
  • Wave-height and surface-elevation reconstruction.
  • Gauge and absolute sensor pressure extraction.
  • Numerical overflow and underflow handling.
  • Reconstruction threshold enforcement.
  • NumPy broadcasting and scalar return types.

Visualisation

python examples/wave_pressure_example.py

Generated output:

outputs/wave_pressure_analysis.png

API reference

Pressure fields and pressure-based reconstruction of linear waves.

This module implements first-order wave-induced pressure using the linearised unsteady Bernoulli equation and Airy wave theory.

Coordinate convention

x : horizontal coordinate, positive in the propagation direction. z : vertical coordinate, positive upwards from still water level. h : positive water depth, with the seabed at z = -h.

Physical assumptions
  • Incompressible, inviscid and irrotational fluid.
  • Small-amplitude, two-dimensional progressive gravity waves.
  • Constant fluid density and water depth.
  • Horizontal impermeable seabed.
  • No background current or surface tension.
  • First-order free-surface boundary conditions.
  • No second-order Bernoulli velocity-head contribution.

All dimensional inputs and outputs use SI units.

Wave-induced dynamic pressure in this module means the pressure perturbation -rhod(phi)/dt, not the velocity head rhoU**2/2.

Pressure reconstruction assumes a known wave number and a monochromatic linear wave. Broadband irregular-wave reconstruction requires frequency-dependent spectral processing.

References

Dean, R. G. and Dalrymple, R. A. (1991). Water Wave Mechanics for Engineers and Scientists. World Scientific.

ATMOSPHERIC_PRESSURE module-attribute

ATMOSPHERIC_PRESSURE: Final[float] = 101325.0

ENGINEERING_GRAVITY module-attribute

ENGINEERING_GRAVITY: Final[float] = 9.81

SEAWATER_DENSITY module-attribute

SEAWATER_DENSITY: Final[float] = 1025.0

ScalarOrArray module-attribute

ScalarOrArray = float | np.ndarray

DEFAULT_MINIMUM_RESPONSE module-attribute

DEFAULT_MINIMUM_RESPONSE = 0.1

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
def as_float_array(
    value: ArrayLike,
    name: str,
) -> np.ndarray:
    """Convert input to a finite floating-point array."""

    array = np.asarray(value, dtype=float)

    if not np.all(np.isfinite(array)):
        raise ValueError(f"{name} must be finite.")

    return array

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
def format_output(
    result: ArrayLike,
) -> float | np.ndarray:
    """Return a Python float for scalar results."""

    result = np.asarray(result, dtype=float)

    if result.ndim == 0:
        return float(result)

    return result

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
def validate_non_negative(
    value: ArrayLike,
    name: str,
) -> np.ndarray:
    """Validate non-negative numerical inputs."""

    array = as_float_array(value, name)

    if np.any(array < 0):
        raise ValueError(f"{name} must be non-negative.")

    return array

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
def validate_positive(
    value: ArrayLike,
    name: str,
) -> np.ndarray:
    """Validate strictly positive numerical inputs."""

    array = as_float_array(value, name)

    if np.any(array <= 0):
        raise ValueError(f"{name} must be positive.")

    return array

cosh_depth_factor

cosh_depth_factor(wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike) -> float | np.ndarray

Calculate the stable hyperbolic cosine depth factor.

Parameters:

Name Type Description Default
wave_number array_like

Positive wave number in rad/m.

required
z array_like

Vertical coordinate in metres, satisfying -h <= z <= 0.

required
depth array_like

Positive still-water depth in metres.

required

Returns:

Type Description
float or ndarray

Dimensionless cosine depth attenuation factor.

Notes

Governing expression:

C = cosh(k*(z+h))/cosh(k*h)

Stable exponential formulation:

C = exp(k*z)*(1 + exp(-2*k*(z+h)))
    / (1 + exp(-2*k*h))

All exponential arguments are non-positive within the mean water column.

At z = 0, C = 1.

Source code in src/fluidmec/waves/airy.py
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
def cosh_depth_factor(
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
) -> float | np.ndarray:
    """Calculate the stable hyperbolic cosine depth factor.

    Parameters
    ----------
    wave_number : array_like
        Positive wave number in rad/m.
    z : array_like
        Vertical coordinate in metres, satisfying -h <= z <= 0.
    depth : array_like
        Positive still-water depth in metres.

    Returns
    -------
    float or numpy.ndarray
        Dimensionless cosine depth attenuation factor.

    Notes
    -----
    Governing expression:

        C = cosh(k*(z+h))/cosh(k*h)

    Stable exponential formulation:

        C = exp(k*z)*(1 + exp(-2*k*(z+h)))
            / (1 + exp(-2*k*h))

    All exponential arguments are non-positive within
    the mean water column.

    At z = 0, C = 1.
    """
    k = validate_positive(wave_number, "Wave number")
    z, h = _validate_vertical_coordinates(z, depth)

    with np.errstate(over="ignore", under="ignore"):
        q = k * (z + h)
        b = k * h

        numerator = 1.0 + np.exp(-2.0 * q)
        denominator = 1.0 + np.exp(-2.0 * b)

        result = np.exp(k * z) * numerator / denominator

    return _finite_result(result, "Cosine depth factor")

wave_phase

wave_phase(x: ArrayLike, time: ArrayLike, wave_number: ArrayLike, angular_frequency: ArrayLike, phase_offset: ArrayLike = 0.0) -> float | np.ndarray

Calculate the phase of a progressive sinusoidal wave.

Parameters:

Name Type Description Default
x array_like

Horizontal position in metres.

required
time array_like

Time in seconds.

required
wave_number array_like

Positive wave-number magnitude in rad/m.

required
angular_frequency array_like

Positive angular frequency in rad/s.

required
phase_offset array_like

Initial phase offset in radians.

0.0

Returns:

Type Description
float or ndarray

Unwrapped wave phase in radians.

Notes

Equation:

theta = k*x - omega*t + phase_offset

Positive k and omega describe propagation in the positive x direction.

This general phase function does not independently enforce the gravity-wave dispersion relation.

Source code in src/fluidmec/waves/airy.py
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
def wave_phase(
    x: ArrayLike,
    time: ArrayLike,
    wave_number: ArrayLike,
    angular_frequency: ArrayLike,
    phase_offset: ArrayLike = 0.0,
) -> float | np.ndarray:
    """Calculate the phase of a progressive sinusoidal wave.

    Parameters
    ----------
    x : array_like
        Horizontal position in metres.
    time : array_like
        Time in seconds.
    wave_number : array_like
        Positive wave-number magnitude in rad/m.
    angular_frequency : array_like
        Positive angular frequency in rad/s.
    phase_offset : array_like, optional
        Initial phase offset in radians.

    Returns
    -------
    float or numpy.ndarray
        Unwrapped wave phase in radians.

    Notes
    -----
    Equation:

        theta = k*x - omega*t + phase_offset

    Positive k and omega describe propagation in the
    positive x direction.

    This general phase function does not independently
    enforce the gravity-wave dispersion relation.
    """
    x = as_float_array(x, "Horizontal position")
    t = as_float_array(time, "Time")
    k = validate_positive(wave_number, "Wave number")
    omega = validate_positive(
        angular_frequency,
        "Angular frequency",
    )
    offset = as_float_array(phase_offset, "Phase offset")

    with np.errstate(over="ignore", invalid="ignore"):
        result = k * x - omega * t + offset

    return _finite_result(result, "Wave phase")

dispersion_angular_frequency

dispersion_angular_frequency(wave_number: ArrayLike, depth: ArrayLike, gravity: ArrayLike = ENGINEERING_GRAVITY) -> float | np.ndarray

Calculate angular frequency from the dispersion relation.

Parameters:

Name Type Description Default
wave_number array_like

Wave-number magnitude k, in rad/m. Positive.

required
depth array_like

Still-water depth h, in metres. Positive.

required
gravity array_like

Gravitational acceleration, in m/s^2.

ENGINEERING_GRAVITY

Returns:

Type Description
float or ndarray

Angular frequency omega, in rad/s.

Notes

Equation:

omega = sqrt(g*k*tanh(k*h))

Assumes linear surface gravity waves.

Source code in src/fluidmec/waves/dispersion.py
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
def dispersion_angular_frequency(
    wave_number: ArrayLike,
    depth: ArrayLike,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
) -> float | np.ndarray:
    """Calculate angular frequency from the dispersion relation.

    Parameters
    ----------
    wave_number : array_like
        Wave-number magnitude k, in rad/m. Positive.
    depth : array_like
        Still-water depth h, in metres. Positive.
    gravity : array_like, optional
        Gravitational acceleration, in m/s^2.

    Returns
    -------
    float or numpy.ndarray
        Angular frequency omega, in rad/s.

    Notes
    -----
    Equation:

        omega = sqrt(g*k*tanh(k*h))

    Assumes linear surface gravity waves.
    """
    k = validate_positive(wave_number, "Wave number")
    h = validate_positive(depth, "Water depth")
    g = validate_positive(gravity, "Gravity")

    omega = np.sqrt(g * k * np.tanh(k * h))

    return format_output(omega)

solve_wave_number

solve_wave_number(period: ArrayLike, depth: ArrayLike, gravity: ArrayLike = ENGINEERING_GRAVITY, *, method: str = 'newton', tolerance: float = 1e-10, max_iterations: int = 100) -> float | np.ndarray

Solve the linear wave dispersion relation for k.

Parameters:

Name Type Description Default
period array_like

Wave period T, in seconds. Positive.

required
depth array_like

Still-water depth h, in metres. Positive.

required
gravity array_like

Gravitational acceleration g, in m/s^2.

ENGINEERING_GRAVITY
method (newton, bisection)

Safeguarded Newton-Raphson or bisection.

"newton"
tolerance float

Relative dimensionless residual tolerance. Must be between zero and one, exclusive.

1e-10
max_iterations int

Maximum number of solver evaluations.

100

Returns:

Type Description
float or ndarray

Positive wave-number magnitude k, in rad/m.

Raises:

Type Description
ValueError

If physical inputs or solver options are invalid.

RuntimeError

If the solver does not converge.

Notes

Solves:

x*tanh(x) = mu

where x = kh and mu = omega**2h/g.

Convergence criterion:

abs(x*tanh(x) - mu) / mu <= tolerance

Newton steps outside the root bracket are replaced by bisection steps.

Supports NumPy broadcasting. Every array element must converge before the function returns.

The result is based on linear gravity wave theory, without current or surface tension.

Source code in src/fluidmec/waves/dispersion.py
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
def solve_wave_number(
    period: ArrayLike,
    depth: ArrayLike,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    method: str = "newton",
    tolerance: float = 1e-10,
    max_iterations: int = 100,
) -> float | np.ndarray:
    """Solve the linear wave dispersion relation for k.

    Parameters
    ----------
    period : array_like
        Wave period T, in seconds. Positive.
    depth : array_like
        Still-water depth h, in metres. Positive.
    gravity : array_like, optional
        Gravitational acceleration g, in m/s^2.
    method : {"newton", "bisection"}, optional
        Safeguarded Newton-Raphson or bisection.
    tolerance : float, optional
        Relative dimensionless residual tolerance.
        Must be between zero and one, exclusive.
    max_iterations : int, optional
        Maximum number of solver evaluations.

    Returns
    -------
    float or numpy.ndarray
        Positive wave-number magnitude k, in rad/m.

    Raises
    ------
    ValueError
        If physical inputs or solver options are invalid.
    RuntimeError
        If the solver does not converge.

    Notes
    -----
    Solves:

        x*tanh(x) = mu

    where x = k*h and mu = omega**2*h/g.

    Convergence criterion:

        abs(x*tanh(x) - mu) / mu <= tolerance

    Newton steps outside the root bracket are replaced
    by bisection steps.

    Supports NumPy broadcasting. Every array element must
    converge before the function returns.

    The result is based on linear gravity wave theory,
    without current or surface tension.
    """
    tolerance = _validate_solver_options(
        method,
        tolerance,
        max_iterations,
    )

    period = validate_positive(period, "Wave period")
    depth = validate_positive(depth, "Water depth")
    gravity = validate_positive(gravity, "Gravity")

    period, depth, gravity = np.broadcast_arrays(
        period,
        depth,
        gravity,
    )

    omega = 2.0 * np.pi / period

    with np.errstate(
        over="ignore",
        under="ignore",
        invalid="ignore",
    ):
        mu = omega**2 * depth / gravity

    if np.any(~np.isfinite(mu)) or np.any(mu <= 0):
        raise ValueError("Inputs exceed the supported numerical range.")

    # The limiting solutions are:
    # Deep water: x = mu
    # Shallow water: x = sqrt(mu)
    #
    # Twice the larger limiting value provides an
    # upper bracket for ordinary positive inputs.
    estimate = np.maximum(mu, np.sqrt(mu))

    lower = np.zeros_like(mu)
    upper = 2.0 * estimate

    if np.any(~np.isfinite(upper)):
        raise ValueError("Unable to construct a finite root bracket.")

    if np.any(_dimensionless_residual(upper, mu) < 0):
        raise RuntimeError("Unable to bracket the dispersion root.")

    x = estimate.copy()

    for _ in range(max_iterations):
        residual = _dimensionless_residual(x, mu)

        converged = np.abs(residual) / mu <= tolerance

        if np.all(converged):
            result = x / depth

            if np.any(~np.isfinite(result)) or np.any(result <= 0):
                raise ValueError("Wave number exceeds numerical range.")

            return format_output(result)

        active = ~converged

        lower = np.where(
            active & (residual < 0),
            x,
            lower,
        )

        upper = np.where(
            active & (residual > 0),
            x,
            upper,
        )

        midpoint = lower + 0.5 * (upper - lower)

        if method == "newton":
            derivative = _dimensionless_derivative(x)

            with np.errstate(
                divide="ignore",
                invalid="ignore",
                over="ignore",
            ):
                candidate = x - residual / derivative

            valid_step = (
                np.isfinite(candidate) & (candidate > lower) & (candidate < upper)
            )

            next_x = np.where(
                valid_step,
                candidate,
                midpoint,
            )

        else:
            next_x = midpoint

        # Preserve array elements that have converged.
        x = np.where(active, next_x, x)

    raise RuntimeError(
        f"Wave dispersion solver did not converge within {max_iterations} iterations."
    )

_finite_output

_finite_output(value: ArrayLike, name: str) -> ScalarOrArray

Return a finite scalar or array.

Source code in src/fluidmec/waves/pressure.py
64
65
66
67
68
69
70
71
72
73
74
def _finite_output(
    value: ArrayLike,
    name: str,
) -> ScalarOrArray:
    """Return a finite scalar or array."""
    result = np.asarray(value, dtype=float)

    if not np.all(np.isfinite(result)):
        raise ValueError(f"{name} exceeds the supported numerical range.")

    return format_output(result)

_validate_sensor_elevation

_validate_sensor_elevation(z: ArrayLike) -> np.ndarray

Validate a sensor coordinate at or below still water level.

Source code in src/fluidmec/waves/pressure.py
77
78
79
80
81
82
83
84
85
86
def _validate_sensor_elevation(
    z: ArrayLike,
) -> np.ndarray:
    """Validate a sensor coordinate at or below still water level."""
    z = as_float_array(z, "Vertical coordinate")

    if np.any(z > 0.0):
        raise ValueError("Vertical coordinate must be at or below still water level.")

    return z

_specific_weight

_specific_weight(density: ArrayLike, gravity: ArrayLike) -> np.ndarray

Calculate positive fluid specific weight in N/m^3.

Source code in src/fluidmec/waves/pressure.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def _specific_weight(
    density: ArrayLike,
    gravity: ArrayLike,
) -> np.ndarray:
    """Calculate positive fluid specific weight in N/m^3."""
    rho = validate_positive(density, "Fluid density")
    g = validate_positive(gravity, "Gravity")

    with np.errstate(over="ignore", under="ignore"):
        result = rho * g

    return validate_positive(result, "Specific weight")

_validate_minimum_response

_validate_minimum_response(minimum_response: float) -> float

Validate a scalar inverse-reconstruction threshold.

Source code in src/fluidmec/waves/pressure.py
103
104
105
106
107
108
109
110
111
112
113
114
def _validate_minimum_response(
    minimum_response: float,
) -> float:
    """Validate a scalar inverse-reconstruction threshold."""
    value = np.asarray(minimum_response, dtype=float)

    if value.ndim != 0 or not np.isfinite(value) or not 0.0 < float(value) <= 1.0:
        raise ValueError(
            "Minimum pressure response must be a finite scalar in the interval (0, 1]."
        )

    return float(value)

pressure_response_factor

pressure_response_factor(wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike) -> ScalarOrArray

Calculate the linear wave pressure response factor.

Parameters:

Name Type Description Default
wave_number array_like

Positive angular wave number k [rad/m].

required
z array_like

Vertical evaluation coordinate [m]. Must satisfy -depth <= z <= 0.

required
depth array_like

Positive still-water depth h [m].

required

Returns:

Type Description
float or ndarray

Dimensionless pressure response factor Kp.

Notes

Kp = cosh(k(z+h))/cosh(kh).

Kp equals one at still water level and decreases towards the seabed.

Stable exponential depth factors are reused from the Airy wave module to avoid hyperbolic overflow. Very small responses may underflow to zero.

Source code in src/fluidmec/waves/pressure.py
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
def pressure_response_factor(
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
) -> ScalarOrArray:
    """Calculate the linear wave pressure response factor.

    Parameters
    ----------
    wave_number : array_like
        Positive angular wave number k [rad/m].
    z : array_like
        Vertical evaluation coordinate [m].
        Must satisfy -depth <= z <= 0.
    depth : array_like
        Positive still-water depth h [m].

    Returns
    -------
    float or ndarray
        Dimensionless pressure response factor Kp.

    Notes
    -----
    Kp = cosh(k*(z+h))/cosh(k*h).

    Kp equals one at still water level and decreases
    towards the seabed.

    Stable exponential depth factors are reused from
    the Airy wave module to avoid hyperbolic overflow.
    Very small responses may underflow to zero.
    """
    return cosh_depth_factor(wave_number, z, depth)

pressure_response_factor_from_period

pressure_response_factor_from_period(period: ArrayLike, z: ArrayLike, depth: ArrayLike, gravity: ArrayLike = ENGINEERING_GRAVITY, *, method: str = 'newton', tolerance: float = 1e-10, max_iterations: int = 100) -> ScalarOrArray

Calculate pressure response from wave period and depth.

Parameters:

Name Type Description Default
period array_like

Positive wave period T [s].

required
z array_like

Vertical coordinate [m], with -depth <= z <= 0.

required
depth array_like

Positive water depth [m].

required
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
method (newton, bisection)

Linear dispersion solver.

"newton"
tolerance float

Relative dimensionless dispersion residual tolerance.

1e-10
max_iterations int

Maximum dispersion solver iterations.

100

Returns:

Type Description
float or ndarray

Dimensionless pressure response factor.

Notes

Wave number is obtained from the linear dispersion relation before calculating the pressure response.

Source code in src/fluidmec/waves/pressure.py
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
def pressure_response_factor_from_period(
    period: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    method: str = "newton",
    tolerance: float = 1e-10,
    max_iterations: int = 100,
) -> ScalarOrArray:
    """Calculate pressure response from wave period and depth.

    Parameters
    ----------
    period : array_like
        Positive wave period T [s].
    z : array_like
        Vertical coordinate [m], with -depth <= z <= 0.
    depth : array_like
        Positive water depth [m].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    method : {"newton", "bisection"}, optional
        Linear dispersion solver.
    tolerance : float, optional
        Relative dimensionless dispersion residual tolerance.
    max_iterations : int, optional
        Maximum dispersion solver iterations.

    Returns
    -------
    float or ndarray
        Dimensionless pressure response factor.

    Notes
    -----
    Wave number is obtained from the linear dispersion
    relation before calculating the pressure response.
    """
    k = solve_wave_number(
        period,
        depth,
        gravity,
        method=method,
        tolerance=tolerance,
        max_iterations=max_iterations,
    )

    return pressure_response_factor(k, z, depth)

wave_hydrostatic_pressure

wave_hydrostatic_pressure(z: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY) -> ScalarOrArray

Calculate the hydrostatic gauge pressure baseline.

Parameters:

Name Type Description Default
z array_like

Vertical coordinate below still water level [m]. Must be non-positive.

required
density array_like

Positive constant fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY

Returns:

Type Description
float or ndarray

Hydrostatic gauge pressure [Pa].

Notes

p_h = -rhogz.

Atmospheric pressure is excluded.

This function uses the upward-positive wave coordinate convention. Water-column depth validation is performed by the wave pressure functions that accept water depth.

Source code in src/fluidmec/waves/pressure.py
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
def wave_hydrostatic_pressure(
    z: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
) -> ScalarOrArray:
    """Calculate the hydrostatic gauge pressure baseline.

    Parameters
    ----------
    z : array_like
        Vertical coordinate below still water level [m].
        Must be non-positive.
    density : array_like, optional
        Positive constant fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].

    Returns
    -------
    float or ndarray
        Hydrostatic gauge pressure [Pa].

    Notes
    -----
    p_h = -rho*g*z.

    Atmospheric pressure is excluded.

    This function uses the upward-positive wave coordinate
    convention. Water-column depth validation is performed
    by the wave pressure functions that accept water depth.
    """
    z = _validate_sensor_elevation(z)
    gamma = _specific_weight(density, gravity)

    with np.errstate(over="ignore", invalid="ignore"):
        result = -gamma * z

    return _finite_output(result, "Hydrostatic pressure")

wave_pressure_amplitude

wave_pressure_amplitude(amplitude: ArrayLike, wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY) -> ScalarOrArray

Calculate the amplitude of wave-induced pressure.

Parameters:

Name Type Description Default
amplitude array_like

Non-negative surface wave amplitude a [m].

required
wave_number array_like

Positive angular wave number k [rad/m].

required
z array_like

Vertical coordinate [m], with -depth <= z <= 0.

required
depth array_like

Positive water depth [m].

required
density array_like

Positive constant fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY

Returns:

Type Description
float or ndarray

Non-negative wave pressure amplitude Pa [Pa].

Notes

Pa = rhoga*Kp.

The peak-to-peak pressure range of a regular monochromatic wave is twice this amplitude.

Source code in src/fluidmec/waves/pressure.py
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
def wave_pressure_amplitude(
    amplitude: ArrayLike,
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
) -> ScalarOrArray:
    """Calculate the amplitude of wave-induced pressure.

    Parameters
    ----------
    amplitude : array_like
        Non-negative surface wave amplitude a [m].
    wave_number : array_like
        Positive angular wave number k [rad/m].
    z : array_like
        Vertical coordinate [m], with -depth <= z <= 0.
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive constant fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].

    Returns
    -------
    float or ndarray
        Non-negative wave pressure amplitude Pa [Pa].

    Notes
    -----
    Pa = rho*g*a*Kp.

    The peak-to-peak pressure range of a regular
    monochromatic wave is twice this amplitude.
    """
    a = validate_non_negative(amplitude, "Wave amplitude")
    gamma = _specific_weight(density, gravity)

    kp = pressure_response_factor(wave_number, z, depth)

    with np.errstate(
        over="ignore",
        under="ignore",
        invalid="ignore",
    ):
        result = gamma * (a * kp)

    return _finite_output(result, "Wave pressure amplitude")

wave_dynamic_pressure

wave_dynamic_pressure(amplitude: ArrayLike, x: ArrayLike, z: ArrayLike, time: ArrayLike, wave_number: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, phase_offset: ArrayLike = 0.0) -> ScalarOrArray

Calculate instantaneous wave-induced pressure perturbation.

Parameters:

Name Type Description Default
amplitude array_like

Non-negative wave amplitude a [m].

required
x array_like

Horizontal evaluation coordinate [m].

required
z array_like

Vertical evaluation coordinate [m]. Must satisfy -depth <= z <= 0.

required
time array_like

Evaluation time [s].

required
wave_number array_like

Positive angular wave number k [rad/m].

required
depth array_like

Positive water depth [m].

required
density array_like

Positive constant fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
phase_offset array_like

Initial wave phase offset [rad].

0.0

Returns:

Type Description
float or ndarray

Signed wave-induced pressure perturbation [Pa].

Notes

p' = rhogaKpcos(theta).

theta = kx - omegat + phase_offset.

Angular frequency is obtained from the linear dispersion relation.

This is the first-order unsteady Bernoulli pressure, not the velocity-based dynamic pressure rho*U**2/2.

Source code in src/fluidmec/waves/pressure.py
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
def wave_dynamic_pressure(
    amplitude: ArrayLike,
    x: ArrayLike,
    z: ArrayLike,
    time: ArrayLike,
    wave_number: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    phase_offset: ArrayLike = 0.0,
) -> ScalarOrArray:
    """Calculate instantaneous wave-induced pressure perturbation.

    Parameters
    ----------
    amplitude : array_like
        Non-negative wave amplitude a [m].
    x : array_like
        Horizontal evaluation coordinate [m].
    z : array_like
        Vertical evaluation coordinate [m].
        Must satisfy -depth <= z <= 0.
    time : array_like
        Evaluation time [s].
    wave_number : array_like
        Positive angular wave number k [rad/m].
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive constant fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    phase_offset : array_like, optional
        Initial wave phase offset [rad].

    Returns
    -------
    float or ndarray
        Signed wave-induced pressure perturbation [Pa].

    Notes
    -----
    p' = rho*g*a*Kp*cos(theta).

    theta = k*x - omega*t + phase_offset.

    Angular frequency is obtained from the linear
    dispersion relation.

    This is the first-order unsteady Bernoulli pressure,
    not the velocity-based dynamic pressure rho*U**2/2.
    """
    omega = validate_positive(
        dispersion_angular_frequency(wave_number, depth, gravity),
        "Angular frequency",
    )

    theta = wave_phase(x, time, wave_number, omega, phase_offset)

    pressure_amplitude = wave_pressure_amplitude(
        amplitude,
        wave_number,
        z,
        depth,
        density,
        gravity,
    )

    result = pressure_amplitude * np.cos(theta)

    return _finite_output(result, "Wave-induced pressure")

wave_gauge_pressure

wave_gauge_pressure(amplitude: ArrayLike, x: ArrayLike, z: ArrayLike, time: ArrayLike, wave_number: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, phase_offset: ArrayLike = 0.0) -> ScalarOrArray

Calculate first-order total gauge pressure.

Parameters:

Name Type Description Default
amplitude array_like

Non-negative wave amplitude [m].

required
x array_like

Horizontal and vertical coordinates [m]. The vertical coordinate must satisfy -depth <= z <= 0.

required
z array_like

Horizontal and vertical coordinates [m]. The vertical coordinate must satisfy -depth <= z <= 0.

required
time array_like

Evaluation time [s].

required
wave_number array_like

Positive wave number [rad/m].

required
depth array_like

Positive water depth [m].

required
density array_like

Positive fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
phase_offset array_like

Initial wave phase offset [rad].

0.0

Returns:

Type Description
float or ndarray

Hydrostatic plus wave-induced gauge pressure [Pa].

Notes

p_g = -rhogz + p'.

The linearised field is not clipped at zero pressure. Evaluation near the moving free surface may fall outside the instantaneous physical water column.

Source code in src/fluidmec/waves/pressure.py
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
def wave_gauge_pressure(
    amplitude: ArrayLike,
    x: ArrayLike,
    z: ArrayLike,
    time: ArrayLike,
    wave_number: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    phase_offset: ArrayLike = 0.0,
) -> ScalarOrArray:
    """Calculate first-order total gauge pressure.

    Parameters
    ----------
    amplitude : array_like
        Non-negative wave amplitude [m].
    x, z : array_like
        Horizontal and vertical coordinates [m].
        The vertical coordinate must satisfy -depth <= z <= 0.
    time : array_like
        Evaluation time [s].
    wave_number : array_like
        Positive wave number [rad/m].
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    phase_offset : array_like, optional
        Initial wave phase offset [rad].

    Returns
    -------
    float or ndarray
        Hydrostatic plus wave-induced gauge pressure [Pa].

    Notes
    -----
    p_g = -rho*g*z + p'.

    The linearised field is not clipped at zero pressure.
    Evaluation near the moving free surface may fall
    outside the instantaneous physical water column.
    """
    hydrostatic = wave_hydrostatic_pressure(z, density, gravity)

    dynamic = wave_dynamic_pressure(
        amplitude,
        x,
        z,
        time,
        wave_number,
        depth,
        density,
        gravity,
        phase_offset=phase_offset,
    )

    with np.errstate(over="ignore", invalid="ignore"):
        result = np.asarray(hydrostatic) + dynamic

    return _finite_output(result, "Wave gauge pressure")

wave_absolute_pressure

wave_absolute_pressure(amplitude: ArrayLike, x: ArrayLike, z: ArrayLike, time: ArrayLike, wave_number: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, atmospheric_pressure: ArrayLike = ATMOSPHERIC_PRESSURE, phase_offset: ArrayLike = 0.0) -> ScalarOrArray

Calculate first-order absolute pressure beneath a wave.

Parameters:

Name Type Description Default
amplitude array_like

Non-negative wave amplitude [m].

required
x array_like

Horizontal and vertical coordinates [m]. The vertical coordinate must satisfy -depth <= z <= 0.

required
z array_like

Horizontal and vertical coordinates [m]. The vertical coordinate must satisfy -depth <= z <= 0.

required
time array_like

Evaluation time [s].

required
wave_number array_like

Positive wave number [rad/m].

required
depth array_like

Positive water depth [m].

required
density array_like

Positive fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
atmospheric_pressure array_like

Non-negative atmospheric pressure reference [Pa].

ATMOSPHERIC_PRESSURE
phase_offset array_like

Initial wave phase offset [rad].

0.0

Returns:

Type Description
float or ndarray

Absolute pressure predicted by linear theory [Pa].

Notes

p_abs = p_atm + p_h + p'.

No cavitation model or nonlinear free-surface correction is included. The caller is responsible for assessing physical applicability.

Source code in src/fluidmec/waves/pressure.py
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
def wave_absolute_pressure(
    amplitude: ArrayLike,
    x: ArrayLike,
    z: ArrayLike,
    time: ArrayLike,
    wave_number: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    atmospheric_pressure: ArrayLike = ATMOSPHERIC_PRESSURE,
    phase_offset: ArrayLike = 0.0,
) -> ScalarOrArray:
    """Calculate first-order absolute pressure beneath a wave.

    Parameters
    ----------
    amplitude : array_like
        Non-negative wave amplitude [m].
    x, z : array_like
        Horizontal and vertical coordinates [m].
        The vertical coordinate must satisfy -depth <= z <= 0.
    time : array_like
        Evaluation time [s].
    wave_number : array_like
        Positive wave number [rad/m].
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    atmospheric_pressure : array_like, optional
        Non-negative atmospheric pressure reference [Pa].
    phase_offset : array_like, optional
        Initial wave phase offset [rad].

    Returns
    -------
    float or ndarray
        Absolute pressure predicted by linear theory [Pa].

    Notes
    -----
    p_abs = p_atm + p_h + p'.

    No cavitation model or nonlinear free-surface
    correction is included. The caller is responsible
    for assessing physical applicability.
    """
    atmospheric = validate_non_negative(
        atmospheric_pressure,
        "Atmospheric pressure",
    )

    gauge = wave_gauge_pressure(
        amplitude,
        x,
        z,
        time,
        wave_number,
        depth,
        density,
        gravity,
        phase_offset=phase_offset,
    )

    with np.errstate(over="ignore", invalid="ignore"):
        result = atmospheric + gauge

    return _finite_output(result, "Wave absolute pressure")

pressure_correction_factor

pressure_correction_factor(wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike, *, minimum_response: float = DEFAULT_MINIMUM_RESPONSE) -> ScalarOrArray

Calculate the inverse pressure response factor.

Parameters:

Name Type Description Default
wave_number array_like

Positive wave number [rad/m].

required
z array_like

Sensor elevation [m], with -depth <= z <= 0.

required
depth array_like

Positive water depth [m].

required
minimum_response float

Minimum accepted dimensionless pressure response. Must satisfy 0 < minimum_response <= 1. Default is 0.1, corresponding to a maximum correction gain of 10.

DEFAULT_MINIMUM_RESPONSE

Returns:

Type Description
float or ndarray

Dimensionless pressure correction gain 1/Kp.

Raises:

Type Description
ValueError

If any pressure response is below the specified minimum or if the result is nonfinite.

Notes

Small responses amplify measurement noise. The threshold is a configurable software safeguard, not a universal engineering design criterion. Responses are rejected rather than clipped.

Source code in src/fluidmec/waves/pressure.py
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
def pressure_correction_factor(
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
    *,
    minimum_response: float = DEFAULT_MINIMUM_RESPONSE,
) -> ScalarOrArray:
    """Calculate the inverse pressure response factor.

    Parameters
    ----------
    wave_number : array_like
        Positive wave number [rad/m].
    z : array_like
        Sensor elevation [m], with -depth <= z <= 0.
    depth : array_like
        Positive water depth [m].
    minimum_response : float, optional
        Minimum accepted dimensionless pressure response.
        Must satisfy 0 < minimum_response <= 1.
        Default is 0.1, corresponding to a maximum
        correction gain of 10.

    Returns
    -------
    float or ndarray
        Dimensionless pressure correction gain 1/Kp.

    Raises
    ------
    ValueError
        If any pressure response is below the specified
        minimum or if the result is nonfinite.

    Notes
    -----
    Small responses amplify measurement noise.
    The threshold is a configurable software safeguard,
    not a universal engineering design criterion.
    Responses are rejected rather than clipped.
    """
    threshold = _validate_minimum_response(minimum_response)

    kp = np.asarray(
        pressure_response_factor(wave_number, z, depth),
        dtype=float,
    )

    if np.any(kp < threshold):
        raise ValueError(
            "Pressure response is below the minimum "
            "accepted threshold. Reconstruction would "
            "excessively amplify measurement noise."
        )

    with np.errstate(over="ignore", divide="ignore"):
        result = 1.0 / kp

    return _finite_output(result, "Pressure correction factor")

surface_elevation_from_pressure

surface_elevation_from_pressure(pressure_perturbation: ArrayLike, wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, minimum_response: float = DEFAULT_MINIMUM_RESPONSE) -> ScalarOrArray

Reconstruct surface elevation from wave pressure.

Parameters:

Name Type Description Default
pressure_perturbation array_like

Signed wave-induced pressure perturbation [Pa]. Hydrostatic and atmospheric components must already have been removed.

required
wave_number array_like

Positive wave number [rad/m].

required
z array_like

Sensor elevation [m], with -depth <= z <= 0.

required
depth array_like

Positive water depth [m].

required
density array_like

Positive constant fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
minimum_response float

Minimum accepted pressure response factor.

DEFAULT_MINIMUM_RESPONSE

Returns:

Type Description
float or ndarray

Reconstructed signed surface elevation [m].

Notes

eta = p'/(rhogKp).

This monochromatic reconstruction assumes known wave number and constant sensor elevation.

Source code in src/fluidmec/waves/pressure.py
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
def surface_elevation_from_pressure(
    pressure_perturbation: ArrayLike,
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    minimum_response: float = DEFAULT_MINIMUM_RESPONSE,
) -> ScalarOrArray:
    """Reconstruct surface elevation from wave pressure.

    Parameters
    ----------
    pressure_perturbation : array_like
        Signed wave-induced pressure perturbation [Pa].
        Hydrostatic and atmospheric components must
        already have been removed.
    wave_number : array_like
        Positive wave number [rad/m].
    z : array_like
        Sensor elevation [m], with -depth <= z <= 0.
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive constant fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    minimum_response : float, optional
        Minimum accepted pressure response factor.

    Returns
    -------
    float or ndarray
        Reconstructed signed surface elevation [m].

    Notes
    -----
    eta = p'/(rho*g*Kp).

    This monochromatic reconstruction assumes known
    wave number and constant sensor elevation.
    """
    pressure = as_float_array(
        pressure_perturbation,
        "Wave pressure perturbation",
    )

    gamma = _specific_weight(density, gravity)

    correction = pressure_correction_factor(
        wave_number,
        z,
        depth,
        minimum_response=minimum_response,
    )

    with np.errstate(
        over="ignore",
        under="ignore",
        invalid="ignore",
        divide="ignore",
    ):
        result = (pressure / gamma) * correction

    return _finite_output(result, "Reconstructed surface elevation")

wave_height_from_pressure_amplitude

wave_height_from_pressure_amplitude(pressure_amplitude: ArrayLike, wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, minimum_response: float = DEFAULT_MINIMUM_RESPONSE) -> ScalarOrArray

Reconstruct regular wave height from pressure amplitude.

Parameters:

Name Type Description Default
pressure_amplitude array_like

Non-negative amplitude of wave pressure [Pa]. This is half the peak-to-peak pressure range.

required
wave_number array_like

Positive wave number [rad/m].

required
z array_like

Sensor elevation [m], with -depth <= z <= 0.

required
depth array_like

Positive water depth [m].

required
density array_like

Positive fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
minimum_response float

Minimum accepted pressure response factor.

DEFAULT_MINIMUM_RESPONSE

Returns:

Type Description
float or ndarray

Reconstructed regular wave height H [m].

Notes

H = 2Pa/(rhog*Kp).

This function does not estimate significant wave height from an irregular-wave pressure spectrum.

Source code in src/fluidmec/waves/pressure.py
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
def wave_height_from_pressure_amplitude(
    pressure_amplitude: ArrayLike,
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    minimum_response: float = DEFAULT_MINIMUM_RESPONSE,
) -> ScalarOrArray:
    """Reconstruct regular wave height from pressure amplitude.

    Parameters
    ----------
    pressure_amplitude : array_like
        Non-negative amplitude of wave pressure [Pa].
        This is half the peak-to-peak pressure range.
    wave_number : array_like
        Positive wave number [rad/m].
    z : array_like
        Sensor elevation [m], with -depth <= z <= 0.
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    minimum_response : float, optional
        Minimum accepted pressure response factor.

    Returns
    -------
    float or ndarray
        Reconstructed regular wave height H [m].

    Notes
    -----
    H = 2*Pa/(rho*g*Kp).

    This function does not estimate significant wave
    height from an irregular-wave pressure spectrum.
    """
    pressure = validate_non_negative(
        pressure_amplitude,
        "Wave pressure amplitude",
    )

    amplitude = surface_elevation_from_pressure(
        pressure,
        wave_number,
        z,
        depth,
        density,
        gravity,
        minimum_response=minimum_response,
    )

    with np.errstate(over="ignore", invalid="ignore"):
        result = 2.0 * np.asarray(amplitude)

    return _finite_output(result, "Reconstructed wave height")

wave_height_from_pressure_range

wave_height_from_pressure_range(pressure_range: ArrayLike, wave_number: ArrayLike, z: ArrayLike, depth: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, minimum_response: float = DEFAULT_MINIMUM_RESPONSE) -> ScalarOrArray

Reconstruct wave height from peak-to-peak pressure.

Parameters:

Name Type Description Default
pressure_range array_like

Non-negative peak-to-peak pressure range [Pa].

required
wave_number array_like

Positive wave number [rad/m].

required
z array_like

Sensor elevation [m], with -depth <= z <= 0.

required
depth array_like

Positive water depth [m].

required
density array_like

Positive fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
minimum_response float

Minimum accepted pressure response factor.

DEFAULT_MINIMUM_RESPONSE

Returns:

Type Description
float or ndarray

Reconstructed regular wave height [m].

Notes

H = pressure_range/(rhogKp).

The pressure range must represent the wave-induced peak-to-peak variation of a regular wave.

Source code in src/fluidmec/waves/pressure.py
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
def wave_height_from_pressure_range(
    pressure_range: ArrayLike,
    wave_number: ArrayLike,
    z: ArrayLike,
    depth: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    minimum_response: float = DEFAULT_MINIMUM_RESPONSE,
) -> ScalarOrArray:
    """Reconstruct wave height from peak-to-peak pressure.

    Parameters
    ----------
    pressure_range : array_like
        Non-negative peak-to-peak pressure range [Pa].
    wave_number : array_like
        Positive wave number [rad/m].
    z : array_like
        Sensor elevation [m], with -depth <= z <= 0.
    depth : array_like
        Positive water depth [m].
    density : array_like, optional
        Positive fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    minimum_response : float, optional
        Minimum accepted pressure response factor.

    Returns
    -------
    float or ndarray
        Reconstructed regular wave height [m].

    Notes
    -----
    H = pressure_range/(rho*g*Kp).

    The pressure range must represent the wave-induced
    peak-to-peak variation of a regular wave.
    """
    pressure = validate_non_negative(
        pressure_range,
        "Peak-to-peak pressure range",
    )

    return surface_elevation_from_pressure(
        pressure,
        wave_number,
        z,
        depth,
        density,
        gravity,
        minimum_response=minimum_response,
    )

extract_wave_pressure

extract_wave_pressure(measured_pressure: ArrayLike, z: ArrayLike, density: ArrayLike = SEAWATER_DENSITY, gravity: ArrayLike = ENGINEERING_GRAVITY, *, atmospheric_pressure: ArrayLike = 0.0) -> ScalarOrArray

Remove hydrostatic and atmospheric pressure baselines.

Parameters:

Name Type Description Default
measured_pressure array_like

Finite measured gauge or absolute pressure [Pa].

required
z array_like

Non-positive sensor elevation relative to SWL [m].

required
density array_like

Positive constant fluid density [kg/m^3].

SEAWATER_DENSITY
gravity array_like

Positive gravitational acceleration [m/s^2].

ENGINEERING_GRAVITY
atmospheric_pressure array_like

Atmospheric reference pressure [Pa].

Use zero for a gauge-pressure sensor. Supply measured atmospheric pressure for an absolute-pressure sensor.

0.0

Returns:

Type Description
float or ndarray

Signed pressure perturbation [Pa].

Notes

p' = p_measured - p_atm - p_h.

This function assumes the sensor elevation and hydrostatic reference are known. Tidal changes, sensor drift and other low-frequency components are not automatically removed.

Source code in src/fluidmec/waves/pressure.py
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
def extract_wave_pressure(
    measured_pressure: ArrayLike,
    z: ArrayLike,
    density: ArrayLike = SEAWATER_DENSITY,
    gravity: ArrayLike = ENGINEERING_GRAVITY,
    *,
    atmospheric_pressure: ArrayLike = 0.0,
) -> ScalarOrArray:
    """Remove hydrostatic and atmospheric pressure baselines.

    Parameters
    ----------
    measured_pressure : array_like
        Finite measured gauge or absolute pressure [Pa].
    z : array_like
        Non-positive sensor elevation relative to SWL [m].
    density : array_like, optional
        Positive constant fluid density [kg/m^3].
    gravity : array_like, optional
        Positive gravitational acceleration [m/s^2].
    atmospheric_pressure : array_like, optional
        Atmospheric reference pressure [Pa].

        Use zero for a gauge-pressure sensor.
        Supply measured atmospheric pressure for an
        absolute-pressure sensor.

    Returns
    -------
    float or ndarray
        Signed pressure perturbation [Pa].

    Notes
    -----
    p' = p_measured - p_atm - p_h.

    This function assumes the sensor elevation and
    hydrostatic reference are known. Tidal changes,
    sensor drift and other low-frequency components
    are not automatically removed.
    """
    pressure = as_float_array(
        measured_pressure,
        "Measured pressure",
    )

    atmospheric = validate_non_negative(
        atmospheric_pressure,
        "Atmospheric pressure",
    )

    hydrostatic = wave_hydrostatic_pressure(z, density, gravity)

    with np.errstate(over="ignore", invalid="ignore"):
        result = pressure - atmospheric - hydrostatic

    return _finite_output(result, "Extracted wave pressure")

References

Dean, R. G. and Dalrymple, R. A. (1991). Water Wave Mechanics for Engineers and Scientists. World Scientific.