Unreadable KDICT

34 views
Skip to first unread message

Tom De Weer

unread,
Feb 25, 2020, 5:33:30 AM2/25/20
to pyNastran Discuss
Hi all,

I'm trying to let Nastran generate some beam stiffness matrices for me. I made an input file containing unconnected beams and I output the KDICT and KELM tables via

MALTER 'MALTER:(KGG, BGG, MGG, K4GG, PG)' $ 
OUTPUT4 KELM//0/-45/2/TRUE/ $ 
OUTPUT2 KDICT//-3/-12/KDICT// $ 

Nastran fails with all sorts of errors after this statement is executed because I didn't put any forces, constraints, ... Normally, this should not influence the matrix output but just to be sure I added an EXIT statement right after. Reading the OP4 works fine, but reading the KDICT table inside the OP2 file fails.

I have attached my input and output files. Can somebody check if they're able to read the OP2?

Some final remarks:
- The F06 file reports that the KDICT has been written to the output file without errors.
- When specifying a proper model and without an EXIT statement, the KDICT becomes readable.

Kind regards,
Tom
onedimensionalelementmatrixgeneration.bdf
onedimensionalelementmatrixgeneration.op2
onedimensionalelementmatrixgeneration.op4
onedimensionalelementmatrixgeneration.f06
onedimensionalelementmatrixgeneration.f04

Tom De Weer

unread,
Feb 25, 2020, 10:19:54 AM2/25/20
to pyNastran Discuss
I did some more research and noted that pyNastran is able to read the KDICT! However, when executing the _read_dict() function in op2_reader.py, the read mode is equal to 1. This skips the table. I'll need confirmation from someone more familiar with this code, but for now I think I'll just manually set read_mode to 0.

Kind regards,
Tom

Steven Doyle

unread,
Feb 25, 2020, 12:06:37 PM2/25/20
to pyNastran Discuss
Tom,

The problem is you didn't close of the OP2 with a -4,0,4 end of file tag.  With that the code knows if it's failing mid-table or at the end of a time step/subcase. I never even considered setting the read_mode to 1.  That seems very lucky.

You can set the post flag to -4.  That OP2 style doesn't have a trailing -4,0,4 tag, so it does a try-except and then checks to see if it's got POST=-4.

You can also do:
>>> model = OP2()
>>> model.post = -4
>>> model.read_op2(...)

Steve

--
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/ca1091d6-c9e2-4713-b541-b12c21b32598%40googlegroups.com.

Tom De Weer

unread,
Feb 26, 2020, 4:13:30 AM2/26/20
to pyNastran Discuss
Steve,

Setting POST=-4 solved the error. Setting read_mode to 1 was indeed lucky but ultimately gave another error. Thanks for all the help!

Just for my information: where do you get all this information about the format of OP2? Is it in the DMAP guide?

Kind regards,
Tom

Steven Doyle

unread,
Feb 26, 2020, 12:29:09 PM2/26/20
to pyNastran Discuss
Tom,

Mostly.  The DMAP guide has this for KDICT.  It doesn't tell you how a record is structured (or even that a partial record exists) or how to tell what the size is.  It's  Fortran Formatted (Unformatted?) binary thing, so when you write a 0, you write 4,0,4.  When you write 1,2,3, you write 4*3,1,2,3,4*3.  I just had to try to read things without crashing long enough until I figured out the structure.   Find the number of nodes/elements in a table and then see if you can't split the record by that.   Then just print out the say 10 numbers as an integer and as a float and go with what seems reasonable. The F06 is really handy to figure things out as most of the stuff can also be written there.

image.png  
The documentation is frequently open to interpretation (or missing or lacking like below), so you just need to see enough examples. 
image.png



--
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.
Reply all
Reply to author
Forward
0 new messages