← Back to team overview

yade-users team mailing list archive

Re: [Question #676776]: how to plot psd

 

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

Description changed to:
Hi there,

I used psdSizes and psdCumm to generate the particles. How to draw a
picture to show particle size distribution.

Since my python foundation is very poor, could you tell me more about
it.

and here is my script:

# encoding: utf-8
from yade import pack, qt, plot

sigmaIso=-25000

O.periodic=True

O.materials.append(FrictMat(young=64e9,poisson=0.12,density=2650,frictionAngle=0.231,label='spheres'))

O.periodic=True
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(5,5,5),rMean=.3,rRelFuzz=.3,num=22312,periodic=True)
sp.toSimulation(material='spheres')

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=(0.1,0.1,0.1),
      maxUnbalanced=.1,relStressTol=1e-3,
      doneHook='compactionFinished()'
   ),
   NewtonIntegrator(damping=.1),
   PyRunner(command='addPlotData()',iterPeriod=300),
   PyRunner(command='particleNumber()',iterPeriod=10000),
]
O.dt=.5*PWaveTimeStep()
O.trackEnergy=True

def particleNumber():
   print(O.bodies[-1].id)
   
   
def addPlotData():
   plot.addData(unbalanced=unbalancedForce(),i=O.iter,
      sxx=triax.stress[0],syy=triax.stress[1],szz=triax.stress[2],
      exx=triax.strain[0],eyy=triax.strain[1],ezz=triax.strain[2],
      #Etot=O.energy.total(),**O.energy,
      porosity=porosity(),coordNum=avgNumInteractions()
      
   )
   print(triax.stress[2],porosity())

plot.plots={'i':('unbalanced',),'i ':('sxx','syy','szz'),' i':('exx','eyy','ezz'),' i ':(('coordNum','r'),None,'porosity'),
}

plot.plot()

qt.View()
qt.Controller()
O.saveTmp()

def compactionFinished():
   O.cell.trsf=Matrix3.Identity
   triax.goal=(sigmaIso,sigmaIso,sigmaIso)
   triax.stressMask=7
   triax.maxStrainRate=(0,0,0)
   triax.doneHook='triaxFinished()'
   triax.maxUnbalanced=0.1

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

Thanks,
Feng

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