|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
Hello,
it seems to be possible to use regular expressions in some?/all? openfoam configuration files. However, I was unable to find any announcement or documentation about that features. For example I try to include all STLs from the triSurface directory in my snappyHexMesh: Code:
geometry { ".*\.stl" { type triSurfaceMesh; } }; Code:
--> FOAM FATAL ERROR: Cannot find triSurfaceMesh starting from "/scratch/flindner/snappy/constant/triSurface/.*\.stl" From function triSurfaceMesh::checkFile(const fileName&, const fileName&) in file searchableSurface/triSurfaceMesh.C at line 116. Thanks, Florian |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Florian,
By what I can see, OpenFOAM uses POSIX regular expressions, but it only applies to OpenFOAM's keywords; doesn't work for files.
The work around is to use the following structure:
Best regards, Bruno
__________________
|
||
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
Hello!
Thanks for your explanation. One problem still: Code:
refinementSurfaces { "(BPID|GOPT|GRWS).*" { level (0 1); } } Code:
refinementRegions { "VRES.*" { mode inside; levels ((0 1)); } } Code:
--> FOAM FATAL ERROR: No surface called "VRES.*" Valid surfaces are 19 ( [...] VRES0300.stl VRES0400.stl VRES0500.stl VRES0600.stl VRES0700.stl ) From function shellSurfaces::shellSurfaces(const searchableSurfaces&, const dictionary>& in file autoHexMesh/shellSurfaces/shellSurfaces.C at line 429. FOAM exiting Another question: Is is possible to use groups and reference them later? My idea is something like that: Code:
refinementRegions { "VRES0(.)00\.stl" { mode inside; levels ((0 $1)); } } Florian |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Florian,
If you search for "POSIX regex" online, you should pick up on several tutorials. The ".*" regular expression doesn't pick up on certain characters. This is because sometimes this helps isolate sentences. In your case, you might want to use either one of these:
Bruno
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
I did use a regular expression tester which matches exactly the way I planned.
The problem seems to be somewhere else, none of the regexps you proposed worked. They all produce the same error: No surface called "VRES[0-9]*\..*" Regards, Florian |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Florian,
I've tried to reproduce the error you're getting, but I haven't managed to get it. The only thing I can figure out is that you're trying to use a surface to define a region, which I don't think snappyHexMesh allows... If you can provide a (small) test case, it's easier to figure out what is happening. Best regards, Bruno
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25 ![]() |
Hello there,
A Good Evening to you! I was just thinking...... I am quite certain that snappyHexMesh does not use the "regular expression" system available in OpenFOAM while reading the snappyHexMeshDict file.... If you look into the code of "refinementSurfaces.C" starting from line 300, you will notice, that it uses the simple ".found(....)" function to locate the names of the geometries specified in the "refinementSurfaces" sub-dictionary.... As far as I know, this does not support Regular Expressions. It looks like as of now, OpenFOAM allows "Regular Expressions" only for patch names, like in the "0/U", "0/p", etc.... files, and in some other internal usages..... In order to use Regular Expressions, you need to use a function "findStrings", into which you give a list of allowed names, and the regular expression.... and it tries to find matches.... I have explicitly modified some of my post-processing code to use Regular Expressions for finding patches (using the functionality provided within OpenFOAM).... it was not something which worked out of the box without changes to my code. Disclaimer ;-): Due to the complexity of OpenFOAM, I think what I have just said above is correct..... but again..... I might be wrong..... it would be great if someone could check this out..... Have a nice day ahead! Philippose |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
Hello!
Partly it seems to use regular expressions, since Code:
refinementSurfaces { "(BPID|GOPT|GRWS).*" { level (0 1); } } Funny thing... Thx! Florian |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
Just as an addition, layers seem to support regexp too:
addLayersControl { layers ".*" { ... } } works. |
|
![]() |
![]() |
![]() |
![]() |
#10 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
I've written this above:
Does defining the full name directly in the region block work?
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#11 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
Using a surface in refinementRegions works perfect. In fact, since STL defines nothing but surfaces thats the only way if you want to use a STL file. The surface must be closed so you can define inside and outside.
If works perfect when using the full name of the surface. My question is just if ommiting the full name and using regular expressions is possible. It seems to be possible for refinementSurfaces and layers, but not for refinementRegions. Or did I misunderstand you? |
|
![]() |
![]() |
![]() |
![]() |
#12 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Florian,
Mmm, I think you understood me correctly. I didn't know we could use a closed STL region for the "refinementRegions" block. And I assume you also defined them in the first geometries block as well. Therefore, I think this can be considered a bug, namely that regex not working in the "refinementRegions" block. Please create a small example case and report it on the official bug tracker: http://www.openfoam.org/mantisbt/my_view_page.php Best regards, Bruno
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#13 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#14 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Florian,
Then at least provide a complete "snappyHexMeshDict" that exemplifies the problem. Otherwise they might simply say something like it works as intended or indicate that there isn't enough information to reproduce the reported issue. Best regards, Bruno
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#15 |
Member
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16 ![]() |
Ok, did it.
|
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF issue | MASOUD | Fluent UDF and Scheme Programming | 14 | December 6, 2012 13:39 |
critical error during installation of openfoam | Fabio88 | OpenFOAM Installation | 21 | June 2, 2010 03:01 |
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found | piprus | OpenFOAM Installation | 22 | February 25, 2010 13:43 |
Problems in compiling paraview in Suse 10.3 platform | chiven | OpenFOAM Installation | 3 | December 1, 2009 07:21 |
ParaView Compilation | jakaranda | OpenFOAM Installation | 3 | October 27, 2008 11:46 |