SteveDoyle2 / pyNastran

A Python-based interface tool for Nastran's file formats
Other
384 stars 147 forks source link

not able to read CTETRA Stress from OP2 for 30e6 elements #755

Closed Cdribusch closed 6 months ago

Cdribusch commented 6 months ago

Hi, I was very excited to use this library to read stress results for CTETRA elements for static simulations and export them to a format that Matlab can read. I'm having no issues on smaller test problems, but it just won't work on the actual problem that has 30 million elements. 7 million, no problem. Is there some kind of hard limit on the number of elements? RAM shouldn't be an issue. I'm very new to Python, and have no idea how to interpret the error below. This is using the latest version available on github (pyNastran-1.4.0+dev.08931759d), but I get the same error with the latest release. I would love to help figure this out. This is the code that I use:

import pyNastran import os from pyNastran.op2.op2 import OP2 op2_filename = "D:\staticReduction_24_02_08_11_23_04_63C.op2" h5_filename = "D:\staticReduction_24_02_08_11_23_04_63C.h5" model = OP2() model.read_op2(op2_filename) model.export_hdf5_filename(h5_filename)

Output/Error Message:

Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.

============================ RESTART: D:\testOP2.py ============================ DEBUG: op2.py:580 combine=True DEBUG: op2.py:581 -------- reading op2 with read_mode=1 (array sizing) -------- INFO: op2_scalar.py:1961 op2_filename = 'D:\staticReduction_24_02_08_11_23_04_63C.op2' DEBUG: op2_reader.py:301 date = (2, 10, 24) DEBUG: op2_reader.py:379 mode='nx' version='12.0.2' DEBUG: op2_scalar.py:2170 table_name=b'PVT0' (PARAM cards) DEBUG: op2_scalar.py:2170 table_name=b'CASECC' (case control) DEBUG: op2_scalar.py:2170 table_name=b'EQEXINS' (internal/external ids (superelement)) DEBUG: op2_reader.py:650 eqexin idata=(101, 6792902, 0, 0, 0, 0, 0) DEBUG: op2_scalar.py:2170 table_name=b'OGPWG' (grid point weight) DEBUG: op2_scalar.py:2170 table_name=b'OES1X1' (nonlinear stress) DEBUG: op2.py:600 -------- reading op2 with read_mode=2 (array filling) -------- DEBUG: op2_reader.py:301 date = (2, 10, 24) DEBUG: op2_scalar.py:2170 table_name=b'PVT0' (PARAM cards) DEBUG: op2_scalar.py:2170 table_name=b'CASECC' (case control) DEBUG: op2_scalar.py:2170 table_name=b'EQEXINS' (internal/external ids (superelement)) DEBUG: op2_reader.py:650 eqexin idata=(101, 6792902, 0, 0, 0, 0, 0) DEBUG: op2_scalar.py:2170 table_name=b'OGPWG' (grid point weight) DEBUG: op2_scalar.py:2170 table_name=b'OES1X1' (nonlinear stress) failed reading b'OES1X1' isubtable=-4 Traceback (most recent call last): File "D:\testOP2.py", line 26, in model.read_op2(op2_filename) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2.py", line 603, in read_op2 OP2_Scalar.read_op2(self, op2_filename=self.op2_filename, mode=mode) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_scalar.py", line 1996, in read_op2 self._read_tables(table_name, table_names) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_scalar.py", line 2192, in _read_tables op2_reader.read_results_table() File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 6770, in read_results_table self.read_results_table4() File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 6795, in read_results_table4 self._read_subtables() File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 7005, in _read_subtables self._read_subtable_3_4(table3_parser, table4_parser, passer) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 7175, in _read_subtable_3_4 unused_n = op2._read_subtable_results(table4_parser, record_len) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\fortran_format.py", line 148, in _read_subtable_results n = table4_parser(data, ndata) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 408, in _read_oes1_4 n = self._read_oes_4_sort(data, ndata) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 659, in _read_oes_4_sort n = self._read_oes1_loads(data, ndata) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 1605, in _read_oes1_loads n, nelements, ntotal = self._oes_csolid(data, ndata, dt, is_magnitude_phase, File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 2931, in _oes_csolid assert eids.min() > 0, eids.min() AssertionError: 0

SteveDoyle2 commented 6 months ago

I’ve never run that high, but it should work. It should be a 64 bit across the whole file and maybe it’s not? What generated the model?

On Mon, Feb 12, 2024 at 17:21 Cdribusch @.***> wrote:

Hi, I was very excited to use this library to read stress results for CTETRA elements for static simulations and export them to a format that Matlab can read. I'm having no issues on smaller test problems, but it just won't work on the actual problem that has 30 million elements. 7 million, no problem. Is there some kind of hard limit on the number of elements? RAM shouldn't be an issue. I'm very new to Python, and have no idea how to interpret the error below. This is using the latest version available on github (pyNastran-1.4.0+dev.08931759d), but I get the same error with the latest release. I would love to help figure this out. This is the code that I use:

import pyNastran import os from pyNastran.op2.op2 import OP2 op2_filename = "D:\staticReduction_24_02_08_11_23_04_63C.op2" h5_filename = "D:\staticReduction_24_02_08_11_23_04_63C.h5" model = OP2() model.read_op2(op2_filename) model.export_hdf5_filename(h5_filename)

Output/Error Message:

Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.

============================ RESTART: D:\testOP2.py

DEBUG: op2.py:580 combine=True DEBUG: op2.py:581 -------- reading op2 with read_mode=1 (array sizing)

INFO: op2_scalar.py:1961 op2_filename = 'D:\staticReduction_24_02_08_11_23_04_63C.op2' DEBUG: op2_reader.py:301 date = (2, 10, 24) DEBUG: op2_reader.py:379 mode='nx' version='12.0.2' DEBUG: op2_scalar.py:2170 table_name=b'PVT0' (PARAM cards) DEBUG: op2_scalar.py:2170 table_name=b'CASECC' (case control) DEBUG: op2_scalar.py:2170 table_name=b'EQEXINS' (internal/external ids (superelement)) DEBUG: op2_reader.py:650 eqexin idata=(101, 6792902, 0, 0, 0, 0, 0) DEBUG: op2_scalar.py:2170 table_name=b'OGPWG' (grid point weight) DEBUG: op2_scalar.py:2170 table_name=b'OES1X1' (nonlinear stress) DEBUG: op2.py:600 -------- reading op2 with read_mode=2 (array filling)

DEBUG: op2_reader.py:301 date = (2, 10, 24) DEBUG: op2_scalar.py:2170 table_name=b'PVT0' (PARAM cards) DEBUG: op2_scalar.py:2170 table_name=b'CASECC' (case control) DEBUG: op2_scalar.py:2170 table_name=b'EQEXINS' (internal/external ids (superelement)) DEBUG: op2_reader.py:650 eqexin idata=(101, 6792902, 0, 0, 0, 0, 0) DEBUG: op2_scalar.py:2170 table_name=b'OGPWG' (grid point weight) DEBUG: op2_scalar.py:2170 table_name=b'OES1X1' (nonlinear stress) failed reading b'OES1X1' isubtable=-4 Traceback (most recent call last): File "D:\testOP2.py", line 26, in model.read_op2(op2_filename) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2.py", line 603, in read_op2 OP2_Scalar.read_op2(self, op2_filename=self.op2_filename, mode=mode) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_scalar.py", line 1996, in read_op2 self._read_tables(table_name, table_names) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_scalar.py", line 2192, in _read_tables op2_reader.read_results_table() File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 6770, in read_results_table self.read_results_table4() File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 6795, in read_results_table4 self._read_subtables() File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 7005, in _read_subtables self._read_subtable_3_4(table3_parser, table4_parser, passer) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\op2_interface\op2_reader.py", line 7175, in _read_subtable_3_4 unused_n = op2._read_subtable_results(table4_parser, record_len) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\fortran_format.py", line 148, in _read_subtable_results n = table4_parser(data, ndata) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 408, in _read_oes1_4 n = self._read_oes_4_sort(data, ndata) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 659, in _read_oes_4_sort n = self._read_oes1_loads(data, ndata) File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 1605, in _read_oes1_loads n, nelements, ntotal = self._oes_csolid(data, ndata, dt, is_magnitude_phase, File "C:\Users\cdribusch\AppData\Local\Programs\Python\Python310\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 2931, in _oes_csolid assert eids.min() > 0, eids.min() AssertionError: 0

— Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/755, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAICUWP7Z7ZYJCQ3KTFKECDYTK5YZAVCNFSM6AAAAABDFVOLVKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZTCMRZGUYDGMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Cdribusch commented 6 months ago

I'm using NX Nastran 12.0.2. The runs finish without any problems, and I'm able to open the OP2 files in FEMAP, so I assume that's not the problem, but I'm happy to try a different version of NX Nastran.

            * *       N X   N a s t r a n       * *
            * *                                 * *
            * *        VERSION -  12.0.2        * *
            * *                                 * *
            * *          MAY 23, 2018           * *
            * *                                 * *
            * *                                 * *
            * *Intel64 Family 6 Model 85 Steppi * *
            * *                                 * *
            * * MODEL Intel(R) Xeon(R) Platinum * *
            * *                                 * *
            * *       Windows Server 2016       * *
            * *                                 * *
            * *       Compiled for X86-64       * *
Cdribusch commented 6 months ago

I'll do some more test cases to double check that it really is the number of elements that seems to be the problem.

SteveDoyle2 commented 6 months ago

I’d make sure your file is 64-bit. You should be able and to force it by making a CELAS1 with an id > 8 characters

On Mon, Feb 12, 2024 at 18:32 Cdribusch @.***> wrote:

I'll do some more test cases to double check that it really is the number of elements that seems to be the problem.

— Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/755#issuecomment-1940303204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAICUWNVWFBFCLL23PJEWXDYTLGFRAVCNFSM6AAAAABDFVOLVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBQGMYDGMRQGQ . You are receiving this because you commented.Message ID: @.***>

SteveDoyle2 commented 6 months ago

32 vs. 64 bit might have nothing to do with this. Depends on the max node/element id. Not sure...

SteveDoyle2 commented 6 months ago

closing due to inactivity and inability to test

Cdribusch commented 5 months ago

Hi, so I've been doing a lot of testing, and I now believe that this is not a bug in pyNastran, but a bug or feature in Nastran. I've created a simple test problem that only contains CTETRA elements and the issue is repeatable. It starts somewhere between 18.1 and 21.6 million elements when you ask for element stress, for example like this: SET 1001001 = 30000000 THRU 80000000 STRESS(PLOT) = 1001001 However, when I ask for element strain, there is no problem. Anyway, what is really interesting is that FEMAP can open and read those op2 files ("attach results"), but it will only list results for the first 19701745 elements. Right now, as far as I know, the only way for me to get element stress results for more elements is to run another simulation with something like SET 1001001 = 50701745 THRU 80000000 to get the remaining element stress values. I'm not sure what the issue is, but I don't think there is anything wrong with pyNastran, except that the error message could have been a little more informative. I think what may be happening is that pyNastran was expecting a certain number of element results but found less, and threw an error. I guess Femap handles the same op2 file by only listing the element results that it found. Anyway, thank you for being so responsive on this!