# Get global stiffness matrix from freefem

**URL:** https://community.freefem.org/t/get-global-stiffness-matrix-from-freefem/1161
**Category:** General Discussion
**Created:** [August 18, 2021, 2:39pm UTC](https://community.freefem.org/t/get-global-stiffness-matrix-from-freefem/1161 "2021-08-18T14:39:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![distractor](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@distractor](https://community.freefem.org/u/distractor)
#### Post date: [August 18, 2021, 2:39pm UTC](https://community.freefem.org/t/get-global-stiffness-matrix-from-freefem/1161/1 "2021-08-18T14:39:08Z")

</div>

Hi,

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

> ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/c8203b999148ad2d9d48da7a268b5f62c4bbb811.png)

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?

---

<div class="post-metadata">

### Author: ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)
#### Post date: [August 22, 2022, 2:37am UTC](https://community.freefem.org/t/get-global-stiffness-matrix-from-freefem/1161/2 "2022-08-22T02:37:15Z")

</div>

[documentation](https://people.sc.fsu.edu/~jburkardt/freefem_src/stiffness_matrix/stiffness_matrix.html)  
This article describes how freefem defines a stiffness matrix, which may be helpful to you

---

<div class="post-metadata">

### Author: ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)
#### Post date: [August 22, 2022, 10:16am UTC](https://community.freefem.org/t/get-global-stiffness-matrix-from-freefem/1161/3 "2022-08-22T10:16:26Z")

</div>

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)](https://github.com/FreeFem/FreeFem-doc/raw/pdf/FreeFEM-documentation.pdf) regarding the incorporation of Dirichlet boundary conditions during the matrix assembly and there is also an example for the tgv-parameter:

> <https://github.com/FreeFem/FreeFem-sources/blob/master/examples/tutorial/tgv-test.edp>

You can also take a look at the [tutorial by Pierre Jolivet](https://joliv.et/FreeFem-tutorial/main.pdf) or the [tutorial by Fotios Kasolis](https://github.com/fotios-kasolis/FreeFEM-tutorial-public)
