Skip to main content

Crate use_fluid

Crate use_fluid 

Source
Expand description

§use-fluid

Small fluid mechanics helpers for RustUse.

§Install

[dependencies]
use-fluid = "0.0.1"

§Foundation

use-fluid provides small fluid mechanics helpers for buoyancy, hydrostatic pressure, flow rate, continuity, Bernoulli-style relations, viscosity, Reynolds number, and simple drag calculations.

Inputs are expected to be SI-style numeric values:

  • kilograms per cubic meter for density
  • cubic meters for volume
  • meters per second squared for acceleration
  • newtons for force
  • pascals for pressure
  • meters for depth, height, and characteristic length
  • square meters for area
  • cubic meters per second for volumetric flow rate
  • kilograms per second for mass flow rate
  • pascal-seconds for dynamic viscosity
  • square meters per second for kinematic viscosity

This crate does not define a full unit system.

More general units and constants belong in the top-level use-units and use-constants sets.

Material databases belong in top-level use-materials.

This crate is not a CFD solver.

§Example

use use_fluid::{Fluid, PipeFlow, dynamic_pressure};

let water = Fluid::with_dynamic_viscosity(1000.0, 0.001).unwrap();
let flow = PipeFlow::new(2.0, 3.0).unwrap();

assert_eq!(flow.volumetric_flow_rate(), Some(6.0));
assert_eq!(flow.mass_flow_rate(water.density), Some(6000.0));
assert_eq!(dynamic_pressure(water.density, 3.0), Some(4500.0));

§When to use directly

Choose use-fluid when you only need reusable fluid mechanics formulas without a full units or simulation stack.

§Scope

  • APIs stay f64-first and do not define a full unit system.
  • Simple scalar helpers only; CFD, turbulence modeling, and material datasets are out of scope.
  • Broader units, constants, and materials belong in the top-level RustUse sets.

§Status

use-fluid is a pre-1.0 crate with a deliberately small API. Small fluid mechanics helpers.

Modules§

prelude

Structs§

Fluid
A simple fluid model with density and optional dynamic viscosity.
PipeFlow
A simple cross-sectional pipe flow with area and scalar velocity.

Functions§

absolute_pressure
Computes absolute pressure from surface pressure and the hydrostatic contribution.
bernoulli_pressure
Computes downstream pressure from the Bernoulli relation between two points.
buoyant_force
Computes buoyant force from fluid density, displaced volume, and gravitational acceleration.
continuity_area
Computes downstream area from continuity for incompressible flow.
continuity_velocity
Computes downstream velocity from continuity for incompressible flow.
displaced_volume_from_buoyant_force
Computes displaced volume from buoyant force, fluid density, and gravitational acceleration.
drag_force
Computes drag force from density, velocity, drag coefficient, and area.
dynamic_pressure
Computes dynamic pressure from density and flow velocity.
dynamic_viscosity
Computes dynamic viscosity from kinematic viscosity and density.
hydrostatic_pressure
Computes hydrostatic pressure from fluid density, gravitational acceleration, and depth.
kinematic_viscosity
Computes kinematic viscosity from dynamic viscosity and density.
mass_flow_rate
Computes mass flow rate from density and volumetric flow rate.
reynolds_number
Computes Reynolds number from density, velocity, characteristic length, and dynamic viscosity.
velocity_from_flow_rate
Computes velocity from volumetric flow rate and area.
volumetric_flow_rate
Computes volumetric flow rate from area and flow velocity.