# Re: [Getfem-users] How to calculate pressure/stress tensor from displacement in linear elasticity problems

```Dear Kostas,

```
I'm interested in computation of stress of a linear elasticity problem. I found this discussion in the getfem-users archive.
```
```
Could you please explain me what is the "mass matrix" in GetFEM++, and how do you need the line "sigmaij = np.transpose(gf.linsolve_mumps(mass_mat_t, sigmaij))" to get sigmaij?
```

Best regards,

Phuoc

```
On Thu, Jan 26, 2017 at 5:07 PM, Konstantinos Poulios <address@hiddenom <mailto:address@hidden>> wrote:
```
Dear Samyak

It would be helpful to know which material law you use (small or
large strains?) and which programming language (python, matlab,
scilab, C++?).

E.g for small strains elasticity in python, something like this
should work:

mass_mat_t = gf.asm_mass_matrix(mim, mft)
for i,j in [[1,1],[2,2],[1,2]]:
sigmaij = gf.asm_generic(mim, 1, "({Lambda}*Div_u*Id(qdim(u)) +
i=i, j=j), -1,
"u", False, mfu, md.variable("u"),
"t", True, mft, np.zeros(mft.nbdof()))
sigmaij = np.transpose(gf.linsolve_mumps(mass_mat_t, sigmaij))

Then sigmaij has the ij component of the stress tensor projected on
the finite element space defined in mft. If mft is a Lagrangian FEM
the values of sigmaij will correspond to the nodes of mft. The
projection from gauss points to the finite element space is as Yves
mentioned some kind of averaging.

I hope this helps.

Best regards
Kostas

```