mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: pairPatchAgglomeration - updated constructors
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,7 +69,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
bool writeAgglom = readBool(agglomDict.lookup("writeFacesAgglomeration"));
|
||||
|
||||
|
||||
const polyBoundaryMesh& boundary = mesh.boundaryMesh();
|
||||
|
||||
labelListIOList finalAgglom
|
||||
@ -95,15 +94,20 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
label patchi = patchids[i];
|
||||
const polyPatch& pp = boundary[patchi];
|
||||
|
||||
if (!pp.coupled())
|
||||
{
|
||||
Info << "\nAgglomerating patch : " << pp.name() << endl;
|
||||
|
||||
pairPatchAgglomeration agglomObject
|
||||
(
|
||||
pp,
|
||||
pp.localFaces(),
|
||||
pp.localPoints(),
|
||||
agglomDict.subDict(pp.name())
|
||||
);
|
||||
|
||||
agglomObject.agglomerate();
|
||||
|
||||
finalAgglom[patchi] =
|
||||
agglomObject.restrictTopBottomAddressing();
|
||||
|
||||
@ -116,42 +120,42 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// - All patches which are not agglomarated are identity for finalAgglom
|
||||
forAll(boundary, patchid)
|
||||
// All patches which are not agglomerated are identity for finalAgglom
|
||||
forAll(boundary, patchi)
|
||||
{
|
||||
if (finalAgglom[patchid].size() == 0)
|
||||
if (finalAgglom[patchi].size() == 0)
|
||||
{
|
||||
finalAgglom[patchid] = identity(boundary[patchid].size());
|
||||
finalAgglom[patchi] = identity(boundary[patchi].size());
|
||||
}
|
||||
}
|
||||
|
||||
// Sync agglomeration across coupled patches
|
||||
labelList nbrAgglom(mesh.nFaces() - mesh.nInternalFaces(), -1);
|
||||
|
||||
forAll(boundary, patchid)
|
||||
forAll(boundary, patchi)
|
||||
{
|
||||
const polyPatch& pp = boundary[patchid];
|
||||
const polyPatch& pp = boundary[patchi];
|
||||
if (pp.coupled())
|
||||
{
|
||||
finalAgglom[patchid] = identity(pp.size());
|
||||
finalAgglom[patchi] = identity(pp.size());
|
||||
forAll(pp, i)
|
||||
{
|
||||
nbrAgglom[pp.start() - mesh.nInternalFaces() + i] =
|
||||
finalAgglom[patchid][i];
|
||||
const label agglomi = pp.start() - mesh.nInternalFaces() + i;
|
||||
nbrAgglom[agglomi] = finalAgglom[patchi][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::swapBoundaryFaceList(mesh, nbrAgglom);
|
||||
forAll(boundary, patchid)
|
||||
forAll(boundary, patchi)
|
||||
{
|
||||
const polyPatch& pp = boundary[patchid];
|
||||
const polyPatch& pp = boundary[patchi];
|
||||
if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
finalAgglom[patchid][i] =
|
||||
nbrAgglom[pp.start() - mesh.nInternalFaces() + i];
|
||||
const label agglomi = pp.start() - mesh.nInternalFaces() + i
|
||||
finalAgglom[patchi][i] = nbrAgglom[agglomi];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,13 +183,13 @@ int main(int argc, char *argv[])
|
||||
facesAgglomeration.boundaryFieldRef();
|
||||
|
||||
label coarsePatchIndex = 0;
|
||||
forAll(boundary, patchid)
|
||||
forAll(boundary, patchi)
|
||||
{
|
||||
const polyPatch& pp = boundary[patchid];
|
||||
const polyPatch& pp = boundary[patchi];
|
||||
if (pp.size() > 0)
|
||||
{
|
||||
fvPatchScalarField& bFacesAgglomeration =
|
||||
facesAgglomerationBf[patchid];
|
||||
facesAgglomerationBf[patchi];
|
||||
|
||||
forAll(bFacesAgglomeration, j)
|
||||
{
|
||||
@ -193,11 +197,11 @@ int main(int argc, char *argv[])
|
||||
index.toGlobal
|
||||
(
|
||||
Pstream::myProcNo(),
|
||||
finalAgglom[patchid][j] + coarsePatchIndex
|
||||
finalAgglom[patchi][j] + coarsePatchIndex
|
||||
);
|
||||
}
|
||||
|
||||
coarsePatchIndex += max(finalAgglom[patchid]) + 1;
|
||||
coarsePatchIndex += max(finalAgglom[patchi]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user