GmshToFoam correct face orientation
Hello,
I built a mesh using gmsh and converted it to FOAM using gmshToFoam. When I run checkMesh, I get the following error: Owner cell vertex labels: 8(31771 10586 1329 10765 10591 1330 10764 31766) bool primitiveMesh::checkFacePyramids(const bool, const scalar, labelHashSet*) const: face 93327 points the wrong way. Pyramid volume: -3.34611e-09 Face 4(10765 1328 47 1329) area: 5.23744e-06 Ownercell: 28043 Owner cell vertex labels: 8(10586 1329 47 1341 10581 1328 10765 31771) --> FOAM Serious Error : Error in face pyramids: faces pointing the wrong way! Writing 29260 faces with incorrect orientation to set wrongOrientedFaces It seems there is a problem with the orientation of some faces. I would like to know if openFOAM has a tool to correct the above error. Because in gmsh I can't seem to correct the problem. |
Hi,
Try the modified gmshTo
Hi,
Try the modified gmshToFoam from this forum, see if it helps. Ervin |
Yes, this version works OK.
Yes, this version works OK.
Although it would be nice if the program could automatically detect if the element needs to be inverted or not. Because I ended up converting the mesh, assigning BC, solving and then I used the -invertHex option and did it all again. I also have only tested it with a mesh in which all elements needed to be inverted. I haven't tested it with a mesh that has some elements that need to be inverted and others that do not. |
I just tested this version in
I just tested this version in a mesh where only some elements needed to be inverted and it did not work. I tried to modify the gmshToFoam to detect and invert automatically but I don't know the specific functions to do that.
What I wanted to do was to compute dot product of the normal of a face with the vector from the face center point to the element centroid point. Maybe computing the volume could also indicate the if the element needs to be inverted or not. Any suggestions? |
element centroid:
when you
element centroid:
when you have a cellShape: (cells[cellI++] = cellShape(tet, tetPoints)) you can ask it for its centre (see cellShape.H). You can also ask for the faces of the cellShape (cellShape::faces) and each of the faces for their centre and area vector (face.H) If you have something working & tested can you send it back? |
Hi Mattijs Janssens,
I alre
Hi Mattijs Janssens,
I already fixed this problem using my own routine in C to invert the whole mesh in the same direction (outwards or inwards). I can send you this code if you like. However, I think it would "nicer" to do it using OpenFOAM classes. |
I agree it would be nicer. You
I agree it would be nicer. You feel like adding it to gmshToFoam? With a bit of searching you should be able to find out the information you need.
The Foam orientation of cells is somewhere in the user guide (chapter 6 i think) |
Hi Mattijs Janssens,
I ju
Hi Mattijs Janssens,
I just altered the gmshToFoam.C file: http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif gmshToFoam.C Please note, I haven't tested it on meshes with prisms. Although it produces several warnings, it seems to work with hexahedral mesh. Please give it a try. |
Hi Billy,
thanks. I changed
Hi Billy,
thanks. I changed it to test on cellShape and put the inverting under a switch. Seems to work for prism cases as well. http://www.cfd-online.com/OpenFOAM_D...s/mime_txt.gif gmshToFoam.C |
Hi Mattijs Janssens,
It loo
Hi Mattijs Janssens,
It looks like a better implementation than mine. I have tested it on a hexahedral mesh and it worked OK. However, is it possible to hide those warnings during conversion? It seems to slow down the process. |
Hi Billy,
Could you warn th
Hi Billy,
Could you warn the GMSH author that his cell shape orientation is incorrect? I think it should be solved in gmsh. I'd rather not hide the warning in Foam. If it is terminal output that is slowing you down redirect gmshToFoam output to a file. |
Hi,
I just tried to convert
Hi,
I just tried to convert a gmsh file with only prisms and autoinvert gave me a strange result. Maybe it is not working with prisms or there is a mixup with gmsh orientation. |
I altered the gmshToFoam file
I altered the gmshToFoam file and this reordering seems to work better:
// Reorder prism. prismPoints[0] = cell[3]; prismPoints[1] = cell[4]; prismPoints[2] = cell[5]; prismPoints[3] = cell[0]; prismPoints[4] = cell[1]; prismPoints[5] = cell[2]; |
There is a new gmsh out (1.61)
There is a new gmsh out (1.61) which says in the changelog:
"hexas and prisms are now always saved with positive volume" !! Can someone test this and get back to me? |
Hi,
I have already download
Hi,
I have already downloaded it and it looks good. I also like the STL remesher! |
So the 1.2 gmshToFoam works wi
So the 1.2 gmshToFoam works without any switches or your changes?
|
I haven't tested that yet. I o
I haven't tested that yet. I only installed the windows version for now, but I will test it in a few days.
|
Hi,
I tested with both pris
Hi,
I tested with both prisms and hexas and it seems that using this new version of gmsh (1.61), you do not need -autoInvert switch. I imported them using gmshToFoam and then tested them using checkMesh. I didn't actually run a simulation on them yet. |
Excellent news!
checkMesh s
Excellent news!
checkMesh should be good enough. |
Hi,
I tried this new gmsh (
Hi,
I tried this new gmsh (1.61) on some .stl file but got some error when I tried gmshToFoam, perhaps I did something wrong. I haven't tried this program before. Looks nice anyway. And gmsh can do hex-meshing (bodyfitted)? If so, I think I'll take a closer look but I have no earlier experience with gmsh... You use it as preprocessor instead of blockMesh, right? |
All times are GMT -4. The time now is 17:47. |