How to save only the particles that contain in the box below ?
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:/
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.
O.materials.
# 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-
right = box((cx+
front = box((cx+
back = box((cx+
bottom = box((cx+
left2 = box((cx-
right2 = box((cx+
front2 = box((cx+
back2 = box((cx+
top2 = box((cx+
Boxids=
O.bodies.
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
NewtonIntegrat
TranslationEng
PyRunner(
]
O.dt=PWaveTimeS
def check() :
if O.bodies[
O.pause()
bb=[]
for b in O.bodies:
if isinstance(
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.
bb.append(b)
nb=len(bb)
vs=nb*
ms=1800*1e-6*vs
V=15*15*12.6*1e-6
Densitymin=ms/V
unitweightmin
print('Densitymin =', Densitymin)
print(
print('Volume of soil =', vs)
print('Mass of soil =', ms)
print('Volume of specimen',V)
print('Number of sphere in specimen', nb)
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: