Get load vector name from Op2 reader

20 views
Skip to first unread message

Prateek Singh

unread,
Sep 2, 2021, 3:42:41 AMSep 2
to pyNastran Discuss
Hey folks,

I am trying to extract the element forces using pynastran from op2 file, but I am unable to get the loadcase (load_vectors[i]) name from the op2 reader.

First I have created an op2 object when I print the stats I got following:

displacements[1]
  isubcase = 1
  type=RealDisplacementArray nnodes=677, table_name=OUGV1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [1]

displacements[2]
  isubcase = 2
  type=RealDisplacementArray nnodes=677, table_name=OUGV1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [2]

spc_forces[1]
  isubcase = 1
  type=RealSPCForcesArray nnodes=677, table_name=OQG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [1]

spc_forces[2]
  isubcase = 2
  type=RealSPCForcesArray nnodes=677, table_name=OQG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [2]

mpc_forces[1]
  isubcase = 1
  type=RealMPCForcesArray nnodes=677, table_name=OQMG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [1]

mpc_forces[2]
  isubcase = 2
  type=RealMPCForcesArray nnodes=677, table_name=OQMG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [2]

grid_point_forces[1]
  type=RealGridPointForcesArray nelements=2 total=5452
  data: [1, ntotal, 6] where 6=[f1, f2, f3, m1, m2, m3]
  data.shape=(1, 5452, 6)
  element type: *TOTALS*, APP-LOAD, F-OF-SPC, QUAD4, ROD
  sort1
  lsdvmns = [0]

grid_point_forces[2]
  type=RealGridPointForcesArray nelements=2 total=5355
  data: [1, ntotal, 6] where 6=[f1, f2, f3, m1, m2, m3]
  data.shape=(1, 5355, 6)
  element type: *TOTALS*, APP-LOAD, F-OF-MPC, F-OF-SPC, QUAD4, ROD
  sort1
  lsdvmns = [0]

load_vectors[1]
  isubcase = 1
  type=RealLoadVectorArray nnodes=677, table_name=OPG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [1]

load_vectors[2]
  isubcase = 2
  type=RealLoadVectorArray nnodes=677, table_name=OPG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [2]

crod_stress[1]
  type=RealRodStressArray nelements=906
  eType
  data: [1, nelements, 4] where 4=[axial, SMa, torsion, SMt]
  element.shape = (906,)
  data.shape = (1, 906, 4)
  element type: CROD
  sort1
  lsdvmns = [1]

crod_stress[2]
  type=RealRodStressArray nelements=906
  eType
  data: [1, nelements, 4] where 4=[axial, SMa, torsion, SMt]
  element.shape = (906,)
  data.shape = (1, 906, 4)
  element type: CROD
  sort1
  lsdvmns = [2]

cquad4_stress[1]
  type=RealPlateStressArray nelements=616 nnodes_per_element=1 nlayers=2 ntotal=
1232
  data: [1, ntotal, 8] where 8=[fiber_distance, oxx, oyy, txy, angle, omax, omin
, von_mises]
  element_node.shape = (1232, 2)
  data.shape=(1, 1232, 8)
  element type: CQUAD4
  s_code: 1
  sort1
  lsdvmns = [1]

cquad4_stress[2]
  type=RealPlateStressArray nelements=616 nnodes_per_element=1 nlayers=2 ntotal=
1232
  data: [1, ntotal, 8] where 8=[fiber_distance, oxx, oyy, txy, angle, omax, omin
, von_mises]
  element_node.shape = (1232, 2)
  data.shape=(1, 1232, 8)
  element type: CQUAD4
  s_code: 1
  sort1
  lsdvmns = [2]

crod_force[1]
  type=RealRodForceArray nelements=906
  data: [1, nnodes, 2] where 2=[axial, torsion]
  data.shape = (1, 906, 2)
  element.shape = (906,)
  element name: CROD
  sort1
  loadIDs = [1]

crod_force[2]
  type=RealRodForceArray nelements=906
  data: [1, nnodes, 2] where 2=[axial, torsion]
  data.shape = (1, 906, 2)
  element.shape = (906,)
  element name: CROD
  sort1
  loadIDs = [2]

cquad4_force[1]
  type=RealPlateForceArray nelements=616
  data: [1, nelements, 8] where 8=[mx, my, mxy, bmx, bmy, bmxy, tx, ty]
  data.shape = (1, 616, 8)
  element.shape = (616,)
  element type: CQUAD4
  sort1
  loadIDs = [1]

cquad4_force[2]
  type=RealPlateForceArray nelements=616
  data: [1, nelements, 8] where 8=[mx, my, mxy, bmx, bmy, bmxy, tx, ty]
  data.shape = (1, 616, 8)
  element.shape = (616,)
  element type: CQUAD4
  sort1
  loadIDs = [2]

