← Back to team overview

yade-users team mailing list archive

Re: [Question #691829]: Filterpack predicate definition issue

 

Question #691829 on Yade changed:
https://answers.launchpad.net/yade/+question/691829

    Status: Answered => Open

Yuxuan Wang is still having a problem:
Hi Jan,
Thank you for the suggestions and they worked quite well for me upon implementation. I saw a significant reduction of particles going from the compressed pack to the filtered pack. 

There is only one thing that I'm still confused about now: I was not
able to see any of the particles after "assembly.toSimulation()" in the
simulation view, even though I could output their locations. Would you
mind giving me a hand on that again?

Thanks again!
Best,
Yuxuan

---------------------
#!/usr/bin/python
# -*- coding: utf-8 -*-
#modifications from trial 10: incorporating Jan's advice on filterpack.

from __future__ import print_function
import matplotlib; matplotlib.rc('axes',grid=True)
import pylab
from yade import pack, plot, qt
from yade import export

############################################
### DEFINING VARIABLES AND MATERIALS ###
############################################

#geometry definition
Ri,Rs,Ro=6.5,8.5,10.5
H=3.5
p=H/2
k=0.01 
Hs=H*k 
hs=Hs/2 
Rx=2*Ro
Hx=2*H

c1=geom.facetCylinder(center=(0,0,p),radius=Ro, height=H, segmentsNumber=20, wallMask=6) 
c2=geom.facetCylinder(center=(0,0,hs),radius=Rs, height=Hs, segmentsNumber=20, wallMask=7)
c3=geom.facetCylinder(center=(0,0,p),radius=Ri, height=H, segmentsNumber=20, wallMask=7)


nRead=readParamsFromTable(
 num_spheres=5000,
 compFricDegree = 30, 
 unknownOk=True
)

from yade.params import table
num_spheres=table.num_spheres
compFricDegree = table.compFricDegree 
damp=0.2 
young=5e6 # contact stiffness
mn,mx=Vector3(-12,-12,-12),Vector3(12,12,12) # corners of the initial packing

## create materials for spheres and plates
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))

## create walls around the packing
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

## use a SpherePack object to generate a psd loose particles packing
global sp
sp=pack.SpherePack()
sp.makeCloud(mn,mx,num=1000,psdSizes=[0.399,0.4,0.799,0.8],psdCumm=[0,0.5,0.5,1]) 
sp.toSimulation(material='spheres')

############################
### DEFINING ENGINES ###
############################

triax=TriaxialStressController(
 thickness = 0,
 stressMask = 7,
 internalCompaction=False, 
 label='controller'
)

newton=NewtonIntegrator(damping=damp)

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()]
 ),

 PyRunner(command='stop()',iterPeriod=1,label='checker'),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
 triax,
 newton
]

#Display spheres with 2 colors for seeing rotations better
Gl1_Sphere.stripes=0
if nRead==0: yade.qt.Controller(), yade.qt.View()

#######################################
### APPLYING CONFINING PRESSURE ###
#######################################
 
triax.goal1=triax.goal2=triax.goal3=-100

def stop():
 if O.iter<100:return
 else:
  controller.dead=True
  for wall in walls:
   wall.state.vel = Vector3.Zero
  for b in O.bodies:
   b.state.vel = Vector3.Zero
  sp.fromSimulation() # update sp from original loose pack to compressed dense pack
  checker.command='gravityDeposition()'

def gravityDeposition():
 if O.iter==101:
  pred=pack.inCylinder((0,0,0),(0,0,H),Ro)-pack.inCylinder((0,0,0),(0,0,Hs),Rs)-pack.inCylinder((0,0,0),(0,0,H),Ri)
  assembly=pack.filterSpherePack(pred,sp,True)
  O.bodies.clear() #delete compressed pack sp
  
  print(len(O.bodies))
  assembly.toSimulation()
  print(len(O.bodies))
  for b in O.bodies:print(b.id,b.state.pos,b.shape.radius)
 else: 
  print ('done')
  O.pause()
#...connect to next steps in simulation

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