CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Checking dictionary in parallel

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Gerry Kan
  • 1 Post By rajibroy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2018, 05:56
Default Checking dictionary in parallel
  #1
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 373
Rep Power: 11
Gerry Kan is on a distinguished road
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
The solver compiled without warning and works fine when I run this on a single processor. For parallel runs, however, my solver will give me the following error, for some or all of the nodes:

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]
I have a feeling that each instance of the solver is looking for the offending dict (xyzDict) in their respective temp directories and (logically) they could not be found because it's not there. Am I missing something, as it seems that it should be the way to check the integrity of the dictionary files.

Thanks in advance, Gerry.
rajibroy likes this.

Last edited by Gerry Kan; July 9, 2018 at 06:40.
Gerry Kan is offline   Reply With Quote

Old   June 22, 2018, 09:05
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
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
    }
jherb is offline   Reply With Quote

Old   June 28, 2018, 08:44
Default
  #3
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 373
Rep Power: 11
Gerry Kan is on a distinguished road
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.

Quote:
Originally Posted by jherb View Post
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
    }
Gerry Kan is offline   Reply With Quote

Old   August 22, 2019, 19:59
Default
  #4
New Member
 
Rajib Roy
Join Date: Jun 2014
Location: Laramie, Wyoming
Posts: 18
Rep Power: 12
rajibroy is on a distinguished road
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;
In a parallel execution case, it points to
Code:
<caseDir>/processor0/constant
, which is naturally absent in the decomposed "processor0/constant" folder. Therefore, I created a symbolic link of the dictionary from "caseDir/constant" to "caseDir/processor0/constant" folder to make it work.

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
Gerry Kan likes this.
rajibroy is offline   Reply With Quote

Old   November 25, 2020, 14:23
Default
  #5
New Member
 
Henning
Join Date: Sep 2020
Posts: 8
Rep Power: 6
dasbrot is on a distinguished road
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
                )
        )
at runtime. This of course fails because time().system() equals e.g.
Code:
caseDir/processor0/system/fluid/balanceParDict
where 'fluid' is one of my regions. I tried replacing time.system() with time.caseSystem() which should at least link to
Code:
caseDir/system/fluid/balanceParDict
but instead the printed warning says
Code:
caseDir/../system/fluid/balanceParDict
not found, so somehow the command is not evaluated properly. Isn't there any method to directly access the global system directory? I also tried giving a relativ path, but this fails too, because the '../' is not evaluated properly.

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.
dasbrot is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


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