Include GEOM tables in output OP2 files

174 views
Skip to first unread message

Philip Moseley

unread,
Jan 13, 2021, 5:33:20 AM1/13/21
to pyNastran Discuss
Hey Steve,

First of all, thanks for all your work, we've been able to do some really interesting things with pyNastran!

But I'm having some compatibility issues with the OP2 files that I'm writing. Even with just a basic read_op2()/write_op2() script, I get an OP2 file that seems incomplete, and it doesn't work with all the same software as the original OP2.

Based on my testing, it seems like a pyNastran OP2 can be read in MSC Patran. But, I haven't been able to read it with MSC SimXpert, or Siemens NX, and it's only partially working in MSC Apex (new feature v2021).

At least one of the problems is that pyNastran doesn't write the geometry data back out to the OP2. Patran has the possibility to read the BDF for the geometry, and then attach the OP2 results to those nodes. But Apex, for example, requires both the model data and the results to be in the OP2 file.

When I turn on the debug statements while reading a Nastran OP2 file, I get the following tables:

DEBUG:   op2_scalar.py:629            set_subcases - subcases = []
DEBUG:   op2.py:562                   combine=True
DEBUG:   op2.py:563                   -------- reading op2 with read_mode=1 (array sizing) --------
INFO:    op2_scalar.py:1761           op2_filename = '.\\simulations\\simple_plates_nastran2021.op2'
DEBUG:   op2_reader.py:297            mode = 'msc'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM1'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM2'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM3'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM4'
DEBUG:   op2_scalar.py:1948             table_name=b'EPT'
DEBUG:   op2_scalar.py:1948             table_name=b'MPT'
DEBUG:   op2_scalar.py:1948             table_name=b'EDT'
DEBUG:   op2_scalar.py:1948             table_name=b'CASECC'
DEBUG:   op2_scalar.py:1948             table_name=b'CONTACT'
DEBUG:   op2_scalar.py:1948             table_name=b'OQG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OQMG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OUG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OGPFB1'
DEBUG:   op2_scalar.py:1948             table_name=b'OES1X1'
DEBUG:   op2_scalar.py:1948             table_name=b'OPG1'
DEBUG:   op2_scalar.py:1948             table_name=b'QUALINFO'
DEBUG:   op2_reader.py:1544           -100001 (AUXMID=0;AFPMID=0;DESITER=0;HIGHQUAL=0;PVALID=0;DESINC=0;DISCRETE=FALSE;MASSID=0;ARBMID=0;PARTNAME=' ';TRIMID=0;MODULE=0)  
DEBUG:   op2_reader.py:1544           -100000 (AUXMID=0;AFPMID=0;DESITER=0;HIGHQUAL=0;PVALID=0;DESINC=0;ARBMID=0;PARTNAME=' ';DISCRETE=FALSE;TRIMID=0)
DEBUG:   op2_reader.py:1544            -99999 (AUXMID=0;AFPMID=0;HIGHQUAL=0;PVALID=0;DESINC=0;PRESEQP=FALSE;ARBMID=0;PARTNAME=' ';TRIMID=0;FLXBDYID=0;DFPHASE=' ')
DEBUG:   op2_reader.py:1544            -99998 (AUXMID=0;AFPMID=0;DESITER=0;HIGHQUAL=0;DESINC=0;DISCRETE=FALSE;ARBMID=0;MASSID=0;PARTNAME=' ';TRIMID=0)
DEBUG:   op2_reader.py:1544            -99997 (ISOLAPP=1;HIGHQUAL=0;AUXMID=0;PARTNAME=' ')
DEBUG:   op2_reader.py:1544              1519 (HIGHQUAL=0;AUXMID=0;DESINC=0;PARTNAME=' ')
DEBUG:   op2_reader.py:1544              1520 (SEID=0;PEID=0;APRCH=' ';QCPLD=' ';HIGHQUAL=0;AUXMID=0;DESINC=0;PARTNAME=' ';MODULE=0)
DEBUG:   op2_reader.py:1544              1531 (PEID=0;DESITER=0;PVALID=0;NL99=0;APRCH=' ';QCPLD=' ';HIGHQUAL=0;AUXMID=0;DESINC=0;DISCRETE=FALSE;MASSID=0;PARTNAME=' ';MODULE=0)
DEBUG:   op2_reader.py:1544              1586 (SEID=0;PEID=0;MTEMP=0;DESITER=0;PVALID=0;APRCH=' ';QCPLD=' ';HIGHQUAL=0;P2G=' ';K2GG=' ';M2GG=' ';DELTA=FALSE;AUXMID=0;BNDSHP=FALSE;ADJOINT=FALSE;DESINC=0;DISCRETE=FALSE;CASEF06=' ';ISOLAPP=1;SUBCID=0;OSUBID=1;STEPID=0;RGYRO=0;PARTNAME=' ';SSTEPID=0;MODULE=0)
DEBUG:   op2.py:582                   -------- reading op2 with read_mode=2 (array filling) --------
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM1'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM2'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM3'
DEBUG:   op2_scalar.py:1948             table_name=b'GEOM4'
DEBUG:   op2_scalar.py:1948             table_name=b'EPT'
DEBUG:   op2_scalar.py:1948             table_name=b'MPT'
DEBUG:   op2_scalar.py:1948             table_name=b'EDT'
DEBUG:   op2_scalar.py:1948             table_name=b'CASECC'
DEBUG:   op2_scalar.py:1948             table_name=b'CONTACT'
DEBUG:   op2_scalar.py:1948             table_name=b'OQG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OQMG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OUG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OGPFB1'
DEBUG:   op2_scalar.py:1948             table_name=b'OES1X1'
DEBUG:   op2_scalar.py:1948             table_name=b'OPG1'
DEBUG:   op2_scalar.py:1948             table_name=b'QUALINFO'
DEBUG:   op2.py:869                   combine_results
DEBUG:   op2.py:595                   finished reading op2