But I am unable to get the load_vectors[i]'s name from op2 which I defined in the bdf file, also the load_vectors[i]'s name is appearing in the f06 file.

I would be immensely grateful if you kindly help me to get the load vector name from op2 file.

Thanks and Regards,
Prateek.

Steven Doyle

unread,
Sep 2, 2021, 12:15:45 PMSep 2
to pyNastran Discuss
The stats are supposed to show you how to access the data and what size/shape things are as well as what that data means.  The data you want is in your list, so:

model = read_op2(op2_filename)
load_vector = model.load_vectors[1]

From there (and given you're doing a static case for the time=0) you have:
translations = load_vector.data[0, :, :3]
rotations = load_vector.data[0, :, 3:]

That has the same length as:
node_gridtype = load_vector.node_gridtype

I hope that helps!



--
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/8b9b3b23-103b-4eed-975c-40c8b890b8den%40googlegroups.com.

Prateek Singh

unread,
Sep 2, 2021, 3:31:03 PMSep 2
to pyNastran Discuss
Hey Steve, 

Thank you for giving your time and replying to the post,

Yes I have been using similar functions to extract the values of different kind of forces. But I am trying to get the loadset name(ID) given to a particular load when we define the bdf file. I think the following example will make it more clear:

Loadset name(ID) in my bdf file (1 and 1000334):

SUBCASE 1
  SUBTITLE = NASTRAN SPC 1 - Pressure
  SPC = 1
  LOAD = 1
SUBCASE 2
  SUBTITLE = NASTRAN SPC 1 - NASTRAN 1000334
  SPC = 1
  LOAD = 1000334
...
...
...
$ Femap with NX Nastran Load Set 1 : Pressure
PLOAD4         1     963     10.                                        
PLOAD4         1     964     10.                                        
PLOAD4         1     965     10.                                        
PLOAD4         1     966     10.                                        
PLOAD4         1     967     10.      
...
...
...
PLOAD4           1522     10.                                        
$ Femap with NX Nastran Load Set 1000334 : NASTRAN 1000334
FORCE    1000334   10010       0      1.-12.4177 -.58796911.9319
MOMENT   1000334   10010       0      1.89406.9512168.79 5270.26
FORCE    1000334   10011       0      1.16.16254 -.581741353.617
MOMENT   1000334   10011       0      1.-37275.8-39684.8-2210.02


Also, in the f06 file I can see these loadsets name(ID) (1 and 1000334):

0                                        C A S E    C O N T R O L    E C H O                                                        
                 COMMAND                                                                                                            
                 COUNT                                                                                                              
                  1        TITLE = SAMPLE_SECTION                                                                
                  2        ECHO = NONE                                                                           
                  3        DISPLACEMENT(PLOT) = ALL                                                              
                  4        SPCFORCE(PLOT) = ALL                                                                  
                  5        OLOAD(PLOT) = ALL                                                                     
                  6        MPCFORCE(PLOT) = ALL                                                                  
                  7        GPFORCE(PLOT) = ALL                                                                   
                  8        FORCE(PLOT) = ALL                                                                     
                  9        STRESS(PLOT) = ALL                                                                    
                 10      SUBCASE 1                                                                               
                 11        SUBTITLE = NASTRAN SPC 1 - PRESSURE                                                   
                 12        SPC = 1                                                                               
                 13        LOAD = 1                                                                              
                 14      SUBCASE 2                                                                               
                 15        SUBTITLE = NASTRAN SPC 1 - NASTRAN 1000334                                            
                 16        SPC = 1                                                                               
                 17        LOAD = 1000334                         

But I am unable to get the names(ID) of these loadsets (1 and 1000334) from the op2 file for the 2 load_vectors:      

load_vectors[1]
  isubcase = 1
  type=RealLoadVectorArray nnodes=677, table_name=OPG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [1]

load_vectors[2]
  isubcase = 2
  type=RealLoadVectorArray nnodes=677, table_name=OPG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 677, 6] dtype=float32
  node_gridtype.shape = (677, 2)
  sort1
  lsdvmns = [2]     

Is this loadset (loadID/LoadName) present in op2 file? 

Apologies, for the long post, I hope my question is clear. I am interested in extracting the load Name from the op2 file along with the data (load_vectors[1].data)

Thank you,
Regards,
Prateek Singh.

Steven Doyle

unread,
Sep 3, 2021, 5:19:02 PMSep 3
to pyNastran Discuss
Not easily.  You can use the read_op2_geom function/method which :

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

That'll give you a BDF, in which case you "should" get something that mostly resembles your input deck.  There's a decent chance though that no geometry is even in the op2.  The better way is to just read your input deck.

    from pyNastran.bdf.bdf import read_bdf
    model = read_bdf(bdf_filename)
    subcase1 = model.subcases[1]

    # value = 100334
    # options = []
    value, options = subcase1['LOAD']


Reply all
Reply to author
Forward
0 new messages