← Back to team overview

yade-users team mailing list archive

[Question #668286]: save in txt.file a packing of spheres

 

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

hi, i m new in yade. I have to describe a land distribution. I m using  all the command of gravity deposition. Now, what i want to do is to save in a txt file the final position of the sphere packings, so i will open it in a new file to change material , properrties and let collide with another body. How can i do ? i try to use export.textExt but is not working. How can i save then the positions and radii of all the spheres? this is my code, thanks for the help:

#####################################################


O.bodies.append(geom.facetBox((10,10,10),(10,10,10),wallMask=31))

# create empty sphere packing

sp=pack.SpherePack()
# generate randomly spheres with uniform radius distribution
sp.makeCloud((0,0,0),(10,10,2.6),rMean=.1,rRelFuzz=.1)

O.bodies.append(pack.regularHexa(pack.inAlignedBox((0,0,0),(20,20,20)),radius=.3,gap=0,color=(0.929,0.412,0.412),material="ghiaia"))

O.engines=[ForceResetter(),InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_MindlinPhys_HertzWithLinearShear()]),

NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4
),
   # call the checkUnbalanced function (defined below) every 2 seconds
PyRunner(command='checkUnbalanced()',realPeriod=2),
   # call the addPlotData function every 200 steps
PyRunner(command='addPlotData()',iterPeriod=10)
]
O.dt=.5*PWaveTimeStep()



O.trackEnergy=True

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
   if unbalancedForce()<.05:
      O.pause()
      plot.saveDataTxt('bbb.txt.bz2')
export.textExt('/tmp/compressed.txt','x_y_z_r_attrs',attrs=[])
      

# collect history of data which will be plotted
def addPlotData():
   
plot.plots={'i':('unbalanced',None,O.energy.keys)}


plot.plot()


O.saveTmp()
export.textExt('/tmp/compressed.txt','x_y_z_r_attrs',attrs=[])

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