pyyeti.cb.cbconvert

pyyeti.cb.cbconvert(M, b, conv='m2e', drm=False)[source]

Apply unit conversion transform to either a Craig-Bampton mass or stiffness matrix, or a Craig-Bampton data recovery matrix.

Parameters:
  • M (2d array) – Craig-Bampton mass or stiffness, or Craig-Bampton data recovery matrix (DRM). Must be square if drm is false.

  • b (1d array) – A vector containing the indices of the b-set DOF in the desired order (uses zero offset).

  • conv (2-element array_like or string; optional) –

    If 2-element array_like, it is:

    (length_conversion, mass_conversion)
    

    If string, it is one of:

    • ‘m2e’ (convert from metric to English)

    • ‘e2m’ (convert from English to metric)

    The string form assumes units of meter & kg, and inch & lbf*s**2/inch (slinch).

  • drm (bool) – If true, M is treated as a data recovery matrix. If false, M is treated as mass or stiffness (and M must be square).

Returns:

2d ndarray – The converted matrix.

Notes

Here is a table showing equivalent settings for conv:

conv

array_like equivalent

‘m2e’

(39.37007874015748, 0.005710147154735817)

‘e2m’

(0.0254, 175.12683524637913)

If M is mass or stiffness, symmetry is maintained and units are converted using two diagonal matrices: C and D. C converts the Craig-Bampton (CB) b-set and q-set units from coupled system units to units compatible with M as input. D converts force units in the opposite direction (from units compatible with M as input to coupled system units). Conversion of a DRM only uses C.

The units conversion is most easily understood by example. Assume M is the CB mass in metric (SI) units and let ‘x’ be the CB b-set and q-set degrees of freedom.

\[F_{si} = M_{si} \cdot {\ddot x}_{si}\]

To work with an English coupled system, the forces must be in English while \({\ddot x}\) is computed in English and must be converted to SI:

\[ \begin{align}\begin{aligned}F_{eng} = D \cdot F_{si}\\{\ddot x}_{si} = C \cdot {\ddot x}_{eng}\end{aligned}\end{align} \]

Therefore:

\[F_{eng} = D \cdot M_{si} \cdot C \cdot {\ddot x}_{eng}\]

The mass (and stiffness) conversion is therefore:

\[M_{eng} = D \cdot M_{si} \cdot C\]

The conversion of units for the DRM is similar. Data recovery is done via:

\[{data\ recovery\ items}_{si} = DRM_{si} \cdot {\ddot x}_{si}\]

Or:

\[{data\ recovery\ items}_{si} = DRM_{si} \cdot C \cdot {\ddot x}_{eng}\]

Therefore, the conversion for the DRM is:

\[DRM_{eng} = DRM_{si} \cdot C\]

Note that the units of the data recovery items as output by the DRM are not changed, ie:

\[{data\ recovery\ items}_{si} = DRM_{eng} \cdot {\ddot x}_{eng}\]

Warning

It is assumed that the b-set are an even multiple of 6 with each grid having the three translations 1st.

Raises:
  • ValueError – If length of b is not an even multiple of six.

  • ValueError – If M is not square when drm is false.

Examples

To show and check the conversion, use identity mass or stiffness and a row of ones for a DRM and convert them from metric (kg, m, sec) to English (lb, in, sec):

>>> from pyyeti import cb
>>> import numpy as np
>>> b = np.arange(6)
>>> m_or_k = np.eye(8)
>>> drm = np.ones((1, 8))
>>> conv = (39.37007874015748, 0.005710147154735817)
>>> m_or_k_si = cb.cbconvert(m_or_k, b, conv)
>>> drm_si = cb.cbconvert(drm, b, conv, drm=True)
>>> # Or, more simply:
>>> m_or_k_si2 = cb.cbconvert(m_or_k, b, 'm2e')
>>> drm_si2 = cb.cbconvert(drm, b, 'm2e', drm=True)
>>> np.allclose(m_or_k_si, m_or_k_si2)
True
>>> np.allclose(drm_si, drm_si2)
True
>>> np.set_printoptions(precision=4, suppress=True, linewidth=60)
>>> np.diag(m_or_k_si)
array([ 0.0057,  0.0057,  0.0057,  8.8507,  8.8507,  8.8507,
        1.    ,  1.    ])
>>> drm_si
array([[ 0.0254,  0.0254,  0.0254,  1.    ,  1.    ,
         1.    ,  0.3361,  0.3361]])

Now, convert back to metric and compare to original:

>>> m_or_k_ = cb.cbconvert(m_or_k_si2, b, 'e2m')
>>> drm_ = cb.cbconvert(drm_si, b, 'e2m', drm=True)
>>> np.allclose(m_or_k, m_or_k_)
True
>>> np.allclose(drm, drm_)
True