From 25d874034b2692d5893ac13aa6c69c6dfe3f8338 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 20 Mar 2014 11:02:51 +0000 Subject: [PATCH] ENH: Updated ACMI to allow fully disconnected regions --- .../AMIInterpolation/AMIInterpolation.C | 53 ++++++++++++------- .../AMIInterpolation/AMIInterpolation.H | 6 +++ .../AMIMethod/AMIMethod/AMIMethod.C | 34 ++++++++---- .../AMIMethod/AMIMethod/AMIMethod.H | 25 +++++++-- .../AMIMethod/AMIMethod/AMIMethodNew.C | 9 ++-- .../AMIMethod/directAMI/directAMI.C | 8 +-- .../AMIMethod/directAMI/directAMI.H | 5 +- .../faceAreaWeightAMI/faceAreaWeightAMI.C | 4 +- .../faceAreaWeightAMI/faceAreaWeightAMI.H | 3 +- .../AMIMethod/mapNearestAMI/mapNearestAMI.C | 6 ++- .../AMIMethod/mapNearestAMI/mapNearestAMI.H | 5 +- .../partialFaceAreaWeightAMI.C | 8 +-- .../partialFaceAreaWeightAMI.H | 5 +- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.C | 12 ++++- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 6 +++ .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 39 +++++++------- .../mappedPolyPatch/mappedPatchBase.C | 1 + .../regionCoupledBase.C | 1 + .../regionModel/regionModel/regionModel.C | 2 + .../meshToMesh/meshToMesh.C | 1 + 20 files changed, 162 insertions(+), 71 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 3dd2863e98..cd586639f2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -206,32 +206,40 @@ void Foam::AMIInterpolation::normaliseWeights ) { // Normalise the weights - wghtSum.setSize(wght.size()); + wghtSum.setSize(wght.size(), 0.0); label nLowWeight = 0; forAll(wght, faceI) { scalarList& w = wght[faceI]; - scalar denom = patchAreas[faceI]; - scalar s = sum(w); - scalar t = s/denom; - - if (conformal) + if (w.size()) { - denom = s; + scalar denom = patchAreas[faceI]; + + scalar s = sum(w); + scalar t = s/denom; + + if (conformal) + { + denom = s; + } + + forAll(w, i) + { + w[i] /= denom; + } + + wghtSum[faceI] = t; + + if (t < lowWeightTol) + { + nLowWeight++; + } } - - forAll(w, i) + else { - w[i] /= denom; - } - - wghtSum[faceI] = t; - - if (t < lowWeightTol) - { - nLowWeight++; + wghtSum[faceI] = 0; } } @@ -534,6 +542,7 @@ Foam::AMIInterpolation::AMIInterpolation const SourcePatch& srcPatch, const TargetPatch& tgtPatch, const faceAreaIntersect::triangulationMode& triMode, + const bool requireMatch, const interpolationMethod& method, const scalar lowWeightCorrection, const bool reverseTarget @@ -541,6 +550,7 @@ Foam::AMIInterpolation::AMIInterpolation : method_(method), reverseTarget_(reverseTarget), + requireMatch_(requireMatch), singlePatchProc_(-999), lowWeightCorrection_(lowWeightCorrection), srcAddress_(), @@ -564,6 +574,7 @@ Foam::AMIInterpolation::AMIInterpolation const TargetPatch& tgtPatch, const autoPtr& surfPtr, const faceAreaIntersect::triangulationMode& triMode, + const bool requireMatch, const interpolationMethod& method, const scalar lowWeightCorrection, const bool reverseTarget @@ -571,6 +582,7 @@ Foam::AMIInterpolation::AMIInterpolation : method_(method), reverseTarget_(reverseTarget), + requireMatch_(requireMatch), singlePatchProc_(-999), lowWeightCorrection_(lowWeightCorrection), srcAddress_(), @@ -654,6 +666,7 @@ Foam::AMIInterpolation::AMIInterpolation : method_(fineAMI.method_), reverseTarget_(fineAMI.reverseTarget_), + requireMatch_(fineAMI.requireMatch_), singlePatchProc_(fineAMI.singlePatchProc_), lowWeightCorrection_(-1.0), srcAddress_(), @@ -862,7 +875,8 @@ void Foam::AMIInterpolation::update srcMagSf_, tgtMagSf_, triMode_, - reverseTarget_ + reverseTarget_, + requireMatch_ ) ); @@ -978,7 +992,8 @@ void Foam::AMIInterpolation::update srcMagSf_, tgtMagSf_, triMode_, - reverseTarget_ + reverseTarget_, + requireMatch_ ) ); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index a8193358c4..7dbacd9efa 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -116,6 +116,10 @@ private: // that the orientation of the target patch should be reversed const bool reverseTarget_; + //- Flag to indicate that the two patches must be matched/an overlap + // exists between them + const bool requireMatch_; + //- Index of processor that holds all of both sides. -1 in all other // cases label singlePatchProc_; @@ -276,6 +280,7 @@ public: const SourcePatch& srcPatch, const TargetPatch& tgtPatch, const faceAreaIntersect::triangulationMode& triMode, + const bool requireMatch = true, const interpolationMethod& method = imFaceAreaWeight, const scalar lowWeightCorrection = -1, const bool reverseTarget = false @@ -288,6 +293,7 @@ public: const TargetPatch& tgtPatch, const autoPtr& surf, const faceAreaIntersect::triangulationMode& triMode, + const bool requireMatch = true, const interpolationMethod& method = imFaceAreaWeight, const scalar lowWeightCorrection = -1, const bool reverseTarget = false diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C index eb9406c562..292d816732 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C @@ -98,6 +98,10 @@ bool Foam::AMIMethod::initialise ( "void Foam::AMIMethod::initialise" "(" + "labelListList&, " + "scalarListList&, " + "labelListList&, " + "scalarListList&, " "label&, " "label&" ")" @@ -129,14 +133,24 @@ bool Foam::AMIMethod::initialise if (!foundFace) { - FatalErrorIn - ( - "void Foam::AMIMethod::initialise" - "(" - "label&, " - "label&" - ")" - ) << "Unable to find initial target face" << abort(FatalError); + if (requireMatch_) + { + FatalErrorIn + ( + "void Foam::AMIMethod::initialise" + "(" + "labelListList&, " + "scalarListList&, " + "labelListList&, " + "scalarListList&, " + "label&, " + "label&" + ")" + ) << "Unable to find initial target face" + << abort(FatalError); + } + + return false; } } @@ -327,12 +341,14 @@ Foam::AMIMethod::AMIMethod const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ) : srcPatch_(srcPatch), tgtPatch_(tgtPatch), reverseTarget_(reverseTarget), + requireMatch_(requireMatch), srcMagSf_(srcMagSf), tgtMagSf_(tgtMagSf), srcNonOverlap_(), diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H index 673a695a33..06afc1a280 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,6 +85,10 @@ protected: // that the orientation of the target patch should be reversed const bool reverseTarget_; + //- Flag to indicate that the two patches must be matched/an overlap + // exists between them + const bool requireMatch_; + //- Source face areas const scalarField& srcMagSf_; @@ -166,9 +170,18 @@ public: const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ), - (srcPatch, tgtPatch, srcMagSf, tgtMagSf, triMode, reverseTarget) + ( + srcPatch, + tgtPatch, + srcMagSf, + tgtMagSf, + triMode, + reverseTarget, + requireMatch + ) ); //- Construct from components @@ -179,7 +192,8 @@ public: const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ); //- Selector @@ -191,7 +205,8 @@ public: const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethodNew.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethodNew.C index 39cc1d3f8f..d06294d583 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethodNew.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethodNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,8 @@ Foam::AMIMethod::New const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ) { if (debug) @@ -58,6 +59,7 @@ Foam::AMIMethod::New "const scalarField&, " "const scalarField&, " "const faceAreaIntersect::triangulationMode&, " + "const bool, " "const bool" ")" ) << "Unknown AMIMethod type " @@ -75,7 +77,8 @@ Foam::AMIMethod::New srcMagSf, tgtMagSf, triMode, - reverseTarget + reverseTarget, + requireMatch ) ); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C index fa5d0b73e1..70673d31d9 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,7 +106,8 @@ Foam::directAMI::directAMI const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ) : AMIMethod @@ -116,7 +117,8 @@ Foam::directAMI::directAMI srcMagSf, tgtMagSf, triMode, - reverseTarget + reverseTarget, + requireMatch ) {} diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H index e7842ff9f8..dc273c792d 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,7 +102,8 @@ public: const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget = false + const bool reverseTarget = false, + const bool requireMatch = true ); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C index 05dcd1e295..d9cfb8402a 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -482,6 +482,7 @@ Foam::faceAreaWeightAMI::faceAreaWeightAMI const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, const bool reverseTarget, + const bool requireMatch, const bool restartUncoveredSourceFace ) : @@ -492,7 +493,8 @@ Foam::faceAreaWeightAMI::faceAreaWeightAMI srcMagSf, tgtMagSf, triMode, - reverseTarget + reverseTarget, + requireMatch ), restartUncoveredSourceFace_(restartUncoveredSourceFace) {} diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H index d1a48a5423..2d1b552018 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -144,6 +144,7 @@ public: const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, const bool reverseTarget = false, + const bool requireMatch = true, const bool restartUncoveredSourceFace = true ); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C index be6f590fa0..59d8c5cdb1 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C @@ -183,7 +183,8 @@ Foam::mapNearestAMI::mapNearestAMI const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ) : AMIMethod @@ -193,7 +194,8 @@ Foam::mapNearestAMI::mapNearestAMI srcMagSf, tgtMagSf, triMode, - reverseTarget + reverseTarget, + requireMatch ) {} diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H index 0daf26662d..86d8c615f2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,7 +116,8 @@ public: const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget = false + const bool reverseTarget = false, + const bool requireMatch = true ); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C index ad0f6376b1..4eddbe6328 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,8 @@ partialFaceAreaWeightAMI const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget + const bool reverseTarget, + const bool requireMatch ) : faceAreaWeightAMI @@ -73,7 +74,8 @@ partialFaceAreaWeightAMI srcMagSf, tgtMagSf, triMode, - reverseTarget + reverseTarget, + requireMatch ) {} diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H index 4fd0ea2494..de8afcf0ef 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,8 @@ public: const scalarField& srcMagSf, const scalarField& tgtMagSf, const faceAreaIntersect::triangulationMode& triMode, - const bool reverseTarget = false + const bool reverseTarget = false, + const bool requireMatch = true ); diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C index f8fdacbd3c..426eb5ced0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C @@ -208,6 +208,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch tgtMask_(), updated_(false) { + AMIRequireMatch_ = false; + // Non-overlapping patch might not be valid yet so cannot determine // associated patchID } @@ -230,6 +232,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch tgtMask_(), updated_(false) { + AMIRequireMatch_ = false; + if (nonOverlapPatchName_ == name) { FatalIOErrorIn @@ -267,6 +271,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch tgtMask_(), updated_(false) { + AMIRequireMatch_ = false; + // Non-overlapping patch might not be valid yet so cannot determine // associated patchID } @@ -291,6 +297,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch tgtMask_(), updated_(false) { + AMIRequireMatch_ = false; + if (nonOverlapPatchName_ == name()) { FatalErrorIn @@ -328,7 +336,9 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch srcMask_(), tgtMask_(), updated_(false) -{} +{ + AMIRequireMatch_ = false; +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index b8284d438e..8c41bc6bb7 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -388,6 +388,7 @@ void Foam::cyclicAMIPolyPatch::resetAMI nbrPatch0, surfPtr(), faceAreaIntersect::tmMesh, + AMIRequireMatch_, AMIMethod, AMILowWeightCorrection_, AMIReverse_ @@ -501,6 +502,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch separationVector_(vector::zero), AMIPtr_(NULL), AMIReverse_(false), + AMIRequireMatch_(true), AMILowWeightCorrection_(-1.0), surfPtr_(NULL), surfDict_(fileName("surface")) @@ -530,6 +532,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch separationVector_(vector::zero), AMIPtr_(NULL), AMIReverse_(dict.lookupOrDefault("flipNormals", false)), + AMIRequireMatch_(true), AMILowWeightCorrection_(dict.lookupOrDefault("lowWeightCorrection", -1.0)), surfPtr_(NULL), surfDict_(dict.subOrEmptyDict("surface")) @@ -639,6 +642,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch separationVector_(pp.separationVector_), AMIPtr_(NULL), AMIReverse_(pp.AMIReverse_), + AMIRequireMatch_(pp.AMIRequireMatch_), AMILowWeightCorrection_(pp.AMILowWeightCorrection_), surfPtr_(NULL), surfDict_(pp.surfDict_) @@ -669,6 +673,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch separationVector_(pp.separationVector_), AMIPtr_(NULL), AMIReverse_(pp.AMIReverse_), + AMIRequireMatch_(pp.AMIRequireMatch_), AMILowWeightCorrection_(pp.AMILowWeightCorrection_), surfPtr_(NULL), surfDict_(pp.surfDict_) @@ -713,6 +718,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch separationVector_(pp.separationVector_), AMIPtr_(NULL), AMIReverse_(pp.AMIReverse_), + AMIRequireMatch_(pp.AMIRequireMatch_), AMILowWeightCorrection_(pp.AMILowWeightCorrection_), surfPtr_(NULL), surfDict_(pp.surfDict_) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index c9c0055a47..40cfc95e25 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -56,7 +56,24 @@ class cyclicAMIPolyPatch private: - // Private data + // Private Member Functions + + //- Return normal of face at max distance from rotation axis + vector findFaceNormalMaxRadius(const pointField& faceCentres) const; + + void calcTransforms + ( + const primitivePatch& half0, + const pointField& half0Ctrs, + const vectorField& half0Areas, + const pointField& half1Ctrs, + const vectorField& half1Areas + ); + + +protected: + + // Protected data //- Name of other half mutable word nbrPatchName_; @@ -97,6 +114,9 @@ private: //- Flag to indicate that slave patch should be reversed for AMI const bool AMIReverse_; + //- Flag to indicate that patches should match/overlap + bool AMIRequireMatch_; + //- Low weight correction threshold for AMI const scalar AMILowWeightCorrection_; @@ -107,23 +127,6 @@ private: const dictionary surfDict_; - // Private Member Functions - - //- Return normal of face at max distance from rotation axis - vector findFaceNormalMaxRadius(const pointField& faceCentres) const; - - void calcTransforms - ( - const primitivePatch& half0, - const pointField& half0Ctrs, - const vectorField& half0Areas, - const pointField& half1Ctrs, - const vectorField& half1Areas - ); - - -protected: - // Protected Member Functions //- Reset the AMI interpolator diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index d4e157635a..6ab8930a42 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -836,6 +836,7 @@ void Foam::mappedPatchBase::calcAMI() const samplePolyPatch(), // nbrPatch0, surfPtr(), faceAreaIntersect::tmMesh, + true, AMIPatchToPatchInterpolation::imFaceAreaWeight, -1, AMIReverse_ diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C index 224a104c3c..a18e83da1d 100644 --- a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C @@ -91,6 +91,7 @@ void Foam::regionCoupledBase::resetAMI() const nbrPatch0, surfPtr(), faceAreaIntersect::tmMesh, + true, AMIPatchToPatchInterpolation::imFaceAreaWeight, -1, AMIReverse_ diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 5e147d22f5..46eae95592 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -242,6 +242,7 @@ Foam::regionModels::regionModel::interRegionAMI p, nbrP, faceAreaIntersect::tmMesh, + true, AMIPatchToPatchInterpolation::imFaceAreaWeight, -1, flip @@ -284,6 +285,7 @@ Foam::regionModels::regionModel::interRegionAMI p, nbrP, faceAreaIntersect::tmMesh, + true, AMIPatchToPatchInterpolation::imFaceAreaWeight, -1, flip diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C index eebb219a6f..2b2b7e978d 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C @@ -419,6 +419,7 @@ Foam::meshToMesh::patchAMIs() const srcPP, tgtPP, faceAreaIntersect::tmMesh, + false, interpolationMethodAMI(method_), -1, true // flip target patch since patch normals are aligned