mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
patchMeanVelocityForce: Add support for processorCyclic patches
If the mean velocity force is applied to a cyclic patch for parallel
runs include contributions from processorCyclic patches generated
from the decomposition of the cyclic patch
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,12 +74,52 @@ Foam::scalar Foam::fv::patchMeanVelocityForce::magUbarAve
|
||||
const volVectorField& U
|
||||
) const
|
||||
{
|
||||
return
|
||||
gSum
|
||||
vector2D sumAmagUsumA
|
||||
(
|
||||
sum
|
||||
(
|
||||
(flowDir_ & U.boundaryField()[patchi_])
|
||||
*mesh_.boundary()[patchi_].magSf()
|
||||
)/gSum(mesh_.boundary()[patchi_].magSf());
|
||||
),
|
||||
sum(mesh_.boundary()[patchi_].magSf())
|
||||
);
|
||||
|
||||
|
||||
// If the mean velocity force is applied to a cyclic patch
|
||||
// for parallel runs include contributions from processorCyclic patches
|
||||
// generated from the decomposition of the cyclic patch
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
if (Pstream::parRun() && isA<cyclicPolyPatch>(patches[patchi_]))
|
||||
{
|
||||
const keyType processorCyclicPatchNames
|
||||
(
|
||||
string("procBoundary.*to.*through" + patch_)
|
||||
);
|
||||
|
||||
labelList processorCyclicPatches
|
||||
(
|
||||
patches.findIndices(processorCyclicPatchNames)
|
||||
);
|
||||
|
||||
forAll(processorCyclicPatches, pcpi)
|
||||
{
|
||||
const label patchi = processorCyclicPatches[pcpi];
|
||||
|
||||
sumAmagUsumA.x() +=
|
||||
sum
|
||||
(
|
||||
(flowDir_ & U.boundaryField()[patchi])
|
||||
*mesh_.boundary()[patchi].magSf()
|
||||
);
|
||||
|
||||
sumAmagUsumA.y() += sum(mesh_.boundary()[patchi].magSf());
|
||||
}
|
||||
}
|
||||
|
||||
mesh_.reduce(sumAmagUsumA, sumOp<vector2D>());
|
||||
|
||||
return sumAmagUsumA.x()/sumAmagUsumA.y();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user