CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] gmshToFoam generates patches with 0 faces and 0 points

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2020, 02:32
Default gmshToFoam generates patches with 0 faces and 0 points
  #1
New Member
 
Join Date: Jan 2019
Posts: 10
Rep Power: 7
Simurgh is on a distinguished road
I have converted my gmsh generated mesh to OpenFOAM format using gmshToFoam, and everything is fine, and mesh is properly converted. checkMesh passes with flying colours. But, I end up with patches (i.e., my Physical surfaces in gmsh) that have 0 faces and 0 points on them! This obviously breaks simulation later on as I cannot assign velocity or pressure to these boundaries. Please help, any ideas is appreciated. I can change the code if need be. I can code in C++, just give me a pointer on what is going on.

Gmsh shows that there are faces on these surfaces, but they are not converted somehow.

Here is the output of mesh conversion, plus checkMesh output at the end:

Info : Running 'gmsh -format msh22 -o mesh/pipe2.msh -3 -smooth 3 mesh/pipe2.geo' [Gmsh 4.5.6, 1 node, max. 1 thread]
Info : Started on Mon Jun 1 23:17:49 2020
Info : Reading 'mesh/pipe2.geo'...
Info : Extrusion layer cycle detected for curve 2
Info : Extrusion layer cycle detected for curve 6
Info : Extrusion layer cycle detected for curve 15
Info : Extrusion layer cycle detected for curve 2
Info : Extrusion layer cycle detected for curve 6
Info : Extrusion layer cycle detected for curve 15
Info : Done reading 'mesh/pipe2.geo'
Info : Meshing 1D...
Info : [ 0 %] Meshing curve 1 (Line)
Info : [ 10 %] Meshing curve 2 (Line)
Info : [ 10 %] Meshing curve 3 (Line)
Info : [ 10 %] Meshing curve 4 (Line)
Info : [ 20 %] Meshing curve 5 (Line)
Info : [ 20 %] Meshing curve 6 (Line)
Info : [ 20 %] Meshing curve 7 (Line)
Info : [ 20 %] Meshing curve 8 (Line)
Info : [ 30 %] Meshing curve 9 (Line)
Info : [ 30 %] Meshing curve 10 (Line)
Info : [ 30 %] Meshing curve 11 (Line)
Info : [ 30 %] Meshing curve 12 (Line)
Info : [ 40 %] Meshing curve 13 (Line)
Info : [ 40 %] Meshing curve 14 (Line)
Info : [ 40 %] Meshing curve 15 (Line)
Info : [ 50 %] Meshing curve 16 (Line)
Info : [ 50 %] Meshing curve 17 (Extruded)
Info : [ 50 %] Meshing curve 18 (Extruded)
Info : [ 50 %] Meshing curve 19 (Extruded)
Info : [ 60 %] Meshing curve 20 (Extruded)
Info : [ 60 %] Meshing curve 21 (Extruded)
Info : [ 60 %] Meshing curve 22 (Extruded)
Info : [ 60 %] Meshing curve 23 (Extruded)
Info : [ 70 %] Meshing curve 24 (Extruded)
Info : [ 70 %] Meshing curve 25 (Extruded)
Info : [ 70 %] Meshing curve 26 (Extruded)
Info : [ 80 %] Meshing curve 27 (Extruded)
Info : [ 80 %] Meshing curve 28 (Extruded)
Info : [ 80 %] Meshing curve 29 (Extruded)
Info : [ 80 %] Meshing curve 30 (Extruded)
Info : [ 90 %] Meshing curve 31 (Extruded)
Info : [ 90 %] Meshing curve 32 (Extruded)
Info : [ 90 %] Meshing curve 33 (Extruded)
Info : [ 90 %] Meshing curve 34 (Extruded)
Info : [100 %] Meshing curve 35 (Extruded)
Info : [100 %] Meshing curve 36 (Extruded)
Info : [100 %] Meshing curve 37 (Extruded)
Info : Done meshing 1D (0.030967 s)
Info : Meshing 2D...
Info : [ 0 %] Meshing surface 20 (Plane, Frontal-Delaunay)
Info : [ 10 %] Meshing surface 21 (Plane, Frontal-Delaunay)
Info : [ 10 %] Meshing surface 22 (Plane, Frontal-Delaunay)
Info : [ 20 %] Meshing surface 23 (Plane, Frontal-Delaunay)
Info : [ 20 %] Meshing surface 24 (Extruded)
Info : [ 30 %] Meshing surface 25 (Extruded)
Info : [ 30 %] Meshing surface 26 (Extruded)
Info : [ 40 %] Meshing surface 27 (Extruded)
Info : [ 40 %] Meshing surface 28 (Extruded)
Info : [ 50 %] Meshing surface 29 (Extruded)
Info : [ 50 %] Meshing surface 30 (Extruded)
Info : [ 60 %] Meshing surface 31 (Extruded)
Info : [ 60 %] Meshing surface 32 (Extruded)
Info : [ 70 %] Meshing surface 33 (Extruded)
Info : [ 70 %] Meshing surface 34 (Extruded)
Info : [ 80 %] Meshing surface 35 (Extruded)
Info : [ 80 %] Meshing surface 36 (Extruded)
Info : [ 90 %] Meshing surface 37 (Extruded)
Info : [ 90 %] Meshing surface 38 (Extruded)
Info : [100 %] Meshing surface 39 (Extruded)
Info : [100 %] Meshing surface 40 (Extruded)
Info : Done meshing 2D (0.300156 s)
Info : Meshing 3D...
Info : Meshing volume 1 (Extruded)
Info : Meshing volume 2 (Extruded)
Info : Meshing volume 3 (Extruded)
Info : Meshing volume 4 (Extruded)
Info : Done meshing 3D (0.023414 s)
Info : Optimizing mesh...
Info : Done optimizing mesh (0.000127 s)
Info : 1675 nodes 5184 elements
Info : Writing 'mesh/pipe2.msh'...
Info : Done writing 'mesh/pipe2.msh'
Info : Stopped on Mon Jun 1 23:17:49 2020
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : dd4b8cf30d-20200514 OPENFOAM=1912 patch=200506
Arch : "LSB;label=32;scalar=64"
Exec : gmshToFoam -case case mesh/pipe2.msh
Date : Jun 01 2020
Time : 23:17:49
Host : houman-Gazelle-Professional
PID : 14979
I/O : uncollated
Case : /home/houman/projects/upipe/openFoamSample/case
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Starting to read mesh format at line 2
Read format version 2.2 ascii 0

