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

Reading data by multiple processors

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 14, 2015, 03:43
Default Reading data by multiple processors
  #1
New Member
 
Khomenko Maxim
Join Date: Aug 2015
Posts: 16
Rep Power: 10
mbookin is on a distinguished road
I'm using the IOdictionary kjmaHistory to store the local List t0 on disk from multiple processors.
Code:
IOdictionary kjmaHistory
    (
        IOobject
        (
            "kjmaHistory",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            //IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        )
    );
List<bool> t0;
 
if (WRITE)
{
t0.setSize(T.size(),false);//inital value of list
kjmaHistory.add("t0",t0,true);//add list to dictionary
...
runTime.write();// store to disk
}
else//READ
 {t0 =kjmaHistory.lookupOrDefault("t0" ,t0);}
Every thing is ok with WRITE. Every processor saves dictionary in procNo/timeName directory. But when I try to READ written lists the problem comes. Every processor reads the list from timeName directory of master processor. (proc0/0.1)

Could you please tell me what am I doing wrong? How can i read data from processors directory but not from masters one?
mbookin is offline   Reply With Quote

Old   November 13, 2015, 10:05
Default
  #2
New Member
 
Khomenko Maxim
Join Date: Aug 2015
Posts: 16
Rep Power: 10
mbookin is on a distinguished road
I do not know why the perious code doesn't work, but now I managed to write one that works. If anyone can explain, please do not hesitate to tell.
Code:
IOdictionary kjmaHistory
    (
        IOobject
        (
            "kjmaHistory",
            runTime.timeName(),
            mesh,
            //IOobject::MUST_READ,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        )
    );
List<bool> t0;
 
if (WRITE)
{
    t0.setSize(T.size(),false);//inital value of list
    kjmaHistory.add("t0",t0,true);//add list to dictionary
    ...
    runTime.write();// store to disk
}
else//READ
{
    dictionary kjmaHistoryDict(kjmaHistory.readStream(kjmaHistory.filePath()));
    t0 =kjmaHistoryDict.lookupOrDefault("t0" ,t0);
}
Every processor reads from its own directory at READ now, but that is not the case in previous code! Why don't they read kjmaHistory at IOdictionary declaration? Only the master node does and sends to others.
mbookin is offline   Reply With Quote

Reply

Tags
iodictionary, list, multiple core


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
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) Aadhavan OpenFOAM Meshing & Mesh Conversion 2 March 8, 2018 01:47
Tecplot reading particle data error ali hemmati FLUENT 1 February 13, 2016 06:17
Error when reading data file. WJXu FLUENT 7 September 1, 2015 19:34
studying a valve case mina.basta OpenFOAM 33 August 30, 2013 04:46
saving Transient/Unsteady data of multiple surface integrals in single file ankur gupta FLUENT 0 February 22, 2012 13:59


All times are GMT -4. The time now is 10:21.