← Back to team overview

yade-users team mailing list archive

[Question #702934]: Why is it not possible to run the code a second time after setting the material of the particles and walls?

 

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

Initially, my simulation used the default materials and didn't deliberately set the characteristics of the particles and walls. After adding these features, I found that after the particle stabilized, the input O.run() could not run the code again, why is this?

The code is as follows:

#Material constants 
Density = 2630
FrictionAngle = 2.1
PoissonRatio = 0.5
Young = 300e6
Damp = 0.5
AvgRadius = 0.1
N_particles = 10000

#Wall constants
WDensity = 0
WFrictionAngle = 0.0
WPoissonRatio = 0.1
WYoung = 50e9

#time calculation
startT = O.time
endT = O.time
timeSpent = endT - startT

SphereMat = O.materials.append(FrictMat(young = Young, poisson = PoissonRatio, frictionAngle = radians(FrictionAngle), density = Density))
WallMat = O.materials.append(JCFpmMat(young = WYoung, poisson = WPoissonRatio,label='JCFmat', frictionAngle = radians(WFrictionAngle), density =WDensity,jointNormalStiffness=2e8,jointShearStiffness=1.5e8))


from yade import pack,plot
O.bodies.append(geom.facetBox((0.05, 9, 10), (0.1, 9, 10), wallMask=63,material=WallMat))
sp = pack.SpherePack()
sp.makeCloud(Vector3(0.05,0,0),Vector3(0.05,18,20), rMean=0.1, rRelFuzz=0)
sp.toSimulation(material = SphereMat)


for b in O.bodies:
   if isinstance(b.shape,Sphere):
       b.state.blockedDOFs='ZxY'
       b.shape.color=(3.,2.,1.)
       
circleRadius=1.5
circleCenter = Vector3(0.05,6,6)
circleRadius1=1.5
circleCenter1 = Vector3(0.05,12,6)
   
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
        PyRunner(command='checkUnbalanced()', realPeriod=2),
        PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = 0.5 * PWaveTimeStep()
O.trackEnergy = True
shuzu=[]
def checkUnbalanced():
	if unbalancedForce() < .01:
		O.pause()
                for b in O.bodies:
		    if isinstance(b.shape,Sphere):

                        b.state.vel=(0,0,0)
                        b.state.angVel=(0,0,0)
                    d = (b.state.pos - circleCenter).norm() 
                    d1 = (b.state.pos - circleCenter1).norm()
                    if d < circleRadius:
                       O.bodies.erase(b.id)
                    if d1 < circleRadius1:
                       O.bodies.erase(b.id)




def addPlotData():
	plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)


O.saveTmp()



from yade import qt
qt.Controller()
qt.View()



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.