Averaging over neighbouring cells in parallel
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:
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();
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;
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.
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.
Thanks Eugene for posting about patchNeighbourField(). Does anybody know if the neighbour data is stored in this (Pstream::myProcNo()) process or does calling this method send a request to the processor solving the other domain?
I got a bit entangled in the code and can't seem to figure this one out, thanks.
|All times are GMT -4. The time now is 00:01.|