SteveDoyle2 / pyNastran

A Python-based interface tool for Nastran's file formats
Other
385 stars 148 forks source link

Read XSOP2DIR for external superelements, error with table name length #718

Open rico500 opened 1 year ago

rico500 commented 1 year ago

Hi!

First of all, pynastran is an awesome tool! Thanks for sharing it with the world.

I've been using it regularly to read modal and frequency response results, which has always worked like a charm. But I'm hitting a roadblock now when attempting to read external superelements from op2 format.

Attached is a basic job demonstrating the issue. job.zip

The error thrown by

from pyNastran.op2.op2 import OP2

this_op2=OP2(debug_file='f.txt')
this_op2.read_op2(r"./91_Dummy4_SEEXT_seid_01.op2")

is image

The log file states :

read_mode = 1 (vectorized; 1st pass)
marker = 2 -> PARAM,POST,-2?
_read_table_name - rewind=True
get_nmarkers- [4, 0, 4]; macro_rewind=True
read_record - marker = [4, 2, 4]; macro_rewind=True
read_record - record = [8, recordi, 8]; macro_rewind=True
--------------------------------------------------------------------------------
table_name = b'XSOP2DIR'
_read_table_name - rewind=False
get_nmarkers- [4, 0, 4]; macro_rewind=False
marker = [4, 2, 4]
table_header = [8, b'XSOP2DIR', 8]

  read_markers -> [4, -1, 4]
get_nmarkers- [4, 0, 4]; macro_rewind=False
read_record - marker = [4, 7, 4]; macro_rewind=False
read_record - record = [28, recordi, 28]; macro_rewind=False
  read_markers -> [4, -2, 4]
  read_markers -> [4, 1, 4]
  read_markers -> [4, 0, 4]
get_nmarkers- [4, 0, 4]; macro_rewind=False
read_record - marker = [4, 2, 4]; macro_rewind=False
read_record - record = [8, recordi, 8]; macro_rewind=False
  read_markers -> [4, -3, 4]
  read_markers -> [4, 1, 4]
  read_markers -> [4, 0, 4]
get_nmarkers- [4, 0, 4]; macro_rewind=False
read_record - marker = [4, 4, 4]; macro_rewind=False
read_record - record = [16, recordi, 16]; macro_rewind=False
--------------------------------------------------------------------------------
f.tell()=224
done...

The hiccup happens on line 347 of op2_reader.py in function read_xsop2dir because the second table name (the first being "XSOP2DIR") has a length of 16 bytes instead of the expected 8 ("GEOM1X XXXXXXXX" instead of "GEOM1X " is suppose.). This has been verified for SE op2 files generated by Nastran MSC 2008.0 and 2018.2. All the following table names seem to maintain this same pattern of trailing Xs to pad the char array up to 16 bytes.

What I'm trying to extract are the MATM, MATK and MATK4 superelement matrices as well as the MUG1B (displacement) and MEF1 (force) translation tables.

Thank you!

SteveDoyle2 commented 1 year ago

Do you have the op2? Access to running nastran is far more difficult now.

rico500 commented 1 year ago

Here are the results. The SE is in _91_Dummy4_SEEXT_seid01.op2

job_results.zip