pyyeti.nastran.n2p.rbcoords¶
- pyyeti.nastran.n2p.rbcoords(rb, verbose=2)[source]¶
Return coordinates of each node given rigid-body modes.
- Parameters:
rb (6 column ndarray) – Rigid-body modes. Nodes can be in any mixture of coordinate systems. Number of rows is assumed to be (6 x nodes). Other DOF (like SPOINTs) must be partitioned out before calling this routine.
verbose (integer) – If 1, print 1 summary line; and if > 1, print warnings for nodes as well.
- Returns:
coords (ndarray) – A 3-column matrix of [x, y, z] locations of each node, relative to same location as rb.
maxdev (float) – Maximum absolute error of any deviation from the expected pattern.
maxerr (float) – Maximum percent deviation; this is the maximum deviation for a node divided by the maximum x, y or z coordinate location for the node.
Notes
The expected pattern for each node in the rigid-body modes is:
[ 1 0 0 0 Z -Y 0 1 0 -Z 0 X 0 0 1 Y -X 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 ]
That 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. The matrix inversion is done in a least squares sense. This means that the use of local coordinate systems is acceptable for this routine. Zero rows (like what could happen for q-set dof) get zero coordinates.
- Raises:
ValueError – When rb is not 6*n x 6.
See also
Examples
>>> import numpy as np >>> from pyyeti import nastran >>> # generate perfect rigid-body modes to test this routine >>> coords = np.array([[0, 0, 0], ... [1, 2, 3], ... [4, -5, 25]]) >>> rb = nastran.rbgeom(coords) >>> coords_out, mxdev, mxerr = nastran.rbcoords(rb) >>> np.allclose(coords_out, coords) True >>> np.allclose(0., mxdev) True >>> np.allclose(0., mxerr) True
Now show example when non-rb modes are passed in:
>>> import numpy as np >>> from pyyeti import nastran >>> not_rb = np.dot(np.arange(12).reshape(12, 1), ... np.arange(6).reshape(1, 6)) >>> np.set_printoptions(precision=4, suppress=True) >>> nastran.rbcoords(not_rb) Warning: deviation from standard pattern, node #1 starting at index 0: Max deviation = 2.6 units. Max % error = 217%. Rigid-Body Rotations: 0.0000 0.0000 0.0000 0.6000 0.8000 1.0000 1.2000 1.6000 2.0000 Warning: deviation from standard pattern, node #2 starting at index 6: Max deviation = 2.6 units. Max % error = 217%. Rigid-Body Rotations: 0.0000 0.0000 0.0000 0.6000 0.8000 1.0000 1.2000 1.6000 2.0000 Maximum absolute coordinate location error: 2.6 units Maximum % error: 217%. (array([[ 1. , 1.2, 0. ], [ 1. , 1.2, 0. ]]), 2.600..., 216.666...)