CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Specifying patch type for GmshToFoam

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

Like Tree1Likes
  • 1 Post By anon_a

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 15, 2012, 07:18
Default Specifying patch type for GmshToFoam
  #1
jam
Member
 
Alain Martin
Join Date: Mar 2009
Posts: 40
Rep Power: 17
jam is on a distinguished road
Hi all,

I remember having used a version of GmshToFoam where the patch type as well as the name was provided in the mesh Physical group. Why was it removed? And can it be put back in without too much effort. I am tired of having to edit the boundary file for every change I make to the design.
Thank you in advance.
jam is offline   Reply With Quote

Old   June 15, 2012, 07:56
Default
  #2
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
What type of changes do you need to make to your boundary file?
Perhaps a combination of the already existing utilities changeDictionary and autoPatch may work for you. Or even sed.

I have only used gmsh briefly in the past, could you please post an unedited boundary file and a "corrected" one?
anon_a is offline   Reply With Quote

Old   June 15, 2012, 08:13
Default
  #3
jam
Member
 
Alain Martin
Join Date: Mar 2009
Posts: 40
Rep Power: 17
jam is on a distinguished road
This the change I want:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

5
(
    frontAndBack
    {
        type            empty;
        nFaces          10092;
        startFace       7328;
    }
    lowerWall
    {
        type            wall;
        nFaces          214;
        startFace       17420;
    }
    outlet
    {
        type            patch;
        nFaces          59;
        startFace       17634;
    }
    upperWall
    {
        type           wall;
        nFaces          184;
        startFace       17693;
    }
    inlet
    {
        type            patch;
        nFaces          25;
        startFace       17877;
    }
)
This is output from GmshToFoam

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

5
(
    frontAndBack
    {
        type            patch;
        nFaces          10092;
        startFace       7328;
    }
    lowerWall
    {
        type            patch;
        nFaces          214;
        startFace       17420;
    }
    outlet
    {
        type            patch;
        nFaces          59;
        startFace       17634;
    }
    upperWall
    {
        type            patch;
        nFaces          184;
        startFace       17693;
    }
    inlet
    {
        type            patch;
        nFaces          25;
        startFace       17877;
    }
)
jam is offline   Reply With Quote

Old   June 15, 2012, 08:43
Default
  #4
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
Two possibilities that I mentioned:

- changeDictionary: check the tutorials for chtMultiRegionFoam.
You just run changeDictionary after placing something like this in the changeDictionaryDict in the system folder

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

dictionaryReplacement
{
    boundary
    {
        frontAndBack
        {
            type            empty;
        }
        lowerWall
        {
            type            wall;
        }
    }

}

// ************************************************************************* //
- with sed: Substitute something in a specific line (line 42 here)

cat constant/polyMesh/boundary > temp
sed -i temp -e '42s!patch!empty!'
mv temp constant/polyMesh/boundary

Off course, this may not work if you make changes in the number of patches because the boundary file will change significantly.


The first way is much better. But, off course, if someone knows a solution within gmsh, that would be much more elegant.
CoolHand likes this.
anon_a is offline   Reply With Quote

Old   June 15, 2012, 08:59
Default
  #5
jam
Member
 
Alain Martin
Join Date: Mar 2009
Posts: 40
Rep Power: 17
jam is on a distinguished road
Thank you very much. I did not know about this command, I did not run and inspect all the tutorials.
jam 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
Create a GeometricField of a given type on given patch? philippose OpenFOAM Programming & Development 4 August 12, 2013 13:41
Cyclic Boundary Condition Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Running, Solving & CFD 36 July 2, 2012 13:23
singularity? mihaipruna OpenFOAM Running, Solving & CFD 5 April 24, 2012 18:18
CheckMeshbs errors ivanyao OpenFOAM Running, Solving & CFD 2 March 11, 2009 03:34
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


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