Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed reading b'ONRGY1' isubtable=-4 #714

Open
tjc0726 opened this issue Nov 22, 2022 · 2 comments
Open

failed reading b'ONRGY1' isubtable=-4 #714

tjc0726 opened this issue Nov 22, 2022 · 2 comments

Comments

@tjc0726
Copy link

tjc0726 commented Nov 22, 2022

This op2 created by optistruct cannot be read correctly,same model computed and outputted by Nastran can be read properly,why does this happen,thanks!

change .txt to .op2
A.txt

model here
change .txt to .bdf
A.txt

model = OP2()
model.read_op2('A.op2')

DEBUG: op2.py:542 combine=True
DEBUG: op2.py:543 -------- reading op2 with read_mode=1 (array sizing) --------
INFO: op2_scalar.py:1672 op2_filename = 'A.op2'
DEBUG: op2_reader.py:239 date = (11, 22, 22)
DEBUG: op2_reader.py:310 mode = 'optistruct'
DEBUG: op2_scalar.py:1850 table_name=b'CASECC'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM1S'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM2S'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM3S'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM4S'
DEBUG: op2_scalar.py:1850 table_name=b'EPTS'
DEBUG: op2_scalar.py:1850 table_name=b'MPTS'
DEBUG: op2_scalar.py:1850 table_name=b'OUGV1'
DEBUG: op2_scalar.py:1850 table_name=b'ONRGY1'
DEBUG: op2_scalar.py:1850 table_name=b'OES1X'
DEBUG: op2_scalar.py:1850 table_name=b'OSTR1X'
DEBUG: op2_scalar.py:1850 table_name=b'OQG1'
DEBUG: op2.py:562 -------- reading op2 with read_mode=2 (array filling) --------
DEBUG: op2_reader.py:239 date = (11, 22, 22)
DEBUG: op2_reader.py:310 mode = 'optistruct'
DEBUG: op2_scalar.py:1850 table_name=b'CASECC'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM1S'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM2S'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM3S'
DEBUG: op2_scalar.py:1850 table_name=b'GEOM4S'
DEBUG: op2_scalar.py:1850 table_name=b'EPTS'
DEBUG: op2_scalar.py:1850 table_name=b'MPTS'
DEBUG: op2_scalar.py:1850 table_name=b'OUGV1'
DEBUG: op2_scalar.py:1850 table_name=b'ONRGY1'
failed reading b'ONRGY1' isubtable=-4

AssertionError Traceback (most recent call last)
Input In [6], in <cell line: 2>()
1 model = OP2()
----> 2 model.read_op2('A.op2')

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2.py:564, in OP2.read_op2(self, op2_filename, combine, build_dataframe, skip_undefined_matrices, encoding)
562 self.log.debug('-------- reading op2 with read_mode=2 (array filling) --------')
563 _create_hdf5_info(self.op2_reader.h5_file, self)
--> 564 OP2_Scalar.read_op2(self, op2_filename=self.op2_filename, mode=mode)
565 except FileNotFoundError:
566 raise

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2_interface/op2_scalar.py:1704, in OP2_Scalar.read_op2(self, op2_filename, combine, load_as_h5, h5_file, mode)
1700 raise FatalError('There was a Nastran FATAL Error. Check the F06.\n'
1701 'No tables exist...check for a license issue')
1703 self._make_tables()
-> 1704 table_names = self._read_tables(table_name)
1706 self.close_op2(force=False)
1707 #self.remove_unpickable_data()

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2_interface/op2_scalar.py:1870, in OP2_Scalar._read_tables(self, table_name)
1868 op2_reader.read_matrix(table_name)
1869 elif table_name in RESULT_TABLES:
-> 1870 op2_reader.read_results_table()
1871 elif self.skip_undefined_matrices:
1872 op2_reader.read_matrix(table_name)

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2_interface/op2_reader.py:4917, in OP2Reader.read_results_table(self)
4915 """Reads a results table"""
4916 if self.size == 4:
-> 4917 self.read_results_table4()
4918 else:
4919 self.read_results_table8()

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2_interface/op2_reader.py:4940, in OP2Reader.read_results_table4(self)
4938 subtable_name = self.get_subtable_name4(op2, data, ndata)
4939 op2.subtable_name = subtable_name
-> 4940 self._read_subtables()

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2_interface/op2_reader.py:5140, in OP2Reader._read_subtables(self)
5137 self.binary_debug.write(f'***isubtable = {op2.isubtable:d}\n')
5139 try:
-> 5140 self._read_subtable_3_4(table3_parser, table4_parser, passer)
5141 except Exception: # pragma: no cover
5142 print(f'failed reading {table_name} isubtable={op2.isubtable:d}')

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/op2_interface/op2_reader.py:5270, in OP2Reader._read_subtable_3_4(self, table3_parser, table4_parser, passer)
5266 else:
5267 if hasattr(op2, 'num_wide'):
5268 # num_wide is the result size and is usually found in
5269 # table3, but some B-list tables don't have it
-> 5270 unused_n = op2._read_subtable_results(table4_parser, record_len)
5271 else:
5272 data, ndata = self._read_record_ndata()

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/fortran_format.py:82, in FortranFormat._read_subtable_results(self, table4_parser, record_len)
79 self.ntotal = 0
81 data, ndata = op2_reader._read_record_ndata()
---> 82 n = table4_parser(data, ndata)
83 assert isinstance(n, integer_types), self.table_name
85 self._reset_vector_counter()

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/tables/oee_energy/onr.py:429, in ONR._read_onr1_4(self, data, ndata)
427 msg = 'table_name=%s table_code=%s' % (self.table_name, self.table_code)
428 raise NotImplementedError(msg)
--> 429 n = self._read_element_strain_energy(data, ndata)
430 else:
431 raise NotImplementedError(self.table_code)

File ~/.local/lib/python3.10/site-packages/pyNastran/op2/tables/oee_energy/onr.py:500, in ONR._read_element_strain_energy(self, data, ndata)
498 ints = np.frombuffer(data, dtype=self.idtype8).reshape(nelements, 4)
499 eids = ints[:, 0] // 10
--> 500 assert eids.min() > 0, f'etype={self.element_name} isubtable={self.isubtable} eids.min()={eids.min()}'
501 obj.element[itime, ielement:ielement2] = eids
503 #[energy, percent, density]

AssertionError: etype=CQUAD4 isubtable=-4 eids.min()=0

@SteveDoyle2
Copy link
Owner

Yeah...Optistruct has a really good op2 writer, but this table isn't done right. It's gonna take me a bit.

@SteveDoyle2
Copy link
Owner

i still need to make tests, but optistruct's strain energy is now supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants