Skip to main content

Fluidmec

Scientific Python tools for fluid mechanics and computational engineering.

PyPI Python License Documentation Development status

Documentation · PyPI · Source code · Report an issue

Overview

Fluidmec is an open-source Python library designed to make fundamental fluid mechanics calculations reusable, transparent and reproducible. It provides a modular interface to engineering equations and selected numerical solvers, reducing the need to repeatedly implement standard calculations from scratch.

The project is intended for students, researchers and engineers working in hydraulics, coastal and offshore engineering, hydrodynamics and scientific computing. Its long-term goal is to extend these foundations towards numerical modelling and computational fluid dynamics (CFD).

Development status: Version 0.1.0 focuses on core fluid mechanics and hydraulics. Full CFD solvers, wave mechanics and machine-learning models are planned capabilities, not features of this release.

Installation

Install the latest published version from PyPI:

python -m pip install fluidmec

For reproducible environments, pin the version:

python -m pip install fluidmec==0.1.0

Verify your installation:

import fluidmec
print(fluidmec.__version__)

Quick start

from fluidmec.core import reynolds_number, froude_number, hydrostatic_pressure

Re = reynolds_number(2.0, 0.5, 1e-6)
Fr = froude_number(2.0, 0.5)
p = hydrostatic_pressure(depth=10.0, density=1000.0)

print(f"Reynolds number: {Re:.0f}")
print(f"Froude number: {Fr:.3f}")
print(f"Gauge pressure: {p:.0f} Pa")

Expected output:

Reynolds number: 1000000
Froude number: 0.903
Gauge pressure: 98100 Pa

Capabilities

Module Available calculations
core.constants Physical constants and reference fluid properties
core.dimensionless Reynolds, Froude, Richardson, Weber, Strouhal and Keulegan–Carpenter numbers; vortex shedding frequency
core.properties Density, dynamic and kinematic viscosity, reduced gravity, specific weight and specific gravity
core.boundary_layer Stokes oscillatory boundary-layer thickness
core.hydrostatics Gauge and absolute pressure, pressure head, pressure differences and stratified pressure
core.hydrostatic_forces Plane-surface forces, centres of pressure, gate forces, moments and buoyancy
core.bernoulli Energy heads, Bernoulli pressure and velocity, Torricelli velocity and ideal discharge
core.continuity Mass and volume flow rates, cross-sectional geometry, continuity and Venturi discharge
core.pipe_flow Darcy friction factors, Colebrook–White iteration, Haaland and Swamee–Jain approximations, head loss and pump power
core.open_channel Channel geometry, Manning and Chézy equations, normal and critical depth, hydraulic jumps and flow classification

Engineering examples

Vectorised Reynolds number calculations

import numpy as np
from fluidmec.core import reynolds_number

velocity = np.array([0.5, 1.0, 2.0, 4.0])
Re = reynolds_number(velocity, length=0.1, kinematic_viscosity=1e-6)
print(Re)
# [ 50000. 100000. 200000. 400000.]

Pipe flow and friction losses

from fluidmec.core import reynolds_number, colebrook_friction_factor, darcy_head_loss

U, D, L = 2.0, 0.1, 50.0
Re = reynolds_number(U, D, 1e-6)
f = colebrook_friction_factor(Re, relative_roughness=0.001)
hf = darcy_head_loss(f, L, D, U)
print(f"Darcy friction factor: {f:.6f}")
print(f"Head loss: {hf:.3f} m")

The Colebrook–White solver is intended for turbulent pipe flow within its documented input limits. The friction factor is the Darcy factor, not the Fanning factor.

Open-channel hydraulics

from fluidmec.core import normal_depth, critical_depth

Q = 5.0       # m³/s
b = 3.0       # m
yn = normal_depth(discharge=Q, bed_width=b, slope=0.001, roughness=0.015)
yc = critical_depth(unit_discharge=Q / b)
print(f"Normal depth: {yn:.3f} m")
print(f"Critical depth: {yc:.3f} m")

This example assumes a rectangular prismatic channel. Normal depth is calculated for steady uniform flow.

Hydrostatic loading

from fluidmec.core import rectangular_gate_force, rectangular_gate_centre_of_pressure

force = rectangular_gate_force(width=2.0, length=3.0, density=1000.0)
depth = rectangular_gate_centre_of_pressure(width=2.0, length=3.0)
print(f"Resultant force: {force:.0f} N")
print(f"Centre of pressure: {depth:.2f} m below the surface")
# 88290 N; 2.00 m

The gate is vertical, with its upper edge at the free surface.

Mathematical foundations

Selected governing relationships implemented in Fluidmec:

Relationship Equation Scope
Reynolds number $Re=\frac{ U
Froude number $Fr=\frac{ U
Hydrostatic gauge pressure $p=\rho gh$ Constant-density static fluid
Bernoulli equation $\frac{p}{\rho g}+\frac{U^2}{2g}+z=\mathrm{constant}$ Steady, incompressible, inviscid flow along a streamline
Mass flow rate $\dot m=\rho UA$ Uniform or representative section velocity and density
Darcy–Weisbach loss $h_f=f\frac{L}{D}\frac{U^2}{2g}$ Distributed pipe friction
Manning equation $Q=\frac{1}{n}AR_h^{2/3}S^{1/2}$ Steady uniform open-channel flow in SI units
Critical depth $y_c=\left(\frac{q^2}{g}\right)^{1/3}$ Rectangular channel, conventional energy coefficient of unity

Consult the API documentation for function-specific assumptions, input constraints and numerical limitations.

Units and numerical conventions

Fluidmec uses SI units unless explicitly documented otherwise. Temperatures in the water-property correlations are expressed in degrees Celsius; gate inclination angles are expressed in degrees.

Quantity Unit
Length, depth, head m
Velocity m/s
Density kg/m³
Pressure Pa
Dynamic viscosity Pa·s
Kinematic viscosity m²/s
Volume flow rate m³/s
Mass flow rate kg/s
Force N
Power W

Many direct calculations accept NumPy arrays and support broadcasting. Some iterative solvers require scalar inputs. Inputs must be dimensionally consistent; automatic unit conversion is not assumed.

Verification and software quality

The development approach emphasises:

  • Analytical reference calculations and conservation checks.
  • Input validation and tests for invalid physical parameters.
  • Scalar and vectorised regression tests.
  • Numerical convergence and solver consistency checks.
  • Automated cross-platform testing and reproducible builds.

Selected analytical reference cases:

Benchmark Reference value
Reynolds number: U = 2 m/s, L = 0.5 m, ν = 10⁻⁶ m²/s 1,000,000
Hydrostatic gauge pressure: h = 10 m, ρ = 1000 kg/m³, g = 9.81 m/s² 98,100 Pa
Bernoulli downstream pressure: p₁ = 150 kPa, U₁ = 2 m/s, U₂ = 8 m/s, equal elevations, ρ = 1000 kg/m³ 120,000 Pa
Laminar Darcy friction factor: Re = 1000 0.064
Colebrook–White factor: Re = 100,000, ε/D = 0.001 ≈ 0.0221745

These are reference targets, not a claim of independent experimental validation. Consult the CI logs for current test results.

Documentation

The Fluidmec documentation provides installation guidance, worked examples, API references, engineering validation notes and the development roadmap. Documentation is built using MkDocs and MkDocstrings and deployed through GitHub Actions.

Development setup

git clone https://github.com/Soham-Banerjee-web/Fluidmec.git
cd Fluidmec
python -m venv .venv

Activate the environment on Windows PowerShell:

.\.venv\Scripts\Activate.ps1

On Linux or macOS:

source .venv/bin/activate

Install development dependencies and run checks:

python -m pip install -e ".[dev]"
python -m pytest --disable-plugin-autoload -q
python scripts/verify_release.py
python -m ruff check src tests

Coverage and documentation:

python -m pytest --disable-plugin-autoload -p pytest_cov.plugin --cov=fluidmec.core --cov-report=term-missing
python -m pip install -e ".[docs]"
python -m mkdocs build --strict
python -m mkdocs serve

Roadmap

Version Planned scope Status
0.1.0 Core fluid mechanics and hydraulics Released
0.2.0 Linear wave theory, dispersion and wave kinematics Next milestone
0.3.0 Hydrodynamic loading and Morison-type formulations Planned
0.4.0 Sediment transport and settling Planned
0.5.0 Buoyancy-driven and stratified flows Planned
0.6.0 Numerical methods Planned
0.7.0 Mesh and spatial discretisation tools Planned
0.8.0 CFD solvers Planned
0.9.0 Visualisation and machine-learning integration Planned
1.0.0 Stable scientific API Long-term goal

Future version numbers and scope are provisional.

Contributing

Contributions from engineers, researchers and software developers are welcome. Proposed engineering functions should include governing equations, physical assumptions, units, applicable regimes, references and reproducible tests.

See CONTRIBUTING.md for development guidelines. Report bugs and feature requests through GitHub Issues.

Citation

If Fluidmec supports your research, please cite the software and specify the version used. See CITATION.cff for citation metadata.

@software{banerjee_fluidmec_2026,
  author  = {Banerjee, Soham},
  title   = {Fluidmec: A Scientific Python Library for Fluid Mechanics},
  year    = {2026},
  version = {0.1.0},
  url     = {https://github.com/Soham-Banerjee-web/Fluidmec}
}

Further reading

The following standard texts provide background for the engineering concepts addressed by the library:

  • White, F. M. — Fluid Mechanics.
  • Chow, V. T. — Open-Channel Hydraulics.
  • Colebrook, C. F. (1939) — Turbulent Flow in Pipes, with Particular Reference to the Transition Region Between the Smooth and Rough Pipe Laws.

These are suggested background references, not a complete function-by-function provenance record.

Licence

Distributed under the MIT License. See LICENSE for details.

Engineering disclaimer

Fluidmec is early-stage scientific software provided without warranty. Users are responsible for verifying assumptions, units, numerical accuracy and applicability to their specific engineering problems. It is not certified for safety-critical design or regulatory compliance.

Author

Soham Banerjee — Developer and maintainer.

Computer Science graduate and MSc Engineering Fluid Mechanics student at Imperial College London. Fluidmec is an independent project connecting scientific computing, software engineering and fluid mechanics; it is not an official Imperial College London product.

GitHub · Fluidmec on PyPI · Documentation

Metadata

Release files for fluidmec 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluidmec 0.3.0
File Size Uploaded Provenance Actions
fluidmec-0.3.0.tar.gz 147.9 kB With provenance Details for fluidmec-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fluidmec 0.3.0
File Interpreter ABI Platform Actions
fluidmec-0.3.0-py3-none-any.whl Python 3 none any Details for fluidmec-0.3.0-py3-none-any.whl

Total release size: 254.5 kB

Release files / fluidmec-0.3.0.tar.gz

Download URL fluidmec-0.3.0.tar.gz
Size 147.9 kB
Tags Source
SHA-256 checksum
How to use checksums
61729ad558dbc9d727b06070193d8a8e2bff7d27a452a5b658295d343024df5e
BLAKE2b-256 checksum
How to use checksums
b77d28df276e13899c38294a06b569dd85f484a430f135134c2d8e86811e09ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / fluidmec-0.3.0-py3-none-any.whl

Download URL fluidmec-0.3.0-py3-none-any.whl
Size 106.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4167ebb35caf8565c40e0552c74e97630ebea822d668a75d63223cb74fc6a2e1
BLAKE2b-256 checksum
How to use checksums
b599408a1d4bdd02b06864dd6801bd4dbb7cb608863d2851b85842a66440a8a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for fluidmec 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fluidmec-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page