← Back to team overview

yade-users team mailing list archive

[Question #688934]: Mass in the cylinder

 

New question #688934 on Yade:
https://answers.launchpad.net/yade/+question/688934

I am trying to calculate the mass of the particles that remain inside the cylinders, I defined the functions to calculate them but it generates an error when executing the algorithm and does not show me the value I need.


from yade import pack, plot

#Altura de caida del material
hc=0

#EQUIPO

#coordenadas centro
x=0
y=0
z=0

#coordenadas extension

f=0.45
a=0.50
h=1


#estrutura del equipo de pluviacion 
O.bodies.append(geom.facetBox((x,y,z),(f,a,(h+hc)),wallMask=31,wire=True))

#Mallas
#O.bodies.append(utils.wall((0,0,(.2+hc)),axis=2,color=(1,0.945,0.078),sense=-1))

#(0,0,(.2+hc)),axis=2,color(1,0.945,0.078),sense=0))


      #O.bodies.append(utils.wall((0,0,.2),axis=2,sense=0))

#PROBETA

#Radio
radius=0.05

#Altura de la probeta
height=0.1

#Probeta 1
#Coordenadas centro
xp1=0.1
yp1=0
zp1=1

O.bodies.append(geom.facetCylinder((xp1,yp1,(-zp1-hc+(height/2))), radius=radius, height=height, fixed=True, wallMask=6, color=(0.933,0.090,.894), wire=False))

#Probeta 2
#Coordenadas centro
xp2=0.1
yp2=0
zp2=1

O.bodies.append(geom.facetCylinder((-xp2,yp2,(-zp2-hc+(height/2))), radius=radius, height=height, fixed=True, wallMask=6, color=(0,0,1), wire=False))


#coordenadas perimetro de particulas
#esquina inferior
xi=0.225
yi=0.225
zi=0.2

#esquina superior
xs=0.225
ys=0.25
zs=0.5

#porosidad 
p=0.903

#tamices
#los diametrso y los porcentajes acumulados siempre se deben ubicar de menor a mayor
#por cada t debe haber un p

#Diametro de la abertura de tamices psdSizes	
t1=0.00008
t2=0.00015
t3=0.00030
t4=0.00085
t5=0.00200
t6=0.00475

#Porcentajes retenidos del material psdCumm
p1=0
p2=0.002
p3=0.111
p4=0.889
p5=0.9994
p6=1

#Material 
#angulo de friccion 
angulo=radians(36) #radianes
#densidad del material
densidad=1418 #(kg/m3)
#Modulo de Young
young=(1e8) #Pa
#Poisson
poisson=0.5
#contenidod de vacios 
porosidad=0.9
#Algoritmo YADE para el material
snd=O.materials.append(FrictMat(young=young,frictionAngle=radians(angulo),density=densidad,
#label="SndG"
))

#Algoritmo YADE para el cuerpo de las esferas

sp=pack.SpherePack()

sp.makeCloud((xi,-yi,(zi+hc)), (-xs,ys,(zs+hc)), porosity=porosidad, psdSizes=[t1,t2,t3,t4,t5,t6], psdCumm=[p1,p2,p3,p4,p5,p6], distributeMass=False)


sp.toSimulation(material=snd,color=(0.882,0.866,0.839))

O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),
				Bo1_Facet_Aabb(),
				Bo1_Cylinder_Aabb(),
				Bo1_Wall_Aabb()
	]),
	InteractionLoop(
		# handle sphere+sphere and facet+sphere collisions
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),
	#GravityEngine(gravity=(0,0,-9.81)),	
	NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
	PyRunner(command='checkUnbalanced()',realPeriod=1),
	PyRunner(command='isBodyInCylinder()',realPeriod=1),
	PyRunner(command='masses()',realPeriod=1)
]
O.dt=PWaveTimeStep()

def checkUnbalanced():
	if unbalancedForce()<0.05: O.pause()


def isBodyInCylinder(body,center,radius):

	d=body.state.pos-center
	d[2]=0
	distance=d.norm()
	return distance<radius


def masses():
	mass1=mass2=0.0
	center1=(xp1,yp1,zp1)
	center2=(-xp2,yp2,zp2)
	for b in O.bodies:
		
		if not isinstance(b.shape,Sphere): continue
		if isBodyInCylinder(b,center1,radius):
			mass1+=b.state.mass
		if isBodyInCylinder(b,center2,radius):
			mass2+=b.state.mass
		return mass1,mass2
		print(mass1,mass2)

Thanks

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