Skip to main content

hydrostatic_pressure

Function hydrostatic_pressure 

Source
pub fn hydrostatic_pressure(
    fluid_density: f64,
    gravitational_acceleration: f64,
    depth: f64,
) -> Option<f64>
Expand description

Computes hydrostatic pressure from fluid density, gravitational acceleration, and depth.

Formula: P = ρ * g * h

Returns None when fluid_density or depth is negative, when gravitational_acceleration is not finite, or when the computed result is not finite.

§Examples

use use_fluid::hydrostatic_pressure;

let pressure = hydrostatic_pressure(1000.0, 9.80665, 10.0).unwrap();

assert!((pressure - 98_066.5).abs() < 1.0e-9);