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

How to access procNo

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2012, 13:59
Default How to access procNo
  #1
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
I want to access the procNo in the main solver code. as follows:

if (ProcNo==0)
forAll(mesh.C(), pointI)
{
if ((mesh.C()[pointI].x()>0)&&(mesh.C()[pointI].x()<0.2))
{
in1[ii1] = pointI;
ii1++;
}
if ((mesh.C()[pointI].x()>0.2)&&(mesh.C()[pointI].x()<0.4))
{
in2[ii2] = pointI;
ii2++;
}
if ((mesh.C()[pointI].x()>0.4)&&(mesh.C()[pointI].x()<0.6))
{
in3[ii3] = pointI;
ii3++;
}
};

But when I wmake it and the error message is
error procNo is not declared in this scope
zxj160 is offline   Reply With Quote

Old   August 14, 2012, 03:18
Default
  #2
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
It should work with
Code:
if (Pstream::myProcNo() == 0)
{
...
}
or
Code:
if (Pstream::master())
{
...
}
Arnoldinho 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
Getting access to mesh (fvMesh) via object registry Chris Lucas OpenFOAM Programming & Development 18 January 15, 2024 02:57
[DesignModeler] DesignModeler Scripting: How to get Full Command Access ANT ANSYS Meshing & Geometry 53 February 16, 2020 15:13
UDF Data Access Macro Woo Meng Wai FLUENT 0 November 6, 2007 20:23
Error: access: unbound variable,HELP sudhakar FLUENT 0 January 15, 2007 23:21
Access Density Allan Walsh FLUENT 3 October 4, 2005 07:55


All times are GMT -4. The time now is 17:14.