New question #684839 on Yade:
https://answers.launchpad.net/yade/+question/684839
Hi All,
I want to use the PDFEngine in my simulation, and I found an answer, but it seems not to work.
here is my MWE:
from yade import pack, plot, export
import math
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=31))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=.05,rRelFuzz=.5)
sp.toSimulation()
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()]
),
PyRunner(command='checkUnbalanced()',realPeriod=2),
#PyRunner(command='addPlotData()',iterPeriod=100),
#PyRunner(command='subbox()',iterPeriod=100),
#PyRunner(command='stress_export()',iterPeriod=1000),
#PyRunner(command='get_component()',iterPeriod=1000),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
#PDFEngine(filename="PDF.txt",iterPeriod= 1000),
PDFEngine(filename="PDF.txt", iterPeriod=1000, numDiscretizeAnglePhi=20,numDiscretizeAngleTheta=20)
]
O.dt=.5*PWaveTimeStep()
print(len(O.bodies))
def checkUnbalanced():
if unbalancedForce()<.0001:
O.pause()
#plot.saveDataTxt('bbb.txt')
def addPlotData():
plot.addData(i=O.iter,unbalanced=unbalancedForce())
#plot.plots={'i':('unbalanced')}
#plot.plot()
###################
when I run this, here is the error:
Welcome to Yade 2018.02b
TCP python prompt on localhost:9000, auth cookie `udeyas'
XMLRPC info provider on http://localhost:21000
Running script test.py
Traceback (most recent call last):
File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
File "test.py", line 22, in <module>
PDFEngine(filename="PDF.txt", iterPeriod=1000, numDiscretizeAnglePhi=20,numDiscretizeAngleTheta=20)
NameError: name 'PDFEngine' is not defined
https://answers.launchpad.net/yade/+question/682859 #3,
I did as they said, but the error said that I didn't define the name.
best,
yong