CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to define multiple boundary field names (https://www.cfd-online.com/Forums/openfoam/88080-how-define-multiple-boundary-field-names.html)

waku2005 May 7, 2011 23:28

How to define multiple boundary field names
 
Dear all;

I'd like to know how to define multiple boundary field names in 0/U, 0/p files like bellow (i.e., different patches but physical conditions are the same).
The bellow lines are allowable in OF, or there are any other ways?
-------
BC1
{
type fixed value;
value uniform (1 0 0);
}
BC2
{
type fixed value;
value uniform (1 0 0);
}
-------
VVVV
-------
BC1 | BC2 <--------- ??????
{
type fixed value;
value uniform (1 0 0);
}
-------

Thanks in advance,
waku2005

olesen May 9, 2011 02:41

Quote:

Originally Posted by waku2005 (Post 306650)
Dear all;

I'd like to know how to define multiple boundary field names in 0/U, 0/p files like bellow (i.e., different patches but physical conditions are the same).
The bellow lines are allowable in OF, or there are any other ways?
-------
BC1
{
type fixed value;
value uniform (1 0 0);
}
BC2
{
type fixed value;
value uniform (1 0 0);
}
-------
VVVV
-------
BC1 | BC2 <--------- ??????
{
type fixed value;
value uniform (1 0 0);
}
-------

Thanks in advance,
waku2005


Regular expressions? See "man 7 regex" for syntax.

Code:


"BC[0-9]+"
{
    type fixedValue;
    value uniform (1 0 0);
}


waku2005 May 9, 2011 06:13

Dear olesen

Thank you for your reply !
Oh, Regular expressions like bellow are very useful for me.

For different names which could not be written with the regular expression, what should I do ?

Quote:

Originally Posted by olesen (Post 306742)
Regular expressions? See "man 7 regex" for syntax.

Code:


"BC[0-9]+"
{
    type fixedValue;
    value uniform (1 0 0);
}



olesen May 9, 2011 07:30

Quote:

Originally Posted by waku2005 (Post 306779)
Dear olesen

Thank you for your reply !
Oh, Regular expressions like bellow are very useful for me.

For different names which could not be written with the regular expression, what should I do ?

There are several solutions, but I have some doubts if you can't formulate most normal things as a regular expression. You can also use a regexp to set a "catchall" condition and use literals to specify the (hopefully few) conditions that deviate. Also observe that the regexs are matched in reversed order http://foam.sourceforge.net/doc/Doxy....html#_details
This property could also be exploited.

Armed with these bits of information, there shouldn't be any huge problem.
As a final alternative, you could post the condition that you figure cannot be expressed as a regular expression and pay 5 Euros to the first one who can solve it for you ;)

waku2005 May 9, 2011 08:28

Quote:

Originally Posted by olesen (Post 306787)
There are several solutions, but I have some doubts if you can't formulate most normal things as a regular expression. You can also use a regexp to set a "catchall" condition and use literals to specify the (hopefully few) conditions that deviate. Also observe that the regexs are matched in reversed order http://foam.sourceforge.net/doc/Doxy....html#_details
This property could also be exploited.

Armed with these bits of information, there shouldn't be any huge problem.
As a final alternative, you could post the condition that you figure cannot be expressed as a regular expression and pay 5 Euros to the first one who can solve it for you ;)

Thanks Olesen,
Regular expression is enaugh for me.


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