CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] gmshToFoam warning - cannot match faces (https://www.cfd-online.com/Forums/openfoam-meshing/215158-gmshtofoam-warning-cannot-match-faces.html)

umd February 24, 2019 12:16

gmshToFoam warning - cannot match faces
 
2 Attachment(s)
Hi all,

I'm trying to build a 3D hexagonal mesh for use in OpenFoam. I started with a template in gmsh so that's the tool I've been using, but I don't have a lot of experience with it.

The mesh builds fine in gmsh and I don't get any errors, nor can I see any from looking at the geometry and mesh it visualises. However, as soon as I run gmshToFoam on the .msh file I get a whole load of warnings and errors. I am saving in Version 2 ASCII, as recommended somewhere else on this forum.

The warnings I get are:

--> FOAM Warning :
From function Foam:: polyMesh:: polyMesh(const Foam::IOobject&, const Foam::Xfer<Foam::Field<Foam::Vector<double> > >&, const cellShapeList&, const faceListList&, const wordList&, const wordList&, const Foam::word&, const Foam::word&, const wordList&, bool)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 595
Found 534 undefined faces in mesh; adding to default patch.

This is followed by an enormous number of this error:

--> FOAM Warning :
From function int main(int, char**)
in file gmshToFoam.C at line 972
Could not match gmsh face 4(12 13 154 150) to any of the interior or exterior faces that share the same 0th point
--> FOAM Warning : Not using gmsh face 4(150 154 155 151) since zero vertex is not on boundary of polyMesh

I suspect the problem is in my surface and volume definitions but I can't for the life of me see what it is. I am attaching my .geo file (hexagonalModel.txt) and the gmsh-generated .msh file (hexagonalModel_mesh.txt). To generate the mesh file I have been using the gmsh GUI 3D option.

I would be really grateful for any help or comments!

KraftPunked November 7, 2020 11:27

I had the same problem and I solved it by not extruding the lines. I extruded only the surfaces and the problem is gone.

Quentin Chevalier February 23, 2022 10:15

2 Attachment(s)
I have a very similar problem on my end.


I'm using gmsh 4.7.1 and OpenFOAM in a container v2112. I'm trying to do something similar to https://openfoamwiki.net/index.php/2...ial_using_GMSH in a cylindrical geometry using wedge boundary conditions.


My .geo file is attached, it's basically a 2D simple nozzle with varying mesh refinement that has been extruded 1° to end up with a slice of a round jet.


@KraftPunked, I did extrude only the physical surface.



This gives no error in gmsh, but it does create issues with gmshToFoam with several hundreds of "Could not match gmsh face W(X Y Z) to any of the interior or exterior faces that share the same 0th point" errors.


As could be expected, this problem leads to a boundary file with missing faces, though some get through nonetheless.


I'm not sure how to adress this error. The top google entries (http://geuz.org/pipermail/gmsh/2020/013527.html, http://onelab.info/pipermail/gmsh/2009/004487.html or https://gitlab.onelab.info/gmsh/gmsh/-/issues/490) are not super helpful.


This in turn leads to the creation of auto patchs in boundary upon execution that lead to failure of decomposePar, and it goes downhill from there.


Anyone had the same problem before ?

Quentin Chevalier February 23, 2022 11:44

3 Attachment(s)
Attached is my entire case file for completeness. Because of file size limits, the .geo file and the .msh file are separate. The .msh file must be put into the case file for the setup to work, the .geo is purely for reference.


The Allrun script will run gmshToFoam, modify the boundary file and run. You'll see that with the versions mentioned above, gmshToFoam throws many errors, and then creates a boundary with no faces for most surfaces as well as a huge defaultFaces that causes a general breakdown in decomposePar.


I also get an error in createPatch that confuses me - it requires a symmetric wedge with respect to y but that seems to be the case in my mesh...


Comments welcome.

mcheikh September 4, 2022 17:59

4 Attachment(s)
Hi,

I know this is an old thread but I think it's important that I upload my solution for converting GMSH .msh files to FOAM format using "gmshToFoam".


When "gmshToFoam" sends the error
"Could not match gmsh face 3(25 2 98) to any of the interior or exterior faces that share the same 0th point"
It means that the 2D gmsh surface face 3(25 2 98) is not found in any of the 3D elements. Remember that open foam 3D elements are saved as faces and that boundary faces in OpenFOAM have to be attributed to a 3D element. If they are not attributed than gmshToFoam will ignore them.

To explain the error in more details let's assume we have the below 2D gmsh surface faces:
face 1 is (25, 2 98) and face 2 is (98 10 2)
25-98
| / |
2 - 10
Lets focus on face 1 for a second. Let's assume that the nearest 3D tet element to that face is
25-98
\ | \
10 - 50
As you can see, face 1 and the corresponding face from the 3D element are not aligned so face 1 will be ignored.

One can easily see this problem in GMSH when one turns on the Mesh Visibility options for 2D element edges and 3D element edges at the same time. If the 2D and 3D edges are aligned at the surface ==> No problem, but if they are not aligned ==> gmshToFoam will ignore the 2D faces. Look at the two pngs that I have uploaded

Now how to solve this problem:
Usually, this discrepancy between the surface faces and the faces of a 3D element happens when one creates all 2D surface faces first and then creates from them a 3D body.
To solve it either create the volume first from one 2D surface (like extruding for example) or focus on aligning the 2D surface properly by using the RIGHT, LEFT when you transfite the surface.

I have uploaded a GMSH script with a problem and how I solved it.


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