pyyeti.cb.rbdispchk¶
- pyyeti.cb.rbdispchk(f, rbdisp, grids=None, ttl='Coordinates Determined from Rigid-Body Displacements:', verbose=True, tol=0.0001)[source]¶
Rigid-body displacement check.
- 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.rbdisp (2d ndarray) – Rigid-body displacements; size is 3*N x 6 where N is the number of nodes. Rows correspond to X, Y, Z triples for each node (in any coordinate system).
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 table of coordinates or any warnings about not matching the pattern
tol (float; optional) – Sets the error tolerance level. If verbose is true, a warning message is printed for each node that does not fit the expected pattern. The criteria for the error message is if the maximum deviation for that node is >
tol*max(node_coords).
- Returns:
coords (2d ndarray) – A 3-column matrix of [x, y, z] locations of each node, relative to refpoint and in the local coordinate system of refpoint.
errs (1d ndarray) – Vector of maximum absolute deviations from the expected pattern for each node (see below).
Notes
The expected pattern for rigid-body displacements for each node is:
[ 1 0 0 0 Z -Y 0 1 0 -Z 0 X 0 0 1 Y -X 0 ]
The pattern shown assumes the node is in the same coordinate system as the reference node. If this is not the case, the 3x3 coordinate transformation matrix (from reference to local) will show up in place of the the 3x3 identity matrix shown above. This routine will use that 3x3 matrix to convert coordinates to that of the reference before checking for the expected pattern. This all means is that the use of local coordinate systems is acceptable for this routine.
- Raises:
ValueError – If rbdisp is not n x 6, where n is multiple of 3.
See also
cbcheck(),rbmultchk(),cbcoordchk(),pyyeti.nastran.n2p.rbgeom(),pyyeti.nastran.n2p.rbgeom_uset()Examples
Define locations for 3 nodes, compute rigid-body modes from them, and calculate their locations to test this routine:
>>> from pyyeti.nastran import n2p >>> from pyyeti import cb >>> import numpy as np >>> from pyyeti import ytools >>> coords = np.array([[0, 0, 0], ... [1, 2, 3], ... [4, -5, 25]]) >>> rb = n2p.rbgeom(coords) >>> xyz_pv = ytools.mkpattvec([0, 1, 2], 3*6, 6).ravel() >>> rbtrimmed = rb[xyz_pv] >>> rbtrimmed array([[ 1., 0., 0., 0., 0., 0.], [ 0., 1., 0., 0., 0., 0.], [ 0., 0., 1., 0., 0., 0.], [ 1., 0., 0., 0., 3., -2.], [ 0., 1., 0., -3., 0., 1.], [ 0., 0., 1., 2., -1., 0.], [ 1., 0., 0., 0., 25., 5.], [ 0., 1., 0., -25., 0., 4.], [ 0., 0., 1., -5., -4., 0.]]) >>> coords_out, errs = cb.rbdispchk(1, rbtrimmed) Coordinates Determined from Rigid-Body Displacements: Node X Y Z Error ------ -------- -------- -------- ---------- 1 0.00 0.00 0.00 0.0000e+00 2 1.00 2.00 3.00 0.0000e+00 3 4.00 -5.00 25.00 0.0000e+00 Maximum absolute coordinate location error: 0 units >>> np.allclose(coords, coords_out) True >>> errs.max() < 1e-9 True