yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #23083
Re: [Question #689234]: How to export relative velocity of spheres to Paraview
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234
Status: Answered => Open
Chien-Cheng Hung is still having a problem:
Hi Jan,
Thanks for your reply.
I still get the same error message after following your instruction.
The complete error message:
###
NameError Traceback (most recent call last)
/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in <module>()
/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in vtkExport()
183 vtk = export.VTKExporter("weakingTemp")
184 def vtkExport():
--> 185 vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))
186
187 ##################################################
/home/hung/YadeNov2019/build/lib/x86_64-linux-gnu/yade-2019-11-18.git-b1a2767/py/yade/export.py in exportSpheres(self, ids, what, comment, numLabel, useRef)
427 # write additional data from 'what' param
428 for name,command in what.items(): # for each name...
--> 429 test = eval(command) # ... eval one example to see what type (float, Vector3, Matrix3) the result is ...
430 # ... and write appropriate header line and loop over all bodies and write appropriate vtk line(s)
431 if isinstance(test,Matrix3):
/home/hung/YadeNov2019/build/lib/x86_64-linux-gnu/yade-2019-11-18.git-
b1a2767/py/yade/export.py in <module>()
NameError: name 'i' is not defined
###
Part of my code looks like:
###
O.engines=[
ForceResetter()
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
,InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
[Ip2_FrictMat_FrictMat_MindlinPhys()],
[Law2_ScGeom_MindlinPhys_Mindlin()]
)
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=TSSC,defaultDt=utils.PWaveTimeStep())
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(1,1,1),doneHook='triaxDone()',label='triax')
,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
,PyRunner(command='dataRecorder()',iterPeriod=10,label='recData',dead=True)
,PyRunner(command='fixVelocity(RATE_shear)',iterPeriod=1,label='fixVel',dead=True)
,PyRunner(iterPeriod=1,command="weakeningTemp",label='weakenTemp',dead=True)
,PyRunner(iterPeriod=1,command="vtkExport()",label='vtkExp',dead=True)
]
def weakeningTemp(interaction):
heatCapacity = 900 # [J/kg*K]
density = 2500 # [kg/m3]
totalHeat = 0
thermal_diff = 1.e-6
shear_modulus = 22e9
tau_c = 0.1*shear_modulus
initialTemp = 20
penetrationDepth = i.geom.penetrationDepth
radius1 = i.geom.refR1
radius2 = i.geom.refR2
effectiveRadius = (i.geom.refR1 * i.geom.refR2 )/( i.geom.refR1+i.geom.refR2 )
contactRadius = math.sqrt( i.geom.penetrationDepth *effectiveRadius)
Da = 2 * contactRadius
contactArea = np.pi*(contactRadius**2)
relativeVelocity = i.geom.shearInc.norm()/O.dt
weakeningTemp = math.sqrt((relativeVelocity*Da)/(np.pi*thermal_diff))*tau_c/(density*heatCapacity) + initialTemp
return weakeningTemp
builtins.weakeningTemp = weakeningTemp # such that VTKExporter has
access to it
vtk = export.VTKExporter("weakingTemp")
def vtkExport():
vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))
###
Cheers,
Chien-Cheng
--
You received this question notification because your team yade-users is
an answer contact for Yade.