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

[mesh manipulation] patch splitting for different boundary conditions

Register Blogs Community New Posts Updated Threads Search

Like Tree18Likes
  • 1 Post By djh2
  • 11 Post By djh2
  • 5 Post By vaina74
  • 1 Post By Laika

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2014, 10:58
Default patch splitting for different boundary conditions
  #1
Senior Member
 
Join Date: Feb 2010
Posts: 213
Rep Power: 17
vaina74 is on a distinguished road
Hi all, I'm setting a preliminary simple case for further analysis and I'm trying to get confident with OpenFOAM meshing tools. I already tried a different approach here, but I guess that topoSet (fvOptions too?) could be useful.
The domain is a single block and I want to define inlet and outlet 'openings' on two different block faces - where a wall boundary condition is defined through blockMeshDict and field definition in the 0 directory.If I am correct, I can create a topoSetDict, such as
Code:
actions
(
    {
        name    inlet;
        type    faceSet;
        action  new;
        source  boxToFace;
        sourceInfo
        {
            box  (-.1 4.4 1.9) (.1 5.6 3.1);
        }
    }

    {
        name    outlet;
        type    faceSet;
        action  new;
        source boxToFace;
        sourceInfo
        {
            box  (4.4 4.4 4.9) (5.6 5.6 5.1);
        }
    }
);
in order to define two sets of faces for square openings on two block faces.
- How can I apply inlet and outlet boundary conditions on the new 'sub-patches'?
- Should I set U and p values on the new inlet and outlet patches (not included in blockMeshDict)?
- Is the correct procedure blockMesh > topoSet > [solver]?

Last edited by vaina74; October 22, 2014 at 12:00.
vaina74 is offline   Reply With Quote

Old   October 22, 2014, 12:53
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 213
Rep Power: 17
vaina74 is on a distinguished road
I hope someone can correct me, if I am on the wrong way.
1. create a simple block, all faces are set as wall.
2. create a topoSetDict in order to generate two sets of cell faces for inlet and outlet openings.
Code:
actions
(
    {
        name    inlet;
        type    faceSet;
        action  new;
        source  boxToFace;
        sourceInfo
        {
            box  (-.01 4.45 1.95) (.01 5.55 3.05);
        }
    }

    {
        name    outlet;
        type    faceSet;
        action  new;
        source boxToFace;
        sourceInfo
        {
            box  (4.45 4.45 4.99) (5.55 5.55 5.01);
        }
    }
);
3. create a createPatchDict in order to define new inlet and outlet patches from the above sets.
Code:
pointSync false;

patches
(
    {
        name inlet;
        patchInfo
        {
            type patch;
        }
        constructFrom set;
        set inlet;
    }
    {
        name outlet;
        patchInfo
        {
            type patch;
        }
        constructFrom set;
        set outlet;
    }
);
4. blockMesh > topoSet > createPatch
Anyway something is wrong because I obtain the message
Code:
Create time

Create polyMesh for time = 0

Reading createPatchDict

Adding new patch inlet as patch 1 from 
{
    type            patch;
}

Adding new patch outlet as patch 2 from 
{
    type            patch;
}


Read 381 faces from faceSet inlet


--> FOAM FATAL ERROR: 
Face 579358 specified in set inlet is not an external face of the mesh.
This application can only repatch existing boundary faces.

    From function createPatch
    in file createPatch.C at line 727.

FOAM exiting
vaina74 is offline   Reply With Quote

Old   October 22, 2014, 13:15
Default
  #3
New Member
 
David H.
Join Date: Oct 2013
Posts: 25
Rep Power: 13
djh2 is on a distinguished road
It looks like you need to intersect your face sets created by topoSet with the boundary faces. I think you're creating a set of faces of your box but they do not coincide with your boundary, or it includes internal domain faces in additional to boundary faces, and OF is not handling that.

It might be helpful to sketch a schematic of your mesh and post it here, so we can figure out what's going on.
suryakaundinya likes this.
djh2 is offline   Reply With Quote

Old   October 22, 2014, 13:32
Default
  #4
Senior Member
 
Join Date: Feb 2010
Posts: 213
Rep Power: 17
vaina74 is on a distinguished road
I think so, but I don't see the reason. Maybe I need a double passage from patch to cells and from cells to face like in your case. This is my elementary blockMeshDict
Code:
convertToMeters 1;

vertices
(
    (0 0 0)
    (10 0 0)
    (10 10 0)
    (0 10 0)
    (0 0 5)
    (10 0 5)
    (10 10 5)
    (0 10 5)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (100 100 50) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    defaultFaces
    {
        type wall;
        faces ();
    }
);

mergePatchPairs
(
);
vaina74 is offline   Reply With Quote

Old   October 22, 2014, 15:02
Default
  #5
New Member
 
David H.
Join Date: Oct 2013
Posts: 25
Rep Power: 13
djh2 is on a distinguished road
I'm not sure I follow what you're saying. It looks like you're trying to add all the faces from your "inlet" or "outlet" set to the patch, and this is not possible because many of them are fictitious with respect to your mesh geometry, or lie within your domain and are therefore not boundary faces.

