Generation of sphere packing using CohFrictMat model

Asked by Meng Qing Xiang

Hello all,

I want to make a simulation of slope using FEMxDEM code. Dr. Guo Ning proposed a good example for the generation of 2D friction packing. I also see Ning also using the FEMxDEM method for cohesive materials. I want to change the prepare.py and set cohesion and rolling friction using CohFrictMat model. The problem is divided into two sstep, firstly a sphere packing without friction and cohesion is compressed to the hydrostatic stress. Then I want to add rolling friction and cohesion to the model. But it does not work, I really appriciate if anyone can give me some advice. Tho code is as following:

from yade import pack

#O.materials.append(FrictMat(young=6.e8,poisson=.8,frictionAngle=.0))
materialId=O.materials.append(CohFrictMat(young=15e6,poisson=0.4,frictionAngle=0,normalCohesion=1e6,shearCohesion=1e6,momentRotationLaw=True,etaRoll=0.1,label='spheres'))

sp = pack.SpherePack()
size = .24
sp.makeCloud(minCorner=(0,0,.05),maxCorner=(size,size,.05),rMean=.005,rRelFuzz=.4,num=400,periodic=True,seed=1)
sp.toSimulation(material='spheres')
O.cell.hSize = Matrix3(size,0,0, 0,size,0, 0,0,.1)
print len(O.bodies)
for p in O.bodies:
   p.state.blockedDOFs = 'zXY'
   p.state.mass = 2650 * 0.1 * pi * p.shape.radius**2 # 0.1 = thickness of cylindrical particle
   inertia = 0.5 * p.state.mass * p.shape.radius**2
   p.state.inertia = (.5*inertia,.5*inertia,inertia)

O.dt = utils.PWaveTimeStep()
print O.dt

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D()],
  [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
  [Law2_ScGeom6D_CohFrictPhys_CohesionMoment(always_use_moment_law=False)]
 ),
 PeriTriaxController(
  dynCell=True,
  goal=(-1.e5,-1.e5,0),
  stressMask=3,
  relStressTol=.001,
  maxUnbalanced=.001,
  maxStrainRate=(.5,.5,.0),
  doneHook='term()',
  label='biax'
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5),
 NewtonIntegrator(damping=.2)
]

def term():
   O.engines = O.engines[:3]+O.engines[4:]
   print getStress()
   print O.cell.hSize
   setContactFriction(radians(30))
   O.cell.trsf=Matrix3.Identity
   O.cell.velGrad=Matrix3.Zero
   for p in O.bodies:
      p.state.vel = Vector3.Zero
      p.state.angVel = Vector3.Zero
      p.state.refPos = p.state.pos
      p.state.refOri = p.state.ori
   O.save('0.yade.gz')
   O.pause()

# servo the stress to the hydrostress state
O.run();O.wait()
#This will reload the autosaved compacted sample
O.reload()
# I want to change the model with rolling friction and Cohesion
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D()],
  [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
  [Law2_ScGeom6D_CohFrictPhys_CohesionMoment(always_use_moment_law=False)]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5),
 NewtonIntegrator(damping=.2)
]
# Add rolling friction and Cohesion to the model
O.engines[2].lawDispatcher.functors[1].always_use_moment_law = True
O.engines[2].physDispatcher.functors[1].setCohesionNow = True
O.step();O.wait();O.save('1.yade.gz')

Thanks in advance!!!
The error information is as follows:
Traceback (most recent call last):
  File "/usr/bin/yadedaily", line 182, in runScript
    execfile(script,globals())
  File "prepareRVECoh.py", line 75, in <module>
    O.engines[2].lawDispatcher.functors[1].always_use_moment_law = True
IndexError: list index out of range
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Meng Qing Xiang
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Dear Meng Qin Xiang, "But it does not work" is too vague to describe a problem.
Please try and be specific, else it needs one to run and understand the script before getting to your point.
Regards
Bruno

Revision history for this message
Meng Qing Xiang (642229461-k) said :
#2

Thanks for your reply. The error information of my code is :
Traceback (most recent call last):
  File "/usr/bin/yadedaily", line 182, in runScript
    execfile(script,globals())
  File "prepareRVECoh.py", line 75, in <module>
    O.engines[2].lawDispatcher.functors[1].always_use_moment_law = True
IndexError: list index out of range
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]

Revision history for this message
Jérôme Duriez (jduriez) said :
#3

Hi,

Python indexing starts with 0, and you thus have to write

O.engines[2].lawDispatcher.functors[0].always_use_moment_law = True

to access the Law2 you want to modify (which is the only one available)

We eventually are quite far from a CohFrictMat related question ;-)

Revision history for this message
Meng Qing Xiang (642229461-k) said :
#4

Dear Duriez:

Thank you very much. That really solve my problem.

Your,
Meng