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

Sanel Avdić posted a new comment:
Here is the script I'm using. The simulation is working. I need help to build a 
part of the code that will give me an access to all inter-particle forces with 
particle IDs and positions so I can extract the ones that are acting on the 
cylinder walls. It would be great if i can extract the data for certain values 
of the compression force Fz (every 100N for example). 
Thanks!


#variables
rMean=0.0025
rRelFuzz=0.2
maxLoad=800
minLoad=100
a=0.025
b=2*a
c=0.03
g=9.81


#material definiton
O.materials.append(FrictMat(young=5e6, poisson=.5, frictionAngle=radians(27), 
density=1000, label='spheres'))


#cylinder walls + particles creation
from yade import pack, plot
O.bodies.append(geom.facetCylinder((a/2,a/2,5*b), a,10*b, segmentsNumber=100, 
wallMask=6))
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (c, c, 28*b/3), rMean=rMean, rRelFuzz=rRelFuzz)
sp.toSimulation(material='spheres')


#engines
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_MindlinPhys()],
                [Law2_ScGeom_MindlinPhys_Mindlin()]
        ),
        NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.5),
        PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]


#timestep
O.dt = .3 * PWaveTimeStep()


#energytracking
O.trackEnergy = True
Etot=O.energy.total()


#settling and pressing the particles
def checkUnbalanced():
        if O.iter < 30000:
                return
        if unbalancedForce() > 0.1:
                return

        O.bodies.append(wall(max([b.state.pos[2] + b.shape.radius for b in 
O.bodies if isinstance(b.shape, Sphere)]), axis=2, sense=-1))
        global plate  
        plate = O.bodies[-1] 
        plate.state.vel =(0,0,-0.1)
        O.engines = O.engines + [PyRunner(command='addPlotData()', 
iterPeriod=100)]
        checker.command = 'unloadPlate()'


#unloading the particles
def unloadPlate():
        if abs(O.forces.f(plate.id)[2]) >= maxLoad:
                plate.state.vel *= -1
                checker.command = 'stopUnloading()'
                
                
#finishing the simulation
def stopUnloading():
        if abs(O.forces.f(plate.id)[2]) < minLoad:
                plate.state.vel *= -1
                plot.saveDataTxt(O.tags['d.id'] + '.txt')
                O.pause()


#plotting the data
def addPlotData():
        if not isinstance(O.bodies[-1].shape, Wall):
                plot.addData()
                return
        Fz = O.forces.f(plate.id)[2]    
        plot.addData(Fz=Fz, w=plate.state.pos[2], unbalanced=unbalancedForce(), 
i=O.iter, Etot=O.energy.total() )


yade.qt.Renderer().shape=0
yade.qt.Renderer().intrPhys=1
plot.plots = {'w': ('Fz',), 'i':('Etot'),}
plot.plot()


O.run()
waitIfBatch()

-- 
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     : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to