hydrostatics.Hull#

class hydrostatics.Hull(filename, center_of_mass, model_name=None)#

Load mesh from stl file, create 3D mesh, and calculate waterplanes. Creates a new Gmsh model.

Parameters:
filenamestr

Filename of mesh that defines hull geometry. Must point to an stl file composed of closed, watertight surfaces, with longitudinal direction of hull along x-axis.

center_of_mass: array_like, shape(3,)

Cartesian coordinates of center of mass of hull.

model_name: str or None

Name of model to be created in Gmsh. Must be unique. If None (default), filename will be used as model name.

Attributes:
model_name

Name of model created in Gmsh.

volume

Total volume of hullform, not accounting for any sort of waterplane.

center_of_massndarray, shape (3,)

Cartesian coordates of center of mass of hull set by user. Can be modified.

__init__(filename, center_of_mass, model_name=None)#

Methods

plot()

Plot meshes in hull model using Gmsh.

solve([waterline, displacement, heel, trim, ...])

Solve for waterplane given some set of constraints.

split(normal, waterline[, rho])

Split hull along waterplane defined by normal.dot(x) == waterline.

static finalize()#
property model_name#

Name of model created in Gmsh.

Returns:
model_namestr

Name of Gmsh model.

plot()#

Plot meshes in hull model using Gmsh.

solve(waterline=None, displacement=None, heel=0.0, trim=0.0, solve_trim=True, rho=1.0, tol=1e-05)#

Solve for waterplane given some set of constraints. Either waterline or displacement must be provided, but not both. If solve_trim = True, trim will be solved for equilibrium (i.e., zero longitudinal righting moment); otherwise, the argument trim will be used.

Parameters:
waterlinefloat or None

Constant term in plane equation.

displacementfloat or None

Target displacement of hull.

heelfloat

Heel of hull. Default 0.

trimfloat

Trim angle (x-z rotation) of waterplane. If solve_trim` is True, trim is used as initial state of solver. Default 0.

solve_trimbool

If True, trim will be solved for neutral (zero longitudinal righting moment). If False, trim argument is used. Default True.

rhofloat

Density of water

tolfloat

Tolerance passed to SciPy solver.

Returns:
solved_hullSolvedHull

Portion of hull below waterplane. Includes details of solver termination.

split(normal, waterline, rho=1.0)#

Split hull along waterplane defined by normal.dot(x) == waterline.

Parameters:
normalarray_like, shape (3,)

Vector normal to plane. Will be normalized.

waterlinefloat

Constant term in plane equation.

rhofloat

Density of water. Default is 1.

Returns:
split_hullSplitHull

Portion of hull below waterplane.

property volume#

Total volume of hullform, not accounting for any sort of waterplane.

Returns:
volumefloat

Total volume of hull.