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

[mesh manipulation] create a new boundary patch on an existing boundary

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2017, 09:32
Default create a new boundary patch on an existing boundary
  #1
Senior Member
 
Gajendra Gulgulia
Join Date: Apr 2013
Location: Munich
Posts: 144
Rep Power: 13
ggulgulia is on a distinguished road
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 is offline   Reply With Quote

Old   July 8, 2017, 11:04
Default
  #2
Senior Member
 
Gajendra Gulgulia
Join Date: Apr 2013
Location: Munich
Posts: 144
Rep Power: 13
ggulgulia is on a distinguished road
solved the problem.

used setSet and createPatch for making the small inlet patch on an existing boundary patch.
ggulgulia is offline   Reply With Quote

Old   July 27, 2017, 14:35
Default
  #3
New Member
 
Martin
Join Date: Oct 2013
Location: Newcastle
Posts: 21
Rep Power: 12
mahtin360 is on a distinguished road
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
mahtin360 is offline   Reply With Quote

Old   April 6, 2021, 01:48
Default
  #4
New Member
 
Join Date: Jul 2013
Posts: 8
Rep Power: 12
Ramsky is on a distinguished road
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 Splitting the Boundaries. 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!
Ramsky is offline   Reply With Quote

Old   September 6, 2021, 07:23
Default
  #5
Member
 
Bushra Rasheed
Join Date: Dec 2020
Posts: 97
Rep Power: 5
B_R_Khan is on a distinguished road
Quote:
Originally Posted by Ramsky View Post
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 Splitting the Boundaries. 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!
B_R_Khan is offline   Reply With Quote

Reply

Tags
cellset


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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 05:37
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55


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