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

[Gmsh] Import gmsh msh to Foam

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2005, 14:55
Default Import gmsh msh to Foam
  #1
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi all,

I've finished a lovely 3D 1/8 engine mesh in gmsh, with hexahedral elements, saved it as version 1 .msh file and tried to apply gmshToFoam to it.

I've exported the mesh 2 ways:

1. without physicals

The error message I get is the following:

Exec : gmshToFoam /home/ervin/OpenFOAM/ervin-1.1/run/tutorials/dieselEngineFoam motor2 motor2.msh
Date : Apr 14 2005
Time : 19:12:05
Host : isi014.mot.upv.es
PID : 18272
Root : /home/ervin/OpenFOAM/ervin-1.1/run/tutorials/dieselEngineFoam
Case : motor2
Nprocs : 1
Create time

Read nVerts:30615

Read nElems:38235

Mapping region 1000033 to Foam patch 0
Mapping region 1000035 to Foam patch 1
Mapping region 1000037 to Foam patch 2
Mapping region 1000039 to Foam patch 3
Mapping region 1000041 to Foam patch 4
Mapping region 1000043 to Foam patch 5
Mapping region 1000045 to Foam patch 6
Mapping region 1000047 to Foam patch 7
Mapping region 1000057 to Foam patch 8
Mapping region 1000059 to Foam patch 9
Mapping region 1000061 to Foam patch 10
Mapping region 2000069 to Foam patch 11
Mapping region 2000073 to Foam patch 12
Mapping region 2000076 to Foam patch 13
Mapping region 2000078 to Foam patch 14
Mapping region 2000087 to Foam patch 15
Mapping region 2000091 to Foam patch 16
Mapping region 2000095 to Foam patch 17
Mapping region 2000100 to Foam patch 18
Mapping region 2000109 to Foam patch 19
Mapping region 2000113 to Foam patch 20
Mapping region 2000117 to Foam patch 21
Mapping region 2000122 to Foam patch 22
Mapping region 2000134 to Foam patch 23
Mapping region 2000138 to Foam patch 24
Mapping region 2000139 to Foam patch 25
Mapping region 2000156 to Foam patch 26
Mapping region 2000160 to Foam patch 27
Mapping region 2000161 to Foam patch 28
Mapping region 2000170 to Foam patch 29
Mapping region 2000174 to Foam patch 30
Mapping region 2000178 to Foam patch 31
Mapping region 2000195 to Foam patch 32
Mapping region 2000199 to Foam patch 33
Mapping region 2000200 to Foam patch 34
Mapping region 2000209 to Foam patch 35
Mapping region 2000213 to Foam patch 36
Mapping region 2000217 to Foam patch 37
Mapping region 2000230 to Foam patch 38
Mapping region 2000234 to Foam patch 39
Mapping region 2000239 to Foam patch 40
Mapping region 2000248 to Foam patch 41
Mapping region 2000252 to Foam patch 42
Mapping region 2000256 to Foam patch 43
Mapping region 2000269 to Foam patch 44
Mapping region 2000273 to Foam patch 45
Mapping region 2000278 to Foam patch 46
Cells:
total:28474
hex :27600
prism:874
pyr :0
tet :0

Patches:
Patch Size
0 20
1 6
2 60
3 18
4 40
5 12
6 140
7 42
8 500
9 150
10 250
11 460
12 575
13 460
14 500
15 138
16 575
17 138
18 150
19 230
20 575
21 230
22 250
23 460
24 23
25 20
26 138
27 23
28 6
29 460
30 69
31 60
32 69
33 138
34 18
35 460
36 46
37 40
38 138
39 46
40 12
41 460
42 161
43 140
44 138
45 161
46 42

--> FOAM Warning : polyMesh::polyMesh(... construct from shapes...) :
Found 8426 undefined faces in mesh; adding to default patch.


--> FOAM FATAL ERROR : Problem : cannot find face 4(0 11 130 129) in patch

Function: findFace
in file: gmshToFoam.C at line: 108.

FOAM aborting

and

2. with physicals - created 5 physical surfaces and 1 physical volume

In this case the error message is the following:

Exec : gmshToFoam /home/ervin/OpenFOAM/ervin-1.1/run/tutorials/dieselEngineFoam motor2 motor1.msh
Date : Apr 14 2005
Time : 19:47:43
Host : isi014.mot.upv.es
PID : 19392
Root : /home/ervin/OpenFOAM/ervin-1.1/run/tutorials/dieselEngineFoam
Case : motor2
Nprocs : 1
Create time

Read nVerts:30615

Read nElems:42146

Mapping region 2000062 to Foam patch 0
Mapping region 2000065 to Foam patch 1
Mapping region 2000283 to Foam patch 2
Mapping region 2000284 to Foam patch 3
Mapping region 2000285 to Foam patch 4
Mapping region 2000286 to Foam patch 5
Cells:
total:28474
hex :27600
prism:874
pyr :0
tet :0

Patches:
Patch Size
0 4952
1 4952
2 828
3 1238
4 575
5 1127

--> FOAM Warning : polyMesh::polyMesh(... construct from shapes...) :
Found 8426 undefined faces in mesh; adding to default patch.


--> FOAM FATAL ERROR : Problem : cannot find face 4(0 11 130 129) in patch

Function: findFace
in file: gmshToFoam.C at line: 108.

FOAM aborting


The error is the same in the 2 cases.

Can anybody please help me with this?
Or a hint of what might be wrong?

I can send the .geo & the .msh file if needed to check.

Gmsh is a really nice 3D structured mesher and it's worth being able to use these meshes in Foam.

Thanks.

Ervin
adorean is offline   Reply With Quote

Old   April 14, 2005, 15:06
Default Hi Ervin, usually the probl
  #2
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Hi Ervin,

usually the problem is that in the .msh file there are no physical boundaries or too many. The converter
- reads all volume elements
- reads all surface elements
- creates a mesh from all the volume elements (with all outside faces in a single patch)
- then tries to match the surface elements (vertex by vertex) to the outside faces of the mesh and set the patch to the physical type of the surface element.

Seems that matching is going wrong - it cannot find the surface element (0 11 130 129) in the mesh.

Don't mind having a look at it. Can you send both files?
mattijs is offline   Reply With Quote

Old   April 15, 2005, 04:00
Default Hi Mattijs, Sure I can. Jus
  #3
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi Mattijs,

Sure I can. Just tell me how. Or, to which address.

Ervin
adorean is offline   Reply With Quote

Old   April 15, 2005, 07:16
Default m.janssens at opencfd.co.uk. L
  #4
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
m.janssens at opencfd.co.uk. Leave out the .msh file if it is too big - I have gmsh.
mattijs is offline   Reply With Quote

Old   April 15, 2005, 07:32
Default I have sent you both files
  #5
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
I have sent you both files

Thanks

Ervin
adorean is offline   Reply With Quote

Old   April 22, 2005, 15:15
Default Hi Mattijs, Well, when I fi
  #6
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi Mattijs,

Well, when I finally set up a case with the engine mesh you've helped me to import, running dieselEngineFoam, produces this error:

Exec : dieselEngineFoam /home/ervin/OpenFOAM/ervin-1.1/run/tutorials/dieselEngineFoam motor1
Date : Apr 22 2005
Time : 19:58:23
Host : isi014.mot.upv.es
PID : 8381
Root : /home/ervin/OpenFOAM/ervin-1.1/run/tutorials/dieselEngineFoam
Case : motor1
Nprocs : 1
Create engine time

Create mesh for time = -0.02



--> FOAM FATAL ERROR : face 0 and 889 areas do not match by 31.4626% -- possible face ordering problem

Function: cyclicFvPatch::makeWeights(scalarField& w) const
in file: meshes/fvMesh/fvPatches/derivedFvPatches/cyclicFvPatch/cyclicFvPatch.C at line: 62.

FOAM aborting

When I imported the mesh into Foam it didn't complain.

Do you think it's still a mesh (face ordering) problem, or it's something else I'm doing wrong?

In the GMSH manual I found this:

"Please note that the list of nodes and elements in Gmsh s mesh files do not have to be dense or ordered (i.e., the node and element numbers do not have to be given in a consecutive or even an ordered way). A sample C++ program to transform the formats so that all lists are dense and ordered is available in the source distribution ( utils/misc/mshsort.cpp ). This program is also a good example on how to read and write files in the .msh format."

