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

myProcNo problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By wyldckat
  • 1 Post By jherb

Reply
 
LinkBack Thread Tools Display Modes
Old   April 25, 2015, 21:38
Default myProcNo problem
  #1
Senior Member
 
Wen Xu
Join Date: May 2014
Posts: 115
Rep Power: 3
wenxu is on a distinguished road
Dear Foamers,

Why the output of UPstream::myProcNo() is always equal to zero even if I use 4 processors? I assume the output should be 0,1,2 then 3, then recycle this list.


Anyone can give me some hints?

Thank you in advance!

Regards,
Wen Xu
wenxu is offline   Reply With Quote

Old   April 26, 2015, 14:12
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,258
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quick answer: Have a look into the source code folder "applications/test/parallel".
In addition, see this post: Different results between 3 processors simulation and 7 processors simulation - post #2
wenxu likes this.
wyldckat is offline   Reply With Quote

Old   April 28, 2015, 13:03
Default
  #3
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 289
Rep Power: 9
jherb is on a distinguished road
If you use Info<< to print out the processor number it is only printed on the first processor. Use cout<< to print it on all processors.
wenxu likes this.
jherb is offline   Reply With Quote

Old   April 28, 2015, 21:26
Default
  #4
Senior Member
 
Wen Xu
Join Date: May 2014
Posts: 115
Rep Power: 3
wenxu is on a distinguished road
Thank you both Bruno and Joachim. You really help me a lot!

I have look into the test case in /application/test/parallel and already know a little about parallel.

Pout can print out the Inter-processor communications, so use "Pout<<" is a good choice to print the details of the processors communications.

I follow this method and print out the parcels number in every processor, the code like this:
Quote:
vector myVector(vector:ne);
reduce(myVector, sumOp<vector>());
Pout<<"myVector: "<<myVector<<endl;
Pout<<"my processor number: "<<UPstream::myProcNo()<<endl;

label Nparcels=coalParcels.nParcels();
IDLList<coalParcel>::iterator iter=coalParcels.begin();
labelList parcelsList(Nparcels);
Pout<<"parcels number: "<<Nparcels<<endl;
Pout<<"parcels total number: "<<returnReduce(coalParcels.nParcels(), sumOp<label>())<<endl;
And the corresponding output like this:
Quote:
[1] myVector: (4 4 4)
[1] my processor number: 1
[3] myVector: (4 4 4)
[3] my processor number: 3
[2] myVector: (4 4 4)
[0] myVector: (4 4 4)
[0] my processor number: 0
[2] my processor number: 2
[0] parcels number: 1098
[1] parcels number: 1787
[2] parcels number: 2595
[3] parcels number: 3554
[1] parcels total number: 9034
[0] parcels total number: 9034
[2] parcels total number: 9034
[3] parcels total number: 9034
But how can I get every parcel's information?
Both
Quote:
Pstream::gatherList(coalParcels)
Note: coalParcels is the object of ReactingMultiPhaseCloud
and
Quote:
List<IDLList<coalParcel> > gatheredParcel(Pstream::nProcs());
gatheredParcel[Pstream::myProcNo()] = coalParcels;
Pstream::gatherList(gatheredParcel);
do not work for me.

Thank you again!

Regards,
Wen Xu
wenxu is offline   Reply With Quote

Old   April 28, 2015, 22:16
Default
  #5
Senior Member
 
Wen Xu
Join Date: May 2014
Posts: 115
Rep Power: 3
wenxu is on a distinguished road
The error output like this:
Code:
/opt/openfoam230/src/OpenFOAM/lnInclude/INew.H: In member function 'Foam::autoPtr<T> Foam::INew<T>::operator()(Foam::Istream&) const [with T = Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > >]':
/opt/openfoam230/src/OpenFOAM/lnInclude/ILListIO.C:58:21:   instantiated from 'void Foam::ILList<LListBase, T>::read(Foam::Istream&, const INew&) [with INew = Foam::INew<Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > > >, LListBase = Foam::DLListBase, T = Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > >]'
/opt/openfoam230/src/OpenFOAM/lnInclude/ILListIO.C:151:5:   instantiated from 'Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::ILList<LListBase, T>&) [with LListBase = Foam::DLListBase, T = Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > >]'
/opt/openfoam230/src/OpenFOAM/lnInclude/gatherScatterList.C:103:17:   instantiated from 'static void Foam::Pstream::gatherList(const Foam::List<Foam::UPstream::commsStruct>&, Foam::List<T>&, int, Foam::label) [with T = Foam::IDLList<Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > > >, Foam::label = int]'
/opt/openfoam230/src/OpenFOAM/lnInclude/gatherScatterList.C:197:9:   instantiated from 'static void Foam::Pstream::gatherList(Foam::List<T>&, int, Foam::label) [with T = Foam::IDLList<Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > > >, Foam::label = int]'
ParticleStatistics.H:19:39:   instantiated from here
/opt/openfoam230/src/OpenFOAM/lnInclude/INew.H:62:25: error: 'New' is not a member of 'Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foam::KinematicParcel<Foam::particle> > > >'
/opt/openfoam230/src/OpenFOAM/lnInclude/INew.H:63:5: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linuxGccDPOpt/coalChemistryFoam.o] Error 1
The letter "p" is somehow replaced by smile token.

Last edited by wyldckat; May 3, 2015 at 13:16. Reason: Changed [QUOTE][/QUOTE] to [CODE][/CODE]
wenxu is offline   Reply With Quote

Old   May 3, 2015, 13:40
Default
  #6
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,258
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

@Wen Xu: Before I forget to mention this, for posting code and output here on the forum, you can find instructions here: Posting code and output with [CODE]

As for the problem you are dealing with right out, I need more details:
  1. Where exactly are you trying to consolidate this information? Is it in a solver or library? And in which one?
  2. Why do you need the details for all particles?
  3. Why do you need all particles to be located at the master processor/application?
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   May 3, 2015, 20:51
Default
  #7
Senior Member
 
Wen Xu
Join Date: May 2014
Posts: 115
Rep Power: 3
wenxu is on a distinguished road
Thank you for your suggestions, Bruno. I messed up with quoting text and code tags.
  1. Quote:
    Where exactly are you trying to consolidate this information? Is it in a solver or library? And in which one?
I want to get all of the particles' velocity to calculate RMS. First, I want to put my code at /src/lagrangian/intermediate/submodels/CloudFunctionObject and then transfer them to slover because compile code in intermediate is time consuming. The two places will have the same problem that I can only get the parcels' information in the every processor, but can not gather them with the code:
Code:
List<IDLList<coalParcel> > gatheredParcel(Pstream::nProcs());
    gatheredParcel[Pstream::myProcNo()] = coalParcels;
    Pstream::gatherList(gatheredParcel);
Now I solve this in reconstruct solver and it works since this solver can "gather" all of the data from different processors. But I still want to know how to gather particles from different processors in lagrangian solver.
  1. Quote:
    Why do you need the details for all particles?
Because I want to statistics them, I need know velocity, position for every parcel.

  1. Quote:
    Why do you need all particles to be located at the master processor/application?
As my description above, any processor ( myProc) can gather the parcels, usually we gather them at master processor.


Now, after have answered your questions, I think whether we can get the parcels' velocity and positions in every processor and write them out with a subList, then we can link these subList together?

Thank you in advance!

Best regards,
Wen Xu
wenxu is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


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