Skip to content

Reading results with superelements and subcases #847

@djagodzinski

Description

@djagodzinski

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_gridtype in _read_complex_table_sort1_mag() in op2_common.py (Line 1325)
    nids and gridtype arrays are length 5, while obj.node_gridtype has 4 rows (nids and gridtype arrays appear correct)

  • obj.node_gridtype is set in build_data() in table_object.py (Line 371)
    The number of rows in node_gridtype is determined by the nnodes parameter

  • nnodes is computed by get_sort_node_sizes() in build in table_object.py (Line 341)
    self._nnodes and self.ntimes determines the nndoes value

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

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