Stability#
Classes for stability analysis and GZ curve calculations.
StabilityCalculator#
- class StabilityCalculator(vessel, water_density=1025.0)#
Calculator for stability analysis (GZ curves).
- Parameters:
vessel – The vessel to calculate stability for
water_density – Water density in kg/m³
- gz_curve(displacement_mass: float, cog: tuple[float, float, float], heels: list[float], tank_options: TankOptions | None = None, fixed_trim: float | None = None, simplification_target: int | None = None) StabilityCurve#
Calculate the GZ curve for a given loading condition.
- Parameters:
displacement_mass – Target displacement in kg.
cog – Center of gravity (lcg, tcg, vcg) tuple in meters.
heels – List of heel angles in degrees.
tank_options – Optional
TankOptionsto configure tank mass and free surface moment inclusion.fixed_trim – Optional fixed trim in degrees. If None, calculates free trim.
simplification_target – Optional target triangle count. If
None, no mesh simplification is performed. Otherwise, hulls are simplified to this target count when total triangles exceed it to reduce computation.
- Returns:
A
StabilityCurveobject.
- gz_curve_from_loading(loading: LoadingCondition, heels: list[float], fixed_trim: float | None = None) StabilityCurve#
Calculate the GZ curve directly from a LoadingCondition. Automatically applies tank fill overrides, uses solid displacement, and restores original fill levels.
- Parameters:
loading – The LoadingCondition defining mass and tank fills.
heels – List of heel angles in degrees.
fixed_trim – Optional fixed trim in degrees.
- Returns:
A
StabilityCurveobject.
- kn_curve(displacements, heels, lcg=0.0, tcg=0.0, fixed_trim=None)#
Calculates KN curves (Righting Lever from Keel) for multiple displacements.
Returns one curve per displacement (cross-curves of stability).
- Parameters:
displacements – List of target displacements in kg
heels – List of heel angles in degrees
lcg – Longitudinal Center of Gravity (m)
tcg – Transverse Center of Gravity (m)
fixed_trim – Optional fixed trim in degrees. If None, calculates free trim.
- Returns:
List of StabilityCurve objects
- complete_stability(displacement_mass: float, cog: tuple[float, float, float], heels: list[float], tank_options: TankOptions | None = None, fixed_trim: float | None = None, simplification_target: int | None = None) CompleteStabilityResult#
Calculate complete stability analysis for a loading condition.
This method combines hydrostatic calculations (at equilibrium), GZ curve generation, and wind heeling analysis (if silhouettes are present).
- Parameters:
displacement_mass – Target displacement in kg.
cog – Center of gravity (lcg, tcg, vcg) tuple in meters.
heels – List of heel angles in degrees.
tank_options – Optional
TankOptionsto configure tank mass and free surface moment inclusion.fixed_trim – Optional fixed trim in degrees. If None, calculates free trim.
simplification_target – Optional target triangle count. If
None, no mesh simplification is performed. Otherwise, hulls are simplified to this target count during GZ curve calculation when total triangles exceed it to reduce computation.
- Returns:
A
CompleteStabilityResultobject containing all analysis data.
- complete_stability_from_loading(loading: LoadingCondition, heels: list[float], fixed_trim: float | None = None) CompleteStabilityResult#
Calculate complete stability analysis directly from a LoadingCondition. Automatically applies tank overrides, calculates equilibrium, and restores original states.
- Parameters:
loading – The LoadingCondition defining mass and tank fills.
heels – List of heel angles in degrees.
fixed_trim – Optional fixed trim in degrees.
- Returns:
A
CompleteStabilityResultobject containing all analysis data.
CompleteStabilityResult#
- class CompleteStabilityResult#
Complete stability calculation result combining hydrostatics, GZ curve, and wind data.
- hydrostatics: HydrostaticState#
Hydrostatic state at equilibrium (draft, trim, GM0, etc.).
- gz_curve: StabilityCurve#
GZ stability curve for the loading condition.
- wind_data: WindHeelingData or None#
Wind heeling data (if silhouettes are defined).
- moulded_breadth: float or None#
Moulded breadth at amidships (IS Code §2.13) in meters, computed from the full hull geometry. Returns None if hull geometry was unavailable.
- gm0: float or None#
Initial transverse metacentric height (GM0) with free surface correction.
- gm0_dry: float or None#
Initial transverse metacentric height without free surface correction.
- max_gz: float or None#
Maximum GZ value on the curve.
- heel_at_max_gz: float or None#
Heel angle at maximum GZ.
StabilityCurve#
- class StabilityCurve#
A complete GZ stability curve.
- points()#
Returns the points as a list of tuples (heel, draft, trim, gz).
- get_stability_points()#
Returns a list of StabilityPoint objects with detailed information.
Each StabilityPoint has:
heel: Heel angle in degreesdraft: Draft at equilibrium (m)trim: Trim angle in degreesgz: GZ value (m) (alias value)value: GZ or KN value (m)cog: Total physical Center of Gravity (LCG, TCG, VCG)vessel_cog: Vessel Center of Gravity (LCG, TCG, VCG)is_flooding: True if any opening is submergedflooded_openings: List of flooded opening namesfreeboard: Minimum deck edge freeboard (m) or None
- Return type:
list[StabilityPoint]
WindHeelingData#
- class WindHeelingData#
Wind heeling data from silhouette calculations.
Used for wind heeling moment calculations per IMO 2008 IS Code (MSC.267).
- submerged_centroid: tuple[float, float]#
Centroid of submerged lateral area (x, z) in meters.
Note: If the silhouettes represent only the emerged windage area (i.e. the submerged area is negligible, < 1% of emerged area), this falls back to the IMO approximation:
z = T/2(half the draft).