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

[Gmsh] gmshToFoam--I'm doing it wrong

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 14, 2014, 19:48
Default gmshToFoam--I'm doing it wrong
  #1
New Member
 
Join Date: Oct 2011
Location: Sydney, NSW
Posts: 21
Rep Power: 14
the.drizzle is on a distinguished road
Thought I had it, but it seems not.

I've built a simply illustrative example here to demonstrate my problem. Basically, I want to make a mesh with internal baffles (zero thickness) so that I can simulate interactions between different materials. Here, I've made a simple 2-D mesh with two regions "air" and "water" (they don't mean anything, just an illustration).

Code:
  Point(1) = {0, 0, -0.05, 1};
  Point(2) = {1, 0, -0.05, 1};
  Point(3) = {1, 1, -0.05, 1};
  Point(4) = {0, 1, -0.05, 1};

  Line(1) = {1, 2};
  Line(2) = {2, 3};
  Line(3) = {3, 4};
  Line(4) = {4, 1};
  Line(5) = {1, 3};

  //Water
  Line Loop(20) = {1, 2, -5};

  //Air
  Line Loop(21) = {5, 3, 4};

  Plane Surface(20) = {20};
  Plane Surface(21) = {21};

  Physical Volume("water") = {1};
  Extrude {0, 0, 0.1} {
   Surface{20};
   Layers{1};
   Recombine;
  }

  Physical Volume("air") = {2};
  Extrude {0, 0, 0.1} {
   Surface{21};
   Layers{1};
   Recombine;
  }


  // Name and define surface patches
  Physical Surface("frontAndBackWater") = {38, 20};
  Physical Surface("frontAndBackAir") = {55, 21};
  Physical Surface("airWalls") = {50, 54, 37};
  Physical Surface("waterWalls") = {29, 33, 37};
  }
I can then build my sample mesh as expected

Code:
$ gmsh -3 sample.geo
and then translate to OpenFOAM with mystery warning number one:

Code:
$ gmshToFoam sample.msh 
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.3.0-f5222ca19ce6
Exec   : gmshToFoam sample.msh
Date   : May 15 2014
Time   : 09:36:23
Host   : "wood"
PID    : 28749
Case   : /xxx/sample
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing 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:6
    Surface 3   frontAndBackWater
    Surface 4   frontAndBackAir
    Surface 5   airWalls
    Surface 6   waterWalls
    Volume 1    water
    Volume 2    air

Starting to read points at line 14
Vertices to be read:10
Vertices read:10

Starting to read cells at line 27
Cells to be read:20

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

CellZones:
Zone    Size
    0   2
    1   2

Skipping tag  at line 50
Patch 0 gets name frontAndBackWater
Patch 1 gets name frontAndBackAir
Patch 2 gets name waterWalls
Patch 3 gets name airWalls

--> FOAM Warning : 
    From function polyMesh::polyMesh(... construct from shapes...)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 627
    Found 12 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

FaceZones:
Zone    Size
    2   2
    3   2

Writing zone 0 to cellZone water and cellSet
Writing zone 1 to cellZone air and cellSet
Writing zone 2 to faceZone waterWalls and faceSet
Writing zone 3 to faceZone airWalls and faceSet
End
Note that every face has been added to default patch. I've seached the forums about this and still can't follow what's going on here, I'm thinking it may have something to do with using OF 2.3.0 instead of an older version? Dunno, problem number one but I think less serious.

Moving on to problem number two, I want to carve up the mesh and get my internal baffle back. I'll use topoSet for this, here is my system/topoSetDict file:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
    // water
    {
        name    water;
        type    cellSet;
        action  new;
        source  cellToCell;
        sourceInfo
        {
            set water;
        }
    }
    {
        name    water;
        type    cellZoneSet;
        action  new;
        source  setToCellZone;
        sourceInfo
        {
            set water;
        }
    }

    // air
    {
        name    air;
        type    cellSet;
        action  new;
        source  cellToCell;
        sourceInfo
        {
            set air;
        }
    }
    {
        name    air;
        type    cellZoneSet;
        action  new;
        source  setToCellZone;
        sourceInfo
        {
            set air;
        }
    }
);

// ************************************************************************* //
and here's what happens:

Code:
$ topoSet 
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.3.0-f5222ca19ce6
Exec   : topoSet
Date   : May 15 2014
Time   : 09:43:07
Host   : "wood"
PID    : 28762
Case   : /xxx/sample
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Create polyMesh for time = 0

Reading topoSetDict

Time = 0
    mesh not changed.
Created cellSet water
    Applying source cellToCell
    Adding all elements of cellSet water ...
    cellSet water now size 2
Created cellZoneSet water
    Applying source setToCellZone
    Adding all cells from cellSet water ...
    cellZoneSet water now size 2
Created cellSet air
    Applying source cellToCell
    Adding all elements of cellSet air ...
    cellSet air now size 2
Created cellZoneSet air
    Applying source setToCellZone
    Adding all cells from cellSet air ...
    cellZoneSet air now size 2

End
and inspection of the boundary file indicates that my internal boundary is gone

Code:
    waterWalls
    {
        type            patch;
        physicalType    patch;
        nFaces          2;
        startFace       12;
    }
That is, each of these patches should contain three faces in this example. Results are easily visualized in paraview.

Thus, I guess I need to figure out how I've messed this up? Clearly I've missed something, any help would be greatly appreciated.
the.drizzle is offline   Reply With Quote

Old   May 15, 2014, 03:04
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

There's no need to worry about defaultFaces, as gmshToFoam first add all boundary faces to this patch and then look for the faces of the physical surfaces defined in msh file, adding them to corresponding patches, and finally if defaultFaces is empty (gmshToFoam found all faces of physical surfaces), it deletes defaultFaces patch from the mesh.

Boundary waterWalls has 2 faces in the very beginning (just after gmshToFoam).

Code:
    waterWalls
    {
        type            patch;
        physicalType    patch;
        nFaces          2;
        startFace       12;
    }
so I guess its size has nothing to do with topoSet.
KateEisenhower likes this.
alexeym is offline   Reply With Quote

Old   May 15, 2014, 03:36
Default
  #3
New Member
 
Join Date: Oct 2011
Location: Sydney, NSW
Posts: 21
Rep Power: 14
the.drizzle is on a distinguished road
Thanks for clearing up that warning, that makes perfect sense and also explains why it doesn't seem to lead to anything in the final output!

As for my other problem, I see that I have been basically attempting to do two very different things and getting the terminology mixed up.

Creating a baffle will require createBaffles and an associated dictionary file (finding this page has helped a lot in figuring out how that works--it's surprisingly simple!). What I'm trying to do above, however, is create a patch that is shared by two regions, which I've also figured out how to do. I'll call it an interface, and have modified my sample.geo file as:

Code:
  Physical Surface("frontAndBackWater") = {38, 20};
  Physical Surface("frontAndBackAir") = {55, 21};
  Physical Surface("airWalls") = {50, 54};
  Physical Surface("waterWalls") = {29, 33};
  Physical Surface("interfaceWall") = {37};
And then added interfaceWall to topoSetDict via

Code:
    // interface
    {
        name    interfaceWall;
        type    faceSet;
        action  new;
        source  faceToFace;
        sourceInfo
        {
            set interfaceWall;
        }
    }
    {
        name    interfaceWall;
        type    faceZoneSet;
        action  new;
        source  setToFaceZone;
        sourceInfo
        {
            faceSet interfaceWall;
        }
    }
and everything now works perfectly. Well, I have to manually edit constant/polymesh/boundaries prior to using splitMeshRegions, but that's to be expected.

Thanks for the help!
the.drizzle is offline   Reply With Quote

Old   May 15, 2014, 03:50
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
You can use changeDictionary utility to modify boundary file, if you'd like to get rid of manual editing.
alexeym is offline   Reply With Quote

Old   May 15, 2014, 03:54
Default
  #5
New Member
 
Join Date: Oct 2011
Location: Sydney, NSW
Posts: 21
Rep Power: 14
the.drizzle is on a distinguished road
Thanks, I'll do that!

On an only nominally related topic, I'm wondering if you know where there might be a resource such as the one I linked above for the thermophysicalProperties dictionary? I know this is covered in chapter 7 of the manual, but what I'm looking for is a list of valid keywords, like what is done in the linked resource.
the.drizzle is offline   Reply With Quote

Old   May 15, 2014, 04:22
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Quote:
Originally Posted by the.drizzle View Post
On an only nominally related topic, I'm wondering if you know where there might be a resource such as the one I linked above for the thermophysicalProperties dictionary? I know this is covered in chapter 7 of the manual, but what I'm looking for is a list of valid keywords, like what is done in the linked resource.
In short: I don't know.

But it depends on the case you're running. There are incompressible solvers with buoyancy, there are compressible solvers. The first class of solvers defines one set of properties read from thermophysicalProperties (and these sets can change from solver to solver), the second class of solvers rely on thermophysicalModels framework. The easiest way to find all keywords is to check sources
alexeym is offline   Reply With Quote

Old   May 15, 2014, 04:25
Default
  #7
New Member
 
Join Date: Oct 2011
Location: Sydney, NSW
Posts: 21
Rep Power: 14
the.drizzle is on a distinguished road
OK, sources it is then. I'll be sure to keep notes!
the.drizzle is offline   Reply With Quote

Reply


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
[Gmsh] gmshToFoam error afshinb OpenFOAM Meshing & Mesh Conversion 6 November 27, 2019 08:50
[Gmsh] Boundary layer not created during gmshToFoam for Gmsh4.0 hasankhan OpenFOAM Meshing & Mesh Conversion 1 November 24, 2018 23:29
Something wrong running rhoSimpleFoam (urgent!) PeterShi OpenFOAM Running, Solving & CFD 7 March 1, 2017 09:21
[Gmsh] maximal number of patch in gmshToFoam laurentD OpenFOAM Meshing & Mesh Conversion 0 July 18, 2016 09:28
fully developed channel flow with kOmega, wrong results boshynova OpenFOAM Programming & Development 1 April 20, 2016 10:54


All times are GMT -4. The time now is 01:24.