fluidmec 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. fluidmec-0.1.0/LICENSE +21 -0
  2. fluidmec-0.1.0/PKG-INFO +49 -0
  3. fluidmec-0.1.0/README.md +11 -0
  4. fluidmec-0.1.0/pyproject.toml +95 -0
  5. fluidmec-0.1.0/setup.cfg +4 -0
  6. fluidmec-0.1.0/src/fluidmec/__init__.py +10 -0
  7. fluidmec-0.1.0/src/fluidmec/buoyancy/__init__.py +1 -0
  8. fluidmec-0.1.0/src/fluidmec/cfd/__init__.py +1 -0
  9. fluidmec-0.1.0/src/fluidmec/constants.py +3 -0
  10. fluidmec-0.1.0/src/fluidmec/core/__init__.py +185 -0
  11. fluidmec-0.1.0/src/fluidmec/core/_dependencies.py +13 -0
  12. fluidmec-0.1.0/src/fluidmec/core/_validation.py +79 -0
  13. fluidmec-0.1.0/src/fluidmec/core/bernoulli.py +302 -0
  14. fluidmec-0.1.0/src/fluidmec/core/boundary_layer.py +48 -0
  15. fluidmec-0.1.0/src/fluidmec/core/constants.py +39 -0
  16. fluidmec-0.1.0/src/fluidmec/core/continuity.py +318 -0
  17. fluidmec-0.1.0/src/fluidmec/core/dimensionless.py +239 -0
  18. fluidmec-0.1.0/src/fluidmec/core/hydrostatic_forces.py +358 -0
  19. fluidmec-0.1.0/src/fluidmec/core/hydrostatics.py +219 -0
  20. fluidmec-0.1.0/src/fluidmec/core/open_channel.py +514 -0
  21. fluidmec-0.1.0/src/fluidmec/core/pipe_flow.py +369 -0
  22. fluidmec-0.1.0/src/fluidmec/core/properties.py +218 -0
  23. fluidmec-0.1.0/src/fluidmec/hydrodynamics/__init__.py +1 -0
  24. fluidmec-0.1.0/src/fluidmec/integrations/__init__.py +1 -0
  25. fluidmec-0.1.0/src/fluidmec/mesh/__init__.py +1 -0
  26. fluidmec-0.1.0/src/fluidmec/ml/__init__.py +1 -0
  27. fluidmec-0.1.0/src/fluidmec/numerics/__init__.py +1 -0
  28. fluidmec-0.1.0/src/fluidmec/sediment/__init__.py +1 -0
  29. fluidmec-0.1.0/src/fluidmec/visualization/__init__.py +1 -0
  30. fluidmec-0.1.0/src/fluidmec/waves/__init__.py +1 -0
  31. fluidmec-0.1.0/src/fluidmec.egg-info/PKG-INFO +49 -0
  32. fluidmec-0.1.0/src/fluidmec.egg-info/SOURCES.txt +50 -0
  33. fluidmec-0.1.0/src/fluidmec.egg-info/dependency_links.txt +1 -0
  34. fluidmec-0.1.0/src/fluidmec.egg-info/requires.txt +22 -0
  35. fluidmec-0.1.0/src/fluidmec.egg-info/top_level.txt +1 -0
  36. fluidmec-0.1.0/tests/test_bernoulli.py +426 -0
  37. fluidmec-0.1.0/tests/test_boundary_layer.py +49 -0
  38. fluidmec-0.1.0/tests/test_constants.py +37 -0
  39. fluidmec-0.1.0/tests/test_continuity.py +555 -0
  40. fluidmec-0.1.0/tests/test_core.py +14 -0
  41. fluidmec-0.1.0/tests/test_froude.py +54 -0
  42. fluidmec-0.1.0/tests/test_hydrostatic_forces.py +345 -0
  43. fluidmec-0.1.0/tests/test_hydrostatics.py +250 -0
  44. fluidmec-0.1.0/tests/test_keulegan_carpenter.py +138 -0
  45. fluidmec-0.1.0/tests/test_open_channel.py +531 -0
  46. fluidmec-0.1.0/tests/test_pipe_flow.py +471 -0
  47. fluidmec-0.1.0/tests/test_properties.py +248 -0
  48. fluidmec-0.1.0/tests/test_reynolds_vectorized.py +131 -0
  49. fluidmec-0.1.0/tests/test_richardson.py +102 -0
  50. fluidmec-0.1.0/tests/test_strouhal.py +135 -0
  51. fluidmec-0.1.0/tests/test_validation.py +128 -0
  52. fluidmec-0.1.0/tests/test_weber.py +98 -0
