label name is not defined

Asked by Leonard

Hi,
I am trying to simulate an uniaxial test, here is the code after referring to several example from others:
from __future__ import division
from __future__ import print_function
from yade import plot,pack,timing
import time, sys, os, copy

rate=-0.1
iterMax=10000

intR=1.1
density=4800
young=20e9
frictionAngle=atan(0.8)
poisson=0.2
Tensile=1e6
Cohesion=1e6

sigmaT=3.5e6,
epsCrackOnset=1e-4
relDuctility=30

idconcrete=O.materials.append(CpmMat(young=30e9,poisson=.2,frictionAngle=frictionAngle,density=density,label="concrete"))
sp=pack.SpherePack()
pred=pack.inCylinder((0,0,0),(0,0,1),0.25)
sp=pack.regularHexa(pred,radius=0.025,gap=0,material=idconcrete,color=[1,1,1])
O.bodies.append(sp)

bb=utils.uniaxialTestFeatures()
negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']

O.dt=0.8*PWaveTimeStep()

engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intR,label='is2aabb'),]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR,label='ss2sc')],
        [Ip2_CpmMat_CpmMat_CpmPhys()],
        [Law2_ScGeom_CpmPhys_Cpm()],
    ),
    NewtonIntegrator(damping=0.4,label='damper'),
    CpmStateUpdater(realPeriod=.5),
    UniaxialStrainer(strainRate=rate,axis=axis,asymmetry=0,posIds=posIds,negIds=negIds,crossSectionArea=crossSectionArea,
                     blockDisplacements=False,blockRotations=False,setSpeeds=True,label='strainer'),
    PyRunner(iterPeriod=100,realPeriod=1,command='addPlotData()',label='plotDataCollector'),

]

O.step()
is2aabb.aabbEnlargeFactor=1.
ss2sc.interactionDetectionFactor=1.

O.run()

def addPlotData():
    plot.addData(i=O.iter,eps=strainer.strain,sigma=strainer.avgStress)

plot.plots={'i':('eps',),'i ':('sigma',),'eps':('sigma',)}
plot.plot()

My Yade version is 2018.02b (on Ubuntu 18.04).
My question is that there is an error:
line 57, in <module>
is2aabb.aabbEnlargeFactor=1.
NameError: name 'is2aabb' is not defined
but in the example " trunk/examples/concrete/uniax.py " , it uses the same label and there is no such error,
Could you please help me with this?
Thanks in advance.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

indeed, it does not work for your example but does work for examples/concrete/uniax.py
Strange, I will have a look

a workaround (not using labels):
###
...
is2aabb = Bo1_Sphere_Aabb(aabbEnlargeFactor=intR)
ss2sc = Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR)
engines=[
    ...
    InsertionSortCollider([is2aabb,]),
    InteractionLoop(
        [ss2sc],
...
###

cheers
Jan

Revision history for this message
Best Jan Stránský (honzik) said :
#2

> engines=[

should be
O.engines = [
:-)

Jan

Revision history for this message
Jan Stránský (honzik) said :
#3

just to make it clear,
"engines = ["
should be changed to
"O.engines = ["
in the originally posted script, then it works
Jan

Revision history for this message
Leonard (z2521899293) said :
#4

Thanks Jan Stránský, that solved my question.