Skip to main content

bernoulli_pressure

Function bernoulli_pressure 

Source
pub fn bernoulli_pressure(
    reference_pressure: f64,
    density: f64,
    reference_velocity: f64,
    velocity: f64,
    gravitational_acceleration: f64,
    reference_height: f64,
    height: f64,
) -> Option<f64>
Expand description

Computes downstream pressure from the Bernoulli relation between two points.

Formula: P2 = P1 + 0.5ρ(v1² - v2²) + ρg(h1 - h2)

Returns None when reference_pressure or density is negative, when any input is not finite, or when the computed result is not finite.

§Examples

use use_fluid::bernoulli_pressure;

let pressure = bernoulli_pressure(100000.0, 1000.0, 4.0, 2.0, 9.80665, 10.0, 5.0).unwrap();

assert!(pressure.is_finite());