CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Specifying patch type for GmshToFoam (http://www.cfd-online.com/Forums/openfoam-solving/103263-specifying-patch-type-gmshtofoam.html)

jam June 15, 2012 06:18

Specifying patch type for GmshToFoam
 
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.

anon_a June 15, 2012 06:56

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?

jam June 15, 2012 07:13

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;
    }
)


anon_a June 15, 2012 07:43

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.

jam June 15, 2012 07:59

Thank you very much. I did not know about this command, I did not run and inspect all the tutorials.


All times are GMT -4. The time now is 05:14.