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

Hi All,

I want to use this command :   yade.export.text(filename, mask=-1) to export 
the particle position and radius.  the explanation for this command is:  mask 
(int) – export only spheres with the corresponding mask.



here is the MWE:


import numpy as np
from yade import pack, plot, export, utils
import math
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=31))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=.07,rRelFuzz=.5)
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()]
        ),
        PyRunner(command='checkUnbalanced()',realPeriod=2),
        PyRunner(command='subbox()',iterPeriod=1000),
        #PyRunner(command='displacement()',iterPeriod=30000),
        
#VTKRecorder(fileName='3d-vtk-',recorders=['all','bstresses'],iterPeriod=1000),
        PyRunner(command='get_po()',iterPeriod=1000),
        NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
        
]
O.dt=.5*PWaveTimeStep()
print(len(O.bodies))
def checkUnbalanced():
        if unbalancedForce()<.001:
                O.pause()
#plot.plots={'i':('unbalanced')}
#plot.plot()
x0 = 0.5
y0 = 0.5
z0 = 0.5
######################## sub-region and 
coloring#########################################
ball_list1 =[]
def subbox():
        global ball_list1
        aaa = 0.0
        for b in O.bodies:
                brp = math.sqrt((b.state.pos[0]-x0)**2 + (b.state.pos[1]-y0)**2)
                if brp >= 0.2:
                        if brp <= 0.4:
                                if (b.state.pos[2]-z0 >= -0.5) and 
(b.state.pos[2]-z0 <= 0.0):
                                        if isinstance(b.shape,Sphere):
                                                b.shape.color 
=Vector3(255,255,255) # white
                                                m = b.id
                                                ball_list1.append(m)
for i in ball_list1:            
        for b in O.bodies[i]:
                b.mask = 1
def get_po():
        export.text(filename = "state1.txt",mask = 1)


but it seems this command just export all particle' information. not just 
ball_list1.

Is there anyone can give me some suggestions.

best,
yong





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

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to