Read Stiffnessmatrix File "##.k.op2"

450 views
Skip to first unread message

hip...@gmail.com

unread,
May 18, 2017, 4:18:46 AM5/18/17
to pyNastran Discuss
Hi,
can anybody help me? I'm wondering if pyNastran able to read the the stiffness matrix File "##.k.op2".I need the stiffness matrix for each element for postprocessing.

If not, has anybody an idea how the format looks like? Cannot find any information, in the nastran help, how the data block is format, i see only a "KELM" in my hex editor.
Thanks a lot,
Regards,


steve

unread,
May 18, 2017, 12:45:45 PM5/18/17
to pyNastran Discuss
KELM/KDICT are not supported.  The most similar way to access the data is in DMIG/MATPOOL format and requires the dev version:

The attached file shows how to put your matrix into DMIG / MATPOOL format.  The key piece of data is:

   MESSAGE //'WRITING IN DMIG FORMAT TO OP2 FILE' $
   MATMOD PATRN,EQEXIN/MPATRN,/16 $
   MATMOD IDENT,EQEXIN/MIDENT,/16 $
   MATMOD RANDM,EQEXIN/MRANDM,/16 $
   MATMOD CMPLX,EQEXIN/MCMPLX,/16 $
   OUTPUT2 MPATRN,MIDENT,MRANDM,MCMPLX//-1/11//OMAXR/'MATPOOL'/
                                  'MATPOOL'/'MATPOOL'/
  'MATPOOL'/'MATPOOL'//////1 $

You can also put your data in matrix form, which drops the grid and component from the output.  It's more confusing, but is supported in v0.8.

   MESSAGE //'WRITING IN MATRIX FORMAT TO OP2 FILE' $
   OUTPUT2 PATRN,IDENT,RANDM,CMPLX//-1/11//OMAXR/'MATRIX'/'MATRIX'/
                                  'MATRIX'/'MATRIX'///////1 $

In that case, you just don't write the MATMOD line.

Steve
matrix_factory.dat

Philipp Gebhardt

unread,
May 18, 2017, 4:19:34 PM5/18/17
to pynastra...@googlegroups.com
Hey Steve,
thanks a lot for your answer. As far i can see, i cannot use it. Unfortunately I use OptiStruct as Solver..i can only find a keyword to generate the k.op2 files.
Is there no documentation of the binary file of the k.op2?
Thanks a lot,
Regards,


--
You received this message because you are subscribed to a topic in the Google Groups "pyNastran Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pynastran-discuss/uFRWGizoRw8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pynastran-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Doyle

unread,
May 18, 2017, 4:46:48 PM5/18/17
to pyNastran Discuss
Phillip,

I'm not familiar with Optistruct other than they make OP2s that are mostly consistent.  I would ask Altair.  The documentation for all the matrix related stuff should be in the DMAP guide (assuming they have it).

Also, I don't have any of the Optstruct documentation.  Can you provide the QRG and DMAP guides as well as an small example bdf and 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-discuss+unsubscribe@googlegroups.com.

Paul Blelloch

unread,
May 18, 2017, 4:56:15 PM5/18/17
to pyNastran Discuss

KELM is not a G-set matrix, so you could not use the DMIG option.  The number of columns is the number of elements, and the number of rows is the maximum number of non-zero entries in any element.  So it’s just a straight forward matrix in OP2 format.  I forget if pyNastran can read regular matrices from OP2, but I thought that it could.  KDICT would be trickier since it’s a specific table, and then the code to actually use those to do something such as assemble a global stiffness matrix would require further trickery.

 


On Thursday, May 18, 2017 at 1:18:46 AM UTC-7, hip...@gmail.com wrote:

Paul Blelloch

unread,
May 18, 2017, 5:07:34 PM5/18/17
to pyNastran Discuss
P.S.

As far as I know Optistruct doesn't have DMAP, and their KELM matrix may in fact have nothing do with the KELM matrix that comes out of NX or MSC Nastran.  So much of what I said might be completely irrelevant.  As Steve suggests you'd need to get documentation from Optistruct to figure out what the format of their KELM matrix is, though I'm assuming that it is some kind of packed matrix of elemental stiffnesses.

Sorry :-(


On Thursday, May 18, 2017 at 1:18:46 AM UTC-7, hip...@gmail.com wrote:

Steven Doyle

unread,
May 18, 2017, 5:21:43 PM5/18/17
to pyNastran Discuss
Paul,

Oh, I was unaware the that the KELM doesn't map to the G-set.  I guess that makes sense.  I alos seem to be a bit unclear in my terminology.  I typically say DMI/DMIG/DMIJ/DMIK/etc. are in DMIG/MATPOOL form and that form is basically pair of (grid, component) with a series of values.

Is the NX/MSC KELM matrix a similar form to something like KGG that can be written to the OP4?  More terminology: something that can be written to the OP4 is what I just call a matrix, be it sparse or dense.

The KELM might just not be enabled because I thought it was a different type of table.  I'm pretty sure the KDICT is how you map the (grid, component) to KELM and is in a totally different format.

Steve

Paul Blelloch

unread,
May 18, 2017, 5:37:34 PM5/18/17
to pyNastran Discuss
I don't know about Optistruct, but in NX and MSC KELM and KDICT are output from the EMG DMAP module.  They are input to the EMA module, which assembles them into the global stiffness matrix KJJ (that's G-set by G-set).  While KELM is a matrix, neither its row or its columns are associated in a simple way with G-set DOF.  Each column is a single square elemental matrix packed into a column, but how it's coded depends on the type of element.  For some elements they are written in the nodal displacement coordinate system, in which case you can think of the rows for that specific column as being associated with DOF, though DOF would be repeated since you're unpacking a square matrix into a column.  For other elements the matrix is in either the elemental or the basic CS and there are additional coordinate system transformations required.  It's a bit of a mess and we only figured it out through trial and error (documentation is lacking).  So I don't think that reading KELM should be a challenge since it's just a plain old dense rectangular matrix.  Interpreting it in any useful way is far more problematic and requires decoding the associated KDICT table. There's also no reason to believe that Optistruct codes KELM the same as NX/MSC Nastran.


On Thursday, May 18, 2017 at 1:18:46 AM UTC-7, hip...@gmail.com wrote:

Steven Doyle

unread,
May 19, 2017, 12:59:00 PM5/19/17
to pyNastran Discuss
I took a look at the code and it looks like the KELM matrix is read.  It should just be located in op2_model.matrices['KELM']

Am I understanding the shape right?  For a matrix of just CQUAD4s, it should be dense, but if you have CRODs and CQUAD4s, shouldn't they it be sparse as it has a different number of DOFs?

It does make sense (maybe I've been doing Nastran too long) that the data is in the displacement (CD) coordinate system, though somewhat frustrating if you want to actually use it.  Maybe make two runs, where the first run is has all nodes with CD=0 and in the second, you actually read results...

Reply all
Reply to author
Forward
0 new messages