From 42a9078dad14ff0e7394eb9676c14852604496c2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 20 Oct 2021 14:51:38 +0100 Subject: [PATCH] ENH: decomposePar: cyclicAMI in constraints. Fixes #2242 --- .../decompositionConstraint.C | 93 ++++++++++++++++- .../decompositionConstraint.H | 9 ++ .../preserveFaceZonesConstraint.C | 99 +++++++++---------- .../preservePatchesConstraint.C | 76 +++++++------- 4 files changed, 182 insertions(+), 95 deletions(-) diff --git a/src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C b/src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C index 7c24d3dec8..12f8a316c6 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C +++ b/src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2017 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,8 @@ License \*---------------------------------------------------------------------------*/ #include "decompositionConstraint.H" +#include "syncTools.H" +#include "cyclicAMIPolyPatch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -36,6 +38,95 @@ namespace Foam 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