← Back to team overview

yade-users team mailing list archive

[Question #676845]: 'instancemethod' object has no attribute '__getitem__'

 

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

Hi 
I want to run this code but the error ''instancemethod' object has no attribute '__getitem__'' occure. 
How can I fix this?
my script 
readParamsFromTable(rMean=.05,rRelFuzz=.3)
from yade.params.table import *
from yade import polyhedra_utils,pack,qt,plot,utils,export,ymport

polyMat = PolyhedraMat(density=8050,young=210e9,poisson=.29,frictionAngle=atan(0.8))
O.materials.append(polyMat)

t=polyhedra_utils.polyhedra(polyMat,(.6,.6,.6),v=[(0,0,0),(0,0,-1.5),(0,1.5,0),(1.5,0,0)])
t.state.pos = (1,1,6)
t.state.vel = (0, 0, -20)
O.bodies.append(t)

O.bodies.append(geom.facetBox((1,1,1),(1,1,1),wallMask=31))

O.materials.append(ViscElMat(young=4e9,poisson=0.25, density=1400, frictionAngle=radians(30), label='sphereMat'))
partCloud = pack.SpherePack()
#Specify the property of the particle cloud wanted
O.bodies.append(pack.regularHexa(pack.inAlignedBox((0,0,0),(2,2,2)),radius=.08,gap=0.0001,color=(0,0,1)))

#send to simulation assigning the material
partCloud.toSimulation(material='sphereMat')

triax=TriaxialStressController(maxMultiplier=1.+2e4/4e9,finalMaxMultiplier=1.+2e3/4e9,thickness = 0,stressMask = 7,internalCompaction=True)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Polyhedra_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Sphere_Polyhedra_ScGeom()],
      [Ip2_CpmMat_CpmMat_CpmPhys()],
   [Law2_ScGeom_CpmPhys_Cpm()]
   ),GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
triax,
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
   # 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),VTKRecorder(fileName='stress',recorders=['all'],iterPeriod=1000)
]
O.dt=.5*PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy['energyName'] subsequently
O.trackEnergy=True


# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
   if unbalancedForce()<.05:
      O.pause()
      plot.saveDataTxt('bbb.txt.bz2')
      # plot.saveGnuplot('bbb') is also possible

# collect history of data which will be plotted
def addPlotData():
   plot.addData(sx=triax.stress[0],sy=triax.stress[1],sz=triax.stress[2],ex=triax.strain[0],ey=triax.strain[1],ez=triax.strain[2],
      i=O.iter,unbalanced=utils.unbalancedForce(),
      totalEnergy=O.energy.total(),**O.energy)

plot.plots={'i':(('unbalanced','go'),None,'kinetic'),' i':('ex','ey','ez',None,'sx','sy','sz'),'i ':(O.energy.keys,None,('totalEnergy','bo'))}
plot.plot()
O.saveTmp()
O.run()

from yade import qt
v=qt.View()
v.axes=True

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