readnas (+FEA)


Purpose

Import data from NASTRAN Output2, Output4, bulk data, and punch files.

Syntax

f=readnas('filename')
f=readnas
f=readnas('directoryonly')
f=readnas('supported')
[f,fname,opdir,opt]=readnas('*.op2','blocks',{'OUGV1','GEOM1'})
f=readnas(filename,'blocks',BLOCK_CELL,OPT,'silent','noprogbar','logfile')
f=readnas(filename,'modes',1:5)

Description

READNAS reads data from a NASTRAN file. READNAS supports Output2 (OP2), bulk data (BLK or DAT), PCH (XYPUNCH, SORT1, and SORT2), and Output4 (OP4) files. OP2 files must be created with the PARAM,POST,-2 or PARAM,POST,-1 option to read geometry and results. READNAS supports geometry, property, matrix, and nodal result data blocks. Geometry data is output in the IMAT geometry structure format. Physical and material property data is returned as structures. Results are output as imat_shp for nodal results, and as result objects for all other result types. Matrices are output as structures. The OGPWG table(s) are output as a structure, which is described in detail below. Unrecognized datablocks are read in as a structure of INT32 vectors.

READNAS determines the file type by the file's extension. If your file does not have a standard extension (i.e. .op2, .pch, .dat, .blk, .op4), READNAS will default to treating the file as BLK. To force READNAS to read the file as a different type, pass in the appropriate string listed below (i.e. 'isop2', 'ispch').

Several optional input arguments are supported. FILENAME is a string containing the filename to be read. It must include the extension of the file to read. If FILENAME is not specified, or FILENAME contains wildcards (i.e. '*.op2'), a standard file dialog will appear. If FILENAME contains wildcards, it will be used as a filter for the file dialog.

Several string input arguments are also supported.

'blocks' Must be followed by a cell array containing data block names to read. If the cell array is scalar and contains an empty matrix, all of the datablocks will be read.
'modes' Must be followed by a numeric vector of mode numbers to read from each SORT1 result datablock
'subcases' Must be followed by a numeric vector of subcase IDs to read from each SORT1 result datablock
'entityids' Must be followed by a numeric vector of entity IDs that will be used to filter results. These IDs represent node IDs for for nodal results and element IDs for elemental results, including Data At Nodes On Elements results such as stress. Works with PCH and OP2 results. Does not work with the sort1tosort2 option.
'silent' Suppress output
'noprogbar' Don't display progress bar at all
'directoryonly' Get directory of the file contents (OP2, OP4, and PCH)
'supported' Return a list of the datablocks recognized by READNAS
'logfile' Write external log file (.lis) containing processing details (default is no log file will be written)
'asresult' Return all results as imat_result (OP2). The default is for nodal displacement results to be returned as imat_shp.
'asraw' Return all table outputs as they are stored in the OP2 file. Unrecognized tables are always returned in this format. You can use one of PARSEOP2TABLE_* helper functions to process some of the tables returned in this format.
'isblk' Force READNAS to treat the file as a bulk data file.
'isop2' Force READNAS to treat the file as an Output2 file.
'ispch' Force READNAS to treat the file as a PCH file.
'isop4' Force READNAS to treat the file as an Output4 file.
'psd' Label PCH file functions as PSDs (use only for XYPUNCH).
'frf' Label PCH file functions as FRFs (use only for XYPUNCH).
'time' Label PCH file functions as time histories (use only for XYPUNCH).
'isascii' Force READNAS to treat the OP4 file as ASCII.
'isbinary' Force READNAS to treat the OP4 file as binary.

 

For PCH files, BLOCK_CELL can be a cell array containing either a single vector of numeric indices of records to read (an empty matrix specifies that all of the records should be read), or a cell array of block names (i.e. 'OUGV1', 'PCHBULK', etc.). The block names are those returned in the .name field of the PCH file directory structure (described here).

OPT is a structure containing special processing options for READNAS. You may also save this structure to a MAT file called readnas_options.mat. If READNAS finds this file in the current working directory, and the MAT file contains a structure named 'OPT', and you have not passed in an OPT structure, READNAS will use the OPT structure found in the MAT file. Supported options are shown in the table below. They are also more fully described below.