fluidmec-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Soham Banerjee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: fluidmec
3
+ Version: 0.1.0
4
+ Summary: Scientific Python library for fluid mechanics, hydraulics and computational fluid dynamics.
5
+ Author: Soham Banerjee
6
+ Project-URL: Homepage, https://github.com/Soham-Banerjee-web/Fluidpy
7
+ Project-URL: Repository, https://github.com/Soham-Banerjee-web/Fluidpy
8
+ Project-URL: Issues, https://github.com/Soham-Banerjee-web/Fluidpy/issues
9
+ Keywords: fluid mechanics,fluid dynamics,CFD,hydraulics,hydrodynamics,scientific computing,coastal engineering,offshore engineering
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Scientific/Engineering
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy>=1.24
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=8.4; extra == "dev"
23
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
24
+ Requires-Dist: ruff>=0.9; extra == "dev"
25
+ Requires-Dist: build>=1.2; extra == "dev"
26
+ Requires-Dist: twine>=6.0; extra == "dev"
27
+ Provides-Extra: visualization
28
+ Requires-Dist: matplotlib>=3.7; extra == "visualization"
29
+ Provides-Extra: numerics
30
+ Requires-Dist: scipy>=1.11; extra == "numerics"
31
+ Provides-Extra: units
32
+ Requires-Dist: pint>=0.24; extra == "units"
33
+ Provides-Extra: docs
34
+ Requires-Dist: mkdocs>=1.6; extra == "docs"
35
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
36
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
37
+ Dynamic: license-file
38
+
39
+ # Fluidmec
40
+ Experimental Python library for fluid mechanics. Not validated for engineering design.
41
+
42
+ ## Setup
43
+ Create a virtual environment, activate it, then run `python -m pip install -e ".[dev]"` and `python -m pytest`.
44
+
45
+ ```python
46
+ from fluidmec.core import reynolds_number
47
+ print(reynolds_number(2, 0.5, 1e-6))
48
+ ```
49
+ SI units are required. Only scalar Reynolds number is implemented; other namespaces are placeholders. Package name and license are pending confirmation.
@@ -0,0 +1,11 @@
1
+ # Fluidmec
2
+ Experimental Python library for fluid mechanics. Not validated for engineering design.
3
+
4
+ ## Setup
5
+ Create a virtual environment, activate it, then run `python -m pip install -e ".[dev]"` and `python -m pytest`.
6
+
7
+ ```python
8
+ from fluidmec.core import reynolds_number
9
+ print(reynolds_number(2, 0.5, 1e-6))
10
+ ```
11
+ SI units are required. Only scalar Reynolds number is implemented; other namespaces are placeholders. Package name and license are pending confirmation.
@@ -0,0 +1,95 @@
1
+
2
+ [build-system]
3
+ requires = ["setuptools>=77", "wheel"]
4
+ build-backend = "setuptools.build_meta"
5
+
6
+ [project]
7
+ name = "fluidmec"
8
+ version = "0.1.0"
9
+ description = "Scientific Python library for fluid mechanics, hydraulics and computational fluid dynamics."
10
+ readme = "README.md"
11
+ requires-python = ">=3.10"
12
+
13
+
14
+ authors = [
15
+ {name = "Soham Banerjee"}
16
+ ]
17
+
18
+ keywords = [
19
+ "fluid mechanics",
20
+ "fluid dynamics",
21
+ "CFD",
22
+ "hydraulics",
23
+ "hydrodynamics",
24
+ "scientific computing",
25
+ "coastal engineering",
26
+ "offshore engineering"
27
+ ]
28
+
29
+ classifiers = [
30
+ "Development Status :: 3 - Alpha",
31
+ "Intended Audience :: Science/Research",
32
+ "Intended Audience :: Education",
33
+ "Programming Language :: Python :: 3",
34
+ "Topic :: Scientific/Engineering",
35
+ "Topic :: Scientific/Engineering :: Physics",
36
+ "Operating System :: OS Independent"
37
+ ]
38
+
39
+ dependencies = [
40
+ "numpy>=1.24"
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+
45
+ dev = [
46
+ "pytest>=8.4",
47
+ "pytest-cov>=5.0",
48
+ "ruff>=0.9",
49
+ "build>=1.2",
50
+ "twine>=6.0"
51
+ ]
52
+
53
+ visualization = [
54
+ "matplotlib>=3.7"
55
+ ]
56
+
57
+ numerics = [
58
+ "scipy>=1.11"
59
+ ]
60
+
61
+ units = [
62
+ "pint>=0.24"
63
+ ]
64
+
65
+ docs = [
66
+ "mkdocs>=1.6",
67
+ "mkdocs-material>=9.5",
68
+ "mkdocstrings[python]>=0.26"
69
+ ]
70
+
71
+ [project.urls]
72
+ Homepage = "https://github.com/Soham-Banerjee-web/Fluidpy"
73
+ Repository = "https://github.com/Soham-Banerjee-web/Fluidpy"
74
+ Issues = "https://github.com/Soham-Banerjee-web/Fluidpy/issues"
75
+
76
+ [tool.setuptools.packages.find]
77
+ where = ["src"]
78
+
79
+ [tool.pytest.ini_options]
80
+ testpaths = ["tests"]
81
+ addopts = "--disable-plugin-autoload -ra"
82
+
83
+ [tool.ruff]
84
+ line-length = 88
85
+ target-version = "py310"
86
+
87
+ [tool.ruff.lint]
88
+ select = ["E", "F", "W", "I"]
89
+
90
+ [tool.coverage.run]
91
+ source = ["fluidmec"]
92
+
93
+ [tool.coverage.report]
94
+ show_missing = true
95
+ fail_under = 95
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ """Reusable fluid mechanics tools."""
2
+
3
+ """FluidPy: Scientific computing for fluid mechanics."""
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+
7
+ try:
8
+ __version__ = version("fluidmec")
9
+ except PackageNotFoundError:
10
+ __version__ = "0+unknown"
@@ -0,0 +1 @@
1
+ """Buoyancy tools."""
@@ -0,0 +1 @@
1
+ """Cfd tools."""
@@ -0,0 +1,3 @@
1
+ """Physical constants in SI units."""
2
+
3
+ STANDARD_GRAVITY = 9.80665
@@ -0,0 +1,185 @@
1
+ from .bernoulli import (
2
+ bernoulli_pressure,
3
+ bernoulli_residual,
4
+ bernoulli_velocity,
5
+ dynamic_pressure,
6
+ ideal_discharge,
7
+ piezometric_head,
8
+ stagnation_pressure,
9
+ torricelli_velocity,
10
+ total_energy_head,
11
+ velocity_head,
12
+ )
13
+ from .boundary_layer import (
14
+ stokes_boundary_layer_thickness,
15
+ )
16
+ from .continuity import (
17
+ annular_area,
18
+ circular_area,
19
+ compressible_continuity_velocity,
20
+ continuity_velocity,
21
+ flow_velocity,
22
+ hydraulic_diameter,
23
+ mass_conservation_residual,
24
+ mass_flow_rate,
25
+ rectangular_area,
26
+ venturi_flow_rate,
27
+ volumetric_flow_rate,
28
+ )
29
+ from .dimensionless import (
30
+ froude_number,
31
+ gradient_richardson_number,
32
+ keulegan_carpenter_number,
33
+ oscillatory_frequency_parameter,
34
+ reynolds_number,
35
+ richardson_number,
36
+ strouhal_number,
37
+ vortex_shedding_frequency,
38
+ weber_number,
39
+ )
40
+ from .hydrostatic_forces import (
41
+ buoyancy_force,
42
+ centre_of_pressure,
43
+ circular_gate_centre_of_pressure,
44
+ circular_gate_force,
45
+ hydrostatic_force,
46
+ hydrostatic_moment,
47
+ integrated_centre_of_pressure,
48
+ integrated_pressure_force,
49
+ rectangular_gate_centre_of_pressure,
50
+ rectangular_gate_force,
51
+ )
52
+ from .hydrostatics import (
53
+ absolute_pressure,
54
+ hydrostatic_depth,
55
+ hydrostatic_pressure,
56
+ pressure_difference,
57
+ pressure_head,
58
+ stratified_pressure,
59
+ )
60
+ from .open_channel import (
61
+ chezy_velocity,
62
+ critical_depth,
63
+ flow_regime,
64
+ hydraulic_depth,
65
+ hydraulic_jump_energy_loss,
66
+ hydraulic_radius,
67
+ manning_discharge,
68
+ manning_velocity,
69
+ normal_depth,
70
+ sequent_depth,
71
+ specific_energy,
72
+ specific_force,
73
+ trapezoidal_area,
74
+ trapezoidal_top_width,
75
+ trapezoidal_wetted_perimeter,
76
+ )
77
+ from .pipe_flow import (
78
+ colebrook_friction_factor,
79
+ darcy_friction_factor,
80
+ darcy_head_loss,
81
+ extended_bernoulli_head,
82
+ haaland_friction_factor,
83
+ laminar_friction_factor,
84
+ minor_head_loss,
85
+ pressure_loss,
86
+ pump_power,
87
+ relative_roughness,
88
+ swamee_jain_friction_factor,
89
+ )
90
+ from .properties import (
91
+ air_density,
92
+ dynamic_viscosity,
93
+ kinematic_viscosity,
94
+ reduced_gravity,
95
+ specific_gravity,
96
+ specific_weight,
97
+ water_density,
98
+ water_dynamic_viscosity,
99
+ water_kinematic_viscosity,
100
+ )
101
+
102
+ __all__ = [
103
+ "absolute_pressure",
104
+ "air_density",
105
+ "annular_area",
106
+ "bernoulli_pressure",
107
+ "bernoulli_residual",
108
+ "bernoulli_velocity",
109
+ "buoyancy_force",
110
+ "centre_of_pressure",
111
+ "chezy_velocity",
112
+ "circular_area",
113
+ "circular_gate_centre_of_pressure",
114
+ "circular_gate_force",
115
+ "colebrook_friction_factor",
116
+ "compressible_continuity_velocity",
117
+ "continuity_velocity",
118
+ "critical_depth",
119
+ "darcy_friction_factor",
120
+ "darcy_head_loss",
121
+ "dynamic_pressure",
122
+ "dynamic_viscosity",
123
+ "extended_bernoulli_head",
124
+ "flow_regime",
125
+ "flow_velocity",
126
+ "froude_number",
127
+ "gradient_richardson_number",
128
+ "haaland_friction_factor",
129
+ "hydraulic_depth",
130
+ "hydraulic_diameter",
131
+ "hydraulic_jump_energy_loss",
132
+ "hydraulic_radius",
133
+ "hydrostatic_depth",
134
+ "hydrostatic_force",
135
+ "hydrostatic_moment",
136
+ "hydrostatic_pressure",
137
+ "ideal_discharge",
138
+ "integrated_centre_of_pressure",
139
+ "integrated_pressure_force",
140
+ "keulegan_carpenter_number",
141
+ "kinematic_viscosity",
142
+ "laminar_friction_factor",
143
+ "manning_discharge",
144
+ "manning_velocity",
145
+ "mass_conservation_residual",
146
+ "mass_flow_rate",
147
+ "minor_head_loss",
148
+ "normal_depth",
149
+ "oscillatory_frequency_parameter",
150
+ "piezometric_head",
151
+ "pressure_difference",
152
+ "pressure_head",
153
+ "pressure_loss",
154
+ "pump_power",
155
+ "rectangular_area",
156
+ "rectangular_gate_centre_of_pressure",
157
+ "rectangular_gate_force",
158
+ "reduced_gravity",
159
+ "relative_roughness",
160
+ "reynolds_number",
161
+ "richardson_number",
162
+ "sequent_depth",
163
+ "specific_energy",
164
+ "specific_force",
165
+ "specific_gravity",
166
+ "specific_weight",
167
+ "stagnation_pressure",
168
+ "stokes_boundary_layer_thickness",
169
+ "stratified_pressure",
170
+ "strouhal_number",
171
+ "swamee_jain_friction_factor",
172
+ "torricelli_velocity",
173
+ "total_energy_head",
174
+ "trapezoidal_area",
175
+ "trapezoidal_top_width",
176
+ "trapezoidal_wetted_perimeter",
177
+ "velocity_head",
178
+ "venturi_flow_rate",
179
+ "volumetric_flow_rate",
180
+ "vortex_shedding_frequency",
181
+ "water_density",
182
+ "water_dynamic_viscosity",
183
+ "water_kinematic_viscosity",
184
+ "weber_number",
185
+ ]
@@ -0,0 +1,13 @@
1
+ """Centralised scientific dependency imports."""
2
+
3
+ try:
4
+ import numpy as np
5
+
6
+ except ImportError as exc:
7
+ raise ImportError(
8
+ "Fluidmec could not initialise NumPy. "
9
+ "Check your Python and NumPy compatibility "
10
+ "and verify that NumPy can be imported independently."
11
+ ) from exc
12
+
13
+ __all__ = ["np"]
@@ -0,0 +1,79 @@
1
+ """
2
+ Internal validation utilities for Fluidmec.
3
+
4
+ These utilities provide consistent input validation
5
+ and output formatting across engineering modules.
6
+ """
7
+
8
+ from numpy.typing import ArrayLike
9
+
10
+ from ._dependencies import np
11
+
12
+
13
+ def as_float_array(
14
+ value: ArrayLike,
15
+ name: str,
16
+ ) -> np.ndarray:
17
+ """Convert input to a finite floating-point array."""
18
+
19
+ array = np.asarray(value, dtype=float)
20
+
21
+ if not np.all(np.isfinite(array)):
22
+ raise ValueError(f"{name} must be finite.")
23
+
24
+ return array
25
+
26
+
27
+ def validate_positive(
28
+ value: ArrayLike,
29
+ name: str,
30
+ ) -> np.ndarray:
31
+ """Validate strictly positive numerical inputs."""
32
+
33
+ array = as_float_array(value, name)
34
+
35
+ if np.any(array <= 0):
36
+ raise ValueError(f"{name} must be positive.")
37
+
38
+ return array
39
+
40
+
41
+ def validate_non_negative(
42
+ value: ArrayLike,
43
+ name: str,
44
+ ) -> np.ndarray:
45
+ """Validate non-negative numerical inputs."""
46
+
47
+ array = as_float_array(value, name)
48
+
49
+ if np.any(array < 0):
50
+ raise ValueError(f"{name} must be non-negative.")
51
+
52
+ return array
53
+
54
+
55
+ def validate_non_zero(
56
+ value: ArrayLike,
57
+ name: str,
58
+ ) -> np.ndarray:
59
+ """Validate non-zero numerical inputs."""
60
+
61
+ array = as_float_array(value, name)
62
+
63
+ if np.any(array == 0):
64
+ raise ValueError(f"{name} must be non-zero.")
65
+
66
+ return array
67
+
68
+
69
+ def format_output(
70
+ result: ArrayLike,
71
+ ) -> float | np.ndarray:
72
+ """Return a Python float for scalar results."""
73
+
74
+ result = np.asarray(result, dtype=float)
75
+
76
+ if result.ndim == 0:
77
+ return float(result)
78
+
79
+ return result