Modify/write op2

27 views
Skip to first unread message

Gustav Graves

unread,
Mar 25, 2021, 4:28:49 AM3/25/21
to pyNastran Discuss
Hello everyone,

I have question regarding the modification of op2.results structure. My goal is to take results from op2 file,post process them in such a way that new data are of different shape than original. Then I would like to write them back to op2 file. Is it possible to modify/resize the op2.structure so I would be able to import them back into op2? Or in other words, is it possible to take some simple small op2. from different fem model as template and modify(resize) the shape of it so I would be able to import the data into it and write the new op2 file. Thanks in advance for help. 

Gustav

Steven Doyle

unread,
Mar 25, 2021, 11:46:59 AM3/25/21
to pyNastran Discuss
That'll work.  It's far easier to do it that way.  The challenge of making an op2 from scratch is all those little flags.

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynastran-discuss/0aecc3e4-b22a-4327-975b-51f1a5632372n%40googlegroups.com.

Gustav Graves

unread,
Mar 25, 2021, 12:31:22 PM3/25/21
to pyNastran Discuss
Thanks for confirmation! Also I forgot to ask, how can I add additional results into op2 file? I've got op2 from static case as template and I would like to add acceleration results to that op2 file. I know that there's a function add_static_case which creates new case but outside the loaded op2 file. Can you please give me hint how to add it into the op2 file? Thanks again!

Steven Doyle

unread,
Mar 25, 2021, 4:39:44 PM3/25/21
to pyNastran Discuss
First, what you saw is a class method.  They're an alternate init.

        table_name = 'OUGV1'
        node_gridtype = np.zeros((10, 2), dtype='int32')
        node_gridtype[:, 0] = np.arange(1, 11)
        data = np.zeros((1, 10, 6), dtype='float32')
        isubcase = 1
        disp = RealDisplacementArray.add_static_case(
            table_name, node_gridtype, data, isubcase, is_sort1=True)
        model.displacements[isubcase] = disp

where:
GRID_TYPE_INT_TO_STR = {
    1 : 'G', # GRID
    2 : 'S', # SPOINT
    3 : 'E', # EXTRA POINT
    4 : 'M', # MODAL POINT
    7 : 'L', # RIGID POINT (e.g. RBE3)
    0 : 'H', # SECTOR/HARMONIC/RING POINT
}

Second, I'm not sure if that will just work if you swap in the acceleration.  I've never seen acceleration as a static result.  I'd expect it to be a real result or a complex results (e.g., frequency response), but give it a shot.

Reply all
Reply to author
Forward
0 new messages