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

Hi! I'm new on YADE. 
I want to generate a packing from a cloud of spheres contained in a box. 

Once obtained the equilibrium after the initial gravity deposition,  the top of 
the box should  go down and stop in the middle of the box. After that, I want 
to reverse the gravity many times in order to simulate the shaking of the 
spheres enclosed in the half of the box. Finally, the top facet should go down 
more, compress the packing, go up relaxing the spheres and, after that, I want 
to determine the final density/porosity of the packing.

I've already written a simple python input which i paste here. My simulation is 
just a draft and stops when the unbalance force is lower that a minimum value. 
I have basically the following questions:

1 - How can I write the condition that stops the top facet in a certain 
position of the box independetly from the unbalance force related to the 
spheres?
2 - How can I save the final  configuration of the spheres which I want to load 
in the subsequent step with the inverted gravity?
3 - How can save/load the final position of the facet top that I want to move 
up in the final step of my simulation?

Here is the code:


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

#Materials
fr = 0.455;rho=2650.0

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))
top=O.bodies.append(geom.facetBox((5,5,10),(5,5,10),wallMask=32,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,num=1000)

# 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()]
                               ),
                # call the checkUnbalanced function (defined below) every 2 
seconds
                #PyRunner(command='checkUnbalanced()',realPeriod=2),

                PyRunner(command='hightcontrol()',iterPeriod=50000),

                
TranslationEngine(translationAxis=(0,0,-1),velocity=2,ids=top,label='trans'),

                NewtonIntegrator(gravity=(0,0,-9.81),damping=0.0),

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

O.dt=.5*PWaveTimeStep()

O.trackEnergy=True

def checkUnbalanced():
        if unbalancedForce()<.05:
                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 for any help you can provide.

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