Starting to read physical names at line 5
Physical names:9
Surface 2 TunnelOutlet
Surface 3 TunnelInlet
Surface 4 TunnelWall
Surface 5 pipeWalls
Surface 6 pipeInlet
Surface 7 pipeOutlet
Surface 8 wedge0
Surface 9 wedge1
Volume 1 air

Starting to read points at line 17
Vertices to be read: 1675
Vertices read:1675

Starting to read cells at line 1695
Cells to be read: 4838

Mapping region 9 to Foam patch 0
Mapping region 7 to Foam patch 1
Mapping region 2 to Foam patch 2
Mapping region 8 to Foam patch 3
Mapping region 3 to Foam patch 4
Mapping region 6 to Foam patch 5
Mapping region 5 to Foam patch 6
Mapping region 4 to Foam patch 7
Mapping region 1 to Foam cellZone 0
Cells:
total:1577
hex :0
prism:1510
pyr :35
tet :32

CellZones:
Zone Size
0 1577

Patch 0 gets name wedge1
Patch 1 gets name pipeOutlet
Patch 2 gets name TunnelOutlet
Patch 3 gets name wedge0
Patch 4 gets name TunnelInlet
Patch 5 gets name pipeInlet
Patch 6 gets name pipeWalls
Patch 7 gets name TunnelWall