So I used this 'mshsort.cpp' to generate an 'ordered' mesh file, but the error message is the same.

If you can find time, could you please have a look at mshsort.cpp utility?

I would do it myself but my lack of C++ knowledge prevents me to.

Thanks!

Ervin
adorean is offline   Reply With Quote

Old   April 23, 2005, 05:21
Default Hi Ervin, This is OpenFOAM
  #7
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Hi Ervin,

This is OpenFOAM wanting the faces of corresponding cyclic faces ordered correctly. Run couplePatches on your case to write a new mesh with reordered faces.
mattijs is offline   Reply With Quote

Old   April 25, 2005, 05:40
Default Hi, Now the error message i
  #8
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi,

Now the error message is:

Create morphMesh for time = -180

Mesh has coupled patches ...

Testing for correct face ordering ...
--> FOAM Serious Error : cyclicPolyPatch::order : patch:slicefront : Patch gets decomposed in 1 zones
This means that the patch is either not two separate regions or one region where the angle between the different regions is not sufficiently sharp.
Please use topological matching or adapt the featureCos() setting
Continuing with incorrect face ordering from now on!
--> FOAM Serious Error : cyclicPolyPatch::order : patch:sliceback : Patch gets decomposed in 1 zones
This means that the patch is either not two separate regions or one region where the angle between the different regions is not sufficiently sharp.
Please use topological matching or adapt the featureCos() setting
Continuing with incorrect face ordering from now on!
Patch face ordering OK.
Coupled patch face ordering ok. Nothing changed ...

End

I have changed the 'slicefront' and 'sliceback' patch type to cyclic in the 'boundary' file.

I don't understand what's wrong.
The 'slicefront' and 'sliceback' represents each one 1 region.

Ervin
adorean is offline   Reply With Quote

Old   April 25, 2005, 07:23
Default The cyclic is both regions in
  #9
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
The cyclic is both regions in one patch. Have a look at the user guide (search for 'cyclic')
mattijs is offline   Reply With Quote

Old   April 25, 2005, 08:44
Default Hi, What is the syntax for
  #10
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi,

What is the syntax for defining these 2 regions in 1 cyclic patch?

slicefront
{
type cyclic;
nFaces 1778;
startFace 114404;
}

sliceback
{
type cyclic;
nFaces 1778;
startFace 117062;
}

Ervin
adorean is offline   Reply With Quote

Old   April 25, 2005, 09:01
Default Q1) What do you think the foll
  #11
New Member
 
Chris Greenshields
Join Date: Mar 2009
Posts: 28
Rep Power: 17
chris is on a distinguished road
Q1) What do you think the following means?:
slicefront
{
type cyclic;
nFaces 1778;
startFace 114404;
}
chris is offline   Reply With Quote

Old   April 25, 2005, 10:59
Default slicefront=arbitrary name of p
  #12
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
slicefront=arbitrary name of patch
cyclic=base patch type
nFaces=1778 quad type mesh faces, startFace=the index into the face list of the first face in the patch

So, is it correct?

slice
{
type cyclic;
nFaces 1778x2;
startFace 114404;
}

E
adorean is offline   Reply With Quote

Old   April 25, 2005, 11:04
Default What's the syntax of faceList?
  #13
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
What's the syntax of faceList?

Or for my question?
adorean is offline   Reply With Quote

Old   April 25, 2005, 11:08
Default What is the syntax for definin
  #14
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
What is the syntax for defining these 2 regions in 1 cyclic patch?

slicefront
{
type cyclic;
nFaces 1778;
startFace 114404;
}

sliceback
{
type cyclic;
nFaces 1778;
startFace 117062;
}

Ervin

It's a simple Q
adorean is offline   Reply With Quote

Old   April 25, 2005, 11:19
Default isn't this working? slice
  #15
Member
 
Tommaso Lucchini
Join Date: Mar 2009
Posts: 87
Rep Power: 17
lucchini is on a distinguished road
isn't this working?

slice
{
type cyclic;
nFaces 1778x2;
startFace 114404;
}
lucchini is offline   Reply With Quote

Old   April 25, 2005, 11:32
Default Hi Tommaso, No, it's not wo
  #16
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi Tommaso,

No, it's not working:

Using geometry to calculate face correspondence across coupled boundaries (processor, cyclic)
This will only work for cyclics if they are parallel or their rotation is defined across the origin

