pyyeti.nastran.op2.OP2.rdn2cop2¶
- OP2.rdn2cop2()[source]¶
Read Nastran output2 file written by DMAP NAS2CAM; usually called by
rdnas2cam().- Returns:
dictionary
’selist’ (array) – 2-columns matrix: [ seid, dnseid ] where, for each row, dnseid is the downstream superelement for seid. (dnseid = 0 if seid = 0).
’uset’ (dictionary) – Indexed by the SE number. Each member is a pandas DataFrame described below.
’cstm’ (dictionary) – Indexed by the SE number. Each member is a 14-column matrix containing the coordinate system transformation matrix for each coordinate system. See description below.
’cstm2’ (dictionary) – Indexed by the SE number. Each member is another dictionary indexed by the coordinate system id number. This has the same information as ‘cstm’, but in a different format. See description below.
’maps’ (dictionary) – Indexed by the SE number. Each member is a mapping table for mapping the A-set order from upstream to downstream; see below.
’dnids’ (dictionary) – Indexed by the SE number. Each member is a vector of ids of the A-set ids of grids and spoints for SE in the downstream superelement. (Does not have each DOF, just ids.) When using the CSUPER entry, these will be the ids on that entry. When using SECONCT entry, the ids are internally generated and will be a subset of the ‘upids’ entry for the downstream SE.
’upids’ (dictionary) – Indexed by the SE number. Each member is a vector of ids of the A-set grids and spoints for upstream se’s that connect to SE. (Does not have each DOF, just ids.) This will only be present for SECONCT type SEs. These ids are internally generated and will contain all the values in the ‘dnids’ of each upstream SE. This allows, for example, the routine
pyyeti.nastran.n2p.upasetpv()to work. Has 0’s for downstream ids (in P-set) that are not part of upstream SEs.
Notes
The module nastran has many routines that use the data created by this routine.
‘uset’ description
Each uset variable is a 4-column pandas DataFrame with ID and DOF forming the row MultiIndex. The column index is:
['nasset', 'x', 'y', 'z']. The order of the degrees of freedom is in Nastran internal sort. GRIDs have 6 rows each and SPOINTs have 1 row. Here is an example uset variable with some notes for the [‘x’, ‘y’, ‘z’] columns (described in more detail below):nasset x y z id dof 1 1 2097154 1.0 2.0 3.0 # grid location in basic 2 2097154 0.0 1.0 0.0 # coord system info 3 2097154 0.0 0.0 0.0 # coord system origin 4 2097154 1.0 0.0 0.0 # | transform to basic 5 2097154 0.0 1.0 0.0 # | for coord system 6 2097154 0.0 0.0 1.0 # | 2 0 4194304 0.0 0.0 0.0 # spoint
That example was formed by using
pyyeti.nastran.n2p.make_uset():from pyyeti.nastran import n2p uset = n2p.make_uset(dof=[[1, 123456], [2, 0]], nasset=[n2p.mkusetmask('b'), n2p.mkusetmask('q')], xyz=[[1, 2, 3], [0, 0, 0]])
The “nasset” column specifies Nastran set membership. It is a 32-bit integer for each DOF. The integer has bits set to specify which Nastran set that particular DOF belongs to. For example, if the integer has the 1 bit set, the DOF is in the m-set. See the source code in
pyyeti.nastran.n2p.mkusetmask()for all the bit positions. Note that you rarely (if ever) need to callpyyeti.nastran.n2p.mkusetmask()directly since the functionpyyeti.nastran.n2p.mksetpv()does this behind the scenes to make partition vectors.For grids, the [‘x’, ‘y’, ‘z’] part of the DataFrame is a 6 row by 3 column matrix:
Coord_Info = [[x y z] # location of node in basic [id type 0] # coord. id and type [xo yo zo] # origin of coord. system [ T ]] # 3x3 transformation to basic # for coordinate system
For spoints, the [‘x’, ‘y’, ‘z’] part of the DataFrame is a 1 row by 3 column matrix:
Coord_Info = [0.0, 0.0, 0.0]
‘cstm’ description
Each cstm contains all the coordinate system information for the superelement. Some or all of this info is in the uset table, but if a coordinate system is not used as an output system of any grid, it will not show up in uset. That is why cstm is here. cstm has 14 columns:
cstm = [ id type xo yo zo T(1,:) T(2,:) T(3,:) ]
Note that each cstm always starts with the two ids 0 and -1. The 0 is the basic coordinate system and the -1 is a dummy for SPOINTs. Note the T is transformation between coordinate systems as defined (not necessarily the same as the transformation for a particular grid … which, for cylindrical and spherical, depends on grid location). This is the same T as in the uset table.
For example, to convert coordinates from global to basic:
Rectangular (type = 1): [x; y; z] = T*[xg; yg; zg] + [xo; yo; zo] Cylindrical (type = 2): % c = cos(theta); s = sin(theta) [x; y; z] = T*[R c; R s; zg] + [xo; yo; zo] Spherical (type = 3): % s1 = sin(theta); s2 = sin(phi) [x; y; z] = T*[r s1 c2; r s1 s2; r c1] + [xo; yo; zo]
‘cstm2’ description
Each cstm2 is a dictionary with the same 5x3 that the ‘Coord_Info’ listed above has (doesn’t include the first row which is the node location). The dictionary is indexed by the coordinate id.
‘maps’ description
maps will be [] for superelements whose A-set dof did not get rearranged going downstream (on the CSUPER entry.) For other superelements, maps will contain two columns: [order, scale]. The first column reorders upstream A-set to be in the order that they appear in the downstream:
down = up[maps[:, 0]]. The second column is typically 1.0; if not, these routines will print an error message and stop. Together with dnids, a partition vector can be formed for the A-set of an upstream superelement (seepyyeti.nastran.n2p.upasetpv()).The op2 file that this routine reads is written by the Nastran DMAP NAS2CAM. The data in the file are expected to be in this order:
SLIST & EMAP or SUPERID For each superelement: USET EQEXINS CSTMS (if required) BGPDTS MAPS (if required)
Note: The 2nd bit for the DOF column of all uset tables is cleared for all S-set. See
pyyeti.nastran.n2p.mkusetmask()for more information.Example usage:
from pyyeti import nastran # list superelement 100 DOF that are in the B set: o2 = nastran.OP2('nas2cam.op2') nas = nastran.rdn2cop2() bset = nastran.mksetpv(nas['uset'][100], 'p', 'b') print('bset of se100 =', nas['uset'][100][bset, :2])
See also