yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #22715
[Question #689910]: How to save only the particles that contain in the box below ?
New question #689910 on Yade:
https://answers.launchpad.net/yade/+question/689910
Now I am creating a box that contains particles and in the box there are two box other box overlapping each other. So I compaction the particle til it should have maximum density . After that I use the order that remove the box on top so that I can use only the particles that contain in the box below.
Like the linked here : https://drive.google.com/file/d/1NJS5aNrSW_rJr_QfPmBXiCBpa6gjfhRj/view?fbclid=IwAR0T39TBoc9dr6izEWT1KW4DXGgrfARtabsu_h3gpQx4BQVm2DCN_XTjIBs
After that I want to save the particles or sphere in the box below that are left by using an order export.text() to save the particles. But there was a problem in the order that it save the particles that contain in both boxes but I only want to save the particles that contain in the box below. Do you have a suggestion how to save only the particles that contain in the box below ?
this is my code :
from yade import pack,ymport
import matplotlib.pyplot as plt
import math
O.materials.append(FrictMat(young=20e10,density=7860,label="steel"))
O.materials.append(FrictMat(young=20e6,poisson=0.3,frictionAngle=radians(30),density=1800,label='spheres'))
# create rectangular box from boxes (maybe there is some library function, but I did not find it quickly)
cx,cy,cz = 6.3,6.3,6.3 # center of the box
dx,dy,dz = 7.5,7.5,7.5 # half-dimensions of the box
t = 0.25 # half-thickness of walls
left = box((cx-dx-t+1.2,cy+1.2,cz),(t,dy+2*t,cz),fixed=True,wire=True,material="steel")
right = box((cx+dx+t+1.2,cy+1.2,cz),(t,dy+2*t,cz),fixed=True,wire=True,material="steel")
front = box((cx+1.2,cy-dy-t+1.2,cz),(dx,t,cz),fixed=True,wire=True,material="steel")
back = box((cx+1.2,cy+dy+t+1.2,cz),(dx,t,cz),fixed=True,wire=True,material="steel")
bottom = box((cx+1.2,cy+1.2,cz-dz-t+1.2),(dx+2*t,dy+2*t,t),fixed=True,wire=True,material="steel")
left2 = box((cx-dx-t+1.2,cy+1.2,cz*2+2.7),(t,dy+2*t,2.7),fixed=True,wire=True,material="steel")
right2 = box((cx+dx+t+1.2,cy+1.2,cz*2+2.7),(t,dy+2*t,2.7),fixed=True,wire=True,material="steel")
front2 = box((cx+1.2,cy-dy-t+1.2,cz*2+2.7),(dx,t,2.7),fixed=True,wire=True,material="steel")
back2 = box((cx+1.2,cy+dy+t+1.2,cz*2+2.7),(dx,t,2.7),fixed=True,wire=True,material="steel")
top2 = box((cx+1.2,cy+1.2,18+t),(dx,dy,t),fixed=True)
Boxids=O.bodies.append((left,right,back,front,left2,right2,back2,front2,bottom))
O.bodies.append(ymport.text('minmin'))
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
TranslationEngine(translationAxis=[0,1,0],velocity=5.0,ids=Boxids[4:8]),
PyRunner(command='check()',iterPeriod=1000,label='checker')
]
O.dt=PWaveTimeStep()
def check() :
if O.bodies[7].state.pos[1]>20:
O.pause()
bb=[]
for b in O.bodies:
if isinstance(b.shape,Sphere):
if b.state.pos[0]>=0 and b.state.pos[0]<=15:
if b.state.pos[1]>=0 and b.state.pos[1]<=15:
if b.state.pos[2]>=0 and b.state.pos[2]<=12.6:
bb.append(b)
nb=len(bb)
vs=nb*(4.0/3)*pi*(0.2**3)
ms=1800*1e-6*vs
V=15*15*12.6*1e-6
Densitymin=ms/V
unitweightmin=(ms*9.81)/V
print('Densitymin =', Densitymin)
print('Unitweightmin =', unitweightmin)
print('Volume of soil =', vs)
print('Mass of soil =', ms)
print('Volume of specimen',V)
print('Number of sphere in specimen', nb)
--
You received this question notification because your team yade-users is
an answer contact for Yade.