I've attached a simplified annotated method based on my previous work in http://www.cfd-online.com/Forums/ope...tml#post484777

In this case, I believe you're essentially taking my purple representation of the box faces and trying to call them all an inlet boundary. I have not found a more elegant way to have OpenFOAM take only the intersecting faces as a patch
Attached Images
File Type: png annotated-1.png (35.6 KB, 831 views)
File Type: png annotated-2.png (20.3 KB, 653 views)
File Type: png annotated-3.png (20.1 KB, 580 views)
djh2 is offline   Reply With Quote

Old   October 27, 2014, 04:45
Default
  #6
Senior Member
 
Join Date: Feb 2010
Posts: 213
Rep Power: 17
vaina74 is on a distinguished road
Hi David, here I am again. Thanks a lot for your 'flowchart', it helped.
The sets of cells and faces was not clear to me, I thought that the boxToFace topoSet source was able to 'intersect' the original patch in order to create a sub-set of faces.
As you said, your procedure is tricky and not so elegant, but it appears as the only possible. I looked for an alternative, but I didn't find anything.
I have a couple of questions for you or other experienced users.
- the source patchToFace (applied to the patch to be manipulated) is really requested?
- are possible more elegant procedures?
- I can't find documentation about fvOptions, I wonder if it could be useful in boundary conditions setting.
I share my simple test case for topoSet and createPatch usage.
blockMeshDict:
Code:
convertToMeters 1;

vertices
(
    (0 0 0)
    (10 0 0)
    (10 10 0)
    (0 10 0)
    (0 0 5)
    (10 0 5)
    (10 10 5)
    (0 10 5)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (100 100 50) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    inletWall
    {
        type wall;
        faces
        (
            (0 4 7 3)
        );
    }
    outletWall
    {
        type wall;
        faces
        (
            (4 7 6 5)
        );
    }
    defaultFaces
    {
        type wall;
        faces ();
    }
);

mergePatchPairs
(
);
topoSetDict:
Code:
actions
(
    // inlet patch generation
    // inletWall patch from blockMeshDict
    {
        name    inlet;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name "inletWall";
        }
    }
    // cutting volume for inlet
    {
        name    inletCells;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (-1 4.5 2) (1 5.5 3);
        }
    }
    // cutting surfaces for inlet
    {
        name    inletFaces;
        type    faceSet;
        action  new;
        source  cellToFace;
        sourceInfo
        {
            set        inletCells;
        option    all;
        }
    }
    // temporary inletWall patch clone
    {
        name    inletPatch;
        type    faceSet;
        action  new;
        source  faceToFace;
        sourceInfo
        {
            set "inlet";
        }
    }
    // cutting temporary inletWall patch clone
    {
        name    inletPatch;
        type    faceSet;
        action  delete;
        source  faceToFace;
        sourceInfo
        {
            set "inletFaces";
        }
    }
    // cutting final inlet patch
    {
        name    inlet;
        type    faceSet;
        action  delete;
        source  faceToFace;
        sourceInfo
        {
            set "inletPatch";
        }
    }
    // outlet patch generation
    {
        name    outlet;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name "outletWall";
        }
    }
    {
        name    outletCells;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (4.5 4.5 4) (5.5 5.5 6);
        }
    }
    {
        name    outletFaces;
        type    faceSet;
        action  new;
        source  cellToFace;
        sourceInfo
        {
            set        outletCells;
        option    all;
        }
    }
    {
        name    outletPatch;
        type    faceSet;
        action  new;
        source  faceToFace;
        sourceInfo
        {
            set "outlet";
        }
    }
    {
        name    outletPatch;
        type    faceSet;
        action  delete;
        source  faceToFace;
        sourceInfo
        {
            set "outletFaces";
        }
    }
    {
        name    outlet;
        type    faceSet;
        action  delete;
        source  faceToFace;
        sourceInfo
        {
            set "outletPatch";
        }
    }
);
createPatchDict:
Code:
pointSync false;

patches
(
    {
        name inlet;
        patchInfo
        {
            type patch;
        }
        constructFrom set;
        set inlet;
    }
    {
        name outlet;
        patchInfo
        {
            type patch;
        }
        constructFrom set;
        set outlet;
    }
);
meshing and patching procedure:
Code:
blockMesh
topoSet
createPatch -overwrite
vaina74 is offline   Reply With Quote

Old   October 28, 2014, 06:59
Default
  #7
Senior Member
 
Join Date: Feb 2010
Posts: 213
Rep Power: 17
vaina74 is on a distinguished road
I keep exploring OpenFOAM meshing tools. Now I am able to subtract a smaller volume from the main blockMesh domain. I just edited the previous topoSetDict, adding
Code:
    {
        name    domain;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (4 4 -1) (6 6 2);
        }
    }
    {
        name    domain;
        type    cellSet;
        action  invert;
    }
and ran
Code:
subsetMesh -overwrite domain
As expected, I obtained a set of oldInternalFaces. I'm looking for the best procedure to create a new patch on them in order to set specific boundaries. I hope that the attached image is clear enough to have an idea of domain geometry.
Attached Images
File Type: jpg editedDomain.jpg (70.5 KB, 403 views)
vaina74 is offline   Reply With Quote