And if I do the same for the same model with the pyNastran OP2, I only get:
DEBUG:   op2_scalar.py:629            set_subcases - subcases = []
DEBUG:   op2.py:562                   combine=True
DEBUG:   op2.py:563                   -------- reading op2 with read_mode=1 (array sizing) --------
INFO:    op2_scalar.py:1761           op2_filename = '.\\test_simple_out--2021.op2'
DEBUG:   op2_reader.py:297            mode = 'msc'
DEBUG:   op2_scalar.py:1948             table_name=b'OUG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OQG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OQMG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OPG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OES1X1'
DEBUG:   op2_scalar.py:1948             table_name=b'OGPFB1'
DEBUG:   op2.py:582                   -------- reading op2 with read_mode=2 (array filling) --------
DEBUG:   op2_scalar.py:1948             table_name=b'OUG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OQG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OQMG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OPG1'
DEBUG:   op2_scalar.py:1948             table_name=b'OES1X1'
DEBUG:   op2_scalar.py:1948             table_name=b'OGPFB1'
DEBUG:   op2.py:869                   combine_results
DEBUG:   op2.py:595                   finished reading op2

All that to say, is there a way to also export the GEOM1-4 tables, and maybe the other "missing" tables as well? Ideally, it would be possible to export an OP2 from pyNastran that's identical to the input OP2.

Thanks!
Philip

Steven Doyle

unread,
Jan 13, 2021, 12:31:40 PM1/13/21
to pyNastran Discuss
Philip,

Thanks!  Glad you like it!  That's always nice to hear!

That question keeps coming up, so maybe it's a sign :)  It's probably time to make a more common read_op2 method that does both with a flag...

The read_op2 method reads results and matrices.  It does not read geometry.  The read_op2_geom method reads geometry.  So:
    from pyNastran.op2.op2_geom import read_op2_geom
    model = read_op2_geom(op2_filename)

The other thing you mentioned is you cannot exactly write the same op2.  So only 32-bit writing is supported at the moment (not typically a huge issue unless you have large IDs).  The other thing that complicates things is there are multiple types of say GRID tables due to the variations in how the table is written (e.g., 32/64 bit or mixed 32/64 bit) that is just ignored that's based on whether the model is nonlinear or not.  The various Nastran's also drift over time, so a card like the PCOMP is not written in the same way as it used to be.  That could be flagged, but it's not.

Give it a shot though.  I would assume it a bug in Apex if they couldn't read an MSC Nastran deck from 5 years ago.  If it is an issue, I need a small example (e.g., 1 element) and it shouldn't be too hard to figure out the source of the issue.  I just don't have Apex/modern Patran, so that makes it harder.

Also, does anybody know what the QUALINFO table means and if it's useful?  It's clearly basic solution info that'd you'd also see at the bottom of the F06, but it doesn't follow an obvious pattern (e.g., same parameters in each row).

Steve

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynastran-discuss/6b21f294-2a12-4c4a-a2a1-f93ba17a3a72n%40googlegroups.com.

Philip Moseley

unread,
Jan 17, 2021, 11:45:12 AM1/17/21
to pyNastran Discuss
Hey Steve,

I've been playing around with the read_op2_geom() command, but I'm still having trouble getting pyNastran to write an OP2 that includes both the geometry and the results.

I've been trying lines like:
    model = read_op2_geom(inp_file, include_results=['stress','strain','displacements'])
    model.write_op2(out_file)

But I'm still not able to get MSC software to read these pyNastran OP2s correctly. Patran gives me the following log when I try to use the "Read Output2" file command with "Both Model Data and Result Entities":
Capture d’écran 2021-01-17 172954.png

I was able to exchange a few emails with an MSC Apex developer, they told me that Apex uses the same import code as Patran. But it seems like maybe MSC Apex is converting the file to an HDF format, and then importing it. I get the following error for the same pyNastran OP2 file:
Capture d’écran 2021-01-17 173307.png
At least for the simple single-element problem, Apex manages to import the mesh, but it can't import the subcases, and therefore can't access the results.

