yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #12586
Re: [Question #293179]: 'Name error' while calling function
Question #293179 on Yade changed:
https://answers.launchpad.net/yade/+question/293179
Status: Open => Answered
Klaus Thoeni proposed the following answer:
Hi,
I didn't run the script previously but when looking at it in more detail
now I can see there are a couple of issues. Below is a running version.
HTH
K
from yade import qt
from yade import plot,pack,geom
#define material properties:
rho = 2500 #density
fric = 0.5 #friction coefficient
fric_angle = atan(fric) #friction angle in radian
stiff_n = 1e8
stiff_s = 1e8
c_n = 0.1 #normal viscous damping
c_s = 0.1 #shear viscous damping
l_d = 0.2 #local damping
#define a material:
Mat = O.materials.append(ViscElMat(kn=stiff_n, ks=stiff_s, \
cn=c_n, cs=c_s, density=rho, frictionAngle=fric_angle))
#create a sphere:
b1 = utils.sphere(center=(0,0.0,1),radius=0.05,fixed=False,material=Mat)
O.bodies.append(b1)
#O.bodies.append(utils.sphere(center=(0,0,1), radius=0.05,
material=Mat))
#create a plane facet:
O.bodies.append(geom.facetBox(center=(0,0,0), extents=(0.5,0.5,0),
fixed=True, material=Mat))
# define data collector
def plotAddData():
pos = b1.state.pos
nIntrs = len( b1.intrs())
plot.addData(i=O.iter,t=O.time,x=pos[0], y=pos[1], z=pos[2], Ek=utils.kineticEnergy(), nIntrs=nIntrs)
#define engines:
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), #Axis-aligned bounding box
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom()], #Interaction geometry
[Ip2_ViscElMat_ViscElMat_ViscElPhys()], #Interaction physics
[Law2_ScGeom_ViscElPhys_Basic()], #Contact law
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=l_d),
# qt.SnapshotEngine(fileBase='/home/subhasish/YADE/tutorials/image/',label='snapper',iterPeriod=100),
PyRunner(iterPeriod=5,command='plotAddData()')
]
#show geometry:
v=qt.View(); v.axes=True
v.viewDir=Vector3(0,1,-.05)
v.eyePosition=Vector3(0,-5,.5)
O.dt = 1e-4
#O.dt=.5*utils.PWaveTimeStep()
# wait=True will cause not returning to python until simulation will have stopped
O.run(50000,True)
# run this outside pyRunner for performance
plot.saveDataTxt('file2.txt.bz2')
--
You received this question notification because your team yade-users is
an answer contact for Yade.