CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Open Source Meshers: Gmsh, Netgen, CGNS, ...

GmshToFoam correct face orientation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 17, 2005, 12:45
Default Hello, I built a mesh using
  #1
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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.
billy is offline   Reply With Quote

Old   July 18, 2005, 03:34
Default Hi, Try the modified gmshTo
  #2
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 68
Rep Power: 7
adorean is on a distinguished road
Hi,

Try the modified gmshToFoam from this forum, see if it helps.

Ervin
adorean is offline   Reply With Quote

Old   July 29, 2005, 13:29
Default Yes, this version works OK.
  #3
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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.
billy is offline   Reply With Quote

Old   August 2, 2005, 20:48
Default I just tested this version in
  #4
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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?
billy is offline   Reply With Quote

Old   August 3, 2005, 18:32
Default element centroid: when you
  #5
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
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?
mattijs is offline   Reply With Quote

Old   August 4, 2005, 18:01
Default Hi Mattijs Janssens, I alre
  #6
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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.
billy is offline   Reply With Quote

Old   August 5, 2005, 12:57
Default I agree it would be nicer. You
  #7
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
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)
mattijs is offline   Reply With Quote

Old   August 5, 2005, 13:45
Default Hi Mattijs Janssens, I ju
  #8
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
Hi Mattijs Janssens,


I just altered the gmshToFoam.C file:

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.
billy is offline   Reply With Quote

Old   August 8, 2005, 15:16
Default Hi Billy, thanks. I changed
  #9
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
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.

gmshToFoam.C
mattijs is offline   Reply With Quote

Old   August 8, 2005, 16:19
Default Hi Mattijs Janssens, It loo
  #10
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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.
billy is offline   Reply With Quote

Old   August 8, 2005, 17:47
Default Hi Billy, Could you warn th
  #11
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
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.
mattijs is offline   Reply With Quote

Old   October 26, 2005, 15:35
Default Hi, I just tried to convert
  #12
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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.
billy is offline   Reply With Quote

Old   October 26, 2005, 16:11
Default I altered the gmshToFoam file
  #13
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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];
billy is offline   Reply With Quote

Old   November 25, 2005, 16:42
Default There is a new gmsh out (1.61)
  #14
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
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?
mattijs is offline   Reply With Quote

Old   November 26, 2005, 14:54
Default Hi, I have already download
  #15
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
Hi,

I have already downloaded it and it looks good. I also like the STL remesher!
billy is offline   Reply With Quote

Old   November 26, 2005, 15:01
Default So the 1.2 gmshToFoam works wi
  #16
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
So the 1.2 gmshToFoam works without any switches or your changes?
mattijs is offline   Reply With Quote

Old   November 26, 2005, 15:08
Default I haven't tested that yet. I o
  #17
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
I haven't tested that yet. I only installed the windows version for now, but I will test it in a few days.
billy is offline   Reply With Quote

Old   November 26, 2005, 16:20
Default Hi, I tested with both pris
  #18
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 7
billy is on a distinguished road
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.
billy is offline   Reply With Quote

Old   November 27, 2005, 06:55
Default Excellent news! checkMesh s
  #19
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
Excellent news!

checkMesh should be good enough.
mattijs is offline   Reply With Quote

Old   November 27, 2005, 08:40
Default Hi, I tried this new gmsh (
  #20
unoder
Guest
 
Posts: n/a
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?
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GmshToFoam varun Open Source Meshers: Gmsh, Netgen, CGNS, ... 4 March 13, 2012 04:24
GmshToFoam example guillaume OpenFOAM Mesh Utilities 3 February 25, 2008 21:06
correct the face handedness kk FLUENT 4 February 16, 2007 10:42
Orientation of Face Variable Macros hirokata FLUENT 0 February 17, 2006 01:12
Y+ orientation Ashish CD-adapco 1 April 22, 2003 03:58


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