New question #677362 on Yade:
https://answers.launchpad.net/yade/+question/677362

Hello all,

I'm new in Yade and in using python in general. I'm trying to generate a 
cylinder full of spheres that are packed to a specific porosity. Then I will 
use that cylinder in another script to apply uniaxial compression. So to 
achieve that, first I create a cloud of spheres in a box and then I apply 
triaxial compaction until I get the desired porosity. The issue is that, after 
I get the desired porosity, how can I extract (or trim/crop) a cylinder from 
the box that is full of compacted spheres??

I would greatly appreciate if anyone can help me to solve this problem. Below 
is my code. 

Thank you
Othman



############################ Material properties #############################
sigmaIso=-1e3 
frictangel=.52
targetp=0.7 #this is the targeted porosity
pervconc=O.materials.append(FrictMat(young = 5e10, poisson = 0.15,frictionAngle 
= radians(frictangel), density=1920))

############################ generate loose packing 
#############################

from yade import pack, qt, plot, export
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(.1,.1,.23),rMean=.0045,rRelFuzz=.015,periodic=True)

sp.toSimulation()
yade.qt.View()

############################ Triaxial compaction #############################
O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()], 
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   PeriTriaxController(label='triax',
      goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7, 
      dynCell=True,maxStrainRate=(100,100,100), 
      maxUnbalanced=.1,relStressTol=1e-3,
      doneHook='compactionFinished()'
   ),
   NewtonIntegrator(damping=.2),
   PyRunner(command='P()',iterPeriod=5000) 
]
O.dt=.5*PWaveTimeStep()
## stop conditions

def P():

        global frictangel
        if utils.porosity()>targetp:
                frictangel = frictangel
                frictangel = .95* frictangel #decreasing friction angle 
                setContactFriction(radians(frictangel))
                print ('porosity = ', utils.porosity(), 'friction angle', 
frictangel)
        if utils.porosity()<targetp:
                O.pause()
                print 'Finished'


def compactionFinished():
   # set the current cell configuration to be the reference one
   O.cell.trsf=Matrix3.Identity
   # change control type: keep constant confinement in x,y, 20% compression in z
   triax.goal=(sigmaIso,sigmaIso,-.2)
   triax.stressMask=3
   # allow faster deformation along x,y to better maintain stresses
   triax.maxStrainRate=(1.,1.,.1)
   # next time, call triaxFinished instead of compactionFinished
   triax.doneHook='triaxFinished()'
   # do not wait for stabilization before calling triaxFinished
   triax.maxUnbalanced=10

def triaxFinished():
   print 'Finished'
   O.pause()



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

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to