Skip to content
Snippets Groups Projects

ENH: decomposePar: cyclicAMI in constraints. Fixes #2242

Merged Mattijs Janssens requested to merge feature-decompositionConstraints_cyclicAMI into develop
4 files
+ 177
90
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -6,7 +6,7 @@
@@ -6,7 +6,7 @@
\\/ M anipulation |
\\/ M anipulation |
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
License
License
This file is part of OpenFOAM.
This file is part of OpenFOAM.
@@ -27,6 +27,8 @@ License
@@ -27,6 +27,8 @@ License
\*---------------------------------------------------------------------------*/
\*---------------------------------------------------------------------------*/
#include "decompositionConstraint.H"
#include "decompositionConstraint.H"
 
#include "syncTools.H"
 
#include "cyclicAMIPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -36,6 +38,95 @@ namespace Foam
@@ -36,6 +38,95 @@ namespace Foam
defineRunTimeSelectionTable(decompositionConstraint, dictionary);
defineRunTimeSelectionTable(decompositionConstraint, dictionary);
}
}
 
 
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
 
 
void Foam::decompositionConstraint::getMinBoundaryValue
 
(
 
const polyMesh& mesh,
 
const labelList& decomposition,
 
labelList& destProc
 
) const
 
{
 
destProc.setSize(mesh.nBoundaryFaces());
 
destProc = labelMax;
 
 
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
 
 
for (const polyPatch& pp : pbm)
 
{
 
const labelUList& faceCells = pp.faceCells();
 
 
forAll(faceCells, i)
 
{
 
label bFacei = pp.offset()+i;
 
destProc[bFacei] = decomposition[faceCells[i]];
 
}
 
}
 
 
// Take minimum of coupled faces (over all patches!)
 
syncTools::syncBoundaryFaceList(mesh, destProc, minEqOp<label>());
 
 
// Do cyclicAMI ourselves
 
for (const auto& pp : pbm)
 
{
 
const auto* ppp = isA<cyclicAMIPolyPatch>(pp);
 
if (ppp)
 
{
 
const auto& cycPp = *ppp;
 
const auto& nbrPp = cycPp.neighbPatch();
 
const labelList nbrDecomp(decomposition, nbrPp.faceCells());
 
labelList thisDecomp(decomposition, cycPp.faceCells());
 
 
if (cycPp.owner())
 
{
 
cycPp.AMI().interpolateToSource
 
(
 
nbrDecomp,
 
[]
 
(
 
label& res,
 
const label facei,
 
const label& fld,
 
const scalar& w
 
)
 
{
 
res = min(res, fld);
 
},
 
thisDecomp,
 
thisDecomp // used in case of low-weight-corr
 
);
 
}
 
else
 
{
 
nbrPp.AMI().interpolateToTarget
 
(
 
nbrDecomp,
 
[]
 
(
 
label& res,
 
const label facei,
 
const label& fld,
 
const scalar& w
 
)
 
{
 
res = min(res, fld);
 
},
 
thisDecomp,
 
thisDecomp // used in case of low-weight-corr
 
);
 
}
 
 
forAll(thisDecomp, i)
 
{
 
label& proc = destProc[cycPp.offset()+i];
 
proc = min(proc, thisDecomp[i]);
 
}
 
}
 
}
 
}
 
 
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::decompositionConstraint::decompositionConstraint
Foam::decompositionConstraint::decompositionConstraint
Loading