fluids
raw JSON → 1.3.0 verified Fri May 01 auth: no python
Fluid dynamics component of the Chemical Engineering Design Library (ChEDL). Provides correlations for fluid properties, friction factors, pipe flow, pumps, valves, fittings, separators, two-phase flow, and more. Current version 1.3.0. Release cadence is irregular, with major updates every 1-2 years.
pip install fluids Common errors
error ModuleNotFoundError: No module named 'fluids.core' ↓
cause Importing `fluids.core` directly is incorrect; core functions are exposed via `fluids` or submodules.
fix
Use
import fluids then fluids.dP_from_f(...) or from fluids import dP_from_f. error AttributeError: module 'fluids' has no attribute 'FrictionFactor' ↓
cause FrictionFactor is not in the top-level namespace; it's in fluids.friction.
fix
Change import to
from fluids.friction import FrictionFactor. error ImportError: cannot import name 'HasNumericData' from 'fluids' ↓
cause In version 1.0.0, HasNumericData was renamed or moved. Old import pattern is broken.
fix
Use
from fluids.constants import HasNumericData or remove dependency; check documentation. error TypeError: FrictionFactor() got an unexpected keyword argument 'Method' ↓
cause In older versions, the argument was `method` (lowercase). Changed to `Method` in newer versions.
fix
Use lowercase
method if using version <1.0.26; or upgrade and use Method. error ValueError: Unknown method '' for function FrictionFactor ↓
cause Empty or invalid method string; must be one of the known methods (e.g., 'Colebrook', 'Blasius').
fix
Specify a valid method or omit to use default.
Warnings
breaking In version 1.0.26, compatibility with numpy 2.0 and scipy 1.14 was added. Code that relied on older numpy/scipy APIs may break if upgrade to 1.0.26+ without updating. ↓
fix Use numpy>=2.0 compatible code; update scipy usage to 1.14 patterns.
breaking Version 1.1.0 removed deprecated methods and renamed several functions. Code using old names like `K_from_f` (now `K_from_f` still works? check) may break. ↓
fix Check the changelog for renamed functions and update calls accordingly.
deprecated The `fluids.geometry` module is mostly deprecated in favor of more specific modules. Functions moved to `fluids.piping` or `fluids.tanks`. ↓
fix Use imports from `fluids.piping`, `fluids.tanks`, etc.
gotcha Unit conventions: Many functions expect SI units (m, kg, Pa, etc.). Mixing units (e.g., bar instead of Pa) leads to incorrect results without error. ↓
fix Always convert to SI units before calling fluids functions.
gotcha Friction factor functions (e.g., `FrictionFactor`) return Darcy-Weisbach friction factor, not Fanning. If using Fanning, divide by 4. ↓
fix Check that you are using the correct friction factor type for your calculation.
Imports
- from fluids import * wrong
from fluids import *correctimport fluids - FrictionFactor wrong
from fluids import FrictionFactorcorrectfrom fluids.friction import FrictionFactor
Quickstart
import fluids
from fluids.friction import FrictionFactor
# Compute friction factor for turbulent flow (Colebrook)
Re = 100000.0 # Reynolds number
roughness = 0.0015 # relative roughness e/D
ff = FrictionFactor(Re=Re, roughness=roughness, Method='Colebrook')
print(f'Friction factor: {ff}')
# Compute pressure drop in a pipe
dP = fluids.core.dP_from_f(fd=ff, L=100.0, D=0.1, rho=1000.0, V=2.0)
print(f'Pressure drop: {dP} Pa')