export the position of sphere

Asked by mikexue

Hello,
I wanted to get the positions of spheres when unbalanced Force < .05 and use export.text() to get the positions of spheres, but I failed.

from yade import pack, plot
from yade import export

# create rectangular box from facets
O.bodies.append(geom.facetBox((.5, .5, .5), (.5, .5, .5), wallMask=31))

# create empty sphere packing
sp = pack.SpherePack()
# generate randomly spheres with uniform radius distribution
sp.makeCloud((0, 0, 0), (1, 1, 1), rMean=.05, rRelFuzz=.5)
# add the sphere pack to the simulation
sp.toSimulation()

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),

]
O.dt = .5 * PWaveTimeStep()

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
def checkUnbalanced():
 if unbalancedForce() < .05:
  O.pause()
                export.textExt("positions.txt")
O.saveTmp()

I appreciate your help.

Best.
Mikexue

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
mikexue
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> I ... use export.text()
> export.textExt("positions.txt")

please be consistent.

> but I failed

please read [1] and provide more information (mainly symptoms of "failing")

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
mikexue (mikexue) said :
#2

Jan, I am sorry.I rerun the script.It worked

Revision history for this message
mikexue (mikexue) said :
#3

Thank you, Jan!!