BUG: pressurePIDControlInletVelocity: incorporate faceZones on processor boundaries

It was not correctly interpolating faceZones which are on processor boundaries.
This caused difference between serial and parallel running. Fixes #16.
This commit is contained in:
mattijs
2015-11-30 14:48:50 +00:00
parent aef2fd5ef4
commit 9d4e09bbd1

View File

@ -30,6 +30,7 @@ License
#include "surfaceFields.H" #include "surfaceFields.H"
#include "linear.H" #include "linear.H"
#include "steadyStateDdtScheme.H" #include "steadyStateDdtScheme.H"
#include "syncTools.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -78,6 +79,8 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::faceZoneAverage
{ {
const fvMesh& mesh(patch().boundaryMesh().mesh()); const fvMesh& mesh(patch().boundaryMesh().mesh());
PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(mesh));
const faceZone& zone = mesh.faceZones()[name]; const faceZone& zone = mesh.faceZones()[name];
area = 0; area = 0;
@ -87,10 +90,23 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::faceZoneAverage
{ {
const label f(zone[faceI]); const label f(zone[faceI]);
const scalar da(mesh.magSf()[f]); if (mesh.isInternalFace(f))
{
const scalar da(mesh.magSf()[f]);
area += da; area += da;
average += da*field[f]; average += da*field[f];
}
else if (isMasterFace[f])
{
const label bf(f-mesh.nInternalFaces());
const label patchID = mesh.boundaryMesh().patchID()[bf];
const label lf(mesh.boundaryMesh()[patchID].whichFace(f));
const scalar da(mesh.magSf().boundaryField()[patchID][lf]);
area += da;
average += da*field.boundaryField()[patchID][lf];
}
} }
reduce(area, sumOp<scalar>()); reduce(area, sumOp<scalar>());