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

Loop over cells per processor (parallel)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2012, 12:56
Default Loop over cells per processor (parallel)
  #1
New Member
 
Maxim
Join Date: May 2012
Posts: 5
Rep Power: 13
bme79 is on a distinguished road
Hi I got a problem and I have read a lot of posts on a different forums but still could not find a solution. I am doing something wrong. Could some one help me out.

Basically when I run my program on single processor it works fine but when on parallel it does not.
I am using the loop

forAll(mesh.C(),celli){

x = mesh.C()[celli].component(0);
y = mesh.C()[celli].component(1);
z = mesh.C()[celli].component(2);
arr = getnewvelocity(rho, U[celli].x(), U[celli].y(), U[celli].z(), p[celli]);

// .......

}

I found a post on this forum suggesting to use "reduce" command but it means that I send all data from all proc to one. I dont want this. I wan to go through all cells per processor.

Could some one give me an advise or example.
Thank you
bme79 is offline   Reply With Quote

Old   July 7, 2012, 18:32
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bme79 View Post
Hi I got a problem and I have read a lot of posts on a different forums but still could not find a solution. I am doing something wrong. Could some one help me out.

Basically when I run my program on single processor it works fine but when on parallel it does not.
I am using the loop

forAll(mesh.C(),celli){

x = mesh.C()[celli].component(0);
y = mesh.C()[celli].component(1);
z = mesh.C()[celli].component(2);
arr = getnewvelocity(rho, U[celli].x(), U[celli].y(), U[celli].z(), p[celli]);

// .......

}

I found a post on this forum suggesting to use "reduce" command but it means that I send all data from all proc to one. I dont want this. I wan to go through all cells per processor.
Well you can. But you must realize that in parallel this only goes through all the cells that are on this processors. But on all processors. Which makes it alright

Whether you want to do a reduce or not is irrelevant: it depends on what is happening in the location where you put the 7 points. May be that you don't need a reduce. May be that you need it after the loop.
Quote:
Originally Posted by bme79 View Post
Could some one give me an advise or example.
Thank you
That is hard without knowing what the 7 points do
gschaider 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
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


All times are GMT -4. The time now is 20:16.