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

Averaging over neighbouring cells in parallel

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 16, 2011, 08:09
Default Averaging over neighbouring cells in parallel
  #1
New Member
 
John O\'Sullivan
Join Date: Mar 2009
Location: Auckland, New Zealand
Posts: 7
Rep Power: 8
jposunz is on a distinguished road
Hi everyone,

I'm having trouble working out how to access neighbouring points when running my application in parallel. As part of my algorithm I need to filter/smooth the values of the Reynolds stresses based on the neighbouring cells. It works fine in serial but in parallel it generates problematic results as the cellCells() call only returns the neighbours on the same processor. I've read lots of posts and found some info referring to PStream and globalMesh but must admit I'm a novice at parallel programming so any help would be great. I thought there may be a simple way to tell the application to look across the entire domain when doing the averaging? Here's my code as it is:

forAll(mesh_.cells(), cellI)
{
const labelList& nbrs = mesh_.cellCells()[cellI];

scalar volCell = mesh_.V()[cellI];

scalar volume = volCell;
scalar volRxx = volCell * R_[cellI].xx();
scalar volRxy = volCell * R_[cellI].xy();
scalar volRxz = volCell * R_[cellI].xz();
scalar volRyy = volCell * R_[cellI].yy();
scalar volRyz = volCell * R_[cellI].yz();
scalar volRzz = volCell * R_[cellI].zz();

forAll(nbrs,nbrI)
{

scalar volCell = mesh_.V()[nbrs[nbrI]];

volume += volCell;
volRxx += volCell * R_[nbrs[nbrI]].xx();
volRxy += volCell * R_[nbrs[nbrI]].xy();
volRxz += volCell * R_[nbrs[nbrI]].xz();
volRyy += volCell * R_[nbrs[nbrI]].yy();
volRyz += volCell * R_[nbrs[nbrI]].yz();
volRzz += volCell * R_[nbrs[nbrI]].zz();
}

Rbuffer[cellI].xx() = volRxx/volume;
Rbuffer[cellI].xy() = volRxy/volume;
Rbuffer[cellI].xz() = volRxz/volume;
Rbuffer[cellI].yy() = volRyy/volume;
Rbuffer[cellI].yz() = volRyz/volume;
Rbuffer[cellI].zz() = volRzz/volume;

}

Thanks!
jposunz is offline   Reply With Quote

Old   March 22, 2011, 00:28
Default
  #2
New Member
 
John O\'Sullivan
Join Date: Mar 2009
Location: Auckland, New Zealand
Posts: 7
Rep Power: 8
jposunz is on a distinguished road
Noone with any ideas? I've spent a lot of time looking through source code for something similar but haven't come up with anything yet.

Thanks!
jposunz is offline   Reply With Quote

Old   April 11, 2011, 16:46
Default
  #3
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
All coupled boundaries of geometric fields have a member function called "patchNeighbourField". I think this should do what you need provided the property you want is stored in a geometric field.

Otherwise you want to use the syncTools, but that's a bit more complicated.

Eugene
eugene is offline   Reply With Quote

Reply

Tags
neighbouring cells, parallel

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
SnappyHexMesh for internal Flow vishwa OpenFOAM Native Meshers: snappyHexMesh and Others 23 August 6, 2014 03:50
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 14:20.