navaltoolbox 0.2.0__tar.gz → 0.3.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.
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/PKG-INFO +10 -85
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/README.md +7 -84
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/navaltoolbox/__init__.py +11 -1
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/navaltoolbox/navaltoolbox.pyi +604 -30
- navaltoolbox-0.3.0/navaltoolbox/plotting.py +173 -0
- navaltoolbox-0.3.0/navaltoolbox/visualization.py +825 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/pyproject.toml +6 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/Cargo.lock +307 -3
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/Cargo.toml +9 -1
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/README.md +31 -7
- navaltoolbox-0.3.0/rust/src/downflooding/loader.rs +375 -0
- navaltoolbox-0.2.0/rust/src/downflooding.rs → navaltoolbox-0.3.0/rust/src/downflooding/mod.rs +30 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/hull.rs +101 -5
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/hydrostatics/calculator.rs +101 -18
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/hydrostatics/dataclasses.rs +9 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/hydrostatics/waterplane.rs +3 -3
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/lib.rs +6 -1
- navaltoolbox-0.3.0/rust/src/mesh/clipper.rs +419 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/mesh/loader.rs +15 -2
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/mesh/mod.rs +1 -1
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/python.rs +560 -32
- navaltoolbox-0.3.0/rust/src/scripting/context.rs +453 -0
- navaltoolbox-0.3.0/rust/src/scripting/engine.rs +481 -0
- navaltoolbox-0.3.0/rust/src/scripting/mod.rs +29 -0
- navaltoolbox-0.3.0/rust/src/scripting/result.rs +307 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/silhouette/core.rs +15 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/stability/calculator.rs +192 -40
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/tanks/tank.rs +202 -26
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/tests/dtmb_validation.rs +1 -1
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/tests/extended_hydrostatics.rs +3 -3
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/tests/integration_tests.rs +54 -13
- navaltoolbox-0.2.0/rust/src/mesh/clipper.rs +0 -289
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/navaltoolbox/py.typed +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/hydrostatics/mod.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/mesh/transform.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/silhouette/loader.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/silhouette/mod.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/stability/complete.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/stability/dataclasses.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/stability/mod.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/tanks/dataclasses.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/tanks/mod.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/src/vessel.rs +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/tests/data/box_10x10.stl +0 -0
- {navaltoolbox-0.2.0 → navaltoolbox-0.3.0}/rust/tests/data/dtmb5415.stl +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: navaltoolbox
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
@@ -12,6 +12,8 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
13
|
Classifier: Programming Language :: Rust
|
|
14
14
|
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Requires-Dist: plotly>=5.0.0
|
|
16
|
+
Requires-Dist: numpy>=1.20.0
|
|
15
17
|
Summary: High-performance naval architecture library for hydrostatics, stability, and tank calculations
|
|
16
18
|
Keywords: naval-architecture,hydrostatics,stability,marine-engineering,ship-design
|
|
17
19
|
Home-Page: https://github.com/NavalToolbox/navaltoolbox-lib
|
|
@@ -45,6 +47,9 @@ NavalToolbox provides fast and accurate naval architecture calculations through
|
|
|
45
47
|
- 🌊 **Downflooding Detection**: Automatic detection of submerged openings
|
|
46
48
|
- 🛢️ **Tank Management**: Fill levels, free surface effects, sounding tables
|
|
47
49
|
- 💨 **Wind Heeling**: Silhouette-based wind calculations (DXF/VTK support)
|
|
50
|
+
- 📝 **Scriptable Verification**: Rhai scripting engine for custom stability criteria
|
|
51
|
+
- 🧊 **3D Visualization**: Interactive vessel and hydrostatic visualization with Plotly
|
|
52
|
+
- 📈 **Plotting**: Built-in 2D plotting utilities with Matplotlib integration
|
|
48
53
|
- ⚡ **High Performance**: Rust backend with Python convenience
|
|
49
54
|
|
|
50
55
|
## Installation
|
|
@@ -89,7 +94,7 @@ vessel = Vessel(hull)
|
|
|
89
94
|
calc = HydrostaticsCalculator(vessel, water_density=1025.0)
|
|
90
95
|
|
|
91
96
|
# Option 1: At draft with VCG (computes stability)
|
|
92
|
-
state = calc.
|
|
97
|
+
state = calc.from_draft(draft=5.0, vcg=7.0)
|
|
93
98
|
|
|
94
99
|
print(f"Volume: {state.volume:.1f} m³")
|
|
95
100
|
print(f"Displacement: {state.displacement:.0f} kg")
|
|
@@ -100,7 +105,7 @@ print(f"GMT (wet): {state.gmt:.3f} m")
|
|
|
100
105
|
print(f"GMT (dry): {state.gmt_dry:.3f} m")
|
|
101
106
|
|
|
102
107
|
# Option 2: Find draft for displacement
|
|
103
|
-
state_disp = calc.
|
|
108
|
+
state_disp = calc.from_displacement(512500.0)
|
|
104
109
|
print(f"Draft for {state_disp.displacement:.0f}kg: {state_disp.draft:.3f} m")
|
|
105
110
|
```
|
|
106
111
|
|
|
@@ -119,7 +124,7 @@ displacement_mass = 8635000.0 # kg
|
|
|
119
124
|
cog = (71.67, 0.0, 7.555) # LCG, TCG, VCG in meters
|
|
120
125
|
heels = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
|
|
121
126
|
|
|
122
|
-
curve = calc.
|
|
127
|
+
curve = calc.gz_curve(displacement_mass, cog, heels)
|
|
123
128
|
|
|
124
129
|
# Display results
|
|
125
130
|
print("Heel (°) | GZ (m)")
|
|
@@ -135,90 +140,10 @@ max_heel = heels[max_idx]
|
|
|
135
140
|
print(f"\nMax GZ: {max_gz:.3f}m at {max_heel}°")
|
|
136
141
|
```
|
|
137
142
|
|
|
138
|
-
### Tank Management
|
|
139
|
-
|
|
140
|
-
```python
|
|
141
|
-
from navaltoolbox import Tank, Vessel, Hull
|
|
142
|
-
|
|
143
|
-
# Create a vessel
|
|
144
|
-
hull = Hull("ship.stl")
|
|
145
|
-
vessel = Vessel(hull)
|
|
146
|
-
|
|
147
|
-
# Add a box-shaped tank
|
|
148
|
-
tank = Tank.from_box(
|
|
149
|
-
name="Fuel Tank 1",
|
|
150
|
-
x_min=40.0, x_max=50.0,
|
|
151
|
-
y_min=-5.0, y_max=5.0,
|
|
152
|
-
z_min=0.0, z_max=3.0,
|
|
153
|
-
fluid_density=850.0 # diesel fuel
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
vessel.add_tank(tank)
|
|
157
|
-
|
|
158
|
-
# Set fill level
|
|
159
|
-
tank.fill_percent = 75.0
|
|
160
|
-
|
|
161
|
-
# Get tank properties
|
|
162
|
-
print(f"Tank: {tank.name}")
|
|
163
|
-
print(f"Total volume: {tank.total_volume:.1f} m³")
|
|
164
|
-
print(f"Fill volume: {tank.fill_volume:.1f} m³")
|
|
165
|
-
print(f"Fluid mass: {tank.fluid_mass:.0f} kg")
|
|
166
|
-
print(f"Center of gravity: {tank.center_of_gravity}")
|
|
167
|
-
print(f"Free surface moment (transverse): {tank.free_surface_moment_t:.2f} m⁴")
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Multi-hull Vessels
|
|
171
|
-
|
|
172
|
-
```python
|
|
173
|
-
from navaltoolbox import Hull, Vessel
|
|
174
|
-
|
|
175
|
-
# Load individual hulls
|
|
176
|
-
port_hull = Hull("port_hull.stl")
|
|
177
|
-
starboard_hull = Hull("starboard_hull.stl")
|
|
178
|
-
|
|
179
|
-
# Create catamaran
|
|
180
|
-
catamaran = Vessel(port_hull)
|
|
181
|
-
catamaran.add_hull(starboard_hull, offset=(0.0, 8.0, 0.0)) # 8m beam between hulls
|
|
182
|
-
|
|
183
|
-
# Calculate hydrostatics
|
|
184
|
-
calc = HydrostaticsCalculator(catamaran, water_density=1025.0)
|
|
185
|
-
state = calc.calculate_at_draft(1.5)
|
|
186
|
-
|
|
187
|
-
print(f"Catamaran displacement: {state.displacement:.0f} kg")
|
|
188
|
-
print(f"Waterplane area: {state.waterplane_area:.1f} m²")
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Downflooding Detection
|
|
192
|
-
|
|
193
|
-
```python
|
|
194
|
-
from navaltoolbox import Hull, Vessel, DownfloodingOpening, StabilityCalculator
|
|
195
|
-
|
|
196
|
-
# Create vessel
|
|
197
|
-
hull = Hull("ship.stl")
|
|
198
|
-
vessel = Vessel(hull)
|
|
199
|
-
|
|
200
|
-
# Add downflooding opening (e.g., air pipe, ventilator)
|
|
201
|
-
opening = DownfloodingOpening.from_point(
|
|
202
|
-
name="Vent pipe",
|
|
203
|
-
x=75.0, y=9.8, z=12.5,
|
|
204
|
-
opening_type="vent"
|
|
205
|
-
)
|
|
206
|
-
vessel.add_downflooding_opening(opening)
|
|
207
|
-
|
|
208
|
-
# Calculate GZ curve with downflooding detection
|
|
209
|
-
calc = StabilityCalculator(vessel, water_density=1025.0)
|
|
210
|
-
heels = list(range(0, 95, 5))
|
|
211
|
-
curve = calc.calculate_gz_curve(8635000.0, (71.67, 0.0, 7.555), heels)
|
|
212
|
-
|
|
213
|
-
# Check for downflooding
|
|
214
|
-
for point in curve.points():
|
|
215
|
-
if point.is_flooding:
|
|
216
|
-
print(f"⚠️ Downflooding at {point.heel}° - {', '.join(point.flooded_openings)}")
|
|
217
|
-
```
|
|
218
|
-
|
|
219
143
|
## Documentation
|
|
220
144
|
|
|
221
145
|
For more detailed documentation, examples, and API reference, visit:
|
|
146
|
+
- **Documentation**: [GitHub Pages](https://navaltoolbox.github.io/navaltoolbox-lib/)
|
|
222
147
|
- **GitHub Repository**: [NavalToolbox/navaltoolbox-lib](https://github.com/NavalToolbox/navaltoolbox-lib)
|
|
223
148
|
- **Issue Tracker**: [GitHub Issues](https://github.com/NavalToolbox/navaltoolbox-lib/issues)
|
|
224
149
|
|
|
@@ -19,6 +19,9 @@ NavalToolbox provides fast and accurate naval architecture calculations through
|
|
|
19
19
|
- 🌊 **Downflooding Detection**: Automatic detection of submerged openings
|
|
20
20
|
- 🛢️ **Tank Management**: Fill levels, free surface effects, sounding tables
|
|
21
21
|
- 💨 **Wind Heeling**: Silhouette-based wind calculations (DXF/VTK support)
|
|
22
|
+
- 📝 **Scriptable Verification**: Rhai scripting engine for custom stability criteria
|
|
23
|
+
- 🧊 **3D Visualization**: Interactive vessel and hydrostatic visualization with Plotly
|
|
24
|
+
- 📈 **Plotting**: Built-in 2D plotting utilities with Matplotlib integration
|
|
22
25
|
- ⚡ **High Performance**: Rust backend with Python convenience
|
|
23
26
|
|
|
24
27
|
## Installation
|
|
@@ -63,7 +66,7 @@ vessel = Vessel(hull)
|
|
|
63
66
|
calc = HydrostaticsCalculator(vessel, water_density=1025.0)
|
|
64
67
|
|
|
65
68
|
# Option 1: At draft with VCG (computes stability)
|
|
66
|
-
state = calc.
|
|
69
|
+
state = calc.from_draft(draft=5.0, vcg=7.0)
|
|
67
70
|
|
|
68
71
|
print(f"Volume: {state.volume:.1f} m³")
|
|
69
72
|
print(f"Displacement: {state.displacement:.0f} kg")
|
|
@@ -74,7 +77,7 @@ print(f"GMT (wet): {state.gmt:.3f} m")
|
|
|
74
77
|
print(f"GMT (dry): {state.gmt_dry:.3f} m")
|
|
75
78
|
|
|
76
79
|
# Option 2: Find draft for displacement
|
|
77
|
-
state_disp = calc.
|
|
80
|
+
state_disp = calc.from_displacement(512500.0)
|
|
78
81
|
print(f"Draft for {state_disp.displacement:.0f}kg: {state_disp.draft:.3f} m")
|
|
79
82
|
```
|
|
80
83
|
|
|
@@ -93,7 +96,7 @@ displacement_mass = 8635000.0 # kg
|
|
|
93
96
|
cog = (71.67, 0.0, 7.555) # LCG, TCG, VCG in meters
|
|
94
97
|
heels = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
|
|
95
98
|
|
|
96
|
-
curve = calc.
|
|
99
|
+
curve = calc.gz_curve(displacement_mass, cog, heels)
|
|
97
100
|
|
|
98
101
|
# Display results
|
|
99
102
|
print("Heel (°) | GZ (m)")
|
|
@@ -109,90 +112,10 @@ max_heel = heels[max_idx]
|
|
|
109
112
|
print(f"\nMax GZ: {max_gz:.3f}m at {max_heel}°")
|
|
110
113
|
```
|
|
111
114
|
|
|
112
|
-
### Tank Management
|
|
113
|
-
|
|
114
|
-
```python
|
|
115
|
-
from navaltoolbox import Tank, Vessel, Hull
|
|
116
|
-
|
|
117
|
-
# Create a vessel
|
|
118
|
-
hull = Hull("ship.stl")
|
|
119
|
-
vessel = Vessel(hull)
|
|
120
|
-
|
|
121
|
-
# Add a box-shaped tank
|
|
122
|
-
tank = Tank.from_box(
|
|
123
|
-
name="Fuel Tank 1",
|
|
124
|
-
x_min=40.0, x_max=50.0,
|
|
125
|
-
y_min=-5.0, y_max=5.0,
|
|
126
|
-
z_min=0.0, z_max=3.0,
|
|
127
|
-
fluid_density=850.0 # diesel fuel
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
vessel.add_tank(tank)
|
|
131
|
-
|
|
132
|
-
# Set fill level
|
|
133
|
-
tank.fill_percent = 75.0
|
|
134
|
-
|
|
135
|
-
# Get tank properties
|
|
136
|
-
print(f"Tank: {tank.name}")
|
|
137
|
-
print(f"Total volume: {tank.total_volume:.1f} m³")
|
|
138
|
-
print(f"Fill volume: {tank.fill_volume:.1f} m³")
|
|
139
|
-
print(f"Fluid mass: {tank.fluid_mass:.0f} kg")
|
|
140
|
-
print(f"Center of gravity: {tank.center_of_gravity}")
|
|
141
|
-
print(f"Free surface moment (transverse): {tank.free_surface_moment_t:.2f} m⁴")
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Multi-hull Vessels
|
|
145
|
-
|
|
146
|
-
```python
|
|
147
|
-
from navaltoolbox import Hull, Vessel
|
|
148
|
-
|
|
149
|
-
# Load individual hulls
|
|
150
|
-
port_hull = Hull("port_hull.stl")
|
|
151
|
-
starboard_hull = Hull("starboard_hull.stl")
|
|
152
|
-
|
|
153
|
-
# Create catamaran
|
|
154
|
-
catamaran = Vessel(port_hull)
|
|
155
|
-
catamaran.add_hull(starboard_hull, offset=(0.0, 8.0, 0.0)) # 8m beam between hulls
|
|
156
|
-
|
|
157
|
-
# Calculate hydrostatics
|
|
158
|
-
calc = HydrostaticsCalculator(catamaran, water_density=1025.0)
|
|
159
|
-
state = calc.calculate_at_draft(1.5)
|
|
160
|
-
|
|
161
|
-
print(f"Catamaran displacement: {state.displacement:.0f} kg")
|
|
162
|
-
print(f"Waterplane area: {state.waterplane_area:.1f} m²")
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Downflooding Detection
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
from navaltoolbox import Hull, Vessel, DownfloodingOpening, StabilityCalculator
|
|
169
|
-
|
|
170
|
-
# Create vessel
|
|
171
|
-
hull = Hull("ship.stl")
|
|
172
|
-
vessel = Vessel(hull)
|
|
173
|
-
|
|
174
|
-
# Add downflooding opening (e.g., air pipe, ventilator)
|
|
175
|
-
opening = DownfloodingOpening.from_point(
|
|
176
|
-
name="Vent pipe",
|
|
177
|
-
x=75.0, y=9.8, z=12.5,
|
|
178
|
-
opening_type="vent"
|
|
179
|
-
)
|
|
180
|
-
vessel.add_downflooding_opening(opening)
|
|
181
|
-
|
|
182
|
-
# Calculate GZ curve with downflooding detection
|
|
183
|
-
calc = StabilityCalculator(vessel, water_density=1025.0)
|
|
184
|
-
heels = list(range(0, 95, 5))
|
|
185
|
-
curve = calc.calculate_gz_curve(8635000.0, (71.67, 0.0, 7.555), heels)
|
|
186
|
-
|
|
187
|
-
# Check for downflooding
|
|
188
|
-
for point in curve.points():
|
|
189
|
-
if point.is_flooding:
|
|
190
|
-
print(f"⚠️ Downflooding at {point.heel}° - {', '.join(point.flooded_openings)}")
|
|
191
|
-
```
|
|
192
|
-
|
|
193
115
|
## Documentation
|
|
194
116
|
|
|
195
117
|
For more detailed documentation, examples, and API reference, visit:
|
|
118
|
+
- **Documentation**: [GitHub Pages](https://navaltoolbox.github.io/navaltoolbox-lib/)
|
|
196
119
|
- **GitHub Repository**: [NavalToolbox/navaltoolbox-lib](https://github.com/NavalToolbox/navaltoolbox-lib)
|
|
197
120
|
- **Issue Tracker**: [GitHub Issues](https://github.com/NavalToolbox/navaltoolbox-lib/issues)
|
|
198
121
|
|
|
@@ -36,7 +36,7 @@ Example:
|
|
|
36
36
|
>>> hull = Hull("ship.stl")
|
|
37
37
|
>>> vessel = Vessel(hull)
|
|
38
38
|
>>> calc = HydrostaticsCalculator(vessel)
|
|
39
|
-
>>> state = calc.
|
|
39
|
+
>>> state = calc.from_draft(5.0)
|
|
40
40
|
>>> print(f"Displacement: {state.displacement:.0f} kg")
|
|
41
41
|
"""
|
|
42
42
|
|
|
@@ -53,6 +53,11 @@ from .navaltoolbox import (
|
|
|
53
53
|
StabilityCurve,
|
|
54
54
|
StabilityCalculator,
|
|
55
55
|
Tank,
|
|
56
|
+
CompleteStabilityResult,
|
|
57
|
+
CriterionResult,
|
|
58
|
+
CriteriaResult,
|
|
59
|
+
CriteriaContext,
|
|
60
|
+
ScriptEngine,
|
|
56
61
|
)
|
|
57
62
|
|
|
58
63
|
__all__ = [
|
|
@@ -67,4 +72,9 @@ __all__ = [
|
|
|
67
72
|
"StabilityCurve",
|
|
68
73
|
"StabilityCalculator",
|
|
69
74
|
"Tank",
|
|
75
|
+
"CompleteStabilityResult",
|
|
76
|
+
"CriterionResult",
|
|
77
|
+
"CriteriaResult",
|
|
78
|
+
"CriteriaContext",
|
|
79
|
+
"ScriptEngine",
|
|
70
80
|
]
|