CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Parallel run crashes when trying to loop into faces of a patch (https://www.cfd-online.com/Forums/openfoam-programming-development/124375-parallel-run-crashes-when-trying-loop-into-faces-patch.html)

dgeorge8286 October 3, 2013 15:10

Parallel run crashes when trying to loop into faces of a patch
 
Hello everybody. I am trying to calculate a flux using an expression that is related to the value of pressure in 2 different patches of my domain.

To find the label of the patches, I am using:

label patchID1 = mesh.boundaryMesh().findPatchID("side1");
const polyPatch& cPatch1 = mesh.boundaryMesh()[patchID1];

label patchID2 = mesh.boundaryMesh().findPatchID("side2");
const polyPatch& cPatch2 = mesh.boundaryMesh()[patchID2];

This works fine. Then:

forAll(cPatch1, facei)
{
J.boundaryField()[patchID1][facei] = p.boundaryField()[patchID1][facei] - p.boundaryField()[patchID2][facei];
}

While in serial this works perfectly, in parallel the solver crashes. the two patches have the same number of faces. Can anybody help me in this?

I inspect that this is related to the communication of the processors but I am not sure how to fix it.

Thank you in advance.

ngj October 4, 2013 14:27

Hi George,

I would suspect that the decomposition is such that you have different number of faces on the two patches on each processor. Try to investigate processor*/constant/boundary, and you will probably see that the number of faces on the two patches is not the same per processor.

Another thing, which you might want to consider carefully, is that right now you assume a matching ordering of the faces. In general cases with might not be the case.

Kind regards,

Niels

dgeorge8286 October 4, 2013 15:27

Hi Niels,

Thank you very much for your response. Indeed it is the way you described it, however the option preservePatches in decomposeParDict doesn't seem to help.

George

jherb February 10, 2014 18:29

Probably too late, but nevertheless: Both patches (side1, side2) have to calculated by the same processor. So I guess preservePatches just guarantees that each patch is calculated by one processor but not all together. You might be able to do the calculation for each patch on an (arbitrary) processor and then use Pstream::scatter to exchange the information between the processors.

LESlie February 11, 2014 10:18

Which OpenFOAM version are you using?

LESlie February 11, 2014 10:21

Quote:

Originally Posted by ngj (Post 455103)
Hi George,

I would suspect that the decomposition is such that you have different number of faces on the two patches on each processor. Try to investigate processor*/constant/boundary, and you will probably see that the number of faces on the two patches is not the same per processor.

Another thing, which you might want to consider carefully, is that right now you assume a matching ordering of the faces. In general cases with might not be the case.

Kind regards,

Niels


Hi Niels,

How does one get face IDs of a polyPatch? I've just posted a thread http://www.cfd-online.com/Forums/ope...-boundary.html

and reading your comments I feel that you might have the answer. Thanks in advance!


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