Modify/write op2

Skip to first unread message

Gustav Graves

Mar 25, 2021, 4:28:49 AMMar 25
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. 


Steven Doyle

Mar 25, 2021, 11:46:59 AMMar 25
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
To view this discussion on the web visit

Gustav Graves

Mar 25, 2021, 12:31:22 PMMar 25
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

Mar 25, 2021, 4:39:44 PMMar 25
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

    1 : 'G', # GRID
    2 : 'S', # SPOINT
    3 : 'E', # EXTRA POINT
    4 : 'M', # MODAL POINT
    7 : 'L', # RIGID POINT (e.g. RBE3)

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
0 new messages