Polyhedra longest edge to vtk

Asked by velimier

Hi,
I am creating simulation by importing voronoi cells to yade as polyhedra.
Along with the computation of the voronoi cells I can determine the longest edge of each cell/polhedra.
My goal is to export the polhedrons as .vtk and to be able to postprocess them using their longest edge as parameter.
Questions are:
1. How to prescribe the longest edge to each polyhedron prior the creation of polyhedrons as "custom" parameter and use it during the simulation?
2. How to export the longest edge of each polyhedron to .vtk to be able to postprocess it in paraview?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
velimier
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,
I don't understand the question 1 at all, sorry :-) Could you specify it
bit? What do you mean by "prescribe", "parameter" and how would you use it
in simulation? Why do you want something to prescribe before creation if
you import the polyhedra? Thanks for answers.
Otherwise it should be easy.
cheers
Jan

2016-04-20 11:52 GMT+02:00 velimier <email address hidden>:

> New question #291529 on Yade:
> https://answers.launchpad.net/yade/+question/291529
>
> Hi,
> I am creating simulation by importing voronoi cells to yade as polyhedra.
> Along with the computation of the voronoi cells I can determine the
> longest edge of each cell/polhedra.
> My goal is to export the polhedrons as .vtk and to be able to postprocess
> them using their longest edge as parameter.
> Questions are:
> 1. How to prescribe the longest edge to each polyhedron prior the creation
> of polyhedrons as "custom" parameter and use it during the simulation?
> 2. How to export the longest edge of each polyhedron to .vtk to be able
> to postprocess it in paraview?
>
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
velimier (velimier) said :
#2

Hi Jan,
maybe "assign" is the better term. I meant to create each polyhedron and to asign parameter to it so I can access the parameter during the simulation. Or is there option to get max edge length of each polyhedron in yade?

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

Hello,
thanks for explanation, now it makes more sense :-) just another
terminology point, in this case you would probably assign attribute or
member, parameter is what you give to a function as input.

to your question:
############################
from yade import export,polyhedra_utils
polyhedrons = [polyhedra_utils.polyhedra(defaultMaterial(),size=(.5,.5,.5))
for i in xrange(3)]
for i,b in enumerate(polyhedrons): b.state.pos = (i,0,0)
O.bodies.append(polyhedrons)
maxEdgeLengths = (1,2,3)
# polyhedrons and maxEdgeLengths would be obtained differently in your case

for poly,maxLen in zip(polyhedrons,maxEdgeLengths):
poly.maxEdgeLength = maxLen # you can assign whatever like this, you only
need not to conflict existing names. E.g. poly.state=1 would give error

vtk = export.VTKExporter('/tmp/p.vtk')
vtk.exportPolyhedra(what=[('maxLen','b.maxEdgeLength')]) # maxLen is
paraview name, b.maxEdgeLength is ours assigned value
############################

cheers
Jan

2016-04-20 12:58 GMT+02:00 velimier <email address hidden>:

> Question #291529 on Yade changed:
> https://answers.launchpad.net/yade/+question/291529
>
> velimier posted a new comment:
> Hi Jan,
> maybe "assign" is the better term. I meant to create each polyhedron and
> to asign parameter to it so I can access the parameter during the
> simulation. Or is there option to get max edge length of each polyhedron
> in yade?
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
velimier (velimier) said :
#4

Well, thank you very much!
If I understood you well, this aproach can used for Sphere (or any shape) as well to create attribute that I need for certain simulation?

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

>
>
> If I understood you well, this aproach can used for Sphere (or any shape)
> as well to create attribute that I need for certain simulation?
>

exactly :-)
Jan

Revision history for this message
velimier (velimier) said :
#6

Will buy you a beer once!
Thanks again!