Maybe I'm using the read_op2_geom() command incorrectly? Or should I somehow be using both the read_op2() and read_op2_geom()? I've attached an example BDF/OP2 from Nastran 2020, with a single 3D element, in case it can be useful to you. Let me know if you have any ideas that I can test!

Thanks,
Philip
single_element--3d.zip

Steven Doyle

unread,
Jan 17, 2021, 12:42:49 PM1/17/21
to pyNastran Discuss
Philip,

>  But it seems like maybe MSC Apex is converting the file to an HDF format, and then importing it. I get the following error for the same pyNastran OP2 file: 

I think you're right; there are definitely transforming it to the HDF5 structure.  I think your issue is in your Apex message.  Subcase info is dropped when writing the OP2.  An attempt will be made to read it, but there are ~200 flags that aren't documented well (that also change based on the version of MSC Nastran).

I'lll give it a shot, but it's going to take me at least a few days.
Steve

Cean Wang

unread,
Aug 3, 2023, 10:58:15 PM8/3/23
to pynastra...@googlegroups.com

I am playing with OP2 and found this post. I tried read_op2_geom() command. I got an error:

Look at the op2 file with a HEX editor, it shows after the NASTRAN_VERSION which is XXXXXXXX, they added one more version section which is 2020 0 0 before the record end (FF FF FF FF)

 

Sent from Mail for Windows

 

From: Philip Moseley
Sent: Monday, January 18, 2021 3:45 AM
To: pyNastran Discuss
Subject: Re: Include GEOM tables in output OP2 files

 

Hey Steve,

 

I've been playing around with the read_op2_geom() command, but I'm still having trouble getting pyNastran to write an OP2 that includes both the geometry and the results.

 

I've been trying lines like:

    model = read_op2_geom(inp_file, include_results=['stress','strain','displacements'])

    model.write_op2(out_file)

 

But I'm still not able to get MSC software to read these pyNastran OP2s correctly. Patran gives me the following log when I try to use the "Read Output2" file command with "Both Model Data and Result Entities":

 

I was able to exchange a few emails with an MSC Apex developer, they told me that Apex uses the same import code as Patran. But it seems like maybe MSC Apex is converting the file to an HDF format, and then importing it. I get the following error for the same pyNastran OP2 file:

Steven Doyle

unread,
Aug 4, 2023, 1:29:29 AM8/4/23
to pynastra...@googlegroups.com
That doesn't seem related to the previous question on hdf5.  Please make a new question. Also, I probably need a small example,

Cean Wang

unread,
Aug 4, 2023, 9:47:48 AM8/4/23
to pynastra...@googlegroups.com

I am using pyNastran to read the single_element--3d.zip he provided. I think it was made with Apex. pyNastran can’t read the extra  section - 2020 0 0. In the other way, OP2 generated by pyNastran doesn’t has this extra section, so Apex can’t read it. No idea about hdf5, it looks not too much format change.

 

Sent from Mail for Windows

 

From: Steven Doyle
Sent: Friday, August 4, 2023 3:29 PM
To: pynastra...@googlegroups.com
Subject: Re: Include GEOM tables in output OP2 files

 

That doesn't seem related to the previous question on hdf5.  Please make a new question. Also, I probably need a small example,

 

On Thu, Aug 3, 2023 at 7:58 PM Cean Wang <cean...@gmail.com> wrote:

I am playing with OP2 and found this post. I tried read_op2_geom() command. I got an error:

Look at the op2 file with a HEX editor, it shows after the NASTRAN_VERSION which is XXXXXXXX, they added one more version section which is 2020 0 0 before the record end (FF FF FF FF)

 

Sent from Mail for Windows

 

From: Philip Moseley
Sent: Monday, January 18, 2021 3:45 AM
To: pyNastran Discuss
Subject: Re: Include GEOM tables in output OP2 files

 

Hey Steve,

 

I've been playing around with the read_op2_geom() command, but I'm still having trouble getting pyNastran to write an OP2 that includes both the geometry and the results.

 

I've been trying lines like:

    model = read_op2_geom(inp_file, include_results=['stress','strain','displacements'])

    model.write_op2(out_file)

 

But I'm still not able to get MSC software to read these pyNastran OP2s correctly. Patran gives me the following log when I try to use the "Read Output2" file command with "Both Model Data and Result Entities":

 

I was able to exchange a few emails with an MSC Apex developer, they told me that Apex uses the same import code as Patran. But it seems like maybe MSC Apex is converting the file to an HDF format, and then importing it. I get the following error for the same pyNastran OP2 file:

At least for the simple single-element problem, Apex manages to import the mesh, but it can't import the subcases, and therefore can't access the results.

Steven Doyle

unread,
Aug 5, 2023, 1:30:05 AM8/5/23
to pynastra...@googlegroups.com
Cean,

That makes more sense.

I don't know which version you're using, but try the version on github.  It works and the single_element case is a test problem.  I'm super busy and don't have a lot of time, so I'm not sure when the next official version will be released..

Steve

Reply all
Reply to author
Forward
0 new messages