← Back to team overview

yade-users team mailing list archive

Re: [Question #700476]: Output micro-stress vtk

 

Question #700476 on Yade changed:
https://answers.launchpad.net/yade/+question/700476

    Status: Open => Answered

Jan Stránský proposed the following answer:
Not directly this way.
However, after following workaround, I could make it run on 2018.02b, too
Cheers
Jan

###
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()
mystresses = [None for _ in O.bodies] # "external" variable, accessed only by b.id
import __builtin__
__builtin__.mystresses = mystresses # make it "global"

for b in O.bodies:
 if isinstance(b.shape, Sphere):
  mystresses[b.id] = s[b.id]*4.*pi/3.*b.shape.radius**3/TW.volume(b.id) # fill mystresses with values
vtk.exportSpheres(ids=[i for i in particleIds],what=[("stress","mystresses[b.id]")]) # using mystresses "global" "external" variable
###

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.