SteveDoyle2 / pyNastran

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

Issue when reading form an OP2 Contaning CTRIA3 and CTRIA6 elements #740

Open gornezo opened 1 year ago

gornezo commented 1 year ago

Dear community,

I have encountered an isssue when trying to load the results of an OP2 model containing both CTRIA3 and CTRIA6 results. Stress output is set to CORNER, thus this forces the op2 reader to load the results of the CTRIA3 in the same directory 'ctria6_stress' that would be normally used by the CTRIA6 results. I believe this is what causes the issue.

Here is an extract of my code:

           # read in model
            model = OP2(debug=False)
            model.read_op2(file_)

           #load results dictionaries
            stress_ctria3 = model.ctria3_stress
            stress_ctria6 = model.ctria6_stress

The obtained error message is: File "C:\Program Files\Python39\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 5347, in _oes_cquad4_144 obj.data[obj.itime, istart:iend, :] = results ValueError: could not broadcast input array from shape (712,8) into shape (3800,8)

In ,my test model I have used 89 CTRIA3 Elements -> 712 entries (4nlayersnlements). Then the CTRIA6 data containing 475 CTRIA6 elements -> 3800 entries (4nlayersnlements) is attempted to be written. Strangely (or maybe because im not understanding something), the itime value when trying to write the CTRIA6 elements is set to 1 instead of 0, which causes the sizing of the data container not to be updated. If I update the code in the oes.py file line 5233 : from:

if obj.itime == 0:

to:

if obj.itime in [0, 1]:

then the program will run, but the content of the ctria6_stress dictionary will only provide the values of the CTRIA6 elements and not the CTRIA3.

My calculation is a linear calculation, thus the time increment of 1 does not seem logical to me. Is this behaviour intended? Then, it remains the question, how can I get results for the case where I have this mixed elements? it seems to work fine for CQUAD4 and CQUAD8 mixture.

I appreciate your help and of course thank you for all the hard work set into this amazing library!

Kind regards, Chris

SteveDoyle2 commented 1 year ago

I’d need to see a small example with the bdf/f06/op2. A small example also let’s me add it as a test. There are a few different types of CTRIA6 output formats depending on solution type/solver.

The time is for modes/time/frequency. You should not be running into that for a static case. The difference in the blocks is that the time=0 blocks sets the node/element ids and some other stuff that is common to all time steps.

On Fri, Aug 18, 2023 at 4:19 AM gornezo @.***> wrote:

Dear community,

I have encountered an isssue when trying to load the results of an OP2 model containing both CTRIA3 and CTRIA6 results. Stress output is set to CORNER, thus this forces the op2 reader to load the results of the CTRIA3 in the same directory 'ctria6_stress' that would be normally used by the CTRIA6 results. I believe this is what causes the issue.

Here is an extract of my code:

       # read in model
        model = OP2(debug=False)
        model.read_op2(file_)

       #load results dictionaries
        stress_ctria3 = model.ctria3_stress
        stress_ctria6 = model.ctria6_stress

The obtained error message is: File "C:\Program Files\Python39\lib\site-packages\pyNastran\op2\tables\oes_stressStrain\oes.py", line 5347, in _oes_cquad4_144 obj.data[obj.itime, istart:iend, :] = results ValueError: could not broadcast input array from shape (712,8) into shape (3800,8)

In ,my test model I have used 89 CTRIA3 Elements -> 712 entries (4 nlayersnlements). Then the CTRIA6 data containing 475 CTRIA6 elements -> 3800 entries (4nlayersnlements) is attempted to be written. Strangely (or maybe because im not understanding something), the itime value when trying to write the CTRIA6 elements is set to 1 instead of 0, which causes the sizing of the data container not to be updated. If I update the code in the oes.py file line 5233 : from:

if obj.itime == 0:

to:

if obj.itime in [0, 1]:

then the program will run, but the content of the ctria6_stress dictionary will only provide the values of the CTRIA6 elements and not the CTRIA3.

My calculation is a linear calculation, thus the time increment of 1 does not seem logical to me. Is this behaviour intended? Then, it remains the question, how can I get results for the case where I have this mixed elements? it seems to work fine for CQUAD4 and CQUAD8 mixture.

I appreciate your help and of course thank you for all the hard work set into this amazing library!

Kind regards, Chris

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

gornezo commented 1 year ago

Hi,

I have attached a zip file with my own small example. There you have a combination of CTRIA3 and CTRIA6 elements. I am wirking with OPTISTRUCT, thus the input file is a .fem file. I hope the issue is not in the OPTISTRUCT solver internal association of the elments, but please let me know what your findings are.

Thanks for the quick reply. I really appreciate it. 2ndOrder_CTRIA_Mixed.zip

SteveDoyle2 commented 1 year ago

This is not a small model. Two elements for this case is plenty.

Also there are no triangles. It’s CQUAD4/CQUAD8.

On Sat, Aug 19, 2023 at 1:25 AM gornezo @.***> wrote:

Hi,

I have attached a zip file with my own small example. There you have a combination of CTRIA3 and CTRIA6 elements. I am wirking with OPTISTRUCT, thus the input file is a .fem file. I hope the issue is not in the OPTISTRUCT solver internal association of the elments, but please let me know what your findings are.

Thanks for the quick reply. I really appreciate it. 2ndOrder_CTRIA_Mixed.zip https://github.com/SteveDoyle2/pyNastran/files/12385383/2ndOrder_CTRIA_Mixed.zip

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

gornezo commented 1 year ago

Hello Steve,

Apologies, I did pack the wrong model, this was my test with CQUAD elements which is working.

For completeness, this is a 4-Element model -> 1 CTRIA3, 1 CTRIA6, 1 CQUAD4, 1 CQUAD8.

I would expect the following code to fill in with 1 element each separate dictionary:

           # read in model (quads and trias)
            model = OP2(debug=False)
            model.read_op2(file_)

            stress_quads4 = model.cquad4_stress
            stress_quads8 = model.cquad8_stress
            stress_trias3 = model.ctria3_stress
            stress_trias6 = model.ctria6_stress

Thanks again.

2ndOrder.zip

SteveDoyle2 commented 1 year ago

I see op2 does have an issue, but I need the f06/ascii output file with the results as well.

On Sat, Aug 19, 2023 at 2:20 PM gornezo @.***> wrote:

Hello Steve,

Apologies, I did pack the wrong model, this was my test with CQUAD elements which is working.

For completeness, this is a 4-Element model -> 1 CTRIA3, 1 CTRIA6, 1 CQUAD4, 1 CQUAD8.

I would expect the following code to fill in with 1 element each separate dictionary:

       # read in model (quads and trias)
        model = OP2(debug=False)
        model.read_op2(file_)

        stress_quads4 = model.cquad4_stress
        stress_quads8 = model.cquad8_stress
        stress_trias3 = model.ctria3_stress
        stress_trias6 = model.ctria6_stress

Thanks again.

2ndOrder.zip https://github.com/SteveDoyle2/pyNastran/files/12386729/2ndOrder.zip

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

gornezo commented 1 year ago

I'm using Optistruct 2022.2 so I have no access to NASTRAN. Im getting you a bdf file so you can run it and produce the f06? Let me know what comes out. 2ndOrderModel_bdf.zip

SteveDoyle2 commented 1 year ago

Pynastran works for the CTRIA6 on NX/MSC Nastran. I need to see the output to add output. It’s a different form than the standard.

On Sat, Aug 19, 2023 at 3:00 PM gornezo @.***> wrote:

I'm using Optistruct 2022.2 so I have no access to NASTRAN. Im getting you a bdf file so you can run it and produce the f06? Let me know what comes out. 2ndOrderModel_bdf.zip https://github.com/SteveDoyle2/pyNastran/files/12386761/2ndOrderModel_bdf.zip

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

gornezo commented 1 year ago

Hi Steve, What kind of output are you looking for when running Optistruct? Let me know so I can produce something useful for you.

When you mentioned there was an issue in the OP2 what did you mean?

Kind regards, Chris

On Sun, Aug 20, 2023, 12:18 AM Steven Doyle @.***> wrote:

Pynastran works for the CTRIA6 on NX/MSC Nastran. I need to see the output to add output. It’s a different form than the standard.

On Sat, Aug 19, 2023 at 3:00 PM gornezo @.***> wrote:

I'm using Optistruct 2022.2 so I have no access to NASTRAN. Im getting you a bdf file so you can run it and produce the f06? Let me know what comes out. 2ndOrderModel_bdf.zip < https://github.com/SteveDoyle2/pyNastran/files/12386761/2ndOrderModel_bdf.zip>

— Reply to this email directly, view it on GitHub < https://github.com/SteveDoyle2/pyNastran/issues/740#issuecomment-1685119690>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAICUWNKWTMPKI3PXABHFMTXWEZRLANCNFSM6AAAAAA3VMH6GY>

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/740#issuecomment-1685121879, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMZBHOLMMLN2W2JCPVDBJJLXWE3R5ANCNFSM6AAAAAA3VMH6GY . You are receiving this because you authored the thread.Message ID: @.***>

SteveDoyle2 commented 1 year ago

The main ascii output file (I stuck a .txt on it for github). static_elements.f06.txt

It has tables like this that describe the output image

It's slow to parse the file, but it's really easy to compare to what I see in the binary data.

gornezo commented 1 year ago

Hi Steve,

Ok, This should help. In the new zip you can find the .fem, .op2 a .pch (NASTRAN punch result format) and additionally the OPTI style ASCII format in the .strs file. 2ndOrder.zip

SteveDoyle2 commented 1 year ago

looks like Optistruct writes the CTRIA3 as a CTRIA6, but the CQUAD4 doesn't have that issue.

Not sure...I need to think about it.