pyyeti.cb.cbcoordchk

pyyeti.cb.cbcoordchk(K, bset, refpoint, grids=None, ttl=None, verbose=True, outfile=1, rb_normalizer=None)[source]

Check interface coordinates of a Craig-Bampton stiffness matrix.

Parameters:
  • K (2d numpy array) – Craig-Bampton stiffness matrix (b+q-set size).

  • bset (1d array) – Partition vector to the b-set DOF; length must be multiple of 6.

  • refpoint (1d array) – 6-element subset of bset representing a statically- determinate set capable of restraining all rigid-body modes (similar to a SUPORT card in Nastran). Typically, this is just all DOF of a single node; however, if this is not possible for a multi-node interface, you’ll also want to define rb_normalizer. If verbose is True, this routine will print a detailed check showing whether or not these DOF properly restrain rigid-body motion. Additionally, the output refpoint_chk will be set to ‘pass’ or ‘fail’. A return of ‘fail’ is not absolute; a human should evaluate the results with verbose set to True.

  • grids (1d array or None; optional) – Length N array of node IDs or None. If array, used only in diagnostic message printing.

  • ttl (string or None; optional) – String to use for title of coordinates listing, or None for no title.

  • verbose (bool; optional) – If True, print check results and table of coordinates and warnings from rbdispchk(). See also refpoint and outfile.

  • outfile (string or file_like or 1 or None; optional) – Either a name of a file, or is a file_like object as returned by open() or io.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.

  • rb_normalizer (2d array_like or None) –

    If not None, the rbmodes output will be normalized via:

    rbmodes = rbmodes @ rb_normalizer
    

    rb_normalizer is 6 x 6. This normalization is necessary when the DOF in refpoint are spread out amongst multiple nodes (which is necessary when all DOF of a single node cannot restrain all rigid-body motion). rb_normalizer defines the motion of the refpoint DOF relative to some reference location. For example, the following creates an rb_normalizer matrix relative to the origin of the basic coordinate system:

    rb_normalizer = n2p.rbgeom_uset(
        uset.iloc[bset], [0., 0., 0.])
    )[refpoint]
    

    This would cause the returned coordinates (see coords below) to be relative to the basic origin and in the basic coordinate system.

Returns:

  • A SimpleNamespace with the members

  • coords (ndarray) – A 3-column matrix of [x, y, z] locations of each node. If rb_normalizer is None, the locations are relative to refpoint and in the local coordinate system of refpoint. Otherwise, if rb_normalizer is used, the locations are in the basic coordinate system relative to the location used to form rb_normalizer.

  • rbmodes (ndarray) – Stiffness-based rigid-body modes (6 columns). Will have zeros corresponding to the modal DOF.

  • maxerr (float) – Maximum absolute error of any deviation from the expected pattern (see rbdispchk()).

  • refpoint_chk (string) – Either ‘pass’ or ‘fail’. See description of refpoint above. Note that refpoint_chk is always True for a single node interface.

Notes

This routine will fail if the DOF in refpoint do not fully and minimally restrain all rigid-body motion. It must be a statically-determinate set.

If coords doesn’t fit the expected pattern shown in rbdispchk(), a warning message is printed.

Note that rbdispchk() is used to calculate coords. That routine accounts for the possibility of the interface DOF using different coordinate systems.

Example usage:

from pyyeti import cb
import numpy as np
b = np.arange(18)     # 3 boundary grids
bref = np.arange(6)   # use 1st as reference
dist = cb.cbcoordchk(kaa, b, bref)
Raises:
  • ValueError – If length of b is not an even multiple of 6.

  • ValueError – If refpoint is not a 6-element subset of bset.