mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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,11 +90,24 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::faceZoneAverage
|
|||||||
{
|
{
|
||||||
const label f(zone[faceI]);
|
const label f(zone[faceI]);
|
||||||
|
|
||||||
|
if (mesh.isInternalFace(f))
|
||||||
|
{
|
||||||
const scalar da(mesh.magSf()[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>());
|
||||||
reduce(average, sumOp<Type>());
|
reduce(average, sumOp<Type>());
|
||||||
|
|||||||
Reference in New Issue
Block a user