Reading results with superelements and subcases
Hi Steve,
I came across something that may be a bug. I am getting an error using the op2.read_op2() method to open an .op2 file with the results of a frequency response analysis with super elements and several subcases. I have a similar .op2 file with super elements but without subcases, and it opened without issue so I think it's a subcase thing.
Stack trace:
INFO: op2_scalar.py:1963 op2_filename = WindowsPath('<Path>/tests/01_raw_data/baseline_cb_sine_subcases.op2')
failed reading b'OUGV1' isubtable=-4
Traceback (most recent call last):
File "<Path>\test.py", line 10, in <module>
temp = read_op2_results(r"<Path>\tests\01_raw_data\baseline_cb_sine_subcases.op2", "tonne-mm-s")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Path>\src\<module>\read_op2_results.py", line 270, in read_op2_results
op2.read_op2(file_name, build_dataframe=True, combine=False)
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2.py", line 612, in read_op2
OP2_Scalar.read_op2(self, op2_filename=self.op2_filename, mode=mode)
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_scalar.py", line 1998, in read_op2
self._read_tables(table_name, table_names)
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_scalar.py", line 2194, in _read_tables
op2_reader.read_results_table()
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 3510, in read_results_table
self.read_results_table4()
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 3535, in read_results_table4
self._read_subtables()
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 3751, in _read_subtables
self._read_subtable_3_4(table3_parser, table4_parser, passer)
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 3921, in _read_subtable_3_4
unused_n = op2._read_subtable_results(table4_parser, record_len)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Path>\venv\Lib\site-packages\pyNastran\op2\fortran_format.py", line 148, in _read_subtable_results
n = table4_parser(data, ndata)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Path>\venv\Lib\site-packages\pyNastran\op2\tables\oug\oug.py", line 717, in _read_oug_4
n = self._read_oug_acceleration(data, ndata)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Path>\venv\Lib\site-packages\pyNastran\op2\tables\oug\oug.py", line 962, in _read_oug_acceleration
n = op2._read_table_vectorized(data, ndata, result_name, storage_obj,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_common.py", line 851, in _read_table_vectorized
n = self._read_complex_table_sort1_mag(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<Path>\venv\Lib\site-packages\pyNastran\op2\op2_interface\op2_common.py", line 1325, in _read_complex_table_sort1_mag
obj.node_gridtype[obj.itotal:itotal2, 0] = nids
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not broadcast input array from shape (5,) into shape (4,)
I tried to trace the error and think I found perhaps a lead. Here's my notes:
-
Crash occurs when setting
obj.node_gridtypein_read_complex_table_sort1_mag()inop2_common.py(Line 1325)nidsandgridtypearrays are length 5, whileobj.node_gridtypehas 4 rows (nidsandgridtypearrays appear correct) -
obj.node_gridtypeis set inbuild_data()intable_object.py(Line 371) The number of rows innode_gridtypeis determined by thennodesparameter -
nnodesis computed byget_sort_node_sizes()in build intable_object.py(Line 341)self._nnodesandself.ntimesdetermines thenndoesvalue
I believe self._nnodes isn't being set properly for some reason. Its value is 136 but would need to be 170 for the correct number of nodes to be determined.
Path to example op2 file: https://drive.google.com/file/d/1LZQ1y4XFV1sUtuiQ1608RUFX0WiMAiQH/view?usp=sharing
Any help would be greatly appreciated.
Thank you, Daniel
I've seen these, but don't understand them. There's a superelement tag, so each static/frequency result should be fine. You'll get a weird key that has the analysis code (statics/modal/frequency/transient), sort method (1/2), superelement name and a few other things, but at least it'll work. Do you have the BDF/F06 associated with that or can you create a simplified version?
I'd guess you're doing something weird in your deck. You can create separate superelement results for say an axisymmetric section (e.g., n=36 10 degree slices made of shell elements).
Hi Steve,
Here's the .f06 and .dat files: .f06: https://drive.google.com/file/d/1xWi_JFaO2V8Mgkfsngbzy573uT8Qe5DR/view?usp=sharing .dat: https://drive.google.com/file/d/1ZuaITbO0itAijpLrMX0nOMgRGK3FG7xS/view?usp=sharing
Just wanted to add, if I remove one of the subcases, it runs fine. I think it's when there is more than one subcase that there are problems with reading the op2. Also, I can read the multi subcase op2 file with IMAT so I don't think it's an issue with the run deck.
Let me know if this is sufficient or if I need to provide something else.
Thanks, Daniel
Can you attach the f06 with PRINT on all the requests (e..g, DISP(PLOT,PRINT)=ALL).
Also the dat file does not include the INCLUDEs./asm files. I'm trying to look at the model to see how things are being done and why it's an issue.
Hi guys,
I had the same issue - FEM with a superelement and 3 subcases of frequency response analysis. If I removed 1 subcase the op2 could be loaded fine with pyNastran but with 3 subcases I got the "could not broadcast input array from shape" error.
What solved the issue for me was to copy the exact case control commands from the "main" case to all the subcases. This way the op2 loads into pyNastran without any error.