# yade-users team mailing list archive

## [Question #695058]: Bending beams mass computation

```New question #695058 on Yade:

Hi there,

I had a look at the bending beams example from the cylinder section in yade's "more examples". [1][2]

I was interested in the mechanical behaviour and analysed the mass of the beams to see if they are computed correctly. That is important if correct mechanical behaviour of the simulation is expected, because it has significant influence on the deflection of the beams.

I just added the following lines at the end of the example code. I changed nothing in the code. I just added these lines at the very end:

print(f"\nBody zero is a {O.bodies[0].shape} with a mass of {round(O.bodies[0].state.mass,3)}.")
ana_node_mass = (4/3)* r**3 * math.pi * O.bodies[0].material.density
print(f"The mass of a Node/sphere is {round(ana_node_mass,3)} if analytically computed.")

sim_total_mass = sum( [b.state.mass for b in O.bodies] )
print(f"\nSimulation total mass: {round(sim_total_mass,3)} kg.")
ana_beam_mass = r**2 * math.pi * L * O.bodies[0].material.density + ana_node_mass # because the cylinders/beam include a half-sphere at the top and bottom
ana_total_mass = 4*ana_beam_mass # because there are 4 beams
print(f"Analytic total mass: {round(ana_total_mass,3)} kg.\n")
##########

This led to the following output:

Body zero is a <GridNode instance at 0x3a619d0> with a mass of 0.524.
The mass of a Node is 0.335 if analytically computed.
Simulation total mass: 69.115 kg.
Analytic total mass: 51.606 kg.

Also printAllVersion() returns the following:

In [1]: printAllVersions()

```
Yade features  :  BoostLog Odeint VTK OpenMP GTS GUI-Qt5 CGAL MPI FEMLIKE GL2PS PotentialParticles PotentialBlocks
```

Libraries used :

| library       | cmake                | C++                |
| ------------- | -------------------- | ------------------ |
| boost         | 1.71.0               | 1.71.0             |
| cgal          |                      | 5.0.2              |
| clp           |                      | 1.17.5             |
| cmake         | 3.16.3               |                    |
| compiler      | /usr/bin/c++ 9.3.0   | gcc 9.3.0          |
| eigen         | 3.3.7                | 3.3.7              |
| freeglut      | 2.8.1                |                    |
| gl            |                      | 20190805           |
| ipython       | 7.13.0               |                    |
| metis         |                      | 5.1.0              |
| mpi           | 3.1                  | ompi:4.0.3         |
| mpi4py        | 3.0.3                |                    |
| openblas      |                      |  OpenBLAS 0.3.8    |
| python        | 3.8.5                | 3.8.5              |
| qglviewer     |                      | 2.6.3              |
| qt            |                      | 5.12.8             |
| sphinx        | 1.8.5-final-0        |                    |
| sqlite        |                      | 3.31.1             |
| vtk           | 6.3.0                | 6.3.0              |

Linux version: Ubuntu 20.04.1 LTS

Can someone explain to me how the mass is computed in the simulation and why it differs quite a lot to my analytical computation?
To ensure correct behavior (e.g. the deflection of the beam, forces acting on the beam like gravity) it would be necessary to obtain the correct mass of the whole body (and also the correct mass distribution).

Best regards!