So I am working on some plasticity computations in FreeFem++, and I would need to obtain the global stiffness matrix for some other calculations.

I am referring to stiffness matrix of the form

for a single finite element.

Now the above definition is a general FEM definition for a stiffness matrix, so I assume FreeFEM does that one way or another at some point during the computation.

Question

Since FreeFEM at some point probably computes the global stiffness matrix, is it possible to store it in a local variable for later use?

Although the website linked by Yangshen is not up to date, you should indeed be aware that the default way to impose Dirichlet boundary conditions is penalization.

Please refer to the official documentation (page 217) regarding the incorporation of Dirichlet boundary conditions during the matrix assembly and there is also an example for the tgv-parameter: