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 generates patches with 0 faces and 0 points (https://www.cfd-online.com/Forums/openfoam-meshing/227553-gmshtofoam-generates-patches-0-faces-0-points.html)

Simurgh June 2, 2020 02:32

gmshToFoam generates patches with 0 faces and 0 points
 
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::polyMesh::polyMesh(const Foam::IOobject&, Foam::pointField&&, 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 June 3, 2020 03:12

Found the issue
 
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.

fedvasu July 29, 2020 15:04

Quote:

Originally Posted by Simurgh (Post 773144)
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!!

Saikumar Bunni October 26, 2021 08:27

Change the gMsh export settings
 
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.


All times are GMT -4. The time now is 09:44.