OPT.global.Femap Logical (default is false). Read results in a format suitable for Femap. This sets several of the other global options (see here for more details). Setting these other options explicitly will override the default Femap option settings.
OPT.global.ideas Logical (default is false). Read results in a format suitable for I-deas. This sets several of the other global options (see here for more details). Setting these other options explicitly will override the default I-deas option settings.
OPT.global.actualnodenumbers Logical (default is false). For Data At Nodes On Elements results (i.e. stress), return the actual node numbers for the result components, rather than 1-N.
OPT.global.renumbercsys Logical (default is false). Renumber coordinate systems 0, 1, and 2. If set to TRUE, coordinate systems will be renumbered, but IMAT functionality such as plotting may not work.
OPT.global.transformtobasic Logical (default is true). Transform results from the coordinate system in the OP2 file to the basic. See below for more details.
OPT.global.atcentroids Logical (default is false). For stress, strain, and element force, return results at the centroid. These results are averaged from the nodal results for 1D elements, and are read directly from the OP2 file for 2D and 3D elements.
OPT.global.atnodes Logical (default is true). For stress, strain, and element force, return results at nodes where they are available (for some linear 2D elements nodal results are not available unless results are output with the CORNER option).
OPT.global.returninvariants For Data At Nodes On Elements results (i.e. stress), return the invariants. These are returned in separate results as the component results. So in other words, each stress result will generate two outputs: one containing component stresses, and the other containing just the invariants.
OPT.global.asraw Logical (default is false). Same as the 'asraw' input option.
OPT.global.combinesuper Logical (default is true). Combine superelement results. Also affects SOL200 results with multiple iterations, and also aeroelastic analysis where the output contains both structural and aerodynamic grids, which will be in separate records (set this option to false in this instance).
OPT.global.forcecombine

Force results to be treated as superelement results and combined into single datasets. This is necessary if your OP2 does not have case control or EXTRN cards and you have superelement results. Use only when necessary.

OPT.global.skipinclude Logical (default is false). Skip missing INCLUDE files (do not error). Only applies to bulk data import.
   
OPT.fem.renumberpid Logical (default is true). Renumber duplicate property IDs. If set to false, no renumbering will be done. This could cause problems if exporting to external programs such as I-deas.
OPT.fem.returnelementextras Logical (default is true). Return the extra element-specific data for the supported element types.
   
OPT.pch.sort1tosort2 Logical (default is false). Translate PCH file SORT1 records to functions (SORT2 format, equivalent to old behavior).

 

Four output arguments are supported. F is the returned data. It is a structure with fields that describe the output.

The following fields are possible for BLK, OP2, or PCH files.

Field Name BLK OP2 PCH Content description
.casecontrol X X   Structure containing case control information, including sets from SET= cards (imat_group).
.ceigen   X   Structure containing the complex eigenvalue table (CLAMA, CLAMAD, FLAMA, or ULAMA).
.eigen   X   Structure containing the eigenvalue table (OLB, LAMA, or XLAMA).
.fem X X X imat_fem containing FEM geometry.
.functions   X X imat_fn containing results in SORT2 format.
.incl_grp X     imat_group containing the entities found in each include file (bulk data only, and only if include files referenced).
.loads X X X Structure containing the different bulk data loads supported.
.matrix X X X Nx1 structure containing matrix information.
.mpc X X X Structure with the fields .id, .name, and .mpc. The .id field contains the list of unique MPC set IDs. The .name field contains a cell array with the MPC names. The .mpc field contains a structure with the fields .sid and .terms. The .sid field is a vector containing the set IDs for each MPC card imported. The .terms field is a cell array, where each cell is an Nx3 matrix of MPC equation terms.
.properties X X X Structure containing physical properties (.ept) and material properties (.mpt).
.pvt X X   Nx2 cell array containing the parameter value table. The first column contains the parameter names and the second column contains the parameter values.
.records     X Cell array containing SORT1 results. Each cell contains the output for a given SORT1 record. Nodal results are returned as an imat_shp, and elemental results (i.e. stress) are returned as a structure.
.result   X   Cell array containing results (imat_shp or imat_result).
.set X X X Structure containing sets (e.g. ASET, BSET, CSET, QSET, USET, as well as EXTRN definition) read from bulk data cards. Each set will be stored as an imat_ctrace in a separate field of .set. The .uset field is a cell array containing the sets for each named USET imported.
.spc X X X Nx4 matrix containing SPC definitions. Column 1 is SPC set ID. Column 2 is the grid ID. Column 3 is the component list, and column 4 is the enforced displacement value.
.table   X   Raw datablock tables (unsupported datablocks import in this format).
.weight   X   Weight generator tables(s).

 

Matrices read from the OP4 file will be returned as a structure array.

FILENAME is a string containing the full path and filename of the file read.

The OP2 directory structure is as follows:

.blocknames Cell array of strings containing the block names.
.blockdata Nx6 matrix containing information about each block. The first column contains the starting word number for the block. The second column contains the number of words for the block and the third column specifies whether the block is a duplicate block. The fourth column contains the record type. The fifth column contains the case control ID. The sixth column contains the superelement ID.
.endianswap Specifies whether byte-swapping occurred due to the OP2 endian-ness being different from the current platform.
.is64bit Logical for whether the OP2 is 64bit. If false, the OP2 is 32bit.

 

