← Back to team overview

yade-users team mailing list archive

Re: [Question #696060]: How to make some stress plates consist of 3 circles (that have radius gradually (0.5, 1, 2)?

 

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

Defri posted a new comment:
The actual code:

##Sphere Cylinder pack
from yade import pack,plot,utils,export
import math
from pylab import rand #for sand color

facets=O.bodies.append(geom.facetBox((0,0,0),(5,2,1.5),wallMask=31))
print('the ids of the facets:',facets)

sp=pack.SpherePack()
sp.makeCloud((-5,-2,-1.5),(5,2,1.5),rMean=.14,rRelFuzz=.1,num=3000)
sp.toSimulation(color=(0.6+0.15*rand(),0.5+0.15*rand(),0.15+0.15*rand()))

##Define material of the grains
b=O.bodies[0]
b.state.blockedDOFs='xyzXYZ'
b.state.vel=(0,0,0)
O.materials.append(FrictMat(young=1e7,poisson=.3,density=2700,frictionAngle=18))

##Make a floor
bottom=wall((0,0,-1.5),axis=2)
O.bodies.append(bottom)

##Engines and Constitutive Law
O.engines=[ForceResetter(),
 	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]), #move for sphere, facet, wall
 	InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()], #interaction between them
   [Ip2_FrictMat_FrictMat_FrictPhys()], # ip2 list (just one list!)
   [Law2_ScGeom_FrictPhys_CundallStrack()]), # law2 list
   NewtonIntegrator(damping=.3,gravity=[0,0,-9.81]),
   PyRunner(command='checkUnbalanced()',iterPeriod=100,label='checker'),
   PyRunner(command='getbottomstress()')
   #VTKRecorder(fileName='tes',recorders=['all'],iterPeriod=100),
   ]

O.dt=.9*PWaveTimeStep()

def checkUnbalanced():
	if O.iter<1000:return # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing 										is stable
	O.materials.append(FrictMat(young=1e8,poisson=0.2,density=2700,frictionAngle=25))
	O.bodies.append(utils.sphere(center=(0,0,5),radius=2,color=[0,1,1]))
	O.bodies[0].state.mass=2000
	checker.command='getbottomstress()'

def getbottomstress():
	b1=O.bodies[2920]
	rad1=b1.shape.radius
	area1=pi*rad1**2
	interactions = bottom.intrs()
	interactions = [i for i in interactions if (i.geom.area1).norm()]
	cp = [i.geom.area1 for i in interactions] 
	fs = [i.phys.normalForce + i.phys.shearForce for i in interactions] 
	StP = (fs,cp)/area1

	if O.iter>1000:
		plot.addData(z=b1.state.pos[2],Stress=StP,i=O.iter,t=O.time)
		
globals().update(locals())

plot.plots={'i':('z'),'t':('Stress')}

plot.plot(subPlots=True)
		
O.saveTmp()
##############################

What I am trying to do based on my code, is that I am trying to build a circle stress plate, then I expect to get the stress by dividing the Force and the area of circle stress plate.
I am trying to find the stress by assigning the boulder (O.bodies[2920]) to the spheres, and expecting to get the stress, and generate the value by making graph.
and if this is working, I am willing to add more circle stress plate that is slightly bigger, like this area2=pi*((rad1+.8)**2-rad1**2) , and add more area3=pi*((rad1+1.2)**2-(rad1+.8)**2) 

Turns out I got the failure note:
AttributeError                            Traceback (most recent call last)
/usr/bin/yade in <module>

/usr/bin/yade in getbottomstress()
     94         area1=pi*rad1**2
     95         interactions = bottom.intrs()
---> 96         interactions = [i for i in interactions if (i.geom.area1).norm()]
     97         cp = [i.geom.area1 for i in interactions]
     98         fs = [i.phys.normalForce + i.phys.shearForce for i in interactions]

/usr/bin/yade in <listcomp>(.0)
     94         area1=pi*rad1**2
     95         interactions = bottom.intrs()
---> 96         interactions = [i for i in interactions if (i.geom.area1).norm()]
     97         cp = [i.geom.area1 for i in interactions]
     98         fs = [i.phys.normalForce + i.phys.shearForce for i in interactions]

AttributeError: 'ScGeom' object has no attribute 'area1'

Thank you
Cheers!

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