local region particle number
hi all,
I want to get the local variables, something like the local stress for a specific region.
my idea is to set a local region and then under that condition, I can calculate these variables.
my first step is to set a local region, I think this is very easy. see the code below.
however, when I count the number of particles in this region, the number by using the code is not the same as shown in the 3D plot.
here is the code.
#######
from yade import pack, plot, export
O.bodies.
sp=pack.
sp.makeCloud(
sp.toSimulation()
O.engines=[
ForceResett
InsertionSo
Interaction
PyRunner(
#PyRunner(
PyRunner(
#PyRunner(
NewtonInteg
]
O.dt=.5*
print(len(
def checkUnbalanced():
if unbalancedForce
O.pause()
#######
ball_list1 =[]
ball_list2 =[]
ball_list3 =[]
def subbox():
global ball_list1
global ball_list2
global ball_list3
for b in O.bodies:
if 0< b.state.pos[2] <= 0.15:
if isinstance(
b.shape.color =Vector3(
m = b.id
ball_
elif 0.15 < b.state.pos[2] <= 0.3:
if isinstance(
b.shape.color =Vector3(0,100,000) # green
n = b.id
ball_
elif b.state.pos[2] > 0.3:
if isinstance(
b.shape.color =Vector3(00,00,255) # blue
q = b.id
ball_
print("this is the number in region 3:",len(
#######
I divide the particles into three regions. as you can see, region three is the upper layer. if we count the number in this region, theere are about 20 particles. however, if we use the print function, this number is about 4500.
I think this may relate to the global or local variable of the " global ball_list3". but right now I haven't figure out how to solve this problem.
thanks!
Yong
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Stránský
- Solved:
- Last query:
- Last reply: