# Principal Stress/Strain Calculation

**URL:** https://community.freefem.org/t/principal-stress-strain-calculation/398
**Category:** General Discussion
**Created:** [May 10, 2020, 1:51pm UTC](https://community.freefem.org/t/principal-stress-strain-calculation/398 "2020-05-10T13:51:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![geoyanzhan3](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/geoyanzhan3/32/147_2.png) [@geoyanzhan3](https://community.freefem.org/u/geoyanzhan3)
#### Post date: [May 10, 2020, 1:51pm UTC](https://community.freefem.org/t/principal-stress-strain-calculation/398/1 "2020-05-10T13:51:35Z")

</div>

Hi,

I am building a 2d/3d elasticity model. By following the tutorial (e.g., Beam\_3d.edp), I can solve the stresses {Sxx, Syy, Sxy} (in 2d) or {Sxx, Syy, Szz, Sxy, Syz, Sxz} (in 3d).

Can I further calculate the principal stresses for all elements? Is using EigenValue function a right direction?

Like solving:  
`( A - \lambda I )x = 0`  
where A is the stress tensor:

A = [Sxx, Sxy, Sxz,  
Sxy, Syy, Syz,  
Sxz, Syz, Szz]

`\lamba` is 3 eigenvalues

Thank you very much!

Yan

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [May 11, 2020, 7:42am UTC](https://community.freefem.org/t/principal-stress-strain-calculation/398/2 "2020-05-11T07:42:40Z")

</div>

For small dense matrices, you can use the LAPACK `dgeev` routine, see [here](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/plugin/lapack.edp#L58) an example. I think that what you want to do is basically loop over your elements and call this routine on all of them?

---

<div class="post-metadata">

### Author: ![geoyanzhan3](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/geoyanzhan3/32/147_2.png) [@geoyanzhan3](https://community.freefem.org/u/geoyanzhan3)
#### Post date: [May 11, 2020, 12:50pm UTC](https://community.freefem.org/t/principal-stress-strain-calculation/398/3 "2020-05-11T12:50:14Z")

</div>

Thank you very much, prj!
