fabric tensor calc and exportSpheres

Asked by ceguo

Hi,

In calculating coordination number, we have choice to skip free particles and contacts which don't contribute to stability using Thornton's equation. Can we also remove these contacts when calculate fabric tensor?

The second question is how to use exportSpheres to write bodyStressTensors to vtk file? I wrote like this: vtkExporter.exportSpheres(what=[('particleVelocity','b.state.vel'),('particleDisplacement','b.state.displ()'),('particleStress','bodyStressTensors()[b.id]')])
But it says bodyStressTensors is not defined.

Ning

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Not sure it will work, but try:
s=bodyStressTensors()
vtkExporter.exportSpheres(what=[...,('particleStress','s[b.id]')])

Also note that bodyStressTensors() is doing a lot of computation, so it is not appropriate to use it in your context, or to write something like:

for b in bodies:
   bodyStressTensors()[b.id]

since it would recompute everything at each step in the loop. Better compute it once and use the returned list, as suggested above.

Revision history for this message
Jan Stránský (honzik) said :
#2

Definitely Bruno's answer is good. Also try
utils.bodyStressTensors()
Jan
Dne 22.10.2012 18:01 "Chareyre" <email address hidden>
napsal(a):

> Question #211968 on Yade changed:
> https://answers.launchpad.net/yade/+question/211968
>
> Status: Open => Answered
>
> Chareyre proposed the following answer:
> Not sure it will work, but try:
> s=bodyStressTensors()
> vtkExporter.exportSpheres(what=[...,('particleStress','s[b.id]')])
>
> Also note that bodyStressTensors() is doing a lot of computation, so it
> is not appropriate to use it in your context, or to write something
> like:
>
> for b in bodies:
> bodyStressTensors()[b.id]
>
> since it would recompute everything at each step in the loop. Better
> compute it once and use the returned list, as suggested above.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#3

Jan, the "utils" prefix is not needed after r2866 (may 2011). ;)
"import utils" is useless to, everything is imported at startup.

It is not very clear for me why ('particleStress','bodyStressTensors()[b.id]') was "not defined".
Or, are you using an old version Ning?

Revision history for this message
ceguo (hhh-guo) said :
#4

Hi Bruno,

I'm using version bzr3149, quite a new one. Also when I use your method, it reports:

File "HOMEDIR/yade/lib/yade-trunk/py/yade/export.py", line 237, in exportSpheres
    test = eval(command)
  File "<string>", line 1, in <module>
NameError: name 's' is not defined

My code is:
vtkExporter = export.VTKExporter('particleInfo')
s=bodyStressTensors()
vtkExporter.exportSpheres(what=[('particleVelocity','b.state.vel'),('particleDisplacement','b.state.displ()'),('particleStress','s[b.id]')])

Revision history for this message
Jan Stránský (honzik) said :
#5

One solution could be:

__bultins__.s = s

and then your code (to prevent some name problems, chose different name
than "s" :-)

Jan

2012/10/23 ceguo <email address hidden>

> Question #211968 on Yade changed:
> https://answers.launchpad.net/yade/+question/211968
>
> Status: Answered => Open
>
> ceguo is still having a problem:
> Hi Bruno,
>
> I'm using version bzr3149, quite a new one. Also when I use your method,
> it reports:
>
> File "HOMEDIR/yade/lib/yade-trunk/py/yade/export.py", line 237, in
> exportSpheres
> test = eval(command)
> File "<string>", line 1, in <module>
> NameError: name 's' is not defined
>
> My code is:
> vtkExporter = export.VTKExporter('particleInfo')
> s=bodyStressTensors()
>
> vtkExporter.exportSpheres(what=[('particleVelocity','b.state.vel'),('particleDisplacement','b.state.displ()'),('particleStress','s[
> b.id]')])
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
ceguo (hhh-guo) said :
#6

Hi Jan,

Then I have a new error:
File "HOMEDIR/yade/lib/yade-trunk/py/yade/export.py", line 251, in exportSpheres
    outFile.write("%g\n"%(eval(command)))
TypeError: float argument required, not Matrix3

:-(
Ning

Revision history for this message
Jan Stránský (honzik) said :
#7

Hi Ning,
this bug was fixed in r3236
Jan

2012/10/23 ceguo <email address hidden>

> Question #211968 on Yade changed:
> https://answers.launchpad.net/yade/+question/211968
>
> Status: Answered => Open
>
> ceguo is still having a problem:
> Hi Jan,
>
> Then I have a new error:
> File "HOMEDIR/yade/lib/yade-trunk/py/yade/export.py", line 251, in
> exportSpheres
> outFile.write("%g\n"%(eval(command)))
> TypeError: float argument required, not Matrix3
>
> :-(
> Ning
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Can you help with this problem?

Provide an answer of your own, or ask ceguo for more information if necessary.

To post a message you must log in.