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

Sout/Pout: print fields in parallel run

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2016, 10:46
Default Sout/Pout: print fields in parallel run
  #1
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 16
Andrea_85 is on a distinguished road
Hi All,

i am trying to debug my code for parallel run. I just want to print the boundary values of a field i have created within the solver on every processor(lets call it "myField").If I simply do

Pout << myField.boundaryField() << nl << endl;

the output is very confused becasue OF mixes values from all processor.
What i want to do is something like this

Code:
scalar n = Pstream::nProcs(); //gives the n° of processors
for (int i=0; i<n; i++)
{
Pout << myField.boundaryField()[i] << nl << endl;

wait until it finishes to write data from processor i, then continue to the next processor
}
The problem is that i do not know how to access myField.boundaryField() on processor "i" (the code above does not work as inteded)

Any idea?

Best,
Andrea
Andrea_85 is offline   Reply With Quote

Old   April 18, 2016, 18:38
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
In your loop you have to make sure that only the processor with the correct number does the output. For this you can use myProcNo() method:
http://openfoamcfd.sourceforge.net/d...stream.html#e6

For synchronizing you can use this approach:
http://www.cfd-online.com/Forums/ope...tml#post448769
jherb 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
Some questions about a multi region case run in parallel zfaraday OpenFOAM Running, Solving & CFD 5 February 23, 2017 11:25
Case running in serial, but Parallel run gives error atmcfd OpenFOAM Running, Solving & CFD 18 March 26, 2016 13:40
Can not run OpenFOAM in parallel in clusters, help! ripperjack OpenFOAM Running, Solving & CFD 5 May 6, 2014 16:25
parallel Grief: BoundaryFields ok in single CPU but NOT in Parallel JR22 OpenFOAM Running, Solving & CFD 2 April 19, 2013 17:49
Run in parallel a 2mesh case cosimobianchini OpenFOAM Running, Solving & CFD 2 January 11, 2007 07:33


All times are GMT -4. The time now is 04:32.