# yade-users team mailing list archive

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

```Question #695058 on Yade changed:

Bruno Chareyre proposed the following answer:
Here is a fix for your test. :)

#### mass computation ####
realLength= (O.bodies[n-1].state.pos-O.bodies[0].state.pos).norm()    # first node to last node of first beam
ana_beam_mass = r**2 * math.pi * realLength * O.bodies[0].material.density
totalActiveMass = sum( [O.bodies[id].state.mass for id in nodesIds] )
print("analytical mass",ana_beam_mass," vs. numerical mass ",totalActiveMass/4)
##########

Output:
analytical mass 11.519173063162576  vs. numerical mass  11.519173063162569

Arguably the function "cylinderConnection()" can be confusing. It produces a node to to node distance which is less than L/N since it includes the spherical caps in L.
OTOH the total mass is defined by neglecting the spherical caps, hence an apparent inconsistency.

Another thing is that the cylinderConnections are never dynamic, they
are just folloing the nodes. They turn out to have have a mass because
some constructors define one by default, but it is not actually used
anywhere. So total mass of the beam is the mass of its nodes.

For very short objects it might not be a good idea to neglect the mass
of spherical caps. On the other hand it would be painfull to compare to
beam theory if the mass was not uniformly distributed (currently it is,
with end nodes having 0.5*mass of center nodes, it wouldn't with
spherical caps).

In the end, all this is just pre-processing by some python helper
function. You can easily assign mass per-node the way you like it, and
you could also bend a modified version of cylinderConnection() to your
liking.

HTH
Bruno

--