meshmagick icon indicating copy to clipboard operation
meshmagick copied to clipboard

Hydrostatics for fully submerged body.

Open akeeste opened this issue 3 years ago • 4 comments

This issue relates exactly to #7 . I am having the same issue and would like to work around it. I am also using fully submerged body and have dug into the error a bit. When the hydrostatics class is initialized, it splits the full mesh into the lower portion and the 'clipped mesh' (crown mesh) that represents the portion of the body above the water. The crown mesh is initialized as empty with no vertices / faces, and they are added in mesh_clipper._clip_crown_by_plane(). If the mesh is fully submerged, no vertices/faces end up being added and meshmagick attempts to create a meshmagick.Mesh() with no vertices/faces. This ultimately fails with an assert error. Can meshmagick catch this error and avoid creating a clipped mesh altogether? then it can return 0 stiffness and the rest of the desired properties from the Hydrostatics module.

I am currently interested in the displaced volume, center of buoyancy, and hydrostatic stiffness. When calling meshmagick.Hydrostatics, I can catch this error and assume that the stiffness is zero for a submerged body. The displaced volume can be calculated with the meshmagick.mesh.Mesh.volume module. However there seems to be no way to get the center of buoyancy outside of the Hydrostatics module. Can I calculate this with another meshmagick function?

File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\hydrostatics.py", line 165, in init self._update_hydrostatic_properties() File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\hydrostatics.py", line 564, in _update_hydrostatic_properties clipper = MeshClipper(self.mesh, assert_closed_boundaries=True, verbose=False) File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\mesh_clipper.py", line 37, in init self._update() File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\mesh_clipper.py", line 114, in _update self._clip() File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\mesh_clipper.py", line 751, in _clip self._clip_crown_by_plane() File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\mesh_clipper.py", line 665, in _clip_crown_by_plane clipped_crown_mesh = Mesh(vertices, crown_faces) File "C:\Users\akeeste\Anaconda3\envs\py37\lib\site-packages\meshmagick\mesh.py", line 409, in init assert np.array(faces).shape[1] == 4 IndexError: tuple index out of range

akeeste avatar Nov 23 '20 23:11 akeeste