SteveDoyle2 / pyNastran

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

Read Geometry from OP2 #322

Closed alby3z closed 8 years ago

alby3z commented 8 years ago

I have problem reading the geometry and to rewrite grids in other coordinate systems.

@alby3z How do I recover the grid positions with respect to (e.g.) the global coordinate system? @SteveDoyle2 i_transform, transforms = bdf_model.get_displacement_index_transforms() op2_model.transform_displacements_to_global(i_transform, transforms) You can only get data with respect to the global frame. I know it's not right for complex cylindrical/spherical analysis results, but I'm not sure what the issue is. I'd recommend plotting the real results in the GUI just to verify they look right.

I have no attribute transform_displacements_to_global in the BDF module. (I am using pyNastran 0.7.2)

@alby3z Do I need to read the read also the respective bdf or I have access to this information through the op2? @SteveDoyle2 You can use: from pyNastran.op2.op2_geom import OP2Geom, read_op2_geom model = read_op2_geom(op2_filename) i_transform, transforms = model.get_displacement_index_transforms() model.transform_displacements_to_global(i_transform, transforms) It's not as robust/complete though.

I have no module read_op2_geom in pyNastran.op2. (I am using pyNastran 0.7.2)

SteveDoyle2 commented 8 years ago

You need to use the master (v0.8). v0.7.2 does not have that.

alby3z commented 8 years ago

I downloaded and installed the master v0.8 but I experienced big problem reading all OP2s.

For example when reading an OP2 (that was parsed from 0.7.2 with no errors) I got an error like:

model.read_op2()
DEBUG:     fname=op2.py                    lineNo=365    combine=True
DEBUG:     fname=op2.py                    lineNo=366    -------- reading op2 with read_mode=1 --------
INFO:      fname=op2_scalar.py             lineNo=1176   op2_filename = 'test.op2'
DEBUG:     fname=op2_scalar.py             lineNo=1364     table_name=b'GEOM1'
DEBUG:     fname=op2_scalar.py             lineNo=1364     table_name=b'GEOM2'
DEBUG:     fname=op2_scalar.py             lineNo=1364     table_name=b'DYNAMICS'
DEBUG:     fname=op2_scalar.py             lineNo=1364     table_name=b'OUG1'
VECTOR

[... a series of errors], the last one is:

File "C:\Users\10758\AppData\Local\Continuum\Anaconda3\lib\site-packages\pynastran-0.8.0+dev.no.checksum.error-py3.5.egg\pyNastran\op2\tables\oug\oug.py", line 585, in _read_eigenvector
    self.subcase.add_op2_data(self.data_code, 'VECTOR')

   File "C:\Users\10758\AppData\Local\Continuum\Anaconda3\lib\site-packages\pynastran-0.8.0+dev.no.checksum.error-py3.5.egg\pyNastran\bdf\subcase.py", line 224, in add_op2_data
     raise NotImplementedError(data_code)

 NotImplementedError: {'thermal': 0, 'device_code': 3, '_times_dtype': 'float32', 'approach_code': 23, 'is_msc': True, 'subtitle': 'UNITS LBF,IN,S - MASSES IN CHUG', 'acoustic_flag': 0, 'name': 'mode', 'table_name': b'OUG1', 'analysis_code': 2, 'eigr': -1.5916157281026244e-12, 'label': 'NORMAL MODES                                                                                        SUBCASE 1', 'isubcase': 1, 'sort_code': 0, 'random_code': 0, 'thermal_bits': [0, 0, 0, 0, 0], 'nonlinear_factor': 1, 'format_code': 1, 'table_code': 7, 'title': 'TEST', 'mode': 1, 'sort_bits': [0, 0, 0], 'mode_cycle': 2.0078868834867115e-07, 'data_names': ['mode', 'eigr', 'mode_cycle'], 'num_wide': 8}
SteveDoyle2 commented 8 years ago

Try again. I removed the error catch.

On Mon, Jul 18, 2016 at 9:04 AM, alby3z notifications@github.com wrote:

I downloaded and installed the master v0.8 but I experienced big problem reading all OP2s.

For example when reading an OP2 (that was parsed from 0.7.2 with no errors) I got an error like:

