Shrinkage of particles

Asked by Alireza Sadeghi on 2019-02-19

Hello All,

I want to simulate shrinkage of particles during the deformation. the summary of my problem is:
there are some particles in the cylinder and gravity are applied to them. The particles which are in the specific area will be reduced their radii. I did the below simulation but it is not the thing that I want to do.

for i in O.bodies:
 if isinstance(i.shape,Sphere) and i.state.pos[2]<-46e-3 and i.state.pos[2]>-48e-3:
  r2=i.shape.radius
                i.shape.radius=(1-2.25e-2)*r2
  i.material=O.materials['Coke']

I want to reduce the size of particles in a specific position. I used the grow.Particle() but it doesn't work. I was wondering if you could give me a solution. the reduction of particles' radius must be a function of time and the position of particles.
Thank you very much for your help in advance.

Best Regards

Alireza

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Alireza Sadeghi
Solved:
2019-02-21
Last query:
2019-02-21
Last reply:
2019-02-21
Jan Stránský (honzik) said : #1

Hello,

please provide a MWE (minimal working example) and read [1].

> but it is not the thing that I want to do.

please be more specific. What it does wrongly and what you expect.

> I used the grow.Particle()

do you mean growParticle(), or really grow.Particle()?

> but it doesn't work.

please again, always be as specific as possible. Did you get an error? If yes, which? The particles did not grow/shrink? ...?

> I was wondering if you could give me a solution. the reduction of particles' radius must be a function of time and the position of particles.

in principle I see no problem to make it work :-)

cheers
Jan

[1] https://yade-dem.org/wiki/Howtoask

Alireza Sadeghi (asadeghime) said : #2

Dear Jan,

Thank you very much for your consideration. Actually , I want to reduce the particles' size in specific area for each iteration (time step), for example:

r1= (1-5e-10) r0

where r0 is initial radius of particle in each iteratition and r1 is the final radius at the end of specific iteratition.

> do you mean growParticle(), or really grow.Particle()?
growParticle() doesn't work. It was a mistake in dictation :)

> please again, always be as specific as possible. Did you get an error? If yes, which? ? The particles did not grow/shrink? ...?

with growParticle() the particles disappeared. I don't know why. In addition, via the code

for i in O.bodies:
 if isinstance(i.shape,Sphere) and i.state.pos[2]<-46e-3 and i.state.pos[2]>-48e-3:
  r2=i.shape.radius
                i.shape.radius=(1-2.25e-2)*r2
  i.material=O.materials['Coke']

the radius will be reduced instantly. but I want their reduction in each step.

Thank you very much for your help.

Best Regards

Alireza

Jan Stránský (honzik) said : #3

Hello,

instant replay: please provide a MWE (minimal working example). I.e. a complete script which we can try, reproduce the problem and see all aspects

> the radius will be reduced instantly. but I want their reduction in each step.

put the code in the function and call it with PyRunner

Jan

Alireza Sadeghi (asadeghime) said : #4

Hello Jan,

This is a simple case similar to my simulation.

O.reset()

from yade import utils, plot
from yade import pack, qt
from datetime import datetime

qtr=qt.Renderer()
qtr.bgColor=(1,1,1)

#==============================================================
#================= define the materials =======================
#==============================================================

O.materials.append(CohFrictMat(normalCohesion= 1e20, shearCohesion= 1e20, isCohesive= True, young=6.81e8, density=1377.5, poisson=0.3, frictionAngle= 0.31, fragile=False, label='Coke'))

O.materials.append(CohFrictMat(normalCohesion= 1e20, shearCohesion= 1e20, isCohesive= False, young=6.81e8,
density=1523.6, poisson=0.3, frictionAngle= 0.28, fragile=False, label='mold'))

#===============================================================
#=================== define wall================================
#===============================================================

mld=yade.geom.facetCylinder((0,0,0),0.6e-2, 10e-2, orientation=Quaternion((0, 0, 1), 0), segmentsNumber=30, wallMask=6, angleRange=None, closeGap=False, radiusTopInner=-1, radiusBottomInner=-1, wire=True, material='mold')
O.bodies.append(mld)

#===============================================================
#=================== define packing ============================
#===============================================================

nums=['t']

mats=['Coke']

coke=(1e-3,2000)

nums=pack.SpherePack()
nums.makeCloud((-4.5e-3,-4.5e-3,-5e-2),(4.5e-3,4.5e-3,0.08),rMean=coke[0],rRelFuzz=1e-4,num=coke[1])
O.bodies.append([utils.sphere(c,r,material=mats[0]) for c,r in nums])

#===============================================================
#=================== define Engine =============================
#===============================================================

O.engines=[
   ForceResetter(),

   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Box_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),

]

O.dt=1.00e-6

#=============================================================
#=====================define Shrinkage========================

O.engines=O.engines+[PyRunner(command='Shrinkage()', label='Shrink',iterPeriod=700000)]

def Shrinkage():

for i in O.bodies[Sphere]:

 if i.state.pos[2]<-40e-3:

          utils.growParticles(0.5,updateMass=True)

#for i in O.bodies:
# if isinstance(i.shape,Sphere) and i.state.pos[2]<-20e-3 and i.state.pos[2]>-30e-3:
# r1=i.shape.radius
# i.shape.radius=(1-2.3e-2)*r1
# i.material=O.materials['Coke']

Thank you very much for your help.

Best Regards

Alireza

>>>>> I used the grow.Particle() but it doesn't work
>>>> do you mean growParticle(), or really grow.Particle()?
>>> growParticle() doesn't work
>> please provide MWE
> utils.growParticles(0.5,updateMass=True)

Please be consistent.
You are asking how to change size and you keep claiming that growParticle() does not work, while the good answer to your question is just growParticle().

Bruno

Oh by the way, did you run the MWE before sending?... I guess not.
This is a MWE;

O.bodies.append(sphere((0,0,0),1))
print O.bodies[0].shape.radius
growParticle(0,0.5)
print O.bodies[0].shape.radius

Output:
1
0.5

Jan Stránský (honzik) said : #7

Hello,

thanks for the code (although, as Bruno pointed, it is not very minimal ;-) Why it is not MWE:
- unused or unnecessarry code (import datetime, qtr.bgColor)
- materials are irrelevant to the problem (and you define CohFrictMat and in engines you have just FrictMat)
- facetCylinder is also not needed
- there are quite a lot particles for testing
- but MOST importantly, it is not WORKING example. Your Shrinkage function ends with error and there are several problems:
   - for i in O.bodies[Sphere]: # ???
   - utils.growParticles(0.5,updateMass=True) # probably you meant just growParticle (without s). growParticles grow all particles. Not what you want and it not very reasonable to use it inside looping over all bodies..

Next time please try to create a MWE specific for the problem.
Quite often you solve the problem yourself this way ;-)

> the radius will be reduced instantly. but I want their reduction in each step.
> PyRunner(command='Shrinkage()', label='Shrink',iterPeriod=700000)

if you want the reduction in each step, use iterPeriod=1

a MWE (demonstration how to shrink particles and an inspiration how true MWE could look like):
###
# you can see particles growing below the wall. For shrinkage, just use multiplier <1

from yade import pack

rMean,num = 1e-3, 100

sp=pack.SpherePack()
sp.makeCloud((-5e-3,-5e-3,0),(5e-3,5e-3,20e-3),rMean=rMean,num=num)
O.bodies.append([utils.sphere(c,r) for c,r in sp])
O.bodies.append(wall((0,0,-5e-3),2))

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
   PyRunner(iterPeriod=1,command='shrink()'),
]
O.dt=1e-5

def shrink():
   for b in O.bodies:
      if not isinstance(b.shape,Sphere):
         continue
      if b.state.pos[2] < -5e-3:
         growParticle(b.id,1+1e-4,updateMass=True)
###

cheers
Jan

Alireza Sadeghi (asadeghime) said : #8

Dear Jan and Dear Bruno,

Thank you very much for your help. My problem is solved with your comments.

Best Regards

Alireza