gmshToFOAM: Found undefined faces in mesh

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

 November 30, 2014, 18:32 gmshToFOAM: Found undefined faces in mesh #1 Member   Join Date: Mar 2014 Location: Austrian abroad in Germany Posts: 48 Rep Power: 3 I am having some trouble with gmshToFOAM. So far the OpenFOAM "cavity" tutorial with the blockMesh utility works fine. Now I would like to solve the "cavity" problem using an unstructured mesh created by Gmesh: Code: ```lc = 0.01; tc = 0.001; // top corners bc = 0.0025; // bottom corners Point(1) = { 0, 0, 0, lc }; Point(2) = { 0.05, 0, 0, lc }; Point(3) = { 0.1, 0, 0, lc }; Point(4) = { 0.1, 0.05, 0, lc }; Point(5) = { 0.1, 0.1, 0, tc }; Point(6) = { 0.05, 0.1, 0, lc }; Point(7) = { 0, 0.1, 0, tc }; Point(8) = { 0, 0.05, 0, lc }; Line(1) = {1,2}; Line(2) = {2,3}; Line(3) = {3,4}; Line(4) = {4,5}; Line(5) = {5,6}; Line(6) = {6,7}; Line(7) = {7,8}; Line(8) = {8,1}; Line Loop (9) = {1:8}; Plane Surface(1) = {9}; Extrude {0, 0, 0.1} { Surface{1}; Layers{1}; Recombine; } Physical Surface("front") = {46,50}; Physical Surface("back") = {34,30}; Physical Surface("bottom") = {22,26}; Physical Surface("left") = {1}; Physical Surface("top") = {42,38}; Physical Surface("right") = {51}; Physical Volume("internal") = {1}; Mesh 3; Save "cavity.msh";``` I am getting the following terminal outputs: Code: ```\$ gmshToFoam cavity.msh ... 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:7 Surface 1 front Surface 2 back Surface 3 bottom Surface 4 left Surface 5 top Surface 6 right Volume 7 internal Starting to read points at line 15 Vertices to be read:652 Vertices read:652 Starting to read cells at line 670 Cells to be read:1806 Mapping region 4 to Foam patch 0 Mapping region 6 to Foam patch 1 Mapping region 3 to Foam patch 2 Mapping region 2 to Foam patch 3 Mapping region 5 to Foam patch 4 Mapping region 1 to Foam patch 5 Mapping region 7 to Foam cellZone 0 Cells: total:578 hex :0 prism:578 pyr :0 tet :0 CellZones: Zone Size 0 578 Skipping tag at line 2479 Patch 0 gets name left Patch 1 gets name right Patch 2 gets name bottom Patch 3 gets name back Patch 4 gets name top Patch 5 gets name front --> FOAM Warning : From function polyMesh::polyMesh(... construct from shapes...) in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 627 Found 1228 undefined faces in mesh; adding to default patch. 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 FaceZones: Zone Size Writing zone 0 to cellZone internal and cellSet End``` and Code: ```\$ icoFoam Create time Create mesh for time = 0 Reading transportProperties Reading field p --> FOAM FATAL IO ERROR: Cannot find patchField entry for left file: ~/.../run/tutorials/incompressible/icoFoam/cavity/0/p.boundaryField from line 25 to line 35. From function GeometricField::GeometricBoundaryField::readField(const DimensionedField&, const dictionary&) in file ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricBoundaryField.C at line 209. FOAM exiting``` Any ideas how to solve this problem?

 December 1, 2014, 03:10 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,235 Rep Power: 21 Hi, This Code: ```--> FOAM Warning : From function polyMesh::polyMesh(... construct from shapes...) in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 627 Found 1228 undefined faces in mesh; adding to default patch.``` can be ignored. As gmshToFoam first adds all boundary faces to defaultFaces patch and then move faces to patches defined in MSH file. IIRC I've already posted explanation on the forum, or you can take a look at sources of gmshToFoam. Second error: add left patch description to p file in 0 folder. Here's the names of the patches in the cavity tutorial: Code: ```boundaryField { movingWall { type zeroGradient; } fixedWalls { type zeroGradient; } frontAndBack { type empty; } }``` either you change names of physical groups in your mesh, or you change names of the patches in 0 folder (p and U) files according to your mesh.

December 1, 2014, 08:00
#3
Member

Join Date: Mar 2014
Posts: 48
Rep Power: 3
Thanks for your quick reply! I made the following changes to the cavity.geo file but icoFOAM still not working

Code:
```Physical Surface("fixedWalls") = {46, 50, 22, 26, 30, 34};
Physical Surface("frontAndBack") = {51, 1};
Physical Surface("movingWall") = {42, 38};```
Running gmshToFoam

Code:
```\$ gmshToFoam cavity.msh

...

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:4
Surface 1    fixedWalls
Surface 2    frontAndBack
Surface 3    movingWall
Volume 4    internal

Starting to read points at line 12

Starting to read cells at line 841

Mapping region 2 to Foam patch 0
Mapping region 1 to Foam patch 1
Mapping region 3 to Foam patch 2
Mapping region 4 to Foam cellZone 0
Cells:
total:732
hex  :0
prism:732
pyr  :0
tet  :0

CellZones:
Zone    Size
0    732

Skipping tag  at line 3132
Patch 0 gets name frontAndBack
Patch 1 gets name fixedWalls
Patch 2 gets name movingWall

--> FOAM Warning :
From function polyMesh::polyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 627
Found 1556 undefined faces in mesh; adding to default patch.
Finding faces of patch 0
Finding faces of patch 1
Finding faces of patch 2

FaceZones:
Zone    Size

Writing zone 0 to cellZone internal and cellSet
End```

Code:
```Create time

Create mesh for time = 0

--> FOAM FATAL IO ERROR:

patch type 'patch' not constraint type 'empty'
for patch frontAndBack of field p in file "...cavity/gmsh/0/p"

file: ~/.../cavity/gmsh/0/p.boundaryField.frontAndBack from line 35 to line 35.

From function emptyFvPatchField<Type>::emptyFvPatchField
(
const fvPatch& p,
const Field<Type>& field,
const dictionary& dict
)

in file fields/fvPatchFields/constraint/empty/emptyFvPatchField.C at line 100.

FOAM exiting```
What does it mean?
Attached Files
 cavity.txt (828 Bytes, 2 views)

 December 1, 2014, 08:16 #4 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,235 Rep Power: 21 Hi, Gmsh doesn't store boundary type information in mesh file, all boundaries has type 'patch' (in OpenFOAM's terminology) after conversion. Cavity tutorial is 2D, frontAndBack boundary should have 'empty' type, fixedWalls and movingWall should have 'wall' type (though for cavity tutorial this is not so important). You should edit constant/polyMesh/boundary file and set correct types. Either by hand, or with changeDictionary utility.

December 1, 2014, 10:07
#5
Member

Join Date: Mar 2014
Posts: 48
Rep Power: 3
I tried to follow your instructions. The attached file is the modified boundary file. I still getting an error message:

Code:
```Create time

Create mesh for time = 0

--> FOAM FATAL IO ERROR:
wrong token type - expected word, found on line 23 the label 1

file: .frontAndBack.physicalType at line 23.

From function operator>>(Istream&, word&)
in file primitives/strings/word/wordIO.C at line 74.

FOAM exiting```
Attached Files
 boundary.txt (1.3 KB, 11 views)

 December 1, 2014, 10:27 #6 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,235 Rep Power: 21 Well, As it said, it expects word (empty), while you've put list there (1(empty)). If you take a look at patchIdentifier.H:122, you'll see that physicalType of the patch is word. I.e. this Code: ``` frontAndBack { type empty; physicalType 1(empty); nFaces 1464; startFace 1052; }``` in fact should be Code: ``` frontAndBack { type empty; physicalType empty; nFaces 1464; startFace 1052; }``` or even Code: ``` frontAndBack { type empty; nFaces 1464; startFace 1052; }``` as physical type of the patch is optional thing. The same with other patches. Last edited by alexeym; December 1, 2014 at 12:57.

 December 1, 2014, 12:08 #7 Member   Join Date: Mar 2014 Location: Austrian abroad in Germany Posts: 48 Rep Power: 3 Sorry! So the boundary file should look like this? Code: ```frontAndBack { type empty; physicalType empty; nFaces 1464; startFace 1052; } fixedWalls { type wall; physicalType empty; nFaces 60; startFace 2516; } movingWall { type wall; physicalType empty; nFaces 32; startFace 2576; }``` Why am I still getting an error message? Code: ```Create time --> FOAM FATAL IO ERROR: cannot find file file: ~/..../tutorials/incompressible/icoFoam/cavity/gmsh/constant/polyMesh/system/controlDict at line 0. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 73. FOAM exiting```

 December 1, 2014, 12:11 #8 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,235 Rep Power: 21 It's worth reading the error (and trying to understand it) before posting message here. You're trying to run a case in constant/polyMesh folder instead of case folder.

December 1, 2014, 12:54
#9
Member

Join Date: Mar 2014
Posts: 48
Rep Power: 3
Thanks for helping me and being so patient Works now!

Quote:
 Originally Posted by alexeym Well, If you take a look at patchIdentifier.H:122, you'll see that physicalType of the patch is word.

 December 1, 2014, 12:59 #10 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,235 Rep Power: 21 Hm, that's right, posted a link to a local copy of documentation instead of sourceforge. Fixed.

 December 2, 2014, 12:39 #11 Member   Join Date: Mar 2014 Location: Austrian abroad in Germany Posts: 48 Rep Power: 3 Thank you again for all your assistance!

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post sam.ho OpenFOAM Pre-Processing 2 April 21, 2014 02:01 kmooney OpenFOAM Running, Solving & CFD 42 November 6, 2012 12:37 ata OpenFOAM Installation 42 May 14, 2012 20:48 flakid OpenFOAM Installation 16 December 28, 2010 09:48 chelvistero OpenFOAM 11 January 15, 2010 20:43

All times are GMT -4. The time now is 08:35.