pyyeti.cb.cbcheck¶
- pyyeti.cb.cbcheck(f, Mcb, Kcb, bseto, bref, uset=None, *, uref=(0, 0, 0), conv=None, em_filt=0, rb_norm=None, reorder=True, n_freefree_modes=25)[source]¶
Run model checks on Craig-Bampton mass and stiffness matrices.
- Parameters:
f (string or file_like or 1 or None) – Either a name of a file, or is a file_like object as returned by
open()orio.StringIO. Input as integer 1 to write to stdout. Can also be the name of a directory or None; in these cases, a GUI is opened for file selection.Mcb (2d ndarray) – Craig-Bampton mass. In order to solve the free-free eigenvalue problem, this routine first finds any null columns in Mcb and Kcb and partitions out those columns and rows (symmetrically) of Mcb and Kcb.
Kcb (2d ndarray) – Craig-Bampton stiffness.
bseto (1d ndarray) – Index partition vector specifying location and order of b-set (boundary) DOF in Mcb and Kcb. Will be used to reorder Mcb and Kcb if reorder is True; see below. Uses zero offset.
bref (1d ndarray) – 6-element subset of bseto (or equal to bseto if bseto only has 6 elements). Defines reference DOF that must be a statically-determinate set capable of restraining all rigid-body motion (similar to the SUPORT card in Nastran). These DOF are used for the stiffness and eigenvalue based rigid-body modes. If bref is not all 6-DOF of a single node, you’ll also want to set rb_norm to True.
uset (pandas DataFrame; optional for single point interface) – The b-set USET table (will be trimmed to the b-set internally if necessary). This is a DataFrame as output by
pyyeti.nastran.op2.OP2.rdn2cop2()orpyyeti.nastran.n2p.addgrid(). For information on the format of this matrix, seepyyeti.nastran.op2.OP2.rdn2cop2(). If uset is None, a single grid with id 1 will be automatically created at (0, 0, 0) and uref will be set to 1. Thepyyeti.nastran.n2p.addgrid()call for this is:uset = n2p.addgrid(None, 1, 'b', 0, [0, 0, 0], 0)
Note
This USET table is typically relative to the coordinate system of the Craig-Bampton component being checked, which simplifies comparisons to documentation. In that case, this USET is the same as the one used in
mk_net_drms(), but unlike the one used inpyyeti.nastran.bulk.wtextseout()(which is relative to superelement 0).uref (integer or array_like; optional) – Defines reference for geometry-based rigid-body modes in a format compatible with
pyyeti.nastran.n2p.rbgeom_uset(): either an integer grid id defined in uset, or a 3-element vector specifying a location in the basic coordinate system. If a 3-element vector, it is in the old units (before conv is used to convert units).conv (None or 2-element array_like or string; optional) – If None, no unit conversion is done. 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). See
cbconvert()for more information.em_filt (scalar; optional) – Effective mass print filter: only modes with percent mass above em_filt will be filtered. For example, to filter out modes below 2% modal effective mass, set em_filt to 2.0.
rb_norm (bool or None; optional) – If None, rb_norm will be set to True if and only if bref represents non-contiguous DOF. If True, the stiffness and eigenvalue-based rigid-body modes will be normalized such that they are relative to uref (as the geometry-based modes are). This is needed in cases where a single node cannot restrain all rigid-body motion; see bref. This would happen for example if the drilling DOF were not connected for the boundary DOF. For more information, see the related discussion in
cbcoordchk()for the “rb_normalizer” input.reorder (bool; optional) – If True, reordering is allowed.
n_freefree_modes (integer; optional) – Number of free-free modes to compute
- Returns:
A SimpleNamespace with the members
bset (1d ndarray) – Vector giving location of reordered b-set. This will equal numpy.arange(len(bset)) if reorder is True. Will equal bseto if there is no reordering.
cb_frq (1d ndarray) – Vector of the fixed-base (Craig-Bampton) frequencies
effmass (pandas DataFrame) – Modal effective mass table in mass units (Mcb[q, b]**2)
effmass_percent (pandas DataFrame) – Modal effective mass table in percent of total
k (2d ndarray) – Reordered and converted version of Kcb. Will equal Kcb if there is no reordering or unit conversion.
m (2d ndarray) – Reordered and converted version of Mcb. Will equal Mcb if there is no reordering or unit conversion.
rbs (2d ndarray) – The stiffness-based rigid-body modes (b+q x 6). DOF order is consistent with returned m and k.
rbg (2d ndarray) – The geometry-based rigid-body modes (b x 6). DOF order is consistent with returned m and k.
rbe (2d ndarray) – The eigenvalue-based rigid-body modes (b+q x 6). DOF order is consistent with returned m and k.
uset (pandas DataFrame) – Converted, reordered version of the input uset. Will equal uset if there is no unit conversion or reordering.
Notes
Reordering, if allowed, will always put the bset first.
This routine performs these checks:
Converts units and reorders mass, stiffness and uset if needed.
Prepare mass and stiffness for free-free eigenvalue problem:
Any null rows/cols are partitioned out
Massless DOF are statically reduced out
Use
scipy.sparse.linalg.eigsh()to solve for first n_freefree_modes eigenvalues and eigenvectors.Checks symmetry of Mcb and Kcb.
Prints some abs-max values from Mcb and Kcb for visual inspection.
Calculate the 3 types of rigid-body modes (all are relative to reordered DOF).
Calculates coordinates of boundary DOF relative to a reference (bref) from the stiffness matrix.
Computes the root-sum-squared distances of motion for each boundary grid for each type of rb-mode. These distances should be 1.
Similarly, computes the root-sum-squared rotations for each boundary grid for each type of rb-mode. These distances should be 1.
Does various mass property checks using 3 types of rigid-body modes: stiffness-, geometry-, and eigensolution-based. The following items are printed for checking:
the three 6x6 mass matrices
the CG location relative to respective reference point (bref for the stiffness and eigensolution based rb modes and Uref for the geometry-based rb modes … which means the geometry-based CG will only match the other two if the reference is the same).
the radius of gyration from the CG about the coordinate axes and about the principal axes.
Computes stiffness grounding checks against the three types of rb modes.
Computes the fixed-base modes and percent modal effective mass.
bseto is used to reorder the matrices via the function
cbreorder(). As a simple example, assume there are 3 modal DOF followed by 12 b-set DOF (two interface grids). Also assume that it is desired to switch the order of these two grids. bseto should then be defined as:bseto = [9, 10, 11, 12, 13, 14, 3, 4, 5, 6, 7, 8]
In other words, specify the row/col position as it is within Mcb and Kcb, in the order you wish them to be. In this case, rows 10 through 15 are wanted to be first, 4 through 9 next, and finally, 1 through 3.
Pay special attention to any warning messages.
Example usage:
import numpy as np from pyyeti import cb from pyyeti import nastran from pyyeti.nastran import op4 o4 = op4.OP4() names, mats, *_ = o4.listload('nas2cam_csuper/inboard_mk.op4') uset, coords = nastran.bulk2uset('nas2cam_csuper/inboard.asm') m, k, *_ = mats[0], mats[1] b = np.arange(24) cb.cbcheck('inboard.cbcheck', m, k, b, b[:6], uset=uset)
Note
This routine is demonstrated in the pyYeti Tutorials: Using cb.cbcheck to check mass and stiffness. There is also a link to the source Jupyter notebook at the top of the tutorial.