capytaine.bodies.dofs module¶
- class capytaine.bodies.dofs.AbstractDof[source]¶
Bases:
ABC- evaluate_gradient_of_motion(mesh: AbstractMesh) ndarray[source]¶
- evaluate_gradient_of_motion_at_quad_points(mesh: AbstractMesh) ndarray[source]¶
- evaluate_motion(mesh: AbstractMesh) ndarray[source]¶
- evaluate_motion_at_quad_points(mesh: AbstractMesh) ndarray[source]¶
- class capytaine.bodies.dofs.CustomDof(motion, gradient_of_motion=None)[source]¶
Bases:
AbstractDofDefines a fully custom dof with the same interface as the other AbstractDof. To be used for elastic dofs.
- Parameters:
motion (Callable) – A function returning the motion at a given location. Required. The function is expected to take a 3-element vector as input (location in space) and return a 3-element vector (displacement at this location).
gradient_of_motion (Callable, optional) – A function returning the gradient (actually jacobian matrix) of the motion The function is expected to take a 3-element vector as input (location in space) and return a 3×3-matrix (jacobian of the displacement at this location). If none is provided, zero value is used, which makes no difference for first order hydrodynamics, but loses some accuracy for hydrostatics and second-order forces.
- class capytaine.bodies.dofs.DofOnSubmesh(dof: AbstractDof, faces)[source]¶
Bases:
AbstractDofDefines a dof that is zeros everywhere except on a given set of faces on which another dof object is used for the definition.
- Parameters:
dof (AbstractDof) – Some other dof
faces (boolean array (or slice or range)) – The indices of the faces on which the dof should be evaluated. Can be provided as a list of indices or a slice, or as a boolean array of size nb_faces the total size of the mesh on which this dof is defined.
- evaluate_gradient_of_motion(mesh: AbstractMesh) ndarray[source]¶
- evaluate_gradient_of_motion_at_quad_points(mesh: AbstractMesh) ndarray[source]¶
- evaluate_motion(mesh: AbstractMesh) ndarray[source]¶
- evaluate_motion_at_quad_points(mesh: AbstractMesh) ndarray[source]¶
- class capytaine.bodies.dofs.RotationDof(rotation_center, direction)[source]¶
Bases:
AbstractDof
- class capytaine.bodies.dofs.TranslationDof(direction)[source]¶
Bases:
AbstractDof
- capytaine.bodies.dofs.add_dofs_labels_to_matrix(dof_names, matrix)[source]¶
Helper function turning a bare matrix into a matrix labelled by the name of the dofs, to be used for instance for the computation of RAO.
- capytaine.bodies.dofs.add_dofs_labels_to_vector(dof_names, vector)[source]¶
Helper function turning a bare vector into a vector labelled by the name of the dofs, to be used for instance for the computation of RAO.
- capytaine.bodies.dofs.rigid_body_dofs(only=None, rotation_center=None)[source]¶
Pass this to FloatingBody initializer to give it rigid body dofs.
- Parameters:
only (sequence of str, optional) – list of the name of the rigid body dofs to be included. By default: all six of them
rotation_center (np.array, optional) – the center for the definition of the rotations