CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Setting the same boundary condition at multiple patches at once (https://www.cfd-online.com/Forums/openfoam-pre-processing/125002-setting-same-boundary-condition-multiple-patches-once.html)

michielm October 17, 2013 03:26

Setting the same boundary condition at multiple patches at once
 
I am currently working with snappyHexMesh to create a mesh which has a number of regions cut out. I have named these "obstacle1","obstacle2" etc

All these obstacles should have the same boundary conditions. When setting them I am already using the following structure:

Code:

obstacle1_region0
    { 
        type fixedValue;
        value uniform 3;
    } 

    obstacle2_region0
    {
      $obstacle1_region0;
    }

    obstacle3_region0
    {
      $obstacle1_region0;
    }

etc

This saves me some time, but it is still a little annoying to have to add new obstacles in U, p, alpha1 every time I change the number of obstacles.

My question is:
is it possible to set the boundary condition for patches with repetitive names in 1 go? I could imagine that would look something like this:
Code:

obstacle$i_region0
{
    type fixedValue;
    value uniform 3;
}


haakon October 17, 2013 05:21

You can use regular expressions in the patch names, like:

Code:

"obstacle.*"
{
    type fixedValue;
    value uniform 3;
}

for all patches starting with the string "obstacle". More refined expressions can of course also be made.

michielm October 17, 2013 05:23

Awesome! Thanks!


All times are GMT -4. The time now is 13:53.