# Print global stiffness matrix in AceFEM

I have a 2D linear elastic simulation in AceFEM and for post-processing purposes I would like to print the global stiffness matrix and global displacement vector.

I am able to get the global x and y displacements using:

GlobalUx = SMTPostData["u"];
GlobalUy = SMTPostData["v"];


from which I can assemble the global displacement vector. (Is there a simpler way?)

My simulation has 2343 nodes and therefore 4686 degrees of freedom. I am attempting to get the global stiffness matrix using

GSM=SMTData["TangentMatrix"]


However, the resulting matrix has dimensions of 4563x4563, which is smaller than it should be. How can I get the full stiffness matrix?

Note: SMTData["MatrixGlobal"] gives the same result as SMTData["TangentMatrix"].

• Perhaps that global stiffness matrix has it's boundary conditions already applied (i.e. removed?) Mar 31, 2021 at 14:04
• @user21 Yes I think that is the case! I would like to have the 'unmodified' or full version of the stiffness matrix though. Mar 31, 2021 at 14:09
• What happens if you do not set up boundary conditions? As an alternative, I can show you how to get the global stiffness matrix with the low level FEM stuff that is build in Mathematica. Is that of interest? Apr 2, 2021 at 6:30
• Yeah, thanks! If I apply no BCs then the stiffness matrix does have the correct dimensions. It would, however, be more convenient to get the full matrix from a problem that does have BCs and not have to create a problem without BCs. Apr 2, 2021 at 8:05
• Then you have to look for changing how the BCs are applied. Removal is one options, appending is another (makes the system larger via lagrangian multipliers) and modification is the third (this is what you are looking for - and the default in Mathematica) You probably have to ask the vendor of AceGen/AceFEM how to change the method of boundary condition deployment. Apr 2, 2021 at 8:15

SMTNodeData is the right command for those questions.

1. SMTNodeData["at"] returns all nodal DOFs. SMTPostData command is for visualization and in general can smooth fields to have nice plots.

2. Global tangent matrix by its definition includes only true unknowns of the problem. If you want an extended tangent with all nodal DOFS included then you can do something like this

tmp = SMTNodeData["DOF"];
(*unconstrain all DOF*)
SMTNodeData["DOF", tmp /. -1 -> 0];
SMTSetSolver[];
Kall = SMTData["TangentMatrix"];
(* return all back as it was*)
SMTNodeData["DOF", tmp];
SMTSetSolver[];


This will not have any side effects.

A simple solution is to set up the problem geometry and not apply the boundary conditions. Then you can run this 'null' problem and print the full stiffness matrix using SMTData["TangentMatrix"] or SMTData["MatrixGlobal"] as mentioned in the OP.

The global stiffness matrix is then easy to store using Mathematica's Export function.

The boundary conditions can then be applied and the problem can be re-run. The stored GSM can then be used for post-processing.

• It would be easier to understand this process of getting a global stiffness matrix if you give a small example of any boundary value problem in AceFEM. May 31, 2021 at 9:16