diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H index e15434bc6a..23664464d3 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H index 0eaa0b92e8..46599dfc48 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/functionObjects/field/mapFields/mapFields.H b/src/functionObjects/field/mapFields/mapFields.H index a699b31392..873ab0899b 100644 --- a/src/functionObjects/field/mapFields/mapFields.H +++ b/src/functionObjects/field/mapFields/mapFields.H @@ -98,7 +98,6 @@ Usage \verbatim nearestFaceAMI faceAreaWeightAMI - partialFaceAreaWeightAMI \endverbatim The inherited entries are elaborated in: diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 96ba959fa0..7f6d4ea540 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -1246,7 +1246,7 @@ void Foam::AMIInterpolation::write(Ostream& os) const if (reverseTarget_) { - os.writeEntry("flipNormals", reverseTarget_); + os.writeEntry("reverseTarget", reverseTarget_); } if (lowWeightCorrection_ > 0) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index 7a2259066e..f691d6ace3 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -364,6 +364,9 @@ public: //- Access to the requireMatch flag inline bool setRequireMatch(const bool flag); + //- Return true if requireMatch and lowWeightCorrectionin active + inline bool mustMatchFaces() const; + //- Access to the reverseTarget flag inline bool reverseTarget() const; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H index 22823a23ec..1effda0385 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,7 +73,7 @@ inline bool Foam::AMIInterpolation::distributed() const inline bool Foam::AMIInterpolation::requireMatch() const { - return requireMatch_ && lowWeightCorrection_ < 0; + return requireMatch_; } @@ -84,6 +84,12 @@ inline bool Foam::AMIInterpolation::setRequireMatch(const bool flag) } +inline bool Foam::AMIInterpolation::mustMatchFaces() const +{ + return requireMatch_ && !applyLowWeightCorrection(); +} + + inline bool Foam::AMIInterpolation::reverseTarget() const { return reverseTarget_; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C index dc41c132ea..7c03cbed1c 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C @@ -55,7 +55,7 @@ void Foam::advancingFrontAMI::checkPatches() const } - if (conformal()) + if (requireMatch_) { const scalar maxBoundsError = 0.05; @@ -345,6 +345,27 @@ void Foam::advancingFrontAMI::triangulatePatch } +void Foam::advancingFrontAMI::nonConformalCorrection() +{ + if (!requireMatch_ && distributed()) + { + scalarList newTgtMagSf(std::move(tgtMagSf_)); + + // Assign default sizes. Override selected values with calculated + // values. This is to support ACMI where some of the target faces + // are never used (so never get sent over and hence never assigned + // to) + tgtMagSf_ = tgtPatch0().magFaceAreas(); + + for (const labelList& smap : this->extendedTgtMapPtr_->subMap()) + { + UIndirectList(tgtMagSf_, smap) = + UIndirectList(newTgtMagSf, smap); + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::advancingFrontAMI::advancingFrontAMI @@ -421,7 +442,8 @@ bool Foam::advancingFrontAMI::calculate { if (AMIInterpolation::calculate(srcPatch, tgtPatch, surfPtr)) { - // Create a representation of the target patch that covers the source patch + // Create a representation of the target patch that covers the source + // patch if (distributed()) { createExtendedTgtPatch(); @@ -454,10 +476,4 @@ bool Foam::advancingFrontAMI::calculate } -bool Foam::advancingFrontAMI::conformal() const -{ - return true; -} - - // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H index 84031daa73..07e08b68d8 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H @@ -199,6 +199,9 @@ protected: List& magSf ) const; + //- Correction for non-conformal interpolations, e.g. for ACMI + virtual void nonConformalCorrection(); + public: @@ -249,10 +252,6 @@ public: //- Labels of faces that are not overlapped by any target faces // Note: this should be empty for correct functioning inline const labelList& srcNonOverlap() const; - - //- Flag to indicate that interpolation patches are conformal, i.e. - //- should fully cover each other - virtual bool conformal() const; }; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C index e6fbbb1816..395b1830f4 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -115,6 +115,9 @@ void Foam::faceAreaWeightAMI::calcAddressing // Reset starting seed label startSeedi = 0; + // Should all faces be matched? + const bool mustMatch = mustMatchFaces(); + bool continueWalk = true; DynamicList