CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Exporting unstructured, face-based, cell data to VTK

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2011, 09:15
Default Exporting unstructured, face-based, cell data to VTK
  #1
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,192
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Dear all,

i am writing my own routine to export cell-centered data from an unstructured, polyhedral, FV solver to Paraview writing it in the old legacy VTK format.

The data structure i'm using can handle 2D/3D general polygonal/polyhedral cells and uses a face-based structure; that is, i have the following information:

1) faces belonging to a given cell
2) nodes belonging to a given face (clockwise/counterclockwise ordered)
3) cells sharing a given face
4) cell topology (triangle, quadrilateral,tetrahedron, hexahedron, pyramid, wedge, polygonal/polyhedral)

and i can easily recover also the following information:

4) nodes belonging to a given cell (NOT SORTED IN ANY SPECIFIC ORDER)

Now, i managed to write the exporting routine but, i naively guessed (going against the obvious suggetsions in the figures from http://www.vtk.org/VTK/img/file-formats.pdf and the fact that a face-node information is missing in the file format) that the order for the nodes of the cells was unimportant, that vtk would have managed that somehow.

So, my question is: given my data structure, is there any simple way to order the nodes of a given polyhedral/polygonal cell such that they can be fitted into the numbering scheme provided in the figure 2 of the above link?

Of course, i could hardcode the parts relative to the single cases, but that wouldn't be nice.

Also, i mention that i haven't really read yet the documentation for the XML format. Is there, maybe, a wayout in this format?

Thanks
sbaffini is offline   Reply With Quote

Old   December 7, 2011, 01:41
Default
  #2
New Member
 
Lubos
Join Date: Apr 2011
Location: Virginia
Posts: 8
Rep Power: 15
lbrieda is on a distinguished road
Send a message via Skype™ to lbrieda
Hi Paolo,

This shouldn't be too difficult given you have the face/node information. You simply need to order the faces according to some consistent set of rules. For instance, for a brick element, you will have two +/-X faces, two +/- Y faces, and two +/- Z faces. Of course, these may not actually be aligned with the physical coordinate axis. Then, to make the system consistent, you will likely have to follow into the neighboring cell (you have this info too). A +X face in the first element becomes the -X face in the second, etc...
lbrieda is offline   Reply With Quote

Old   December 7, 2011, 05:25
Default
  #3
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,192
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Dear Ibrieda,

thank you for your concern. After i spent almost half-day in finding an easy, elegant way to do the job for any kind of cell... i didn't find any possible way. But then i realized that hardcoding the ordering for each kind of cell was not that difficult at all, so i did it.

In practice, what i did is just following the rules described in the link i posted above:

program

for each cell
for each face of the cell

order the nodes of the face according to the face-normal direction (just in case, not really necessary i think)

if cell=tri/tetra, just put the nodes of the face in the list, endif

if cell=quad/hexa, if it's the first face just put the nodes in the list; endif
if it's not the first face, choose the other face as the one not sharing any node with the first one. Order the nodes of this second face such that the first one/two nodes of the two faces form a face too. Put these nodes in the list. endif
endif

if cell=wedge, take the first tri face and put its nodes in the list;
take the second tri face and order the nodes like in the hexa case; endif

if cell=pyramid, take the quad face and put the nodes in the list;
take the remaining node and put it in the list; endif

if cell=poly, just put the nodes of the face in the list, endif

endfor


remove redundant nodes

endfor


end program


I tested the program for all but polygonal/polyhedral cells and it works. For polygonal cells (2D) i had to order the cell nodes in a counterclockwise fashion but this was a problem per se. For polyhedral cells there was no obvious way of ordering the nodes. So i just skipped the ordering for poly cells (2D/3D). Also, i don't even have a polyhedral grid generator to test it.

I could also decompose each cell in a sum of tri/tetra and do the job but this would have been much more cumbersome and also the node list should have been augmented by cell and face centroids, which was not so nice.

In any case, thanks

Regards
7islands likes this.
sbaffini is offline   Reply With Quote

Old   December 17, 2011, 07:46
Default expering data in unstructured mesh
  #4
Member
 
lalupp
Join Date: Jul 2010
Location: India
Posts: 47
Rep Power: 16
lalupp is on a distinguished road
Hi

I also tried to export cell data and face data through vtk (legacy) but as per my knowledge volume data and surface data together cannot be exported, only one

but write data in multiple files and read
.xmdf and hdf5
lalupp is offline   Reply With Quote

Old   December 18, 2011, 16:06
Default
  #5
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,192
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Dear lalupp,

thanks for the interest. Actually, i was not trying to export surface and volume data together but just volume (i.e., cell centered) data. At the end, i managed to write the routine for all but polyhedral cells.

I've read somewhere that, of course, to do the job for polyhedral cells, an additional section is needed in the file, where the face-node connectivity is specified. However i was unable to find anywhere a detailed description of the format for this new section. Also, i am still in doubt if this feature is really available for the old vtk legacy format or it is just available fot the xml one. Are you aware of this or do you have any information about the proper format for polyhedral cells?

Thanks
sbaffini is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 22:00
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
Error message: 8 face(s) not in face lists of adjacent cells jyoung79 FLUENT 0 November 10, 2012 17:09
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 19:37.