Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stiffness matrix and translation #8

Open
mancellin opened this issue May 8, 2018 · 4 comments
Open

Stiffness matrix and translation #8

mancellin opened this issue May 8, 2018 · 4 comments

Comments

@mancellin
Copy link
Contributor

I'm not actually sure if this is a bug or a feature that I don't understand:

from meshmagick.mmio import load_mesh
from meshmagick.mesh import Mesh
from meshmagick.hydrostatics import Hydrostatics

reference_mesh = Mesh(*load_mesh("SEAREV.hst", 'hst'))

for shift in range(0, 100, 20):
    shifted_mesh = reference_mesh.copy()
    shifted_mesh.translate_x(shift)
    print shift
    print Hydrostatics(shifted_mesh, cog=(shift, 0, 0)).hs_data['stiffness_matrix'][2, 2]
    print Hydrostatics(shifted_mesh, cog=(shift, 0, 0)).hs_data['Iyy']

The inertia matrix is invariant when the body is translated in the x direction.
I would have expected the same to be true for the stiffness matrix.
Are the rotation dofs defined around the same axis in both cases ?

@mancellin
Copy link
Contributor Author

Actually it seems that the x and y coordinates given in the cog argument have no influence on the results.

@ryancoe
Copy link
Contributor

ryancoe commented Mar 6, 2021

Looking at this a bit more, here's my current understanding:

stiffness: I think there was a bit of a problem here, which I've submitted a fix for with #22 (note however that what I've done is not yet propagated back to the Hydrostatics class; if you think it looks good we can finish doing this).

hydrostatics: these look like they are currently calculated relative to a point on a vertical line passing through origin but with the correct vertical position:

This section uses the x and y location of the origin (xi, yi = polyverts[0, :2])

xi, yi = polyverts[0, :2]
for (xii, yii) in polyverts[1:, :2]:
dx = xii - xi
dy = yii - yi
px = xi + xii
py = yi + yii
# a = xi * xi + xii * xii
sigma0 += dy * px
sigma1 += dy * (px * px - xi * xii)
sigma2 += dx * (py * py - yi * yii)
# sigma3 += dy * (py * a + 2 * px * (xi * yi + xii * yii))
sigma3 += dy * (py * px * px + yi * xi * xi + yii * xii * xii)
sigma4 += dy * (xi * xi + xii * xii) * px
sigma5 += dx * (yi * yi + yii * yii) * py
xi, yi = xii, yii

This section uses the vertical location of the cog (self.zg)

a = self.zg - zb # BG
gm_x = transversal_metacentric_radius - a
gm_y = longitudinal_metacentric_radius - a

Thus, it might be appropriate to change this method so that it calculates based on COG, right?

polyverts = clipper.clipped_crown_mesh.vertices[polygon]

This line would be changed to polyverts = clipper.clipped_crown_mesh.vertices[polygon] - self._gravity_center

@ryancoe
Copy link
Contributor

ryancoe commented Mar 6, 2021

related to #1

@frongere
Copy link
Member

frongere commented May 4, 2021

I just released v3.0 which should fix these issues.

Note however that I have totally refactored the hydrostatics module using only functions with no class. The code is far more simple and the number of lines of code has lowered.

The stiffness matrix and metacentric stuffs are now expressed on a line passing though COG/buoyancy centre.

Positions such as buoyancy centre are expressed in the initial frame. It allows to directly compare results to other commercial software such as Maat Hydro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants