CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   OpenFOAM file syntax (

amtri August 26, 2010 16:42

OpenFOAM file syntax

I am trying to understand the OpenFOAM file syntax. I ran into an example (motorBike), where the polyMesh/boundary file has several boundaries named, e.g., motorBike_engine%56, motorBike_chain%40, etc.

There are NO boundary entries named motorBike_.AAA where AAA can be anything. In other words, there are no entries where there is a period "." after the underscore character "_".

However, looking at the initial conditions, I see an entry as follows: "motorBike_.*"

Note the period after the underscore.

I can only suspect that these initial conditions apply to all boundaries named motorBike_* (without the period). If that's indeed the case, can anybody help me understand this syntax? If I had a list of files named as the boundaries and did a "ls motorBike_.*" I would find nothing.

So there must be something more to this. Pointing me to some point in the documentation where this syntax is explained is also appreciated. I couldn't find it.


daveatstyacht August 27, 2010 07:06

If I recall correctly each of those "motorBike_engine%56" like objects is actually a surface from the .stl file of the motor bike. Since they are not all one surface (patch) the boundary conditions of each must be specified, since listing ALL of those surface would be a real pain you can use the wildcard "*" to specify all of the patches with that motorBike_ beginning to their name. I believe the "." has a symbolic meaning of relative to the current working directory. Hope this helps.


Andreas_F August 27, 2010 07:16

. Matches any single character (many applications exclude newlines, and exactly which characters are considered newlines is flavor, character encoding, and platform specific, but it is safe to assume that the line feed character is included). Within POSIX bracket expressions, the dot character matches a literal dot. For example, a.c matches "abc", etc., but [a.c] matches only "a", ".", or "c".

* Matches the preceding element zero or more times. For example, ab*c matches "ac", "abc", "abbbc", etc. [xyz]* matches "", "x", "y", "z", "zx", "zyx", "xyzzy", and so on. \(ab\)* matches "", "ab", "abab", "ababab", and so on.

It is regular expressions.
For further information see:

marupio August 27, 2010 09:27

.* is unix for * in windows.

amtri August 27, 2010 10:56

Thanks to all who responded. I guess I was confused by the syntax of regular expressions. In unix, if I have files a.a, a.b, a.c, and ac, if I do

% ls

I get

a.a a.b ac a.c

But if I do

% ls a.*

I get

a.a a.b a.c

I'll take a look at regular expressions. Thanks again to all!

Andreas_F August 28, 2010 07:19

It doesn' t have to do with windows or unix.
It is simply regular expressions. "motorBike_.*" means all the boundaries starting with "motorBike_"
"motorBike_aaa" ,
"motorBike_bdccccc" ,

. Matches any single character
* Matches the preceding element zero or more times

"motorBike_*" means all the boundaries starting with "motorBike" and having " _" zero or more times.

All times are GMT -4. The time now is 09:31.