New question #700476 on Yade: https://answers.launchpad.net/yade/+question/700476
Hi, I'd like to ask that how to output vtk file for micro-stress[1]. Referring to previous answer at #6 in [2], a working MWE provided by Jan is copied as below: ################### Working MWE from yade import export O.bodies.append(( sphere((0,0,0),1), sphere((1,0,0),1), )) O.step() s = bodyStressTensors() vtk = export.VTKExporter("stress-test") TW=TesselationWrapper() TW.setState() TW.computeVolumes() s=bodyStressTensors() for b in O.bodies: b.mystress = s[b.id]*4.*pi/3.*b.shape.radius**3/TW.volume(b.id) vtk.exportSpheres(what=[("stress","b.mystress")]) ########## However, when I tried to adapt this code to a packing of particles like what example code [3] has done. I got an error saying: "AttributeError: 'Body' object has no attribute 'mystress'" ############## Below is the not-working MWE from yade import export tt=TriaxialTest() tt.generate("test.yade") O.load("test.yade") O.run(100,True) particleIds=[] for i in O.bodies: if isinstance(i.shape,Sphere): particleIds.append(i.id) vtk = export.VTKExporter("microStress") TW=TesselationWrapper() TW.setState() TW.computeVolumes() s=bodyStressTensors() for b in O.bodies: if isinstance(b.shape, Sphere): b.mystress = s[b.id]*4.*pi/3.*b.shape.radius**3/TW.volume(b.id) vtk.exportSpheres(ids=[i for i in particleIds],what=[("stress","b.mystress")]) ########## Do you know why this error occurs for the second MWE? Thanks Leonard [1]https://yade-dev.gitlab.io/trunk/user.html?highlight=paraview#micro-stress [2]https://answers.launchpad.net/yade/+question/685223 [3]https://gitlab.com/yade-dev/trunk/-/blob/master/examples/tesselationwrapper/tesselationWrapper.py -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp