← Back to team overview

yade-users team mailing list archive

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

 

Question #695058 on Yade changed:
https://answers.launchpad.net/yade/+question/695058

Paul Pircher gave more information on the question:
Here the complete code for copy pasta:

# encoding: utf-8
"An example showing various bending beams."

from builtins import range
from yade.gridpfacet import *

#### Parameter ####
L=10.		# length of the beam
n=12		# number of nodes used to generate the beam
r=L/50.	# radius of the beam element

#### Engines ####
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_GridConnection_Aabb()]),
	InteractionLoop(
		[Ig2_GridNode_GridNode_GridNodeGeom6D()],
		[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],
		[Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]
	),
	NewtonIntegrator(gravity=(0,0,-10),damping=0.5,label='newton')
]

#### Create materials and set different properties ####
O.materials.append(CohFrictMat(young=1e6,poisson=0.3,density=1e1,frictionAngle=radians(10),normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=False,label='mat1'))
O.materials.append(CohFrictMat(young=1e6,poisson=0.3,density=1e1,frictionAngle=radians(10),normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='mat2'))
O.materials.append(CohFrictMat(young=3e6,poisson=0.3,density=1e1,frictionAngle=radians(10),normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='mat3'))
O.materials.append(CohFrictMat(young=1e7,poisson=0.3,density=1e1,frictionAngle=radians(10),normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='mat4'))

#### Vertices ####
vertices1=[]
vertices2=[]
vertices3=[]
vertices4=[]
for i in range(0,n):
  vertices1.append( [i*L/n,0,0] )
  vertices2.append( [i*L/n,1,0] )
  vertices3.append( [i*L/n,2,0] )
  vertices4.append( [i*L/n,3,0] )

#### Create cylinder connections ####
nodesIds=[]
cylIds=[]
cylinderConnection(vertices1,r,nodesIds,cylIds,color=[1,0,0],highlight=False,intMaterial='mat1')
cylinderConnection(vertices2,r,nodesIds,cylIds,color=[0,1,0],highlight=False,intMaterial='mat2')
cylinderConnection(vertices3,r,nodesIds,cylIds,color=[0,0,1],highlight=False,intMaterial='mat3')
cylinderConnection(vertices4,r,nodesIds,cylIds,color=[1,1,1],highlight=False,intMaterial='mat4')

#### Set boundary conditions ####
for i in range(0,4):
   O.bodies[nodesIds[i*n]].dynamic=False
#   O.bodies[nodesIds[i*n]].state.blockedDOFs='xyzXYZ'
#   O.bodies[nodesIds[i*n]].state.blockedDOFs='xyz'

#### For viewing ####
from yade import qt
qt.View()

#### Set a time step ####
O.dt=1e-05

#### Allows to reload the simulation ####
O.saveTmp()

#### Added mass computation ####
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")

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.