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

Paolo gave more information on the question:
Thank you Jan and Bruno for the hint about the NewtonIntegrator. It works. 
However I cannot make the top stop at a desired height. In particular I have a 
box which is 20 in height. I want the top to stop when it reaches 15 (so it 
goes down only for 5). I paste here the modified code (I made some changes from 
the previous code by looking at the oedometric example in the Yade Manual).
Basically I would like to reproduce the following steps:

     1. Generation of the packing from a cloud.
     2. Once the pack is stable (i.e. unbalancedforce<0.1) generation of the 
top (plate) which goes down.
     3. Stop the plate at 15 height.
     4. Reverse the gravity.
     5. Wait the new equilibrium configuration ( i.e. unbalancedforce<0.1) and 
stop the simulation.

Then I need to reproduce 4 and 5 many times in order to simulate the
shaking but I think that this could be easy to handle.

Here is the modified code.

# import yade modules that we will use below
from yade import pack, plot

#Materials
fr = 0.455;rho=2650.0
global vel
vel=2

Mat1 = 
O.materials.append(ViscElMat(kn=10.0e4,ks=10.0e4,frictionAngle=fr,density=rho))
Mat2 = 
O.materials.append(ViscElMat(kn=10.0e4,ks=10.0e4,frictionAngle=fr,density=rho))

# create rectangular box from facets
box=O.bodies.append(geom.facetBox((5,5,10),(5,5,10),wallMask=15,material=Mat1))
ground=O.bodies.append(utils.wall(position=(0,0,0),axis=2,sense=0,material=Mat1))

# create empty sphere packing
sp=pack.SpherePack()

# generate spheres

sp.makeCloud((0,0,0),(10,10,20),rMean=0.5)

# add the sphere pack to the simulation
sp.toSimulation(material=Mat2)

O.engines=[
                ForceResetter(),
                
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
                InteractionLoop(
                # handle sphere+sphere and facet+sphere collisions
                
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
                               ),
                
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.0,label='integrator'),

                # call the checkUnbalanced function (defined below) every 2 
seconds
                PyRunner(command='deposition()',realPeriod=2,label='checker'),
                # call the addPlotData function every 200 steps
                PyRunner(command='addPlotData()',iterPeriod=100),
         ]

O.dt=.5*PWaveTimeStep()

def deposition():
        if O.iter<100: return 
        if unbalancedForce()>0.1: return 
        
O.bodies.append(utils.wall(position=(0,0,20),axis=2,sense=0,material=Mat1))
        global plate       
        plate=O.bodies[-1] 
        plate.state.vel=(0,0,-vel)
        checker.command='stopPlate()'

def stopPlate():
        if plate.state.pos[2]<15: 
                plate.state.vel*=0
        integrator.gravity=(0,0,+9.81)  
        checker.command='stop1()'

def stop1():
        if unbalancedForce()<.02: 
                O.pause()
                

def addPlotData():
   
plot.addData(i=O.iter,UnbalancedForce=unbalancedForce(),Porosity=porosity()*100,Density=(1-porosity())*100,
)

plot.plots={'i':('UnbalancedForce',None,'Porosity','Density',
)}


plot.plot()

O.saveTmp()
 

Thank you guys!! =)

-- 
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