op2 reader troubles for 1 subcase modal analysis

103 views
Skip to first unread message

SamB

unread,
Mar 9, 2016, 1:59:54 PM3/9/16
to pyNastran Discuss
Hi,

I'm using python 3.5, pyNastran 7.2, and msc nastran.

I can read in an op2 file, but then I cannot get the eigenvectors out or even get stats without an error.

This is the error I get when I try for stats:

>>> print(model.get_op2_stats())
{1:   type=RealSPCForcesArray ntimes=10 nnodes=646
  data: [t1, t2, t3, r1, r2, r3] shape=[10, 646, 6] dtype=float32
  gridTypes
  modes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
eigrs = [84.09542846679688, 192.75697326660156, 194.0482940673828, 392.6983947753906, 395.2553405761719, 403.5948791503906, 2728.04248046875, 4349.8525390625, 4364.28125, 5048.0146484375]
mode_cycles = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bleyde/anaconda3/lib/python3.5/site-packages/pyNastran/op2/op2_f06_common.py", line 608, in get_op2_stats
    try:
  File "/home/bleyde/anaconda3/lib/python3.5/site-packages/pyNastran/op2/op2_f06_common.py", line 601, in compare
    return key[0]
IndexError: invalid index to scalar variable.


You can see the data is in there... but then the code breaks.

When I try to get the eigenvectors, this happens:

>>> eigs = model.eigenvectors[1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 1


Attached is the op2 file I'm loading.

Thanks,

Sam



run1.op2

Steven Doyle

unread,
Mar 9, 2016, 2:10:09 PM3/9/16
to pyNastran Discuss
Based on your stats, you don't have eigenvectors.  You need to request them.

--
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.
For more options, visit https://groups.google.com/d/optout.

SamB

unread,
Mar 9, 2016, 3:40:37 PM3/9/16
to pyNastran Discuss
Thanks for the reply, Steve!

I actually don't care about the eigenvectors themselves, my end goal is to extract the natural frequencies. Am I mistaken in thinking the natural frequencies are in cycle, which is in the eigenvectors table?

Would not having eigenvectors in the op2 file cause get_op2_stats to break?

Steven Doyle

unread,
Mar 9, 2016, 5:14:01 PM3/9/16
to pyNastran Discuss
You can directly extract the eigenvalue (LAMA) table from the op2.  Use the beam_modes example to put the table in the deck and access op2.eigenvalues.

Would not having eigenvectors in the op2 file cause get_op2_stats to break?

No.

It wasn't clear from that error message what was really going on and I don't have much time at the moment, but there were some edge cases in v0.7.x that made the OP2 break (e.g. SORT2 results).  The v0.8-dev/master branch is much more robust.  It's also ~500x faster.

SamB

unread,
Mar 9, 2016, 5:32:00 PM3/9/16
to pyNastran Discuss
Thanks Steve! I'll keep my eye out for version 8. 
Reply all
Reply to author
Forward
0 new messages