Create morphMesh for time = -180

Mesh has coupled patches ...

Testing for correct face ordering ...
cyclicPolyPatch::order : Found 80 on patch slice where the cos of the angle between two connected faces was less than 0.9
cyclicPolyPatch::order : Writing zone 0 face centres to OBJ file "slice_zone_0.obj"
cyclicPolyPatch::order : Writing zone 1 face centres to OBJ file "slice_zone_1.obj"
cyclicPolyPatch::order : Writing zone 2 face centres to OBJ file "slice_zone_2.obj"
cyclicPolyPatch::order : Number of faces per zone:3(1778 880 898)
--> FOAM Serious Error : cyclicPolyPatch::order : patch:slice : Patch gets decomposed in 3 zones
This means that the patch is either not two separate regions or one region where the angle between the different regions is not sufficiently sharp.
Please use topological matching or adapt the featureCos() setting
Continuing with incorrect face ordering from now on!
Patch face ordering OK.
Coupled patch face ordering ok. Nothing changed ...

End

I'm a beginner with this so I need exact answers.

The question is still the same:

Q) How EXACTLY do I have to define the cyclic patch for the two above mentioned regions.

The geometry is 1/8 3D sector.

Ervin
adorean is offline   Reply With Quote

Old   April 25, 2005, 12:35
Default Hi, I've got it working. T
  #17
Member
 
Ervin Adorean
Join Date: Mar 2009
Posts: 76
Rep Power: 17
adorean is on a distinguished road
Hi,

I've got it working.
Thanks.

Ervin
adorean is offline   Reply With Quote

Old   April 27, 2005, 04:50
Default Hi! I am a new user and I hav
  #18
aap
New Member
 
Amalia Apalategui
Join Date: Mar 2009
Posts: 13
Rep Power: 17
aap is on a distinguished road
Hi!
I am a new user and I have a very basic question. I am trying to convert a gmsh mesh into foam. The gmsh file looks like
$NOD


$ENDNOD
$ELM


$ENDELM


when I enter the following command

gmshToFoam root case file.msh

I get the error message
--> FOAM FATAL IO ERROR : Attempt to get back from bad stream

file: t10.msh at line 1.

Function: void Istream::getBack(token& t)
in file: db/IOstreams/IOstreams/Istream.C at line: 48.

Can you tell me what I am doing wrong?
Thanks a lot

Amalia
aap is offline   Reply With Quote

Old   April 27, 2005, 05:15
Default The '$NOD' should be followed
  #19
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
The '$NOD' should be followed by a number which is the number of vertices (nodes) following. I have

$NOD
29341
.. (29341 lines of coordinates)
$ENDNOD
$ELM
32132
.. (32132 lines of element data)
$ENDELM
mattijs is offline   Reply With Quote

Old   April 27, 2005, 05:25
Default Thanks Mattijs, my file has
  #20
aap
New Member
 
Amalia Apalategui
Join Date: Mar 2009
Posts: 13
Rep Power: 17
aap is on a distinguished road
Thanks Mattijs,
my file has the number of vertices and elements. The file was in a wrong directory. :-(
Now I get this error message

Read nVerts:445

Read nElems:879

Mapping region 100 to Foam patch 0
Cells:
total:0
hex :0
prism:0
pyr :0
tet :0

Patches:
Patch Size
0 798



--> FOAM FATAL ERROR : faces deallocated

Function: const faceList& polyMesh::allFaces() const
in file: meshes/polyMesh/polyMesh.C at line: 562.

FOAM aborting

Aborted


It seems that the mesh information is not correct in the mshfile. But I can visualize this mesh with gmsh (and in fact this mesh is one of the tutorial)

Thanks a lot
Amalia
aap is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] Errors during blockMesh meshing Madeleine P. Vincent OpenFOAM Meshing & Mesh Conversion 51 May 30, 2016 11:51
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 15:07
decomposePar is missing a library whk1992 OpenFOAM Pre-Processing 8 March 7, 2015 08:53
MSH Import Vivek Vasudevan FLUENT 6 March 30, 2007 11:53
MSH file import Vivek Vasudevan Main CFD Forum 2 March 19, 2007 20:03


All times are GMT -4. The time now is 00:15.