model.read_op2() DEBUG: fname=op2.py lineNo=365 combine=True DEBUG: fname=op2.py lineNo=366 -------- reading op2 with read_mode=1 -------- INFO: fname=op2_scalar.py lineNo=1176 op2_filename = 'test.op2' DEBUG: fname=op2_scalar.py lineNo=1364 table_name=b'GEOM1' DEBUG: fname=op2_scalar.py lineNo=1364 table_name=b'GEOM2' DEBUG: fname=op2_scalar.py lineNo=1364 table_name=b'DYNAMICS' DEBUG: fname=op2_scalar.py lineNo=1364 table_name=b'OUG1' VECTOR [... a series of errors], the last one is:

File "C:\Users\10758\AppData\Local\Continuum\Anaconda3\lib\site-packages\pynastran-0.8.0+dev.no.checksum.error-py3.5.egg\pyNastran\op2\tables\oug\oug.py", line 585, in _read_eigenvector self.subcase.add_op2_data(self.data_code, 'VECTOR')

File "C:\Users\10758\AppData\Local\Continuum\Anaconda3\lib\site-packages\pynastran-0.8.0+dev.no.checksum.error-py3.5.egg\pyNastran\bdf\subcase.py", line 224, in add_op2_data raise NotImplementedError(data_code)

NotImplementedError: {'thermal': 0, 'device_code': 3, '_times_dtype': 'float32', 'approach_code': 23, 'is_msc': True, 'subtitle': 'UNITS LBF,IN,S - MASSES IN CHUG', 'acoustic_flag': 0, 'name': 'mode', 'table_name': b'OUG1', 'analysis_code': 2, 'eigr': -1.5916157281026244e-12, 'label': 'NORMAL MODES SUBCASE 1', 'isubcase': 1, 'sort_code': 0, 'random_code': 0, 'thermal_bits': [0, 0, 0, 0, 0], 'nonlinear_factor': 1, 'format_code': 1, 'table_code': 7, 'title': 'TEST', 'mode': 1, 'sort_bits': [0, 0, 0], 'mode_cycle': 2.0078868834867115e-07, 'data_names': ['mode', 'eigr', 'mode_cycle'], 'num_wide': 8}

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/322#issuecomment-233374631, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAqWVaa2NbK2r3zABVrWWPBsxtbiSzsks5qW6P3gaJpZM4JOzwr .

alby3z commented 8 years ago

Loading OP2 now is fine provided that PARAM,POST,-2 is used. Instead using -1 options the following error is raised:

NotImplementedError: eigenvectors; table_name=b'OUG1'

For what concern reading geometry I got errors invoking the commands:

from pyNastran.op2.op2_geom import read_op2_geom
op2_geom = read_op2_geom(op2_filename)

The software echos the following error:

  File "C:\Users\10758\AppData\Local\Continuum\Anaconda3\lib\site-packages\pynastran-0.8.0+dev.no.checksum.error-py3.5.egg\pyNastran\bdf\bdf_interface\add_card.py", line 138, in add_property
    assert key > 0, 'pid=%s prop=%s' % (key, prop)

AssertionError: pid=0 prop=PBUSH          0       K      0.      0.      0.      0.      0.      0.
                       B      0.      0.      1.      1.      1.      1.
                      GE 4.51-40   1.+10   1.+10   1.+10   1.+10   1.+10
                     RCV    500.      0.      0.      0.

Then the parsing continues and at certain points it stucks without finishing the function call. When I press Enter on the keyboard, Python returns to the prompt butop2_geom has not been created:

NameError: name 'op2_geom' is not defined

SteveDoyle2 commented 8 years ago

The PBUSH is a terrible card. There are 3 versions of the card between NX and MSC Nastran (one unique and one common one for each). They all use the same marker flags and the documentation is incorrect regarding when each form is used.

You can disable that card using:

model._ept_map[(1402, 14, 37)] = ['PBUSH', self._read_fake]

Alternatively go to pyNastran/op2/tables/geom/ept.pyand comment out the PBUSH entry of_ept_map(and make a new one withself._read_fake`). I wouldn't be hugely surprised if there are other op2 geometry bugs. It's still very much a beta reader. Nastran does some strange things under the hood.

SteveDoyle2 commented 8 years ago

Also, do you have an example?

SteveDoyle2 commented 8 years ago

closing...PBUSH issue is a separate bug