Old   November 8, 2014, 18:37
Default
  #8
New Member
 
mamue
Join Date: Mar 2011
Location: Germany
Posts: 2
Rep Power: 0
mamue is on a distinguished road
Thanks for this useful hint djh2. But I run in a FOAM FATAL ERROR

I think, I'm able to cut patch faces with this method, because I can see the success in paraFoam by switching in the directory 0.001. But if I use the createPatch -overwrite option I run in a FOAM FATAL ERROR out-of-order 0.1 at index 2 if I try to open the mesh with paraFoam.

Someone any idea?
mamue is offline   Reply With Quote

Old   November 10, 2014, 10:26
Default
  #9
New Member
 
David H.
Join Date: Oct 2013
Posts: 25
Rep Power: 13
djh2 is on a distinguished road
Quote:
Originally Posted by mamue View Post
But if I use the createPatch -overwrite option I run in a FOAM FATAL ERROR out-of-order 0.1 at index 2 if I try to open the mesh with paraFoam.
Can you provide some dictionary files? I can try to reproduce your issue, or point out any inconsistencies that you may have in your dictionary.

This could be a bug to file
djh2 is offline   Reply With Quote

Old   November 12, 2014, 06:24
Default
  #10
New Member
 
mamue
Join Date: Mar 2011
Location: Germany
Posts: 2
Rep Power: 0
mamue is on a distinguished road
Thank you djh2, but I found the "bug" in front of the screen.

The reason is, that I overwrite a existing patch name in constant/boundary with my definition in createPatch. This produce the error. Using always a new name from the old constant/boundary over the definitions in topoSet and createPatch.
mamue is offline   Reply With Quote

Old   April 14, 2016, 23:36
Default
  #11
New Member
 
Aidan
Join Date: Jul 2014
Location: Belfast
Posts: 17
Rep Power: 12
amcloughlin801 is on a distinguished road
Hi vaina74, did you ever solve this problem? If so, I'd be very grateful if you could share.

Thanks
Aidan
amcloughlin801 is offline   Reply With Quote

Old   June 24, 2016, 06:11
Default
  #12
New Member
 
Join Date: Jun 2009
Location: Belgium
Posts: 11
Rep Power: 17
Laika is on a distinguished road
Dear Vaina74 and David,

thanks for the posts; they were helpful for me. I played around with topoSet trying to find a more elegant way to cut out a patch from an existing patch, but I can't find a better way then your 6-actions-procedure as well. It would be nice to have actions that intersect face-sets or that select boundary-faces from a larger face-set.

I try to make code as reusable as possible. In your 6-actions-procedure there are some sets created that only have a temporary use. I don't give them descriptive names, but just call them tempset1, tempset2, ...
For a subsequent patch to cut out, I simply use the same names "tempset1". topoSet will simply overwrite the old tempsets, but that's ok as you don't need them anymore. The result is imo more readable, and requires less editing, and produces less useless files in the sets-directory.

Here is what I mean (topoSetDict snippet):

Code:
// 6-actions patch generation: cut out 'filter1' from 'ceiling' 
    { 
        name    filter1; 
        type    faceSet; 
        action  new; 
        source  patchToFace; 
        sourceInfo 
        { 
            name "ceiling"; 
        } 
    } 
    // cutting volume for inlet 
    { 
        name    tempset1; 
        type    cellSet; 
        action  new; 
        source  boxToCell; 
        sourceInfo 
        { 
            box (3 1 2)(5 3 4); 
        } 
    } 
    // taking faces belonging to the cutting volume 
    { 
        name    tempset2; 
        type    faceSet; 
        action  new; 
        source  cellToFace; 
        sourceInfo 
        { 
            set        tempset1; 
            option    all;    //Is there not better option, like only selecting boundary faces? 
        } 
    } 
    // temporary clone of ceiling-face-zone 
    { 
        name    tempset3; 
        type    faceSet; 
        action  new; 
        source  faceToFace; 
        sourceInfo 
        { 
            set "filter1"; 
        } 
    } 
    // removing the filter1 faces from the ceiling-faces-clone 
    { 
        name    tempset3; 
        type    faceSet; 
        action  delete; 
        source  faceToFace; 
        sourceInfo 
        { 
            set "tempset2"; 
        } 
    } 
    // final filter1 patch = ceiling-faces - tempset3 
    { 
        name    filter1; //this is the final result to use in createPatchDict ! 
        type    faceSet; 
        action  delete; 
        source  faceToFace; 
        sourceInfo 
        { 
            set "tempset3"; 
        } 
    } 
    //here ends the 6-actions sequence to cut a patch from an existing patch.
cheers,
happy Foaming,

Laika,
still orbiting
wind_ likes this.
Laika is offline   Reply With Quote

Old   April 3, 2019, 15:45
Default
  #13
New Member
 
Join Date: Mar 2016
Posts: 23
Rep Power: 10
miragemobile is on a distinguished road
Does anyone know if a better method to only selecting boundary faces has been introduced since 2016?
miragemobile 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
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32


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