yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #22245
Re: [Question #688837]: calculate the mass of the particles
Question #688837 on Yade changed:
https://answers.launchpad.net/yade/+question/688837
Status: Answered => Open
Estefany Carmona Alvarez is still having a problem:
Jan!
With the commands you indicated, I can now see that the simulation stops for the indicated condition.
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)
>>>
1. But when executing the isBodyInCylinder function the script shows the following alert:
###
TypeError: isBodyInCylinder () takes exactly 3 arguments (0 give)
###
I understand that the arguments requested are the body (b), the center
(center1 or center2) and the radius. I understand that these arguments
are defined, so I don't know what the error might be.
>>>
2. If it is ok to add a PyRunner for each command created
###
PyRunner (command = 'checkUnbalanced ()', realPeriod = 1),
PyRunner (command = 'isBodyInCylinder ()', realPeriod = 1),
PyRunner (command = 'masses ()', realPeriod = 1)
###
>>>>>
3. Is there any reference value for the real Period or how can I ensure that the period indicated for the function is sufficient.
Thanks Jan!!
--
You received this question notification because your team yade-users is
an answer contact for Yade.