The PCH directory structure is as follows:

.name Nx1 cell array containing the record names (may be blank).
.index Nx4 matrix containing record indices. Generally speaking this field is only of interest to READNAS internally. The first column is the record number, the second column is the ID, the third column is the ply number, and the fourth column is the column number.
.data Nx12 matrix. The columns are as follows: Function Type, Subcase, Data Type, Entity Type, Entity Number, Item, Complex Type (1=real, 2=real/imag, 3=mag/phase), #Rows, #Columns, Sort Type, (201=MATRIX, 205=SORT1, 206=SORT2, 207=XYPUNCH, 208=PCHTABLED1, 303=BULK), Superelement ID, and Z Value (time/frequency/0 for static). Note that for SORT1TOSORT2 data, #Rows is set to -1.
.supported Nx1 logical specifying whether the record is supported by READNAS.

 

Supported sort types are listed in the table below.

Sort Type Number

Sort Type

201 MATRIX
205 SORT1
206 SORT2
207 XYPUNCH
208 PCHTABLED1
303 BULK

 

For OP4 files, the directory output is a cell array of strings containing the matrix names.

The physical and material property output structure is defined below. Both sets of property data are returned in the .properties field of the output. Physical property data is returned in the .ept field, and material property data is returned in the .mpt field. Each of these fields contains a structure, the format of which is described below. The following physical property cards are supported: PBAR, PBARL, PBEAM, PBEAML, PBEND, PBUSH, PDAMP, PELAS, PRBAR, PROD, PTUBE, PCOMP, PSHEAR, PSHELL, and PSOLID. The following material property cards are supported: MAT1, MAT2, MAT3, MAT4, MAT5, MAT8, MAT9, and MAT10.

.id Nx1 vector of property ID's.
.type Nx1 cell array of strings containing the property type. This matches the physical or material property card name.
.data Nx1 cell array of structures. Each field contains a structure whose fields are specific to the property. There are too many properties and fields to describe here in detail. In general, field names will match the field description names in the NASTRAN documentation. To understand the fields and their contents, please look up the bulk data entry in the NASTRAN Quick Reference Guide.

 

The OGPWG (grid point weight generator) output structure is described below. If there are multiple superelements in the OP2 file, this structure will be an array, where each index contains the table for each superelement.

.refid Reference grid point I, or 0 for the basic origin.
.title Run title.
.subtitle Run subtitle. Contains the superelement ID in the description if applicable.
.label Run label.
.MO Rigid body mass matrix relative to the reference point in the basic coordinate system. 6x6 matrix.
.S Transformation matrix from the basic coordinate system to the principal mass axes. 3x3 matrix.
.mass Principal masses. 3x1 vector.
.cg Center of gravity in the X, Y, and Z directions, presented column-wise. 3x3 matrix.
.IS Inertia matrix about the center of gravity relative to the principal mass axes. 3x3 matrix.
.IQ Principal moments of inertia about the center of gravity. 3x1 vector.
.Q Transformation matrix between the S-axes and the Q-axes. The columns are the unit direction vectors for the corresponding principal inertias. 3x3 matrix.

 

The LAMA (eigenvalue) output structure is described below. Each field is an NMODESx1 numeric vector, where NMODES is the number of modes extracted during the eigenvalue analysis.

.modenum Mode number.
.extorder Mode extraction order.
.eigenval Eigenvalue (l).
.omega Omega (w), which is the square root of the eigenvalue.
.freq Frequency in Hz, which is omega divided by 2p.
.genmass Generalized mass.
.genstiff Generalized stiffness.

 

Bulk data file TABLED1 cards are imported into the .tables field. This field contains another structure containing the .tabled1 field (in the future the other TAB* cards will be returned in appropriate fields). Each table is contained in a structure with the following fields.

.id TAB* card ID.
.xaxis X Axis type ('LINEAR' or 'LOG' or empty if not specified on the bulk data entry)
.yaxis Y Axis type ('LINEAR' or 'LOG' or empty if not specified on the bulk data entry)
.data Nx2 matrix containing the table values. The first column contains the X axis values, and the 2nd column contains the Y axis values.

 

OPT is a structure containing the processing options used during the import.

Important notes

The notes below refer to the default behavior. Specifics for each program mask are described further below.

Generally speaking, when you import results from an OP2 file, you need the geometry datablocks present so READNAS can access information relevant to the result processing. If you opt not to transform results to the basic coordinate system or return actual node numbers, you can import nodal and energy results without the geometry.

Nodes will be imported in the definition coordinate system when read from both bulk data files and Output2 files. SPOINTs will import as nodes with the color yellow and coordinates 0,0,0.

Matrices will be contained in a structure, where each element of the structure contains the contents of one of the matrices read. The structure fields are described in the following table. If the matrices being read from the Output2 file were created by the substructure DMAP alter provided by MTS for creating a Guyan-reduced substructure (KXX, MXX, and GO), READNAS will also fill in the DOF field. Otherwise this field will contain empty DOF lists, since NASTRAN does not store matrix DOF lists directly in the Output2 file.

.matrix Matrices in sparse format.
.name Matrix names.
.dof Row and column DOF, respectively, stored as a 1x2 cell array of imat_ctrace.
.phase Logical. True if the matrix is complex-valued and values are given in magnitude/phase form.
.symmetric Logical. True if the matrix is symmetric. READNAS will return the fully populated matrix.
.matpool Logical. True if the matrix was read in from NASTRAN DMIG and has value 0 if matrix was read in from NASTRAN DMI. Matrices read from an OP2 file will always have a value of 0.

 

If you have a DMI matrix, and wish to obtain a matrix where the row and column numbers match the row and column numbers in the DOF fields, you can use the expandDMI function.

CONM1 and CONM2 mass and inertia properties will be imported as physical property tables.

To read a subset of SORT1 results from the OP2 file, use the 'subcases' and/or 'modes' specifiers. These act as filters on the results. For modes runs, 'modes' specifies the mode(s) to read. 'subcases' allows you to specify results from specific subcase IDs to read. The subcase numbers match the number specified on the SUBCASE case control cards.

Element Type-Specific Extra Data

Some NASTRAN elements have element-based data that is specific to the element type. This data can optionally be returned by readnas, and is located in the extra property of imat_elem. readnas only supports the extra type-specific data for certain element types. These are documented in the table below.

Element Type Type-specific data description
CBAR

Structure containing the following fields:

.x 1x3 vector containing the orientation [X1 X2 X3]
.x_flag Specifies the coordinate system for the orientation vector ("basic", "global"), or "node" if an orientation node was specified
.pa_pb 1x2 vector containing the end A and end B pin flags [PA PB]
.wa_wb 1x6 vector containing the end A and end B offsets [W1A W2A W3A W1B W2B W3B]
CBEAM

Structure containing the following fields:

.x 1x3 vector containing the orientation [X1 X2 X3]
.x_flag Specifies the coordinate system for the orientation vector ("basic", "global"), or "node" if an orientation node was specified
.pa_pb 1x2 vector containing the end A and end B pin flags [PA PB]
.wa_wb 1x6 vector containing the end A and end B offsets [W1A W2A W3A W1B W2B W3B]
CBEND

Structure containing the following fields:

.x 1x3 vector containing the orientation [X1 X2 X3]
.x_flag Specifies the coordinate system for the orientation vector ("basic", "global"), or "node" if an orientation node was specified
CBUSH

Structure containing the following fields:

.x 1x3 vector containing the orientation [X1 X2 X3]
.x_flag Specifies the coordinate system for the orientation vector ("basic", "global"), or "node" if an orientation node was specified (stored in .g0)
.g0 Orientation node (if used) [GO]
.cid Element coordinate system ID [CID]
.ocid Coordinate system ID of spring-damper offset [OCID]
.s_loc Spring damper location [S]
.s_comp Components of spring-damper offset [S1 S2 S3]
CBUSH1D

Structure containing the following field:

.cid Element coordinate system ID [CID]
CELAS2

Structure containing the following field:

.k Spring stiffness
.ge Damping coefficient
.s Stress coefficient
CGAP

Structure containing the following fields:

.x 1x3 vector containing the orientation [X1 X2 X3]
.x_flag Specifies the coordinate system for the orientation vector ("basic", "global"), or "node" if an orientation node was specified (stored in .g0)
.g0 Orientation node (if used) [G0]
.cid Element coordinate system ID [CID]
CONM1

Structure containing the following fields:

.cid Coordinate system identification number
.m 1x21 vector containing the mass terms
CONM2

Structure containing the following fields:

.cid Coordinate system identification number
.m Mass
.x 1x3 vector containing the orientation [X1 X2 X3]
.i 1x6 vector containing the inertias[I11 I21 I22 I31 I32 I33]
CPLSTN3
CPLSTN4
CPLSTN6
CPLSTN8

Structure containing the following fields:

.theta Material property orientation angle [THETA]
CQUAD4
CQUAD8
CQUADR
CTRIA3
CTRIA6
CTRIAR

Structure containing the following fields:

