CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   parallel issue: global face zone/patch ... (

matteoL June 14, 2010 12:51

parallel issue: global face zone/patch ...
My problem is the following:
Let's say I am simulating the flow around a cylynder and I need to be able to get the normal gradient of the velocity on the cylinder.

In serial it is very easy, i just have to do:

vectorField UgradN=U.boundaryField()[CylPatch].snGrad();

where cylPatch is the index corresponding my "Cylinder" patch.

I would like to do the same in parallel:
If i do the same call and run the code in parallel I will end up with different vectorField per processor because the CylPath will have been split among the different partition, and every partition will see only its part of the Cylinder.

What should I do?
How can I be able to obtain the WHOLE UgradN field in a parallel decomposed cases?

I think (but it is here that I need some help since I am really very unsure about what I am saying) that the solution may be to define a global faceZone set that is the same as my cylinder patch but in this way i can force the code to keep a reference of all cylinder faces on every subpartition. Is this correct?

If yes, how can i compute the "U.boundaryField()[CylPatch].snGrad()" ? Also if I do the Zone trick, I am not sure this keep enough information on every partition to be able to evaluate the normal gradient (it would need also some cell values and those are not available on every partition..).

I could do some trick like evaluating the gradient on every partition and then use gMax/gMin/gAverage to get a "complete" one... but I am not sure if it is feasible and anyway very likely it is not the best way to go..

Any idea?

Thanks for your help,

herbert June 16, 2010 06:13

Hi Matteo,

if you only need some integral values over the patch the most elegant way is using gMax/gMin/gAverage/gSum.


matteoL June 16, 2010 06:22

Hello Stefan,
thanks for the help.
Unfortunately I don't need integral values but punctual values of some quatity (i.e. th normal gradient of U) on all patch faces.

My idea is that every partition evaluate its share, and then I make them share "somehow" their information.. But how do i share them? Is there control of MPI comamnds in OF?

If not, the first trick that comes to my mind is initialze a vector to zero with lenght the total number of patch faces, let every partition fill its part locally (i need some sort of conenctivity information between local face index and globalfaceZone index) and then "reduce(max)" every compoment of the vector so to get the whole vector...
I know that this is completely unefficient, but at the moment this is the only solution that comes to my mind..

Any other idea?

All times are GMT -4. The time now is 15:46.