changeDictionary messes it up when #include directive is used
Hello,
I'm working in a chtMultiRegion case and, as it is usual in these kind of cases, I have to use changeDictionary to set up boundaries after creating the geometry with blockMesh and topoSet. So far, no problem. However, in this case I want to make use of the #include directive in order to use some values stored in a particular folder. I want to do that because some values are very common among all regions (and they are a few...) and I have to do a good amount of simulations switching them, so if I could only change the values from the file stored in an outter folder it would be very nice... The problem is that it seems that changeDictionary is not capable to handle the #include statement. I will show you how I used it and the results it gave me: ·changeDictionaryDict where I used #include dirctive: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Code:
dimensions [ 0 0 0 1 0 0 0 ]; Code:
--> FOAM FATAL IO ERROR: I also tried to put the statement in an upper position like outside the T keyword or even above the dictionaryReplacement keyword, but OpenFOAM complained either way. Actually, in any of the last cases the utility crushes and no dictionary is replaced. Any word of advice will be very welcome. Regards, Alex |
Not trying to spam, just asking...
Any idea on what the problem could be? Or directly changeDictionary utility can not handle properly the #include directive? May it be a bug?
|
Hi Alex,
If you run changeDictionary with the "-help" option, you should see this line: Code:
-literalRE treat regular expressions literally (i.e., as a keyword) Let us know if this works as intended. I do vaguely remember having problems with this as well in the past, but it was with an older version of OpenFOAM... not sure which one. Best regards, Bruno |
Quote:
Thanks for your tip. However, after running the command changeDictionary -help the correct options seems to be Code:
-enableFunctionEntries enables expansion of dictionary directives - #include, #codeStream etc Regards, Alex |
Quick question: Which OpenFOAM version are you using?
|
Quick answer :p : I'm using 2.3.x version
|
Hi Alex,
Sorry, I re-read now the post you had written and yesterday I thought you were still having problems in using changeDictionary. I quickly had thought of this because that option is provided on older versions of OpenFOAM and I very vaguely remember that the option "-enableFunctionEntries" didn't always work as intended... mmm, possibly because back then I actually wanted to preserve the original includes... Anyway, I'm glad you've figured out the option you needed :) Best regards, Bruno |
Quote:
I also wanted that the include line was copy-pasted literally instead of substituting its values in the new dictionary, but as far as I saw the effect is the same since the macro substitution is done correctly. I also tried to use both "-enableFunctionEntries" and "-literalRE" at a time, the problem is that as it copy-pastes literally the regular expressions instead of interpreting them. Thus, it copied the character ".*" directly to the new file so all the boundaries that were to be found under the ".*" were changed to "calculated" instead... Best regards, Alex |
All times are GMT -4. The time now is 19:36. |