.theta Material property orientation angle [THETA]
.mcid Material coordinate system ID [MCID
.zoffs Offset from the surface of grid points to the element reference plane [ZOFFS]
.tflag Flag specifying how t is used [TFLAG]
.t Element corner thicknesses [T1 T2 T3 T4]
RBAR
RBE2
RBE3
RROD

Structure containing the following field:

.alpha Coefficient of thermal expansion [ALPHA]

 

BLK File Output

READNAS reads most information from a bulk data file, including parts of the file management section and executive and case control. It handles INCLUDE statements as well. Relative paths on an INCLUDE statement are treated as relative from the top-level bulk data specified to READNAS.

If bulk data includes a comment line that has the form "$TITLE       =      #", where column 79 contains a digit, it will assume that this is the start of a punch data record. If this is not intended, then please modify the format of the comment line so that READNAS interprets it correctly as a comment.

 

PCH File Output

READNAS considers Punch file data to be stored as a series of records. A record consists of a header line or lines, followed by numeric data. SORT1 records are written as a matrix, where the rows are the entity (i.e. node or element), and the columns are the item codes. One record is written for each time or frequency step, and for each step, one record is written for each entity type. SORT2 records are written as a matrix, where the rows are the time or frequency, and the columns are the item codes. One record is written for each entity type. XYPUNCH records are written as a 2-column matrix, where the first column is the time or frequency, and the second column is the data for a specific entity and item code. The XYPUNCH header contains very little information, so for example it is not possible to determine whether the first column contains time or frequency values. READNAS thus allows you to specify what this axis contains.

BULK data found in PCH files will be returned in the fields that are returned when reading bulk data directly. Each section of bulk data found in the PCH file will appear as a separate record. If the same bulk record types are found in multiple bulk sections, READNAS will attempt to merge them. All matrices will be returned, even if they are duplicated. Only the first set of FEM geometry will be returned. Only the first set of each set type will be returned.

Nonlinear CBUSH results are written to the PCH file as a stress record for element type 226. The data has 18 values. The first 9 are translational forces, stresses, and strains, in that order. The following 9 are the rotational forces, stresses, and strains. Note that the Output2 file output is ordered differently. Please see the notes below for datablock OESNLXR.

Punch file results are reordered in the same way, such that the first result values are force, the next 6 are stress, and the final 6 are strain.

It is possible to have READNAS return the SORT1 records in SORT2 format. To do this, pass in the OPT structure with the .pch.sort1tosort2 field set to true.

SORT2 and XYPUNCH records (and SORT1 records converted to functions) are returned in the .functions field of the output as imat_fn.

Matrix records are returned in the .matrix field as an array of structures using the format specified above.

SORT1 records are returned in the .records field as a cell array. Each cell contains the data for a specific record. If the record contained nodal data (item codes 3-8), it will be stored as an imat_shp. Otherwise, it will be stored as a structure with the following fields:

.title String containing NASTRAN run title.
.subtitle String containing NASTRAN run subtitle.
.label String containing NASTRAN run label.
.id mx1 vector containing entity IDs (i.e. node or element) corresponding to the data rows.
.item 1xn vector containing the item codes for the data columns.
.entitytype Scalar specifying the entity type. The corresponds to the NASTRAN entity type (i.e. CBAR=34).
.seid Scalar specifying the Superelement ID (if specified in the PCH file).
.datatype Scalar specifying the data type. This corresponds to the I-deas nomenclature, which is documented here.
.subcase Subcase number.
.modenum Mode number for modal results or Load ID for static results.
.zvalue Time value or frequency or mode frequency (Hz), depending on the analysis type.
.eigenvalue For modes, contains the eigenvalue. For complex modes, this value with be complex.
.acode NASTRAN approach code.This is the Analysis Code*10 + Device Code. Please consult your NASTRAN documentation for more details.
.data MxN matrix containing the numeric SORT1 items, where M is the number of IDs (length of .id), and N is the number of values in .item, and the contents of each column corresponds to the item code in .item for this result. Columns defined with string-based items are set to NaN, and the string contents are stored in the same column in .datachar.
.datachar MxN cell array of strings containing the string-based items, where M is the number of IDs (length of .id), and N is the highest column number containing a string-based item. N will always be equal to or less than the length of .id. Columns with numeric items contain empty matrices. If this result type does not have any string-based item codes, this field contains an empty matrix.

 

Output2 Import Notes

This section contains general information about how Output2 stores its data. The following subsections define how the import options modify the results from the way they are stored in the Output2 file. If no transformation is requested, results will be returned the way they are stored in the Output2 file. Please see below for details of what transformations occur if they are requested.

Nodal displacement results (OUG) are stored in the displacement coordinate system unless their datablock name begins with 'B', in which case the results are stored in the basic coordinate system.

Nodal force results (OQG) are stored in the displacement coordinate system.

Element forces read from the OEF datablocks are always imported with some coordinate system transformation. 1D elements such as CBAR and CBEAM are always imported in the element coordinate system. Forces are transformed according to the cross section rotation angle. Eccentricities are also accounted for. CELAS and CBUSH forces are always imported as they are stored in the Output2 file. Please note that for bar/beam elements, NASTRAN defines moments IN a plane, where IMAT defines moments ABOUT an axis perpendicular to the plane. readnas returns the moment in plane 1 as Mz and the moment in plane 2 as My, which means that the moment values will appear flipped from what NASTRAN reports. There may also be a sign change on the moments, depending on the program mask. Please read the sections on I-deas and Femap masks for more important information.

SCN Nastran 2019.1 through 2401 has a bug where the sign on the shell stress resultant moment output for CQUAD8 is negated from what it should be. This bug was fixed in SCN Nastran 2406. readnas returns the results as they are stored in the Output2 file.

NASTRAN does not write out stress tensors for 1D elements. IMAT returns the stresses as components of a tensor, but the values returned are not tensor components.

Element Type Tensor components and actual storage

CBAR (linear, type 34)

CBEND (linear, type 69)

CBARAO (linear, type 100)

Tensor Component Element stress component
XX Axial stress
XY Bending stress at point C
YY Bending stress at point D
XZ Bending stress at point E
YZ Bending stress at point F
CBEAM (linear, type 2)
Tensor Component Element stress component
XY Longitudinal stress at point C
YY Longitudinal stress at point D
XZ Longitudinal stress at point E
YZ Longitudinal stress at point F

CONROD (linear, type 10)

CROD (linear, type 1)

CTUBE (linear, type 3)

Tensor Component Element stress component
XX Axial stress
XZ Torsional stress
CROD (nonlinear, type 89)
Tensor Component Element stress component
XX Axial stress
XY Equivalent stress
YY Total strain
XZ Effective plastic strain
YZ Effective creep strain
ZZ Linear torsional stress
CBEAM (nonlinear, type 94)
Tensor Component Element stress component
XX Axial stress
XY Equivalent stress
YY Total strain
XZ Effective plastic strain
YZ Effective creep strain

 

The OESNLXD datablock contains nonlinear output for different element types. NASTRAN mixes the datatypes stored in this datablock. Since results in IMAT can only have a single datatype, READNAS returns OESNLXD results as a force dataset. The implications are that if you export these results to another format (e.g. Universal file), and then change units and read the results back in, non-force results will be scaled incorrectly. The table below describes how the results for the supported element types are returned.

Element Type Output storage
CGAP The first 3 components (1 through 3) contain the X, Y, and Z forces, respectively. Components 4 through 6 contain the X, Y, and Z displacements. The open/close state and the two slip values are not returned from the Output2 file, but are imported from the Punch file.
CROD The 6 components are returned in order of Axial stress, Equivalent stress, Total strain, Effective plastic strain, Effective creep strain, and Linear torsional stress.

 

Nonlinear CBUSH results are written to the OESNLXR datablock. READNAS returns a stress dataset. Layer 0 contains the force results. Layer 1 contains the stresses, and layer 2 contains the strains. Please note that the resulting output is tagged by READNAS as a force, so changing the units on export/import may result in incorrect values for the stresses and strains. Also note that the PCH file import retains the NASTRAN ordering. See the notes above.

For 2D elements, element stress resultants are stored in the element coordinate system. See the CQUAD and CTRIA documentation in the NASTRAN Quick Reference Guide for more details on the definition of the element coordinate system, as well as the material coordinate system. Midside node results for parabolic elements are averaged from the two adjacent corner nodes, since the Output2 file does not store midside node results.

Stress and strain data is stored in the Output2 file in the element coordinate system for all element types except PCOMP. Stresses and strains for composite shell elements (PCOMP) are written to the Output2 file in the ply coordinate system.

If requested, READNAS returns stress and strain invariants. It returns Maximum Principal, Minimum Principal, Maximum Shear, Octahedral Stress/Strain, and von Mises. Nastran does not store all of these invariants for each element type. When it is available from OP2, that value is returned. When it is not available from the OP2 and it can be calculated, READNAS computes the value and returns it. When this is not possible, READNAS returns 0. Note that READNAS only computes invariants for SORT1 data.

        STRESS(VONMISES)
STRAIN(VONMISES)
  STRESS(MAXS/SHEAR)
STRAIN(MAXS/SHEAR)
  MAX PRIN MIN PRIN   MAXS OCTS VONM   MAXS OCTS VONM
OES (real)                    
shell OP2 OP2   readnas readnas OP2   OP2 readnas readnas
solid OP2 OP2   readnas readnas OP2   readnas OP2 readnas
composite shell OP2 OP2   OP2 readnas readnas   OP2 readnas readnas
composite solid readnas readnas   OP2 readnas readnas   OP2 readnas readnas
axisymmetric solid 0 0   0 readnas OP2   0 OP2 readnas
OESVM (complex)                    
shell readnas readnas   readnas readnas OP2   OP2 readnas readnas
solid OP2 OP2   readnas readnas OP2   readnas OP2 readnas
composite shell 0 0   0 readnas OP2   0 readnas OP2
composite solid 0 0   0 readnas OP2   0 readnas OP2
axisymmetric solid readnas readnas   readnas readnas OP2   readnas OP2 readnas
CTRIAX6 (type 53) readnas readnas   readnas readnas readnas   readnas readnas readnas
OESX* (real->random)                    
shell 0 0   0 0 OP2   0 0 OP2
solid 0 0   0 0 OP2   0 0 OP2
composite shell 0 0   0 0 OP2   0 0 OP2
composite solid 0 0   0 0 OP2   0 0 OP2
axisymmetric solid 0 0   0 0 OP2   0 0 OP2

* Strain invariants are not stored or returned for this data type

Grid point force balances are written to the Output2 file in the displacement coordinate system. See the notes for GPFORCE in the NASTRAN documentation. These results are returned as Data on Elements at Nodes results. Special quantities are identified with a non-positive element ID. Please refer to the table below for a list of these quantities and their associated "element" identifier.

Element ID Quantity
>0 Element number
0 SPC (reaction) forces
-1 Applied loading at node
-2 MPC/Couple forces
-3 Total force
-4 X2GG (from DMIG)
-5 FRF

 

The layer number for solid composite elements (CPENTA and CHEXA that reference PCOMPS) is 10*ply layer + BMT layer. This element type supports output at up to three locations on each ply (Bottom, Middle, Top). This is the BMT layer, where 1 = Bottom, 2 = Middle, and 3 = Top. The ply layer is 1 for the bottom ply and increments by 1. To determine the output location from the layer number, divide the layer by 10. The integer portion is the ply layer number and the remainder is the BMT layer. For example, a layer number of 42 corresponds to ply layer 4 middle surface, and 103 corresponds to ply layer 10 top surface.

Output on each element is ordered in the nodal order expected by I-deas. The node order is the same between I-deas and NASTRAN for linear elements. However, parabolic elements have a different numbering sequence. I-deas interleaves corner and midside nodes, and NASTRAN orders the corner nodes first, followed by the midside nodes. The node numbering listed in the component listing follow the NASTRAN convention, but are ordered in the I-deas convention. This is so exporting these results via writeunv will result in a correctly ordered Universal file result dataset. To clarify the ordering, consider a CTRIA6 with corner nodes 1, 2, and 3, and midside nodes 4, 5, and 6. The component listing for the results at this element will be in node order 1 4 2 5 3 6.

Matrices are written to the OP2 file several different ways. readnas supports all matrices written as matrix datablocks. These datablocks are named with the matrix name, and they contain only the matrices with no row and column DOF information. External superelements are written to the OP2 in the XSOP2DIR datablock which contains the directory of matrices, and multiple EXTDB datablocks that contain these matrices. readnas uses the information in XSOP2DIR to rename the EXTDB datablocks to their corresponding matrix name, so that the matrix name is what is displayed in the readnas GUI. The MATPOOL datablock contains matrices of several different formats. readnas imports the DMIG-formatted matrices from MATPOOL. Matrices from all of these sources are returned as a structural array in the .matrix field of the readnas output.

Option: Femap

This option sets the transformtobasic option to false, atnodes to true, atcentroids to true, and actualnodenumbers to false. This combination has the effect of returning the data much more closely to the way it is stored in the OP2 file.

Only one spring force is returned for each CELAS element, and is returned at node 0, the "centroid" and node 1.

CBAR and CBEAM element Y and Z moment values are switched as compared to the way they are stored and printed in the NASTRAN output (for example, F06), since IMAT defines beam moments about an axis and NASTRAN defines moments in a plane. The signs on the moments will match what is displayed in the F06 file. Forces and moments are returned for nodes 1 and 2 (end A and end B of each element), as well as the "centroid". The centroidal values are the average of the node 1 and node 2 values. The axial and shear forces are the same for both nodes, since NASTRAN only stores one value per element for the axial, shear, and torque. However, the moments may be different.

CROD and CONROD only returns components 1 and 4 for element forces. All 6 components are returned for stresses as the stress tensor components are used to store various other quantities (see notes above).

CBUSH returns forces at the centroid and at node 1. The values returned are identical for both locations.

Shell stress resultants are returned with a layer number of 100. This layer number is used to identify stress resultants when writing a Femap Neutral file with writeFemap.

Only results at the corners of parabolic elements are returned. No midsize results are returned, since NASTRAN does not store midside node values in its output.

Option: I-deas

This option sets the transformtobasic option to true, atnodes to true, atcentroids to false, renumbercsys to true, and actualnodenumbers to false.

Nodal displacement data read from the OUG datablocks (displacements and pressures) is imported from the Output2 file in the global (basic) coordinate system if geometry information is present in the Output2 file.

Nodal (SPC) forces read from the OQG datablocks are transformed to the global (basic) coordinate system if geometry information is present in the Output2 file.

Midsize node results will be returned for parabolic elements, but since NASTRAN does not store midside results, these are simply the average of the two corner nodes on that edge.

For bar/beam/bend element forces, the end A Mz and end B My moments have their signs negated from what is stored in the Output2 file and printed to the F06 file. In addition, the end A axial and shear forces and end A torsion are negated from what is stored in NASTRAN.

Output on each element is ordered in the nodal order expected by I-deas. The node order is the same between I-deas and NASTRAN for linear elements. However, parabolic elements have a different numbering sequence. I-deas interleaves corner and midside nodes, and NASTRAN orders the corner nodes first, followed by the midside nodes. The node numbering listed in the component listing follow the NASTRAN convention, but are ordered in the I-deas convention. This is so exporting these results via writeunv will result in a correctly ordered Universal file result dataset. To clarify the ordering, consider a CTRIA6 with corner nodes 1, 2, and 3, and midside nodes 4, 5, and 6. The component listing for the results at this element is in node order 1 4 2 5 3 6.

Option: transformtobasic

Coordinate transformations require that geometry information is present in the Output2 file. If this information is not present, results will be returned as they are stored in the Output2 file.

Nodal displacement data read from the OUG datablocks (displacements and pressures) will be transformed to the basic coordinate system. If these results were written to the Output2 file in the basic coordinate system (datablock name begins with 'B'), this option has no effect, since the results are already in the basic coordinate system.

Nodal (SPC) forces read from the OQG datablocks are transformed to the basic coordinate system.

Elemental forces for 1D elements such as CELAS, CBUSH, CBAR and CBEAM are transformed to the basic coordinate system.

Shell stress resultant data is not transformed and is returned as it is stored in the Output2 file.

Stress and strain data is always returned in the element coordinate system for 1D elements. For 2D and 3D elements, it is returned in the basic coordinate system for most elements. For CHEXA1, CHEXA2, CPYRAM, CQUAD, CQUADX, CTRAPRG, CTRIARG, and CWEDGE elements, the data is always returned as it is stored in the Output2 file.

Stresses and strains for composite shell elements (PCOMP) are transformed from the element coordinate system (defined by the element first edge) to the basic. This means that there is still a transformation from the ply angle to basic that has not been performed.

Heat flux and heat gradient data for 1D elements will be returned exactly as it is stored in the Output2 file. Data for 2D and 3D elements is transformed to the basic coordinate system.

OP2: Generic Tables

Tables not explicitly recognized by READNAS can still be imported. They will be stored in the .table field of the output. This field contains one field for each unrecognized table read. The field names are the names of the tables read. Each of these fields is a structure with three fields, .header, .record and .trailer. The .record field is a cell array, where each cell contains an INT32 vector corresponding to the records in the table. The .trailer field is a 1x6 int32 array containing the 6 trailer words for the table. The .header field is a structure with four fields. This structure contains the actual contents of the 16-word header found in OP2 tables. The .name field is an 8-character array corresponding to the table name. This corresponds to the first 2 words in the header. The .fulltrailer field contains the 7-word trailer that immediately follows the table name. The last 6 words of this trailer correspond to the contents of the .trailer field. The .name2 field contains the contents of the next two words in the header. In most cases this should match the .name field, but it does not always do so. The .date field contains the last 5 words of the header, which is the date string. In many cases this is empty since it is not set in the OP2 file.

To properly interpret the table records and trailer, please visit the NASTRAN DMAP Programmer's Guide. The record data is read in as INT32. Since it can be real (float32), double, or character data, it will likely be necessary to recast the data into the appropriate datatype. READNAS can read in Output2 files created on platforms with different endian-ness from the platform on which it is running. READNAS will perform the necessary byte-swapping based on 4-byte words. The .endianswap field of the DIR structure specifies whether READNAS performed byte-swapping during the read. IMAT provides the function TYPECAST_OP2 to typecast data from INT32 to another data type, correctly handling any byte-swapping necessary.

IMAT provides several helper routines for processing some of tables in raw format. Please refer to the PARSEOP2TABLE_* functions for useful examples of how to process raw OP2 tables.

Examples

>> f=readnas('/users/testdata/output.op2','blocks',{'BOUGV1','OEF1'});
>> s=readnas('*.dat','silent');

>> opt = [];
>> opt.global.atnodes = true;
>> f=readnas('filename.op2',opt);

See Also

expandDMI, readodb, readadf, readunv, setunits, getunits, parseop4, parseop2table_dmig, parseop2table_sets, typecast_op2