CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

How to iterate over all cells in decomposed mesh

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 23, 2007, 06:08
Default Hi everybody, Could someone
  #1
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 100
Rep Power: 8
tehache is on a distinguished road
Hi everybody,

Could someone give me a hint on how to iterate over all cells of a decomposed mesh?

After naively using it for quite some time, I just found out that mesh.cells() gives me only the cells of one partition

Thank you!

Thomas
tehache is offline   Reply With Quote

Old   October 23, 2007, 07:14
Default Hi Thomas! That's the whole
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Thomas!

That's the whole point of parallelizing: every processor is responsible for "his" cells. If one processor could loop over all cells it would no longer be parallel.

What do you want to do? If it is something like counting cells with a specific property (that's one of the reasons why you might want to do this), then you should do it as usual and use something like

reduce(cnt,sumOp<label>());

to calculate the sum over all processors and distribute it to all processors

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   October 23, 2007, 07:44
Default Hi Bernhard, Actually, I wa
  #3
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 100
Rep Power: 8
tehache is on a distinguished road
Hi Bernhard,

Actually, I was looking for a cell at a specific location to set a reference value there (fvMatrix::setReference).
I think I ran into a trap with that idea ... now apperently every processor is setting reference at a different cell..
Isn't there some way, even doing communication, to globally find a cell?
Just tried findNearestCell(), but seems to work also ony within one processors cells...
tehache is offline   Reply With Quote

Old   October 23, 2007, 09:26
Default Hi Thomas! Something like t
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Thomas!

Something like this?

label cellI=mesh.findCell(location);
if(cellI>=0) {
matrix.setReference(cellI,value);
}

That'd set the reference only on the processor that has the cell in question, I guess.

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   October 23, 2007, 10:06
Default Thx a lot! Thats it. And s
  #5
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 100
Rep Power: 8
tehache is on a distinguished road
Thx a lot!

Thats it.
And so easy.... shame on me
tehache 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
Reconstruction of decomposed dynamic mesh cases david OpenFOAM Post-Processing 2 January 9, 2009 08:19
Empty cells in mesh Nikolaos FLOW-3D 2 October 21, 2008 23:17
RAM necessary for a 6 million cells hex mesh Antoine FLUENT 2 September 4, 2008 10:13
mesh with 804 cells.. nicolas FLUENT 6 September 24, 2007 06:14
ParaFoam OF 14 decomposed cases philippose OpenFOAM Paraview & paraFoam 4 April 18, 2007 05:17


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