# Finite Element, NASTRAN, DMAP, how to print the differential stiffness matrix in .f06 output file

We are working on an optimization problem in which we can approximate the eigenvalue calculation by assuming a constant eigenvector, using the formula:

$$\tilde{\lambda}=\frac{\{\phi_0\}^T[K]\{\phi_0\}}{\{\phi_0\}^T[K_{G_0}]\{\phi_0\}}$$

where $\{\phi_0\}$ is the already calculated eigenvector, $[K_{G_0}]$ is the already calculated differential stiffness matrix and $[K]$ is the new stiffness matrix. We managed already to print $[K]$ using a couple of DMAP commands (see example in this link), but how to print $[K_{G_0}]$?

-

## migrated from physics.stackexchange.comMay 12 '13 at 10:01

This question came from our site for active researchers, academics and students of physics.

After scrutinizing thoroughly the NASTRAN documentation I found the following option to print the stiffness matrix $[K]$:

SOL 101
TIME 20
DIAG 8
compile semg
alter 'kjjz.*stiffness'
matprn kjjz//
CEND
SPC = 1
SUBCASE 1
BEGIN BULK
INCLUDE 'bulk_data.dat'


That will print the stiffness matrix into the .f06 file.

After printing the stiffness matrix the differential stiffness matrix can be calculated using the approximation above, i.e. dividing the stiffness matrix by the eigenmode:

$$[K_{G_0}] = \frac{[K]}{\lambda_0}$$

Where $\lambda_0$ is the already computed eigenvalue (using SOL 105 for example). There will be a different $[K_{G_0}]$ for each eigenvalue.

A sample code is available here using a Python script to compute the approximated eigenvalue using the equation presented in the question. You have to execute:

python test_01.py


Things to be improved here:

• how to stop the solution just after the stiffness matrix is printed, to avoid running the SOL 101 (but running it with zero load will be fast)

• how to print the stiffness matrix in a binary file

-