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

Some cells have disappeared

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 9, 2010, 09:42
Default Some cells have disappeared
  #1
Member
 
Markus Weinmann
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 77
Rep Power: 8
cfdmarkus is on a distinguished road
Hi all,

I have added two lines to pisoFoam to count the number of cells:

const cellList& cells = mesh.cells();
Info << " no cells: " << cells.size() << endl;

When I run it on a single processor it counts: 1278060 cells - which is correct.
But when I decompose the case and run it on 16 processsors, the number reduces to: 79043 cells. This is approx. 1/16 of the total number of cells.

Consequently, when I loop over all cells using "forAll(cells,cellI)" some cells are always missing

Does anyone know why mesh.cells() does not include all cells when run in parallel and how can the missing cells be accessed?

Thanks
Markus
cfdmarkus is offline   Reply With Quote

Old   December 9, 2010, 10:14
Default
  #2
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 252
Rep Power: 11
MartinB is on a distinguished road
Hi Markus,

you must gather the information to the master:
Code:
const cellList& cells = mesh.cells();
label nCells = 0;
nCells = cells.size();
reduce(nCells, sumOp<label>());
Info << " no cells: " << nCells << endl;
Martin
MartinB is offline   Reply With Quote

Old   December 10, 2010, 12:37
Default
  #3
Member
 
Markus Weinmann
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 77
Rep Power: 8
cfdmarkus is on a distinguished road
Thank you Martin!
cfdmarkus is offline   Reply With Quote

Old   August 19, 2011, 08:48
Default field manipulation with parallel computations
  #4
Member
 
Kim Yusik
Join Date: Dec 2009
Posts: 39
Rep Power: 7
impecca is on a distinguished road
Thanks for the thread on this subject first.

I've managed to get number of cells in parallel computing as Martin suggested but I still have a problem with modifying 'field' itself. here is the code I use



const cellList& cells = mesh.cells();
label nCells = 0;
nCells= cells.size();
reduce(nCells, sumOp<label>());
scalar i = 0;

forAll(cells, celli){
i++;
}
Info<<"i= "<<i <<nl;
Info<<"nCells= " <<nCells<<nl;


with a single processor, it shows:
i= 336000
nCells= 336000

with 4 processors, it shows:
i= 84332
nCells= 336000


as you can see, nCells isn't affected by multi processing but the field loop number (i) is depending on the number of processors. So question is that is there any way that I can manipulate field (say velocity) with the parallel compuations ?
What I want to do is imposing artificial fluctuations on one plane in the middle of domain.

I also wrote same question in this forum but no response so far,
http://www.cfd-online.com/Forums/ope...mputation.html

Thanks in advance

Yusik

Last edited by impecca; August 19, 2011 at 09:07. Reason: na
impecca is offline   Reply With Quote

Old   August 19, 2011, 08:58
Default
  #5
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 252
Rep Power: 11
MartinB is on a distinguished road
Hi Yusik,

you can manipulate the field within the loop:
forAll(cells, celli)
{
i++;
// your manipulation here, each processor will manipulate
// its part of the field.
}

Hmmhhh, not sure if I understand your problem correctly, maybe you can provide some code snippets of your intended algorithm...

Martin
MartinB is offline   Reply With Quote

Old   August 21, 2011, 09:23
Default
  #6
Member
 
Kim Yusik
Join Date: Dec 2009
Posts: 39
Rep Power: 7
impecca is on a distinguished road
Yes, it works. you are right Martin. I was a different problem. I replied to other thread (link below). Thanks for your help.


http://www.cfd-online.com/Forums/ope...tml#post320892
impecca 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
Number of cells in mesh don't match with size of cellLevel colinB OpenFOAM Native Meshers: snappyHexMesh and Others 11 January 13, 2015 12:47
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
snappyHexMesh aborting Tobi OpenFOAM Native Meshers: snappyHexMesh and Others 0 November 10, 2010 04:23
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43
physical boundary error!! kris CD-adapco 2 August 3, 2005 00:32


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