nasread#
Purpose
Read results from outputs of the MSC/NASTRAN finite element code. This function is part of FEMLink.
Syntax
out = nasread('FileName','Command')
Description
nasread reads bulk data deck (NASTRAN input), direct reading of model and result information in OUTPUT2 and OUTPUT4 files generated using NASTRAN PARAM,POST,-i cards. This is the most efficient and accurate method to import NASTRAN results for post-processing (visualization with feplot, normal model handling with nor2ss, ...) or parameterized model handling with upcom. Results in the .f06 text file (no longer supported).
Available commands are
Bulk file#
model=nasread('FileName','bulk') reads NASTRAN bulk files for nodes (grid points), element description matrix, material and element properties, and coordinate transformations, MPC, SPC, DMIG, SETS, ...
Use 'BulkNo' for a file with no BEGIN BULK card. Unsupported cards are displayed to let you know what was not read. You can omit the 'bulk' command when the file name has the .dat or .bdf extension.
Each row of the bas.bas output argument contains the description of a coordinate system.
The following table gives a partial conversion list. For an up to date table use nas2up('convlist')
NASTRAN | SDT |
CELAS1, CELAS2, RBAR | celas |
RBE2 | rigid |
RBE3 | rbe3 in Case |
CONROD | bar1 |
CBAR, CBEAM, CROD | beam1 |
CBUSH | cbush |
CSHEAR | quad4 |
CONM1, CONM2 | mass2 |
CHEXA | hexa8, hexa20 |
CPENTA | penta6, penta15 |
CTETRA | tetra4, tetra10 |
CTRIA3, CTRIAR | tria3 |
CTRIA6 | tria6 |
CQUAD4, CQUADR | quad4 |
CQUAD8 | quadb |
Details on properties are given under naswrite WritePLIL. NASTRAN Scalar points are treated as standard SDT nodes with the scalar DOF being set to DOF .01 (this has been tested for nodes, DMIG and MPC).
OUTPUT2 binary#
model=nasread('FileName','output2') reads output2 binary output format for tables, matrices and labels. You can omit the output2 command if the file names end with 2. The output model is a model data structure described in section 7.6. If deformations are present in the binary file, the are saved OUG(i) entries in the stack (see section 7.8). With no output argument, the result is shown in feplot.
Warning: do not use the FORM = FORMATTED in the eventual ASSIGN OUTPUT2 statement.
The optional out argument is a cell array with fields the following fields
.name | Header data block name (table, matrix) or label (label) |
.dname | Data block name (table, matrix) or NASTRAN header (label) |
.data | cell array with logical records (tables), matrix (matrix), empty (label) |
.trl | Trailer (7 integers) followed by record 3 data if any (for table and matrix), date (for label) |
Translation is provided for the following tables
GEOM1 | nodes with support for local coordinates and output of nodes in global coordinates |
GEOM2 | elements with translation to SDT model description matrix (see bulk command). |
GEOM4 | translates constraints (MPC, OMIT, SPC) and rigid links (RBAR, RBE1, RBE2, RBE3, RROD, ...) to SDT model description matrix |
GPDT | with use of GPL and CSTM to obtain nodes in global coordinates |
KDICT | reading of element mass (MDICT, MELM) and stiffness (KDICT, KELM) matrix dictionaries and transformation of a type 3 superelement handled by upcom. This is typically obtained from NASTRAN with PARAM,POST,-4. To choose the file name use Up.file='FileName';Up=nasread(Up,'Output2.op2'); |
MPT | material property tables |
OUG | transformation of shapes (modes, time response, static response, ...) as curve entries in the stack (possibly multiple if various outputs are requested). |
Note : by default deformations are in the SDT global coordinate system (basic in NASTRAN terminology). You may switch to output in the local (global in NASTRAN terminology) using PARAM,OUGCORD,GLOBAL. | |
To avoid Out of Memory errors when reading deformations, you can set use a smaller buffer sdtdef('OutOfCoreBufferSize',10) (in MB). When too large, def.def is left in the file and read as a v_handle object that lets you access deformations with standard indexing commands. Use def.def=def.def(:,:) to load all. | |
To get the deformation in the stack use calls of the form def=stack_get(model,'curve','OUG(1)','get') | |
OEE | tables of element energy |
OES | tables of element stresses or strains. |
This translation allows direct reading/translation of output generated with NASTRAN PARAM,POST commands simply using out=nasread('FileName.op2'). For model and modeshapes, use PARAM,POST,-1. For model and element matrices use PARAM,POST,-4 or PARAM,POST,-5 (see BuildUp command below).
BuildUp,BuildOrLoad#
A standard use of FEMLink is to import a model including element matrices to be used later with upcom. You must first run NASTRAN SOL103 with PARAM,POST,-4 to generate the appropriate .op2 file (note that you must include the geometry in the file, that is not use PARAM,OGEOM,NO). Assuming that you have saved the bulk file and the .op2 result in the same directory with the same name (different extension), then
Up=nasread('FileName.blk','buildup')
reads the bulk and .op2 file to generate a superelement saved in FileName.mat.
It is necessary to read the bulk because linear constraints are not saved in the .op2 file during the NASTRAN run. If you have no such constraints, you can read the .op2 only with Up=upcom('load FileName);Up=nasread(Up,'FileName.op2').
The BuildOrLoad command is used to generate the upcom file on the first run and simply load it if it already exists.
nasread('FileName.blk','BuildOrLoad') % result in global variable Up
OUTPUT4 binary#
out=nasread('FileName','output4') reads output4 binary output format for matrices (stiffness, mass, restitution matrices ...). The result out is a cell array containing matrix names and values stored as MATLAB sparse matrices.
All double precision matrix types are now supported. If you encounter any problem, ask for a patch which will be provided promptly.
Output4 text files are also supported with less performance and no support for non sequential access to data with the SDT v_handle object.
Supported options
-
-full : assumes that the matrix to be read should be stored as full (default sparse).
- -transpose : transpose data while reading.
- -hdf : save data in a hdf file. Reading is performed using buffer (sdtdef('OutOfCoreBufferSize',100) for a 100MB buffer). It is useful to overcome the 2GB limit on 32 bit Matlab: see sdthdf for details about how to build v_handle on hdf file.
In NASTRAN to generate matrices you should output to OP4 files. You should have a card to specify the output file ASSIGN INPUTT4='job_kv.op4',STATUS=NEW,UNIT=40,DELETE then in your DMAP alter OUTPUT4 KGG,MGG,,,//0/40/1 $ Output matrices
.f06 output (obsolete)#
ASCII reading in .f06 files is slow and often generates round-off errors. You should thus consider reading binary OUTPUT2 and OUTPUT4 files, which is now the only supported format. You may try reading matrices with nasread('FileName','matprt'), tables with nasread('F','tabpt') and real modes with
[vector,mdof]=nasread('filename','vectortype')
Supported vectors are displacement (displacement), applied load vector (oload) and grid point stress (gpstress).
See also