SteveDoyle2 / pyNastran

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

Error reading OP2 geometry (PCOMP with nlayers>100) #628

Closed jolague closed 3 years ago

jolague commented 3 years ago

Hi,

I try to read an .op2 file wich has some PCOMP with more than 100 layers. "op2_geom = read_op2_geom(op2_filename,debug=False,skip_undefined_matrices=True)"

The following error appears: assert 0 < nlayers < 100, 'pid=%s nlayers=%s z0=%s nms=%s sb=%s ft=%s Tref=%s ge=%s' % ( AssertionError: pid=72988 nlayers=100 z0=0.0 nms=5.520699897232362e-09 sb=0.0 ft=0 Tref=0.0 ge=0.0

Is there any reason why there is an assert that limits the nlayers variable to 100? It appears in line 1289, in _read_pcomp_32_bit

I have modified that assert and it seems that the code runs correctly.

SteveDoyle2 commented 3 years ago

The check is there because there are multiple PCOMP table forms and I don’t know what causes the different forms to be created. It basically is try-excepting the different forms. Usually the property id is enough to catch a bad table, but it’s just another check. If you’re off by a field, you can end up with say -583261 or +583261 layers. I figured 100 layers was reasonable for any real problem, which is up from ~20.

How many do you have?

On Fri, Nov 13, 2020 at 2:54 AM jolague notifications@github.com wrote:

Hi,

I try to read an .op2 file wich has some PCOMP with more than 100 layers. "op2_geom = read_op2_geom(op2_filename,debug=False,skip_undefined_matrices=True)"

The following error appears: assert 0 < nlayers < 100, 'pid=%s nlayers=%s z0=%s nms=%s sb=%s ft=%s Tref=%s ge=%s' % ( AssertionError: pid=72988 nlayers=100 z0=0.0 nms=5.520699897232362e-09 sb=0.0 ft=0 Tref=0.0 ge=0.0

Is there any reason why there is an assert that limits the nlayers variable to 100? It appears in line 1289, in _read_pcomp_32_bit

I have modified that assert and it seems that the code runs correctly.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAICUWPNWSTOS4J3GXDSCJLSPUF7TANCNFSM4TUN52NQ .

jolague commented 3 years ago

I have around 115 layers. Wind turbine blades has commonly more than 100 layers on root.

As far as i know, there is just 2 types of PCOMP which has 1 or 2 layers per line. I cant identify why Patran use one of then either, but in any case I dont think that check has sense.

SteveDoyle2 commented 3 years ago

As far as i know, there is just 2 types of PCOMP which has 1 or 2 layers per line

That doesn't affect the OP2 format.

I dont think that check has sense.

There are at least 2 very different ways to read a binary PCOMP card. For example, nlayers=0 for NX 64-bit. It's a totally different reader. The check helps to make sure there are no errors.

I'll bump it to 200.

jolague commented 3 years ago

I work in onshore wind turbine sector where blades goes form 40 to 80 meters long. Offshore wind tubines use up to 120 and the sector is still growing.

In my opinion, maybe you could increase the limit to 300-400 layers to avoid future problems.

Btw, really great job. Thanks, Jon

SteveDoyle2 commented 3 years ago

it's 400 now.