CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (http://www.cfd-online.com/Forums/openfoam-meshing-open/)
-   -   Import gmsh msh to Foam (http://www.cfd-online.com/Forums/openfoam-meshing-open/61904-import-gmsh-msh-foam.html)

adorean April 14, 2005 14:55

Hi all, I've finished a lov
 
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

mattijs April 14, 2005 15:06

Hi Ervin, usually the probl
 
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?

adorean April 15, 2005 04:00

Hi Mattijs, Sure I can. Jus
 
Hi Mattijs,

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

Ervin

mattijs April 15, 2005 07:16

m.janssens at opencfd.co.uk. L
 
m.janssens at opencfd.co.uk. Leave out the .msh file if it is too big - I have gmsh.

adorean April 15, 2005 07:32

I have sent you both files
 
I have sent you both files

Thanks

Ervin

adorean April 22, 2005 15:15

Hi Mattijs, Well, when I fi
 
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 http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif mshsort.cpp utility?

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

Thanks!

Ervin

mattijs April 23, 2005 05:21

Hi Ervin, This is OpenFOAM
 
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.

adorean April 25, 2005 05:40

Hi, Now the error message i
 
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

mattijs April 25, 2005 07:23

The cyclic is both regions in
 
The cyclic is both regions in one patch. Have a look at the user guide (search for 'cyclic')

adorean April 25, 2005 08:44

Hi, What is the syntax for
 
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

chris April 25, 2005 09:01

Q1) What do you think the foll
 
Q1) What do you think the following means?:
slicefront
{
type cyclic;
nFaces 1778;
startFace 114404;
}

adorean April 25, 2005 10:59

slicefront=arbitrary name of p
 
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 April 25, 2005 11:04

What's the syntax of faceList?
 
What's the syntax of faceList?

Or for my question?

adorean April 25, 2005 11:08

What is the syntax for definin
 
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

lucchini April 25, 2005 11:19

isn't this working? slice
 
isn't this working?

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

adorean April 25, 2005 11:32

Hi Tommaso, No, it's not wo
 
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 April 25, 2005 12:35

Hi, I've got it working. T
 
Hi,

I've got it working.
Thanks.

Ervin

aap April 27, 2005 04:50

Hi! I am a new user and I hav
 
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

mattijs April 27, 2005 05:15

The '$NOD' should be followed
 
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

aap April 27, 2005 05:25

Thanks Mattijs, my file has
 
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


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