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/)
-   -   Pipe flow in gmsh / OF (http://www.cfd-online.com/Forums/openfoam-meshing-open/85252-pipe-flow-gmsh.html)

andreasp February 21, 2011 08:15

Pipe flow in gmsh / OF
 
1 Attachment(s)
Hi everyone!

Actually my problems seem to be quite similar to other discussions in this forum, but since I am completely new to both gmsh and OF I haven't really found answers that help me...

In the future I want to use OF to compute steady state flow profiles in rather complex "pipe-like" geometries. For that, I will have to use unstructured meshes in different formats (nastran, icem, ...).

So I thought a very simple pipe flow simulation on a gmsh-generated tetra-mesh would be a good start. I am attaching the .geo file (added .txt). To be able to distinguish between different boundaries etc., I have generated physical groups for inlet, outlet, walls, and fluid volume. To me, the mesh looks just fine. Please let me know, if there is already something wrong with the gmsh part.

btw. is there a command to do the meshing directly in the .geo file? So far I just load the .geo file and then do the meshing by clicking the 3D button in the gmsh menu... which is somehow a strange hybrid approach. I'd prefer to have the complete procedure scripted.

Anyway, I convert the gmsh to polyMesh by
Code:

gmshToFoam pipe.msh
This runs without errors, but gives me a warning:
Code:

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

Found $MeshFormat tag; assuming version 2 file format.
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    inlet
    Surface 2    outlet
    Surface 3    wall
    Volume 4    fluid

Starting to read points at line 12
Vertices to be read:1549
Vertices read:1549

Starting to read cells at line 1564
Cells to be read:8197

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

CellZones:
Zone    Size
    0    6565

Skipping tag  at line 9764
Patch 0 gets name inlet
Patch 1 gets name wall
Patch 2 gets name outlet

--> FOAM Warning :
    From function polyMesh::polyMesh(... construct from shapes...)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 576
    Found 1632 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 fluid and cellSet
End

And running
Code:

checkMesh -constant
indicates no problems at all, but the most interesting output is:
Code:

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    inlet              28      21      ok (non-closed singly connected) 
    wall                1576    800      ok (non-closed singly connected) 
    outlet              28      21      ok (non-closed singly connected) 
    defaultFaces        0        0        ok (empty)

Moreover the generated constant/polyMesh/boundary file contains this:
Code:

    defaultFaces
    {
        type            patch;
        nFaces          0;
        startFace      13946;
    }

This seems odd to me. No inner faces?

I have not yet tried to just run a solver, since setting up physical parameters and numerical solution schemes will probably take me some time. And I believe that doesn't really make sense as long as there's still a problem with the mesh...?

And another thing: Which solver would you recommend for this application? Basically appropriate to me seem both icoFoam and simpleFoam. Remember, I just want to compute a very simple laminar flow steady state solution (Hagen-Poiseuille).

Thanks in advance for any hints!

Andreas

andreasp February 22, 2011 12:13

OK, I figured it out.

As described here I could just delete the defaultFaces, and everything worked!

But maybe one more thing:
Is there any way to specify a stop criterion for simpleFoam besides a fixed number of steady state solver iterations (i.e. time steps)? I was looking for something like an overall stopping residual, but haven't found that so far.

claco March 2, 2011 05:07

Quote:

Originally Posted by andreasp (Post 296264)
Hi everyone!

Actually my problems seem to be quite similar to other discussions in this forum, but since I am completely new to both gmsh and OF I haven't really found answers that help me...

In the future I want to use OF to compute steady state flow profiles in rather complex "pipe-like" geometries. For that, I will have to use unstructured meshes in different formats (nastran, icem, ...).

So I thought a very simple pipe flow simulation on a gmsh-generated tetra-mesh would be a good start. I am attaching the .geo file (added .txt). To be able to distinguish between different boundaries etc., I have generated physical groups for inlet, outlet, walls, and fluid volume. To me, the mesh looks just fine. Please let me know, if there is already something wrong with the gmsh part.

btw. is there a command to do the meshing directly in the .geo file? So far I just load the .geo file and then do the meshing by clicking the 3D button in the gmsh menu... which is somehow a strange hybrid approach. I'd prefer to have the complete procedure scripted.

Anyway, I convert the gmsh to polyMesh by
Code:

gmshToFoam pipe.msh
This runs without errors, but gives me a warning:
Code:

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

Found $MeshFormat tag; assuming version 2 file format.
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    inlet
    Surface 2    outlet
    Surface 3    wall
    Volume 4    fluid

Starting to read points at line 12
Vertices to be read:1549
Vertices read:1549

Starting to read cells at line 1564
Cells to be read:8197

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

CellZones:
Zone    Size
    0    6565

Skipping tag  at line 9764
Patch 0 gets name inlet
Patch 1 gets name wall
Patch 2 gets name outlet

--> FOAM Warning :
    From function polyMesh::polyMesh(... construct from shapes...)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 576
    Found 1632 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 fluid and cellSet
End

And running
Code:

checkMesh -constant
indicates no problems at all, but the most interesting output is:
Code:

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    inlet              28      21      ok (non-closed singly connected) 
    wall                1576    800      ok (non-closed singly connected) 
    outlet              28      21      ok (non-closed singly connected) 
    defaultFaces        0        0        ok (empty)

Moreover the generated constant/polyMesh/boundary file contains this:
Code:

    defaultFaces
    {
        type            patch;
        nFaces          0;
        startFace      13946;
    }

This seems odd to me. No inner faces?

I have not yet tried to just run a solver, since setting up physical parameters and numerical solution schemes will probably take me some time. And I believe that doesn't really make sense as long as there's still a problem with the mesh...?

And another thing: Which solver would you recommend for this application? Basically appropriate to me seem both icoFoam and simpleFoam. Remember, I just want to compute a very simple laminar flow steady state solution (Hagen-Poiseuille).

Thanks in advance for any hints!

Andreas


Dear Andreas,

I would like to built a prismatic boundary layer onto the pipe internal surfaces. The result would be an hybrid mesh with a tetrahedral core and a prismatic boundary layer.

Have You ever tried it? Can You Help me doing that via a .geo file?

Thank You in advance.


Claudio Comis

andreasp March 2, 2011 09:33

Claudio,

I am sorry I have hardly any experience with gmsh.
(Just enough to generate trivial tetra meshes for my test cases...)

But I'm sure you'll find hints on this googling for things like "gmsh prism layer hybrid meshes" etc...

Andreas

billynoe March 2, 2011 18:16

as for the default faces gmshToFoam always makes that patch. it is convenient if you don't want to define many internal physical surfaces (faces) as walls for instance. it is weird that it said it was putting 1600 some undefined faces there but checkmesh said it was empty. Foam ignores any patches with 0 faces anyways.


All times are GMT -4. The time now is 23:55.