|
[Sponsors] |
June 21, 2018, 05:56 |
Checking dictionary in parallel
|
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 373
Rep Power: 11 |
Howdy Folks:
In my solver I will be reading from a custom system dictionary. I wanted the solver to check if the dict follows the proper dictionary format. Here is a code snippet: Code:
// preamble not shown int main ( int argc, char *argv[] ) { // standard and default OF includes not shown const word xyzDictName ( "xyzDict" ); IOobject xyzDictIO ( /* implementation not shown */ ); if ( !xyzDictIO.typeHeaderOk<dictionary>(true) ) FatalErrorIn ( args.executable () ) << "File " << xyzDictIO.name() << " not found in " << xyzDictIO.instance() << exit (FatalError); // rest of code not shown Code:
[0] [0] [0] --> FOAM FATAL ERROR: [0] File xyzDict not found in "system" [0] [0] FOAM parallel run exiting [0] [2] [2] [2] --> FOAM FATAL ERROR: [2] File xyzDict not found in "system" [2] [2] FOAM parallel run exiting [2] Thanks in advance, Gerry. Last edited by Gerry Kan; July 9, 2018 at 06:40. |
|
June 22, 2018, 09:05 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
You can check, if the current process is running in the master process like this:
Code:
if (Pstream::master()) { // do whatever you want to do on the master } |
|
June 28, 2018, 08:44 |
|
#3 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 373
Rep Power: 11 |
Hallo JH,
Thanks, but I don't think this would work because I am getting the same error message for every node. Limiting the search to the master node will not work. Incidentally, I tried anyways (what can I lose?), but it unfortunately only confirmed my suspicion. Gerry. |
|
August 22, 2019, 19:59 |
|
#4 |
New Member
Rajib Roy
Join Date: Jun 2014
Location: Laramie, Wyoming
Posts: 18
Rep Power: 12 |
Having the same issue with OpenFOAM-6. Did you find any solution?
Thank you in advance. Edit: Found a solution Print the dictionary path information using : Code:
Info << <dict-name>.objectPath() << endl; Code:
<caseDir>/processor0/constant I guess in the source code, it's possible to create a dictionary pointer to assign appropriate path based on serial or parallel execution. Hope somebody will find the solution helpful. Regards, R |
|
November 25, 2020, 14:23 |
|
#5 |
New Member
Henning
Join Date: Sep 2020
Posts: 8
Rep Power: 6 |
Sorry to bump this thread, but are there any news on the topic? I don't really consider the symlink method a good solution, especially since I hve the same problem in a multi-region case.
The problem is e.g. in this line where I try to read a dictionary Code:
IOdictionary ( IOobject ( "balanceParDict", time().system(), *this, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ) Code:
caseDir/processor0/system/fluid/balanceParDict Code:
caseDir/system/fluid/balanceParDict Code:
caseDir/../system/fluid/balanceParDict Thanks a lot for any help, cheers! For now I change it to time().constant() and created symlinks inside each processir*/constant/regionName folder which is easier than creating a new symlink inside each new time directory Last edited by dasbrot; November 27, 2020 at 06:57. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Parallel Build on macOS High Sierra - error: C++ compiler cannot create executables | Kit62 | SU2 Installation | 2 | March 27, 2018 10:46 |
cgns grid problem | praveen | SU2 | 20 | March 10, 2014 15:09 |
checking for C++ compiler default output file name... configure: error: C++ compiler | dhxlxz | SU2 Installation | 2 | September 7, 2013 12:08 |
[GAMBIT] Problem with interior faces | miro2000 | ANSYS Meshing & Geometry | 11 | August 24, 2013 15:00 |
parallel Grief: BoundaryFields ok in single CPU but NOT in Parallel | JR22 | OpenFOAM Running, Solving & CFD | 2 | April 19, 2013 17:49 |