yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #28157
Re: [Question #702750]: How to detect the coordinates of each particle?
Question #702750 on Yade changed:
https://answers.launchpad.net/yade/+question/702750
Status: Answered => Open
孙灿 is still having a problem:
My code is as follows:
from yade import pack,plot
O.bodies.append(geom.facetBox((0.05, 9, 10), (0.1, 9, 10), wallMask=63))
sp = pack.SpherePack()
sp.makeCloud(Vector3(0.05,0,0),Vector3(0.05,18,20), rMean=0.1, rRelFuzz=1/3)
sp.toSimulation()
(xdim,ydim,zdim)= aabbDim()
print("Height is ",zdim)
for b in O.bodies:
if isinstance(b.shape,Sphere):
b.state.blockedDOFs='ZxY'
b.shape.color=(3.,2.,1.)
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
PyRunner(command='checkUnbalanced()', realPeriod=2),
PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = 0.5 * PWaveTimeStep()
O.trackEnergy = True
def checkUnbalanced():
if unbalancedForce() < .05:
O.pause()
#coords = [b.state.pos for b in O.bodies]
#print(b.state.pos)
#zMax = max(b.state.pos[2] for b in O.bodies)
zMax = max(b.state.pos[2] for b in O.bodies)
print("Z ",zMax)
(xdim,ydim,zdim)= aabbDim()
print("Height is ",zdim)
def addPlotData():
plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)
O.saveTmp()
from yade import qt
qt.Controller()
#qt.View()
>This code throw IndentationError: unexpected indent
This may be due to an indentation error caused by copying over.
>what do you mean by "no z-value output"?
Yes, I found this problem, I did not set the print for output.
But the zMax = max(b.state.pos[2] for b in O.bodies) string of code
didn't solve my problem. It can only get the z-value of the highest
particle before the run, and I need to get the z-value of the uppermost
particles after gravity.
--
You received this question notification because your team yade-users is
an answer contact for Yade.