Skip to content

Reading OP2 files #46

@djagodzinski

Description

@djagodzinski

Hi @twmacro,

I am having trouble reading in data from OP2 files, such as elastic strain energy (EKE). It appears pyyeti has functionality built in, where I could read this data without having to use the DMAP. Does pyyeti support reading in generic data from OP2 files without the DMAP? Below is a summary of what I am seeing.

>>> o2 = op2.OP2("<file path>.op2")
>>> print(o2.dbdct.keys())
dict_keys(['PVT0', 'CASECC', 'GEOM1S', 'GEOM2S', 'GEOM4S', 'EPTS', 'MPTS', 'DYNAMICS', 'BGPDTS', 'EQEXINS', 'OGPWG', 'EFMFSMS', 'EFMASSS', 'RBMASSS', 'EFMFACS', 'MPFACS', 'MEFMASS', 'MEFWTS', 'LAMA', 'OUGV1', 'ONRGY1', 'OEKE1', 'ONRGY2'])
>>>
>>> o2.set_position('ONRGY1')
45800
>>> name, trailer, rectype = o2.rdop2nt()
>>> temp = o2.rdop2matrix(trailer)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<...>\venv\Lib\site-packages\pyyeti\nastran\op2.py", line 559, in rdop2matrix
    matrix[r : r + n, col] = struct.unpack(
    ~~~~~~^^^^^^^^^^^^^^^^
ValueError: could not broadcast input array from shape (72,) into shape (0,)

I can see why rdop2matrix() gets tripped up because the trailer entry has a 0 for its 3rd entry (index 2).

>>> o2.dbdct['ONRGY1'][0]         
namespace(name='ONRGY1', start=45800, stop=58880, nbytes=13079, dbtype=0, size=(0, 0), trailer=(101, 10, 0, 0, 0, 2, 0), headers=[[(22, 18, 1197994693), 584], [(1012, 1150488744, 1073585648), 592], [(22, 18, 1212777119), 584], [(1012, 1167000431, 1074655500), 592], [(22, 18, 1212777119), 584], [(1012, 1176212073, 1083860973), 592], [(22, 18, 1217449303), 584], [(1012, 1166939440, 1069825658), 592], [(22, 18, 1231060748), 584], [(1012, 1190678199, 1079850632), 592], [(22, 18, 1233267819), 584], [(1012, 1195726125, 1083676561), 592], [(22, 18, 1236752431), 584], [(1012, 1191443824, 1074789111), 592], [(22, 18, 1236752431), 584], [(1012, 1200825604, 1084261114), 592], [(22, 18, 1238470447), 584], [(1012, 1187995039, 1069934606), 592], [(22, 18, 1238470447), 584], [(1012, 1192067592, 1074204042), 592]])

Thank you,
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions