# Obtaining the strain-displacement matrix

**URL:** <https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291>\
**Category:** General Discussion\
**Created:** [October 29, 2021, 8:21am UTC](https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291 "2021-10-29T08:21:08Z")\
**Posts on this page:** 5\
**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:** [October 29, 2021, 8:21am UTC](https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291/1 "2021-10-29T08:21:08Z")

</div>

In FEM, the displacements are known in mesh nodes. The strain tensor **Eps** is then computed using the strain-displacement matrix, usually noted with **B** , so that **Eps** = **B**  **u** for displacement vector **u**.

Additionally, stress tensor can be obtained as **sigma** = **E Eps** , for elasticity tensor **E**. Finally, the divergence of the stress tensor then becomes div( **sigma** ) = **B^T sigma**

# Goal

My goal is to compute the divergence of the stress tensor. But I can’t figure out how to do that wihtout knowing the strain displacement matrix **B**. Is there a way to obtain that matrix **B** from FreeFem?

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [October 29, 2021, 3:14pm UTC](https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291/2 "2021-10-29T15:14:23Z")

</div>

the only problem is div(Eps(u)) is a operator of order 2 , so the derivative with distribution sense is not so easy ( you get dirac on edge, in 2d). but you can try to solve

solve Prob([dive1,dive2]’,[w1,w2]) =  
int2d(Th) ([dive1,dive2]’\*[w1,w2]) + int2d(Th)( Eps(u):[grad(w1),grad(w2)] + BC ???

---

<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:** [October 30, 2021, 8:57am UTC](https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291/3 "2021-10-30T08:57:58Z")

</div>

So solving something like

```auto
 macro graaad(w1, w2) [dx(w1), dy(w1), dy(w2), dy(w2)] // EOM

Nh dive1, dive2, dive, w1, w2;
solve Prob([dive1,dive2],[w1,w2]) =
	int2d(Th) ([dive1,dive2]'*[w1,w2]) 
	+ int2d(Th)( e(u, v)' * graaad(w1, w2))
	+ on(4, dive1=0, dive2=0)
	;

```

For the following case should do the trick? I am **super not sure** about the BC though!

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

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [October 30, 2021, 9:13am UTC](https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291/4 "2021-10-30T09:13:34Z")

</div>

yes, I think is correct

---

<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:** [November 2, 2021, 2:25pm UTC](https://community.freefem.org/t/obtaining-the-strain-displacement-matrix/1291/5 "2021-11-02T14:25:08Z")

</div>

Sadly this will not do the job. I must be able to compute the divergence of the stress tensor, without computing the strains from displacements.

In plasticity, for example, the stresses in each node can be and are corrected with Newton-Raphson method. And the exit condition for the N-R method requires computation of the divergence of the stress tensor - not from the displacements, but rather directly. In general FEM, that’s supposed to be easy by taking **f = B^T \* sigma**.
