The punch file method may be used to extract the mass & stiffness matrices from Nastran models. The format is awkward since zero terms are not stored. Also the matrices are assumed to be symmetric, and the upper triangular portion above the diagonal is not stored.
Here is a paper from the Middle East Technical University which explains the format: paper link.
The key is to apply the following command in the *.nas, *.dat, *.bdf or equivalent file:
PARAM,EXTOUT,DMIGPCH
Here is a sample file for a fixed-free beam, aluminum, 24 inch long, solid cylinder, 0.25 inch diameter, 24 elements: beam_24e_diam_0p25_punch-000.nas
Its punch file output is: beam_24e_diam_0p25_punch-000.pch
The fundamental frequency is 11.9 Hz.
If Femap is used, select the punch output with coupled mass.
Here is a C++ program which converts the punch file into full mass & stiffness matrices in ASCII text format:
The mass & stiffness matrices can then be imported to Excel, Matlab or some other program.
* * *
Note: the dimension of the extracted mass matrix will be less than that of the stiffness matrix for models with massless nodes.
Here is a workaround:
An Indirect Method for Extracting Nastran Full Mass Matrices for Models with Massless Nodes extract_massless_node.pdf
– Tom Irvine