← 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

Description changed to:
Hello Yade programmers and users,
I encountered a problem in my recent simulation script which has been troubling me, and it’d be much appreciated if I can get some advice.

Here are the steps I’m trying to accomplish:
1.	Make a loose pack of particles following defined PSD.
2.	Use compression engine to generate a denser pack.
3.	At defined iteration #, turn off compression engine. 
4.	Filter pack with pack.filterpack into desired shape.
5.	Continue with further steps (gravity deposition, geometry rotation, etc).

Problem:
My error came from step 4, in the "gravityDeposition()" portion of my code. When I tried using pack.filterpack with the engine running, the filter was not applied. I then paused O.engines to check if my predicate definition was truly recognized, and it turns out that it wasn’t for some reason. Would anyone be able to help me find the cause of this? Thanks a lot!

Error:
---------------------------------------------------
NameError                                 Traceback (most recent call last)
/usr/bin/yade in <module>()
----> 1 pred

NameError: name 'pred' is not defined
---------------------------------------------------

Here is my script using yade 2018.02b:
-------------------------
#!/usr/bin/python
# -*- coding: utf-8 -*-

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(-50,-50,-50),Vector3(50,50,50) # 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=6000,psdSizes=[1,2,2.25,2.5,3,4,6],psdCumm=[0.,0.1,0.3,0.3,.3,.7,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=10,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=-10000

def stop():
 if O.iter<100:return
 checker.command='gravityDeposition()'

def gravityDeposition():
  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)
  assembly.toSimulation()

#...connect to next steps in simulation
---------------------------------------------------

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