Metadata-Version: 2.4
Name: fluidmec
Version: 0.3.0
Summary: Scientific Python library for fluid mechanics, hydraulics and computational engineering.
Author: Soham Banerjee
License-Expression: MIT
Project-URL: Homepage, https://soham-banerjee-web.github.io/fluidmec/
Project-URL: Documentation, https://soham-banerjee-web.github.io/fluidmec/
Project-URL: Repository, https://github.com/Soham-Banerjee-web/Fluidmec
Project-URL: Issues, https://github.com/Soham-Banerjee-web/Fluidmec/issues
Project-URL: Changelog, https://github.com/Soham-Banerjee-web/Fluidmec/blob/main/CHANGELOG.md
Project-URL: Releases, https://github.com/Soham-Banerjee-web/Fluidmec/releases
Project-URL: PyPI, https://pypi.org/project/fluidmec/
Keywords: fluid mechanics,fluid dynamics,CFD,hydraulics,hydrodynamics,scientific computing,coastal engineering,offshore engineering,numerical methods,engineering mathematics,computational engineering
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Provides-Extra: dev
Requires-Dist: pytest>=8.4; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.9; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=6.0; extra == "dev"
Provides-Extra: visualization
Requires-Dist: matplotlib>=3.7; extra == "visualization"
Requires-Dist: pillow>=9.3; extra == "visualization"
Provides-Extra: numerics
Requires-Dist: scipy>=1.11; extra == "numerics"
Provides-Extra: units
Requires-Dist: pint>=0.24; extra == "units"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.6; extra == "docs"
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
Dynamic: license-file

# Fluidmec

**Scientific Python tools for fluid mechanics and computational engineering.**

[![PyPI](https://img.shields.io/pypi/v/fluidmec?color=blue)](https://pypi.org/project/fluidmec/)
[![Python](https://img.shields.io/pypi/pyversions/fluidmec)](https://pypi.org/project/fluidmec/)
[![License](https://img.shields.io/github/license/Soham-Banerjee-web/Fluidmec)](https://github.com/Soham-Banerjee-web/Fluidmec/blob/main/LICENSE)
[![Documentation](https://img.shields.io/badge/docs-online-blue)](https://soham-banerjee-web.github.io/fluidmec/)
[![Development status](https://img.shields.io/badge/status-early%20development-orange)](https://pypi.org/project/fluidmec/)

[Documentation](https://soham-banerjee-web.github.io/fluidmec/) · [PyPI](https://pypi.org/project/fluidmec/) · [Source code](https://github.com/Soham-Banerjee-web/Fluidmec) · [Report an issue](https://github.com/Soham-Banerjee-web/Fluidmec/issues)

## 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:

```bash
python -m pip install fluidmec
```

For reproducible environments, pin the version:

```bash
python -m pip install fluidmec==0.1.0
```

Verify your installation:

```python
import fluidmec
print(fluidmec.__version__)
```

## Quick start

```python
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:

```text
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

```python
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

```python
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

```python
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

```python
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|L}{\nu}$ | Inertial-to-viscous force ratio |
| Froude number | $Fr=\frac{|U|}{\sqrt{gL}}$ | Inertial-to-gravitational effects |
| 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](https://soham-banerjee-web.github.io/fluidmec/) 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](https://soham-banerjee-web.github.io/fluidmec/) 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

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

Activate the environment on Windows PowerShell:

```powershell
.\.venv\Scripts\Activate.ps1
```

On Linux or macOS:

```bash
source .venv/bin/activate
```

Install development dependencies and run checks:

```bash
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:

```bash
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](CONTRIBUTING.md) for development guidelines. Report bugs and feature requests through [GitHub Issues](https://github.com/Soham-Banerjee-web/Fluidmec/issues).

## Citation

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

```bibtex
@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](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](https://github.com/Soham-Banerjee-web) · [Fluidmec on PyPI](https://pypi.org/project/fluidmec/) · [Documentation](https://soham-banerjee-web.github.io/fluidmec/)
