CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

How to visualize polyhedron mesh in paraview

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes
  • 1 Post By akrasemann
  • 9 Post By Ship Designer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 5, 2014, 08:21
Smile How to visualize polyhedron mesh in paraview
  #1
New Member
 
Jinbin Ge
Join Date: Mar 2013
Posts: 6
Rep Power: 13
gejiabin is on a distinguished road
Recently,I use the "polyDualMesh" to produce polyhedron mesh,then I visualize it in paraview by "foamToVTK".But the "foamToVTK" decomposes the
Polyhedra into pramid type.paraFoam is not work on my computer and I have to use foamToVTK for post-processing
gejiabin is offline   Reply With Quote

Old   March 7, 2014, 04:59
Default python solution
  #2
New Member
 
Jinbin Ge
Join Date: Mar 2013
Posts: 6
Rep Power: 13
gejiabin is on a distinguished road
I have one solution.Since I need only to observe polymesh,I convert the openfoam mesh format to paraview unstructed grid format .vtk using python.
It is tedious,is there any more simple way?

#!/usr/bin/vtkpython
datapath_read_points="constant/polyMesh/points"
datapath_read_faces="constant/polyMesh/faces"
datapath_write="VTK/1.vtk"

file_read_points=open(datapath_read_points,'r')
file_read_faces=open(datapath_read_faces,'r')
file_write=open(datapath_write,'w')
#----------------------------------------------------
#Header
file_write.write("# vtk DataFile Version 3.1\n" )
file_write.write("Visualization for polyMesh\n" )
file_write.write("ASCII\n" )
file_write.write("DATASET UNSTRUCTURED_GRID\n" )

#----------------------------------------------------

l_points=file_read_points.readlines()
numPoints=l_points[18]
numPoints=numPoints.replace("\n"," ")
file_write.write("POINTS " + numPoints + "float\n" )
for line in l_points[20:20+int(numPoints)]:
line=line.replace("(","")
line=line.replace(")","")
file_write.write(line)

#----------------------------------------------------
l_cells_=file_read_faces.readlines()
numCells=l_cells_[18]
numCells=numCells.replace("\n"," ")
#------------------------------------------
l_cells_=l_cells_[20:]

while l_cells_[-1]!=')\n':
l_cells_.pop()

l_cells=[]
for line in l_cells_:

if line=="(\n":
l_cells[-1]+="("
continue

if line==")\n":
l_cells[-1]+=")\n"
continue

if line=="\n":
l_cells.append("")
continue

if len( line.split('(') )>1:
l_cells.append(line)
continue

if len(l_cells)==0:
l_cells.append(line.replace("\n"," "))
continue

l_cells[-1]+=line.replace("\n"," ")

#------------------------------------------
numSize=0;
for line in l_cells:
if line=="":
continue
line=line.split('(');
numSize+=int(line[0])+1;

file_write.write("CELLS " + numCells + str(numSize) +"\n")
for line in l_cells:
if line=="":
continue
line=line.replace("("," ")
line=line.replace(")","")
file_write.write(line)

#----------------------------------------------------
file_write.write("CELL_TYPES "+numCells + "\n" )
file_write.write("7 "*int(numCells))

file_read_points.close()
file_read_faces.close()
file_write.close()
#----------------------------------------------------
gejiabin is offline   Reply With Quote

Old   March 7, 2014, 09:09
Default
  #3
New Member
 
akrasemann
Join Date: Dec 2013
Posts: 17
Rep Power: 13
akrasemann is on a distinguished road
I'm not sure weather this helps, but I had difficulties displaying a polyhedral mesh created by enGrid. If your problem is displaying, the following might help:

wyldckat pointed out to me in this post http://www.cfd-online.com/Forums/engrid/128987-exporting-mesh-openfoam-chtmultiregion-case.html#post471822 that one has to tick the check box "Use VTKPolyhedron" to display the mesh properly.
rugg likes this.
akrasemann is offline   Reply With Quote

Old   August 8, 2020, 22:09
Default
  #4
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
Where can I find the "Use VTKPolyhedron" button in ParaView? I'm using ParaView for Mac 5.7.0 and I can't find any reference in the ParaView user guide.

I'm investigating with a very simple example how OpenFOAM makes transitions between refinement levels in hexahedral meshes. I made a mesh of 2 cells and then refined one of them. After refinement, checkMesh reports 9 cells as expected, of which 8 are hexahedrons and 1 is a 9-faced polyhedron. When I open the mesh in ParaView however, the polyhedron gets subdivided in 13 bodies, of which 6 are tetrahedrons and 7 pyramids, see attached picture. I would like to see what difference it makes with the VTKPolyhedron option switched on, because I think that this decompositions of polyhedrons create disturbances in the wave patterns of ship resistance calculations, see attached picture of wave pattern. It is essential that I know whether this is a mesh quality issue or just ParaView visualizing it wrong.

Thanks!
Ship Designer is offline   Reply With Quote

Old   August 11, 2020, 23:33
Default
  #5
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
I accidentally found what I was looking for… The checkbox has changed label from "Use VTKPolyhedron" to "Decompose polyhedra". It is only visible after clicking the gear on the top right which displays more controls in the properties panel. After months of using ParaView I somehow never noticed that gear over there… I don't know but I think that there ought to be User Interface Guidelines for Linux applications too… Terrible GUIs at times.
Attached Images
File Type: png ParaView Decompose Polyhedra Checkbox.png (81.9 KB, 244 views)
File Type: jpg Refinement Transition with Proper Polyhedron.jpg (24.8 KB, 143 views)
hamdani, kiski, KlausSchuh and 6 others like this.
Ship Designer is offline   Reply With Quote

Reply

Tags
foamtovtk, paraview, polydualmesh, polyhedron


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
[OpenFOAM] Paraview 3.98.0 does not update list of mesh regions letzel ParaView 6 April 19, 2021 16:57
ParaView: Number of cells/points in mesh and field don't match Jaggy_Snake OpenFOAM Bugs 2 March 1, 2017 10:06
[ICEM] surface mesh merging problem everest ANSYS Meshing & Geometry 44 April 14, 2016 07:41
[ICEM] Problem making structured mesh on a surface froztbear ANSYS Meshing & Geometry 4 November 10, 2011 09:52
[Gmsh] gmshToFoam problem: not the same mesh in Gmsh vs. paraview zhernadi OpenFOAM Meshing & Mesh Conversion 8 July 7, 2011 03:28


All times are GMT -4. The time now is 11:07.