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

Some cells have disappeared

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2010, 08:42
Default Some cells have disappeared
  #1
Member
 
Markus Weinmann
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 77
Rep Power: 17
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, 09:14
Default
  #2
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 21
MartinB will become famous soon enough
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, 11:37
Default
  #3
Member
 
Markus Weinmann
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 77
Rep Power: 17
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: 16
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: 255
Rep Power: 21
MartinB will become famous soon enough
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: 16
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 Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Number of cells in mesh don't match with size of cellLevel colinB OpenFOAM Meshing & Mesh Conversion 14 December 12, 2018 08:07
[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
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


All times are GMT -4. The time now is 23:27.