yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #21058
Re: [Question #685223]: what are the input variables to get the micro-stress firled
Question #685223 on Yade changed:
https://answers.launchpad.net/yade/+question/685223
nobody gave more information on the question:
Hi all,
let me make this more clear, right now I exported some text files. the
file contains the position, radius, and the nine per particle stress
components.
I'm trying to use the following code to output the micro stress
field[1].
###############################################
from yade import ymport, export
vtk = export.VTKExporter("stress")
s=bodyStressTensors()
m = 0
number_of_txtfiles =1634
while m < number_of_txtfiles:
O.bodies.append(ymport.text("./num"+str(m)+".txt"))
O.step()
TW = TesselationWrapper()
TW.triangulate()
TW.computeVolumes()
TW.setState
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='all',what=[('pos','b.state.pos'),('stress','b.mystress')],useRef=False)
m = m +1
########################################
here is the error.
Welcome to Yade 2018.02b
TCP python prompt on localhost:9000, auth cookie `cuessk'
XMLRPC info provider on http://localhost:21000
Running script calculate-stress.py
Traceback (most recent call last):
File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
File "calculate-stress.py", line 16, in <module>
b.mystress = s[b.id]*4.*pi/3.*b.shape.radius**3/TW.volume(b.id)
IndexError: list index out of range
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]
#############################
I tried the following attempts:
1) print out some basic particle information
In [1]: len(O.bodies)
Out[1]: 622
In [2]: b.state.pos
Out[2]: Vector3(0.935164196838,0.38080276367,0.869850258236)
In [3]: b.shape.radius
Out[3]: 0.041134821457
this is the same as the first exported text file.
2) I tried to print out the per particle stress. i.e. the stress I got
by using bodystresstensor.
In [5]: s
Out[5]: []
In [6]: s[b.id]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/usr/bin/yade in <module>()
----> 1 s[b.id]
IndexError: list index out of range
In [7]:
this means that particle stress didn't import successfully. So I checked the yade.ymport.text function, here is the explanation: it says it will load the coordinate from the file. as for the **kw ((unused keyword arguments) is passed to utils.sphere). I checked the definition of the utils.sphere[3] , it didn't mention particle stress.
#################################
as we all know, we do not have some function like the position (b.state.pos) (this is something like the intrinsic funtion that a particle has, but for the particle stress, we don't have commnad like b.sress or b.state.stress), I think maybe this is the reason why the per particle stress can not import successfully.
besides, I don't know why the list index is out of range.
#########################
thanks,
references
[1]https://yade-dem.org/doc/user.html#microstressandmicrostrain
[2]https://yade-dem.org/doc/yade.ymport.html?highlight=yade%20ymport%20text#yade.ymport.text
[3]https://yade-dem.org/doc/yade.utils.html?highlight=yade%20utils%20sphere#yade.utils.sphere
--
You received this question notification because your team yade-users is
an answer contact for Yade.