--> FOAM Warning :
From function Foam:olyMesh:olyMesh(const Foam::IOobject&, Foam:ointField&&, 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 593
Found 3253 undefined faces in mesh; adding to default patch defaultFaces
Finding faces of patch 0
Finding faces of patch 1
Finding faces of patch 2
Finding faces of patch 3
Finding faces of patch 4
Finding faces of patch 5
Finding faces of patch 6
Finding faces of patch 7

FaceZones:
Zone Size
1 4
5 4

Writing zone 0 to cellZone air and cellSet
Writing zone 1 to faceZone pipeOutlet and faceSet
Writing zone 5 to faceZone pipeInlet and faceSet
End

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : dd4b8cf30d-20200514 OPENFOAM=1912 patch=200506
Arch : "LSB;label=32;scalar=64"
Exec : checkMesh -case case
Date : Jun 01 2020
Time : 23:17:50
Host : houman-Gazelle-Professional
PID : 14980
I/O : uncollated
Case : /home/houman/projects/upipe/openFoamSample/case
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0

Mesh stats
points: 1675
internal points: 0
faces: 5553
internal faces: 2300
cells: 1577
faces per cell: 4.97971
boundary patches: 8
point zones: 0
face zones: 2
cell zones: 1

Overall number of cells of each type:
hexahedra: 0
prisms: 1510
wedges: 0
pyramids: 35
tet wedges: 0
tetrahedra: 32
polyhedra: 0

Checking topology...
Boundary definition OK.
Cell to face addressing OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
Patch Faces Points Surface topology
wedge1 1577 854 ok (non-closed singly connected)
pipeOutlet 0 0 ok (empty)
TunnelOutlet 17 35 ok (non-closed singly connected)
wedge0 1577 854 ok (non-closed singly connected)
TunnelInlet 17 35 ok (non-closed singly connected)
pipeInlet 0 0 ok (empty)
pipeWalls 34 68 ok (non-closed singly connected)
TunnelWall 31 64 ok (non-closed singly connected)

Checking faceZone topology for multiply connected surfaces...
FaceZone Faces Points Surface topology
pipeOutlet 4 9 ok (non-closed singly connected)
pipeInlet 4 9 ok (non-closed singly connected)

Checking basic cellZone addressing...
CellZone Cells Points Volume BoundingBox
air 1577 1675 0.697106 (0 -2 0) (1.9981 2 0.261052)

Checking geometry...
Overall domain bounding box (0 -2 0) (1.9981 2 0.261052)
Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
Mesh has 3 solution (non-empty) directions (1 1 1)
Boundary openness (-1.11534e-17 9.73628e-18 2.85705e-16) OK.
Max cell openness = 2.05534e-16 OK.
Max aspect ratio = 20.3769 OK.
Minimum face area = 2.00566e-05. Maximum face area = 0.0257222. Face area magnitudes OK.
Min volume = 7.05952e-07. Max volume = 0.00141272. Total volume = 0.697106. Cell volumes OK.
Mesh non-orthogonality Max: 59.066 average: 5.01187
Non-orthogonality check OK.
Face pyramids OK.
Max skewness = 1.92527 OK.
Coupled point location match (average 0) OK.

Mesh OK.

End


Thank you
Simurgh is offline   Reply With Quote

Old   June 3, 2020, 03:12
Default Found the issue
  #2
New Member
 
Join Date: Jan 2019
Posts: 10
Rep Power: 7
Simurgh is on a distinguished road
The issue is that the internal boundary converted from gmsh (using gmshToFoam convertor) is not a patch. It can be converted to a patch using createBaffles.
Simurgh is offline   Reply With Quote

Old   July 29, 2020, 15:04
Default
  #3
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 12
fedvasu is on a distinguished road
Quote:
Originally Posted by Simurgh View Post
The issue is that the internal boundary converted from gmsh (using gmshToFoam convertor) is not a patch. It can be converted to a patch using createBaffles.
Can you please tell me how to convert the desired patch using createBaffles ?

I don't any ANY internal boundary patches!!
fedvasu is offline   Reply With Quote

Old   October 26, 2021, 08:27
Default Change the gMsh export settings
  #4
New Member
 
Saikumar Reddy Y
Join Date: May 2020
Posts: 8
Rep Power: 5
Saikumar Bunni is on a distinguished road
Just for closing this common issue with gMsh.

One of the most common reasons would be missing the SetFactory("Built-in") command which is the library file for the CAD type approach of geometry generation.

The second error would be the export format.

Only Version 2 ASCII is compatible with the gmshToFoam command in OpenFOAM.

Go to file --> Export --> select .msh in the files --> "DO NOT INCLUDE PARAMETRIC NODES AND ELEMENTS" while exporting. This is also a common source of error.

Export the mesh file.

Now open the mesh file in notepad/wordpad and check if you $NODES for the nodes, not $ParametricNODES. Also in the $ELEMENTS make sure there is no '0' in the contents. This implies some of the cells have been assigned to patch 0, which needs to be avoided.
Saikumar Bunni is offline   Reply With Quote

Old   August 25, 2023, 07:58
Default Similar issue
  #5
New Member
 
Avi
Join Date: Jul 2023
Posts: 2
Rep Power: 0
popopo is on a distinguished road
The following is my geo file and I exported it with all elements and no parametric coordinates. I cannot get gmshToFoam to read my physical groups in the boundary file.


Code:
// Gmsh project created on Thu Aug 24 13:42:03 2023
//+
// Backend kernel
SetFactory("Built-in");
//+
// Defining the properties of the mesh
xoffset = 0;
yoffset = 0.5;
chlength = 80;
chwidth = 4;
radius = 1;
//+
// Setting mesh characteristic
// here, mesh size is the ratio between the perimeter of the cylinder and the number of division on the cylinder (which is 2pi*r/n)
meshsize = 0.011;
numpts = Round((2*Pi*radius)/meshsize);
//+
// Drawing the points
Point(1) = {0+xoffset, 0, 0, 1.0};
Point(2) = {0+xoffset, 0+yoffset, 0, 1.0};
Point(3) = {xoffset, radius+yoffset, 0, 1.0};
Point(4) = {xoffset, -radius+yoffset, 0, 1.0};
Point(5) = {radius+xoffset, yoffset, 0, 1.0};
Point(6) = {-radius+xoffset, yoffset, 0, 1.0};
Point(7) = {-0.25*chlength, 0.5*chwidth,0,1.0};
Point(8) = {-0.25*chlength, 0, 0, 1.0};
Point(9) = {-0.25*chlength, -0.5*chwidth, 0, 1.0};
Point(10) = {0.75*chlength, 0.5*chwidth, 0, 1.0};
Point(11) = {0.75*chlength, 0, 0, 1.0};
Point(12) = {0.75*chlength, -0.5*chwidth, 0, 1.0};
Point(13) = {0.5*chwidth+xoffset, 0.5*chwidth, 0, 1.0};
Point(14) = {-0.5*chwidth+xoffset, 0.5*chwidth, 0, 1.0};
Point(15) = {-0.5*chwidth+xoffset, -0.5*chwidth, 0, 1.0};
Point(16) = {0.5*chwidth+xoffset, -0.5*chwidth, 0, 1.0};
Point(17) = {0.5*chwidth+xoffset, 0, 0, 1.0};
Point(18) = {-0.5*chwidth+xoffset, 0, 0, 1.0};
Point(19) = {0+xoffset, 0.5*chwidth, 0, 1.0};
Point(20) = {0+xoffset, -0.5*chwidth, 0, 1.0};
//+
// Drawing the walls and other lines
Line(1) = {7, 14};
Line(2) = {14, 19};
Line(3) = {19, 13};
Line(4) = {13, 10};
Line(5) = {10, 11};
Line(6) = {11, 12};
Line(7) = {12, 16};
Line(8) = {16, 20};
Line(9) = {20, 15};
Line(10) = {15, 9};
Line(11) = {9, 8};
Line(12) = {8, 7};
Line(13) = {14, 18};
Line(14) = {18, 15};
Line(15) = {13, 17};
Line(16) = {17, 16};
Line(17) = {18,8};
Line(18) = {17,11};
//+
// Drawing the cylinder
Point(21) = {radius*Cos(Pi/4)+xoffset,radius*Sin(Pi/4)+yoffset, 0, 1.0};
Point(22) = {-radius*Cos(Pi/4)+xoffset,radius*Sin(Pi/4)+yoffset, 0, 1.0};
Point(23) = {-radius*Cos(Pi/4)+xoffset,-radius*Sin(Pi/4)+yoffset, 0, 1.0};
Point(24) = {radius*Cos(Pi/4)+xoffset,-radius*Sin(Pi/4)+yoffset, 0, 1.0};
Circle(19) = {3, 2, 22};
Circle(20) = {22, 2, 6};  
Circle(21) = {6, 2, 23};  
Circle(22) = {23, 2, 4};  
Circle(23) = {4, 2, 24};  
Circle(24) = {24, 2, 5};  
Circle(25) = {5, 2, 21};  
Circle(26) = {21, 2, 3};  
Line(27) = {19, 3};  
Line(28) = {14, 22};  
Line(29) = {18, 6};  
Line(30) = {15, 23};  
Line(31) = {20, 4};  
Line(32) = {16, 24};  
Line(33) = {17, 5};  
Line(34) = {13, 21};
//+
// Setting mesh size through transfinite curves
Transfinite Curve {12, 11, 13, 14, 2, 3, 9, 8, 15, 16, 5, 6, 19, 20, 21, 22, 23, 24, 25, 26} = Round(numpts/8) Using Progression 1;
Transfinite Curve {-1, 17, 10} = 22 Using Progression 1.2;
Transfinite Curve {4, 18, -7} = 29 Using Progression 1.2;
Transfinite Curve {-30, -31, -32, -33, -34, -27, -28, -29} = Round(numpts/8) Using Progression 1.05;
//+
// Drawing surfaces
Curve Loop(1) = {1, 13, 17, 12};
Plane Surface(1) = {1};
Curve Loop(2) = {10, 11, -17, 14};
Plane Surface(2) = {2};
Curve Loop(3) = {13, 29, -20, -28};
Plane Surface(3) = {3};
Curve Loop(4) = {14, 30, -21, -29};
Plane Surface(4) = {4};
Curve Loop(5) = {2, 27, 19, -28};
Plane Surface(5) = {5};
Curve Loop(6) = {22, -31, 9, 30};
Plane Surface(6) = {6};
Curve Loop(7) = {3, 34, 26, -27};
Plane Surface(7) = {7};
Curve Loop(8) = {23, -32, 8, 31};
Plane Surface(8) = {8};
Curve Loop(9) = {34, -25, -33, -15};
Plane Surface(9) = {9};
Curve Loop(10) = {33, -24, -32, -16};
Plane Surface(10) = {10};
Curve Loop(11) = {4, 5, -18, -15};
Plane Surface(11) = {11};
Curve Loop(12) = {7, -16, 18, 6};
Plane Surface(12) = {12};
// Making transfinite surfaces
Transfinite Surface {1} = {7, 8, 18, 14};
Transfinite Surface {2} = {8, 9, 15, 18};
Transfinite Surface {3} = {14, 18, 6, 22};
Transfinite Surface {4} = {18, 15, 23, 6};
Transfinite Surface {5} = {14, 22, 3, 19};
Transfinite Surface {6} = {23, 15, 20, 4};
Transfinite Surface {7} = {19, 3, 21, 13};
Transfinite Surface {8} = {4, 20, 16, 24};
Transfinite Surface {9} = {21, 5, 17, 13};
Transfinite Surface {10} = {5, 24, 16, 17};
Transfinite Surface {11} = {13, 17, 11, 10};
Transfinite Surface {12} = {17, 16, 12, 11};
//+
// Recombine Surfaces
Recombine Surface {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
//+
// Extrude to create volume
Extrude {0, 0, 1} {
  Surface{1}; Surface{2}; Surface{3}; Surface{4}; Surface{5}; Surface{6}; Surface{7}; Surface{8}; Surface{9}; Surface{10}; Surface{11}; Surface{12}; 
  Layers {1}; Recombine;
}
//+
// Adding Physical Groups
Physical Surface("inlet", 299) = {55, 69};
Physical Surface("beforeCylinder", 300) = {47, 77};
Physical Surface("afterCylinder", 301) = {231, 253};
Physical Surface("aboveCylinder", 302) = {135};
Physical Surface("belowCylinder", 303) = {157};
Physical Surface("outlet", 304) = {267, 297};
Physical Surface("walls", 305) = {43, 131, 175, 263, 65, 161, 205, 285};
Physical Surface("cylinder", 306) = {139, 183, 223, 245, 197, 153, 117, 95};
Physical Surface("frontAndBack", 307) = {56, 1, 78, 2, 276, 11, 298, 12, 100, 3, 122, 4, 144, 5, 188, 7, 232, 9, 10, 254, 210, 8, 166, 6};
popopo is offline   Reply With Quote

Reply

Tags
gmshtofoam patch, gmshtofoam problem


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
Decomposing meshes Tobi OpenFOAM Pre-Processing 22 February 24, 2023 09:23
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
GenerateVolumeMesh Error - Surface Wrapper Self Interacting (?) AndreP STAR-CCM+ 10 August 2, 2018 07:48
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 03:21
snappyhexmesh remove blockmesh geometry philipp1 OpenFOAM Running, Solving & CFD 2 December 12, 2014 10:58


All times are GMT -4. The time now is 10:28.