# yade-users team mailing list archive

## Re: How to keep a constant stress boundary?

```
Le 14 sept. 2009 à 18:30, Bruno Chareyre a écrit :

```
```I wrote Shop::totalForceInVolume, which computes stiffness and force
just for that purpose. I am not sure it is physically correct, but
should be: if you sum forces on all interactions (abs values of the
components, that is), you get some summary force in the whole
simulation. Dividing that force e.g. z-component by xy area of the
periodic cell, you have average stress in the z sense, right?

```
```After 1min of thinking :
```
mmmh.... probably not. Suppose you have the same stress in a sample that is twice higher (y-length) with the same x/z length, the sum of forces will be multiplied by 2, you divide by the same area. YOUR stress is twice bigger when it should be the same. You need to divide by a volume like in Love-Weber : Sum(fi*lj)/V // component (ij) of the stress tensor Not a big deal to compute that (its somewhere in a recorder already, it needs adaptation for periodic volume though).
```
Maybe it should be more clear with that:

sigma components (xx, xy,..., zz) = 0
FOREACH_INTERACTIONS
```
- Compute lx, ly and lz (components of the branch vector that connects the mass centers) - Compute fx, fy and fz (components of interaction force, don't mind about the constitutive law and the sign if we just want to compute the mean stress tensor)
```
sxx += fx * lx;
sxy += fx * ly;
sxz += fx * lz;
// ...
syx += fy * lx;
// ...
szz += fz * lz;
END_LOOP

- Compute volume V of the cell by using cellMin and cellMax vectors.
- Multiply the mean stress components by 1/V.

(obviously, it should be shortly written with wm3...)

```
Note also that a dynamic contribution (usually neglected in quasi static problems) can be added to this expression.
```
```
```I would be glad if you could check that Shop::totalForceInVolume.

Some control code is in PeriIsoCompressor, you can take that as
inspiration, I think it is quite readable:

Vector3r cellSize=rb->cellMax-rb->cellMin;
```
Vector3r cellArea=Vector3r(cellSize[1]*cellSize[2],cellSize[0] *cellSize[2],cellSize[0]*cellSize[1]);
```Vector3r sumForces=Shop::totalForceInVolume(avgStiffness,rb);
```
Vector3r sigma=Vector3r(sumForces[0]/cellArea[0],sumForces[1]/ cellArea[1],sumForces[2]/cellArea[2]);
```// etc.

```
If I change the value of, say, rb->cellMax, will it instantly translate all particles in proportion? (you remember this old discussion?)
```
```
With tri-periodic conditions, the cell can be considered (and can be treated) as a bodies defined by a mass, a matrix 3x3 for the position, and two other matrixes 3x3 for velocity and acceleration. Any transformation of the cell should instantly be translate to the particles ! This is actually what I do in a 2D code (tapio-K).
```
I hope it helps.

VR

```