yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #16766
Re: [Question #432837]: how to get stress values with VTKExporter
Question #432837 on Yade changed:
https://answers.launchpad.net/yade/+question/432837
Nishant posted a new comment:
Hi Gary,
Did you solve this issue with exporting bodyStress?
I have the same problem: If it a fresh simulations, bodyStresses can be exported to vtkExporter.
But if we save and load the configuration, it gives error:
Below is my MWE:
#-----------------------------------------------------------------------------------------------------
from yade import pack, export
Len = 1.0
wallIds=O.bodies.append(geom.facetBox(center=(Len/2,Len/2,Len/2),extents = (Len/2,Len/2,Len/2), wallMask=63, color=(1,0,0)))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(Len,Len,Len),rMean=.1, num =10)
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()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping = 0.2,label='newton')
]
O.dt = 0.5*PWaveTimeStep()
O.run(int(1e4),True)
O.save('Trial.yade.gz')
#------
#O.load('Trial.yade.gz')
#O.step()
#------
stresses = bodyStressTensors()
for b in O.bodies:
b.mystress = stresses[b.id]
vtkExporter = export.VTKExporter('Check')
vtkExporter.exportSpheres(what=[('velocity', 'b.state.vel.norm()'),('stress','b.mystress')])
vtkExporter.exportFacets(what=[('pos','b.state.pos')])
#-----------------------------------------------------------------------------------------------------
Above works!. But if I uncomment:
O.load('Trial.yade.gz')
O.step()
I get error:
test = eval(command) # ... eval one example to see what type (float, Vector3, Matrix3) the result is ...
File "<string>", line 1, in <module>
AttributeError: 'Body' object has no attribute 'mystress'
--
You received this question notification because your team yade-users is
an answer contact for Yade.