pyyeti.cb.cgmass

pyyeti.cb.cgmass(m, all6=False)[source]

Compute 6x6 mass at CG given a 6x6 mass matrix.

Parameters:
  • m (2d ndarray) – 6x6 symmetric mass matrix at some reference point.

  • all6 (bool; optional) – If true, return all 6 values; otherwise, only return mcg and dxyz.

Returns:

  • mcg (2d ndarray) – 6x6 mass matrix at CG.

  • dxyz (1d ndarray) – The [x,y,z] distances from the reference point to the cg in the coordinate system of that reference point.

  • gyr (1d ndarray) – A 3-element vector containing the radii of gyration relative to the CG about X, Y, and Z axes.

  • princ_gyr (1d ndarray) – Same as gyr, but about principal axes.

  • I (2d ndarray) – 3x3 inertia matrix at CG in X, Y, Z axes.

  • princ_I (2d ndarray) – Same as I, but in principal axes (smallest to biggest).

Notes

The general 6x6 mass matrix relative to some reference point is:

\[\begin{split}M = \left[ \begin{array}{cccccc} m_x & 0 & 0 & 0 & m_x d_z & -m_x d_y \\ 0 & m_y & 0 & -m_y d_z & 0 & m_y d_x \\ 0 & 0 & m_z & m_z d_y & -m_z d_x & 0 \\ 0 & -m_y d_z & m_z d_y & I_{xx} + m_z d_y^2 + m_y d_z^2 & -I_{xy} - m_z d_x d_y & -I_{xz} - m_y d_x d_z \\ m_x d_z & 0 & -m_z d_x & -I_{xy} - m_z d_x d_y & I_{yy} + m_z d_x^2 + m_x d_z^2 & -I_{yz} - m_x d_y d_z \\ -m_x d_y & m_y d_x & 0 & -I_{xz} - m_y d_x d_z & -I_{yz} - m_x d_y d_z & I_{zz} + m_x d_y^2 + m_y d_x^2 \end{array} \right]\end{split}\]

The distances \(d_j\) are the distances from the reference point to the cg in the coordinate system of that reference point. The inertias \(I_{ij}\) are relative to the CG.

The product of inertia terms are defined by, for example:

\[I_{xy} = I_{yx} = \int x y dm\]

where \(x\) and \(y\) are the distances from the CG to the mass \(dm\).

The radius of gyration about the X axis is computed by \(\sqrt{I_{xx}/m_x}\). The others are computed similarly. Principal axis radii of gyration are also computed if requested.

Raises:

ValueError – If m is not symmetric.

Examples

>>> import numpy as np
>>> from pyyeti import cb
>>> np.set_printoptions(precision=4, suppress=True)
>>> mass = np.array([[3,     0,     0,     0,     0,     0],
...                  [0,     3,     0,     0,     0,   120],
...                  [0,     0,     3,     0,  -120,     0],
...                  [0,     0,     0,  1020,   -60,    22],
...                  [0,     0,  -120,   -60,  7808,    23],
...                  [0,   120,     0,    22,    23,  7800]])
>>> mcg1, dcg1 = cb.cgmass(mass)
>>> mcg1
array([[    3.,     0.,     0.,     0.,     0.,     0.],
       [    0.,     3.,     0.,     0.,     0.,     0.],
       [    0.,     0.,     3.,     0.,     0.,     0.],
       [    0.,     0.,     0.,  1020.,   -60.,    22.],
       [    0.,     0.,     0.,   -60.,  3008.,    23.],
       [    0.,     0.,     0.,    22.,    23.,  3000.]])
>>> dcg1
array([ 40.,   0.,   0.])
>>> mcg, dcg, gyr, pgyr, I, pI = cb.cgmass(mass, all6=True)
>>> np.all(mcg == mcg1)
True
>>> np.all(dcg == dcg1)
True
>>> gyr
array([ 18.4391,  31.6649,  31.6228])
>>> pgyr
array([ 18.4204,  31.5288,  31.7693])
>>> I
array([[ 1020.,   -60.,    22.],
       [  -60.,  3008.,    23.],
       [   22.,    23.,  3000.]])
>>> pI
array([[ 1017.9312,     0.    ,     0.    ],
       [    0.    ,  2982.2045,     0.    ],
       [    0.    ,     0.    ,  3027.8643]])