CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] create a new boundary patch on an existing boundary (https://www.cfd-online.com/Forums/openfoam-meshing/189881-create-new-boundary-patch-existing-boundary.html)

ggulgulia June 29, 2017 09:32

create a new boundary patch on an existing boundary
 
Hello FOAMers

I am trying to create a new boundary say for example of a square size of 0.2*0.3 mm in the middle of an existing wall boundary of size 2.5*2.5 mm.

The geometry is too complicated already (it's a combustion chamber) and also i am required to demonstrate the usage of various tools and utilities of OpenFoam than just simple blockMesh and hence I don't want to create more blockMesh

What I wish to do is to create a new boundary patch called inlet on the existing mesh.

what i think is using setSet command after defining cellSet in the systems directory. But I have no idea how to do it!

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      cellSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

name            inlet;  //name of the new patch??
action          new; //?
topoSetSources  ( boxToCell { box ( x1 y1 z1 ) ( x2 y2 z2) ; } );  //no idea what      boxToCell is or topoSetSources is??

any suggestion is appreciated. Thaank you in advance

ggulgulia July 8, 2017 11:04

solved the problem.

used setSet and createPatch for making the small inlet patch on an existing boundary patch.

mahtin360 July 27, 2017 14:35

Hi, I am trying something similar here, could you explain what you did exactly as i struggle to find out how to best use these utilities.

I want to take a slice on my bottom wall and give it a specific boundary condition.
The mesh is existing already, what steps do i need to do to create a slice of certain thickness on the bottom wall?

Hope you can point me to the right way here

Best wishes
Martin

Ramsky April 6, 2021 01:48

Below steps worked for me in creating a new patch from an existing patch, without recreating the mesh.

General overview:
  • Grab the cell faces that need to be defined as a boundary.
  • Assign those cell faces as a new boundary.

Detailed steps:
  • First, extract the cells that contains required boundary. This is done by creating a cellSet. Cells can be marked by a box or other means (e.g. cylinder) that is supported by topoSet. To grab the cells exactly on the face (and avoid grabbing the faces from adjacent boundary), adjust the box dimensions suitably. Tip: Load the original patch in paraview, and note the extents for better defining the box extents.
  • Next, extract the faces from the cellSet. This done by setting the source as 'boxToFace' in topoSet.

Example system/topoSetDict file
Code:

                FoamFile
                {
                    version    2.0;
                    format      ascii;
                    class      dictionary;
                    object      topoSetDict;
                }
               
                // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
               
                actions
                (
                    // BCWALL_FLOWSLEEVE_EXT
                    {
                        name    inletFaceSet;          //name of the new set to be created
                        type    faceSet;                  // is it a cellSet or faceSet?
                        action  new;                        // is it new or appending?
                        source  boxToFace;            // extracting faces from the defined box
                        sourceInfo                          // box details
                        {
                            box  (0.00014 -0.08 -0.03) (0.001 -0.034 0.03);  //Fine adjustments are need to extract faces alone from desired face. Tip: Load the surface in paraview, and get the x-bounds correctly.
                        }
                    }
                );


Now, assigning the newly created faceSet as a patch boundary. This is done using createPatch. Example system/createPatchDict file:

Code:

                FoamFile
                {
                    version    2.0;
                    format      ascii;
                    class      dictionary;
                    object      createPatchDict;
                }
               
                pointSync false;
               
                // Patches to create.
               
                patches
                (
                    {
                        name INLET_NEW;  // Name of new patch to be created
               
                        patchInfo
                        {
                                type patch;    // is it a patch or wall? polyMesh/boundary file will be updated accordingly.
                        }
               
                        constructFrom set;   
               
                        // If constructFrom = set : name of faceSet
                        set inletFaceSet;            // name of the set created in topoSet
                    }
);

While executing createPatch, one can overwrite existing mesh (createPatch -overwrite). Else, a new folder will be created with polyMesh folder.


There is an alternate process suggested in https://www.cfd-online.com/Forums/op...oundaries.html. The issue I encountered with this approach was that I could not save an STL as the boundary faces contained largely hex cells. Error message said that 'only triangles can be saved as an STL'.

Hope this helps. Happy foaming!

B_R_Khan September 6, 2021 07:23

Quote:

Originally Posted by Ramsky (Post 800760)
Below steps worked for me in creating a new patch from an existing patch, without recreating the mesh.

General overview:
  • Grab the cell faces that need to be defined as a boundary.
  • Assign those cell faces as a new boundary.

Detailed steps:
  • First, extract the cells that contains required boundary. This is done by creating a cellSet. Cells can be marked by a box or other means (e.g. cylinder) that is supported by topoSet. To grab the cells exactly on the face (and avoid grabbing the faces from adjacent boundary), adjust the box dimensions suitably. Tip: Load the original patch in paraview, and note the extents for better defining the box extents.
  • Next, extract the faces from the cellSet. This done by setting the source as 'boxToFace' in topoSet.

Example system/topoSetDict file
Code:

                FoamFile
                {
                    version    2.0;
                    format      ascii;
                    class      dictionary;
                    object      topoSetDict;
                }
               
                // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
               
                actions
                (
                    // BCWALL_FLOWSLEEVE_EXT
                    {
                        name    inletFaceSet;          //name of the new set to be created
                        type    faceSet;                  // is it a cellSet or faceSet?
                        action  new;                        // is it new or appending?
                        source  boxToFace;            // extracting faces from the defined box
                        sourceInfo                          // box details
                        {
                            box  (0.00014 -0.08 -0.03) (0.001 -0.034 0.03);  //Fine adjustments are need to extract faces alone from desired face. Tip: Load the surface in paraview, and get the x-bounds correctly.
                        }
                    }
                );


Now, assigning the newly created faceSet as a patch boundary. This is done using createPatch. Example system/createPatchDict file:

Code:

                FoamFile
                {
                    version    2.0;
                    format      ascii;
                    class      dictionary;
                    object      createPatchDict;
                }
               
                pointSync false;
               
                // Patches to create.
               
                patches
                (
                    {
                        name INLET_NEW;  // Name of new patch to be created
               
                        patchInfo
                        {
                                type patch;    // is it a patch or wall? polyMesh/boundary file will be updated accordingly.
                        }
               
                        constructFrom set;   
               
                        // If constructFrom = set : name of faceSet
                        set inletFaceSet;            // name of the set created in topoSet
                    }
);

While executing createPatch, one can overwrite existing mesh (createPatch -overwrite). Else, a new folder will be created with polyMesh folder.


There is an alternate process suggested in https://www.cfd-online.com/Forums/op...oundaries.html. The issue I encountered with this approach was that I could not save an STL as the boundary faces contained largely hex cells. Error message said that 'only triangles can be saved as an STL'.

Hope this helps. Happy foaming!

Hi! Thanks for this detailed solution. However I am having a problem when I follow this, boxToFace in toposet is working fine for me and selects the desired size inlet face. However, when I use cylinderToCell, it doesn't select any faces and doesn't show any patches created in paraview. Can you please help what am I doing wrong?
My topoSet and createPatch files are:

TopoSet:

actions
(
{
name f0;
type faceSet;
action new;
/* source boxToFace;
box (-0.2 -0.2 0)(0.2 0.2 0.001);*/
source cylinderToCell;
p1 (0 0 0);
p2 (0 0 -0.5);
radius 4;

}
);

CreatePatch:


pointSync false;

// Patches to create.
patches
(
{
// Name of new patch
name inlet;

// Type of new patch
patchInfo
{
type patch;
}

// How to construct: either from 'patches' or 'set'
constructFrom set;

// If constructFrom = patches : names of patches. Wildcards allowed.
patches ("periodic.*");

// If constructFrom = set : name of faceSet
set f0;
}
);

Thanks!


All times are GMT -4. The time now is 21:08.