From fe7f362d5740db90d1aa58000bc697193704fb53 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 2 Jan 2020 20:27:30 +0000 Subject: [PATCH] cyclic patches: Removed unnecessary definitions of and calls to doTransform --- .../manipulation/createPatch/createPatch.C | 2 +- .../constraint/cyclic/cyclicPointPatchField.H | 8 ---- .../processor/processorPointPatchField.H | 8 ---- .../processorCyclicPointPatchField.C | 13 +++--- .../processorCyclicPointPatchField.H | 8 ---- .../cyclicLduInterfaceField.H | 6 +-- .../processorLduInterfaceField.H | 6 +-- .../cyclicGAMGInterfaceField.H | 12 +++--- .../basic/coupled/coupledPolyPatch.C | 20 +++------ .../basic/coupled/coupledPolyPatch.H | 15 ------- .../constraint/cyclic/cyclicPolyPatch.C | 41 ++----------------- .../constraint/cyclic/cyclicPolyPatch.H | 16 +++++--- .../constraint/oldCyclic/oldCyclicPolyPatch.H | 6 ++- .../transform/transformer/transformer.H | 4 ++ .../transformer/transformerTemplates.C | 14 +++++++ .../constraint/cyclic/cyclicFvPatchField.C | 14 +------ .../cyclicAMI/cyclicAMIFvPatchField.C | 5 +-- .../cyclicAMI/cyclicAMIFvPatchField.H | 12 +++--- .../jumpCyclic/jumpCyclicFvPatchField.C | 18 ++------ .../jumpCyclicAMI/jumpCyclicAMIFvPatchField.C | 5 +-- .../processor/processorFvPatchField.C | 5 +-- .../processor/processorFvPatchField.H | 16 ++++---- .../processorCyclicFvPatchField.H | 18 +++++--- .../cyclicAMIPointPatchField.C | 8 +--- .../cyclicAMIPointPatchField.H | 8 ---- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 13 ------ .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 9 ++-- 27 files changed, 104 insertions(+), 206 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 6725b427c6..ee5fb16337 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -751,7 +751,7 @@ int main(int argc, char *argv[]) // This is a bit tricky. Both normal and position might be out and // current separation also includes the normal - // ( separation_ = (nf&(Cr - Cf))*nf ). + // (separation = (nf&(Cr - Cf))*nf ). // For cyclic patches: // - for separated ones use user specified offset vector diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H index 34edd903d3..767b9b5c2a 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H @@ -138,14 +138,6 @@ public: // Cyclic coupled interface functions - //- Does the patch field perform the transformation - virtual bool doTransform() const - { - return - cyclicPatch_.transform().rotates() - && pTraits::rank != 0; - } - //- Return transformation between the coupled patches virtual const transformer& transform() const { diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index 5d2ab59a0f..c3aa4c6c1f 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -146,14 +146,6 @@ public: } } - //- Does the patch field perform the transformation - virtual bool doTransform() const - { - return - procPatch_.procPolyPatch().transform().rotates() - && pTraits::rank != 0; - } - // Constraint handling diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C index 6ed5ca2b02..f71ae934d4 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C @@ -162,14 +162,11 @@ void Foam::processorCyclicPointPatchField::swapAddSeparated ); } - if (doTransform()) - { - procPatch_.procCyclicPolyPatch().transform().transform - ( - receiveBuf_, - receiveBuf_ - ); - } + procPatch_.procCyclicPolyPatch().transform().transform + ( + receiveBuf_, + receiveBuf_ + ); // All points are separated this->addToInternalField(pField, receiveBuf_); diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H index c7e1ddef54..823b2029d3 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H @@ -150,14 +150,6 @@ public: } } - //- Does the patch field perform the transformation - virtual bool doTransform() const - { - return - procPatch_.procPolyPatch().transform().rotates() - && pTraits::rank != 0; - } - // Evaluation functions diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H index 7bfa988d30..a11c8c6e4f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H @@ -72,12 +72,12 @@ public: // Access - //- Is the transform required - virtual bool doTransform() const = 0; - //- Return the transformation virtual const transformer& transform() const = 0; + //- Is the transform required + virtual bool doTransform() const = 0; + //- Return rank of component for transform virtual int rank() const = 0; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H index 1e1ed83d20..d1bfbc2759 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H @@ -81,15 +81,15 @@ public: //- Return neighbour processor number virtual int neighbProcNo() const = 0; - //- Is the transform required - virtual bool doTransform() const = 0; - //- Return transformation between the coupled patches virtual const transformer& transform() const = 0; //- Return rank of component for transform virtual int rank() const = 0; + //- Is the transform required + virtual bool doTransform() const = 0; + //- Transform given patch field template diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H index 92167abb25..7ad818a031 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H @@ -109,12 +109,6 @@ public: //- Cyclic interface functions - //- Does the interface field perform the transformation - virtual bool doTransform() const - { - return doTransform_; - } - //- Return the transformation virtual const transformer& transform() const { @@ -127,6 +121,12 @@ public: return rank_; } + //- Does the interface field perform the transformation + virtual bool doTransform() const + { + return doTransform_; + } + // Interface matrix update diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index 41395abee6..db5b4c0d11 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -315,9 +315,7 @@ Foam::coupledPolyPatch::coupledPolyPatch polyPatch(name, size, start, index, bm, patchType), matchTolerance_(defaultMatchTol_), ordering_(ordering), - transformType_(UNSPECIFIED), - parallel_(true), - separated_(false) + transformType_(UNSPECIFIED) {} @@ -344,9 +342,7 @@ Foam::coupledPolyPatch::coupledPolyPatch dict.found("transformType") ? transformTypeNames.read(dict.lookup("transformType")) : UNSPECIFIED - ), - parallel_(true), - separated_(false) + ) {} @@ -358,9 +354,7 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(pp, bm), matchTolerance_(pp.matchTolerance_), - transformType_(pp.transformType_), - parallel_(true), - separated_(false) + transformType_(pp.transformType_) {} @@ -375,9 +369,7 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(pp, bm, index, newSize, newStart), matchTolerance_(pp.matchTolerance_), - transformType_(pp.transformType_), - parallel_(true), - separated_(false) + transformType_(pp.transformType_) {} @@ -392,9 +384,7 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(pp, bm, index, mapAddressing, newStart), matchTolerance_(pp.matchTolerance_), - transformType_(pp.transformType_), - parallel_(true), - separated_(false) + transformType_(pp.transformType_) {} diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 46a19377b3..0e59448481 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -93,21 +93,6 @@ protected: //- Type of transformation transformTypes transformType_; - //- Are coupled patches parallel - mutable bool parallel_; - - //- Are coupled patches separated - mutable bool separated_; - - //- Offset (distance) vector from one side of the couple to the other - mutable vector separation_; - - //- Face transformation tensor - mutable tensor forwardT_; - - //- Neighbour-cell transformation tensor - mutable tensor reverseT_; - //- Transformation between the coupled patches mutable transformer transform_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 1f0b203982..bf449ead55 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -83,9 +83,6 @@ void Foam::cyclicPolyPatch::calcTransformTensors if (Cf.size() == 0) { // Dummy geometry. Assume non-separated, parallel. - parallel_ = true; - separated_ = false; - transform_ = transformer(); } else @@ -109,10 +106,6 @@ void Foam::cyclicPolyPatch::calcTransformTensors { // Type is rotation or unknown and normals not aligned - parallel_ = false; - separated_ = false; - separation_ = Zero; - tensorField forwardT(Cf.size()); tensorField reverseT(Cf.size()); @@ -129,21 +122,12 @@ void Foam::cyclicPolyPatch::calcTransformTensors << " local tolerance " << error << endl; } - forwardT_ = forwardT[0]; - reverseT_ = reverseT[0]; - transform_ = transformer(forwardT[0]); } else { // Translational or (unknown and normals aligned) - parallel_ = true; - - forwardT_ = Zero; - reverseT_ = Zero; - - // Three situations: // - separation is zero. No separation. // - separation is same. Single separation vector. @@ -190,9 +174,6 @@ void Foam::cyclicPolyPatch::calcTransformTensors << ". Assuming zero separation." << endl; } - separated_ = false; - separation_ = Zero; - transform_ = transformer(); } else @@ -204,9 +185,6 @@ void Foam::cyclicPolyPatch::calcTransformTensors << ". Assuming uniform separation." << endl; } - separated_ = true; - separation_ = separation[0]; - transform_ = transformer(separation[0]); } } @@ -216,9 +194,6 @@ void Foam::cyclicPolyPatch::calcTransformTensors << " Variation in separation greater than" << " local tolerance " << smallDist[0] << endl; - separated_ = true; - separation_ = separation[0]; - transform_ = transformer(separation[0]); } } @@ -468,12 +443,6 @@ void Foam::cyclicPolyPatch::calcTransforms ); const tensor revT(E1.T() & E0); - parallel_ = false; - separated_ = false; - separation_ = Zero; - forwardT_ = revT.T(); - reverseT_ = revT; - transform_ = transformer(revT.T()); } else if (transformType() == TRANSLATIONAL) @@ -515,12 +484,7 @@ void Foam::cyclicPolyPatch::calcTransforms } // Set transformation - parallel_ = true; - separated_ = true; - forwardT_ = Zero; - reverseT_ = Zero; - - transform_ = transformer(); + transform_ = transformer(separation_); } else { @@ -1576,11 +1540,14 @@ bool Foam::cyclicPolyPatch::order void Foam::cyclicPolyPatch::write(Ostream& os) const { coupledPolyPatch::write(os); + if (!neighbPatchName_.empty()) { writeEntry(os, "neighbourPatch", neighbPatchName_); } + coupleGroup_.write(os); + switch (transformType()) { case ROTATIONAL: diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index fe21de890a..16fb5053bc 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -76,14 +76,20 @@ class cyclicPolyPatch //- Index of other half mutable label neighbPatchID_; - // For rotation + // Specified transformation - //- Axis of rotation for rotational cyclics - vector rotationAxis_; + // For translation - //- Point on axis of rotation for rotational cyclics - point rotationCentre_; + //- Offset vector from one side of the cyclic to the other + vector separation_; + // For rotation + + //- Axis of rotation for rotational cyclics + vector rotationAxis_; + + //- Point on axis of rotation for rotational cyclics + point rotationCentre_; //- List of edges formed from connected points. e[0] is the point on // the first half of the patch, e[1] the corresponding point on the diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H index b5ece50f37..c41688a7c7 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,6 +60,10 @@ class oldCyclicPolyPatch // Used to split cyclic into halves. scalar featureCos_; + // For translation + + //- Offset vector from one side of the cyclic to the other + vector separation_; // For rotation diff --git a/src/OpenFOAM/primitives/transform/transformer/transformer.H b/src/OpenFOAM/primitives/transform/transformer/transformer.H index f2e965bb67..48f1654dca 100644 --- a/src/OpenFOAM/primitives/transform/transformer/transformer.H +++ b/src/OpenFOAM/primitives/transform/transformer/transformer.H @@ -196,6 +196,10 @@ public: template Type invTransform(const Type&) const; + //- Inverse transform the given field + template + void invTransform(Field&, const Field&) const; + //- Inverse transform the given field template tmp> invTransform(const Field&) const; diff --git a/src/OpenFOAM/primitives/transform/transformer/transformerTemplates.C b/src/OpenFOAM/primitives/transform/transformer/transformerTemplates.C index 06f7decc84..ad4c28e2d3 100644 --- a/src/OpenFOAM/primitives/transform/transformer/transformerTemplates.C +++ b/src/OpenFOAM/primitives/transform/transformer/transformerTemplates.C @@ -101,6 +101,20 @@ Type Foam::transformer::invTransform(const Type& x) const } +template +void Foam::transformer::invTransform +( + Field& res, + const Field& fld +) const +{ + if (rotates_) + { + Foam::transform(res, R().T(), fld); + } +} + + template Foam::tmp> Foam::transformer::invTransform ( diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 3229884d52..19dca4cc01 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -132,19 +132,9 @@ Foam::cyclicFvPatchField::patchNeighbourField() const Field& pnf = tpnf.ref(); - if (doTransform()) + forAll(pnf, facei) { - forAll(pnf, facei) - { - pnf[facei] = transform().transform(iField[nbrFaceCells[facei]]); - } - } - else - { - forAll(pnf, facei) - { - pnf[facei] = iField[nbrFaceCells[facei]]; - } + pnf[facei] = transform().transform(iField[nbrFaceCells[facei]]); } return tpnf; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 2acbe9a65b..a6b589690d 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -156,10 +156,7 @@ Foam::cyclicAMIFvPatchField::patchNeighbourField() const tpnf = cyclicAMIPatch_.interpolate(pnf); } - if (doTransform()) - { - transform().transform(tpnf.ref(), tpnf()); - } + transform().transform(tpnf.ref(), tpnf()); return tpnf; } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H index 5645e9c597..2ead572f5c 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H @@ -188,6 +188,12 @@ public: // Cyclic AMI coupled interface functions + //- Return transformation between the coupled patches + virtual const transformer& transform() const + { + return cyclicAMIPatch_.transform(); + } + //- Does the patch field perform the transformation virtual bool doTransform() const { @@ -196,12 +202,6 @@ public: && pTraits::rank != 0; } - //- Return transformation between the coupled patches - virtual const transformer& transform() const - { - return cyclicAMIPatch_.transform(); - } - //- Return rank of component for transform virtual int rank() const { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index 09b33663c7..02f1090cef 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -106,21 +106,11 @@ Foam::jumpCyclicFvPatchField::patchNeighbourField() const jf *= -1.0; } - if (this->doTransform()) + forAll(*this, facei) { - forAll(*this, facei) - { - pnf[facei] = - this->transform().transform(iField[nbrFaceCells[facei]]) - - jf[facei]; - } - } - else - { - forAll(*this, facei) - { - pnf[facei] = iField[nbrFaceCells[facei]] - jf[facei]; - } + pnf[facei] = + this->transform().transform(iField[nbrFaceCells[facei]]) + - jf[facei]; } return tpnf; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C index 28e837a057..8c60fea622 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C @@ -115,10 +115,7 @@ Foam::jumpCyclicAMIFvPatchField::patchNeighbourField() const tpnf = this->cyclicAMIPatch().interpolate(pnf); } - if (this->doTransform()) - { - this->transform().transform(tpnf.ref(), tpnf()); - } + this->transform().transform(tpnf.ref(), tpnf()); tmp> tjf = jump(); if (!this->cyclicAMIPatch().owner()) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index f86946f21e..98d5736972 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -295,10 +295,7 @@ void Foam::processorFvPatchField::evaluate procPatch_.compressedReceive(commsType, *this); } - if (doTransform()) - { - procPatch_.transform().transform(*this, *this); - } + procPatch_.transform().transform(*this, *this); } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index 705d189bb9..f545506105 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -261,14 +261,6 @@ public: return procPatch_.neighbProcNo(); } - //- Does the patch field perform the transformation - virtual bool doTransform() const - { - return - procPatch_.transform().rotates() - && pTraits::rank != 0; - } - //- Return transformation between the coupled patches virtual const transformer& transform() const { @@ -280,6 +272,14 @@ public: { return pTraits::rank; } + + //- Does the patch field perform the transformation + virtual bool doTransform() const + { + return + procPatch_.transform().rotates() + && pTraits::rank != 0; + } }; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H index 8cff755919..b1d7e10a5d 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H @@ -154,6 +154,18 @@ public: // Access + //- Return transformation between the coupled patches + virtual const transformer& transform() const + { + return procPatch_.transform(); + } + + //- Return rank of component for transform + virtual int rank() const + { + return pTraits::rank; + } + //- Does the patch field perform the transformation virtual bool doTransform() const { @@ -161,12 +173,6 @@ public: procPatch_.transform().rotates() && pTraits::rank != 0; } - - //- Return transformation between the coupled patches - virtual const transformer& transform() const - { - return procPatch_.transform(); - } }; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C index 0e7a544173..a3933b5429 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C @@ -151,12 +151,8 @@ void Foam::cyclicAMIPointPatchField::swapAddSeparated Field ptFld(this->patchInternalField(pField)); Field nbrPtFld(nbr.patchInternalField(pField)); - - if (doTransform()) - { - ptFld = transform().invTransform(ptFld); - nbrPtFld = transform().transform(nbrPtFld); - } + transform().invTransform(ptFld, ptFld); + transform().transform(nbrPtFld, nbrPtFld); // convert point field to face field, AMI interpolate, then // face back to point diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H index 0f2f3f52f6..29d886cc8a 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H @@ -183,14 +183,6 @@ public: // Cyclic AMI coupled interface functions - //- Does the patch field perform the transformation - virtual bool doTransform() const - { - return - cyclicAMIPatch_.transform().rotates() - && pTraits::rank != 0; - } - //- Return transformation between the coupled patches virtual const transformer& transform() const { diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index a91b21b85f..ca2805fbd0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -227,11 +227,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms } } - parallel_ = false; - separated_ = false; separation_ = Zero; - forwardT_ = revT.T(); - reverseT_ = revT; transform_ = transformer(revT.T()); @@ -246,11 +242,6 @@ void Foam::cyclicAMIPolyPatch::calcTransforms << endl; } - parallel_ = true; - separated_ = true; - forwardT_ = Zero; - reverseT_ = Zero; - transform_ = transformer(separation_); break; @@ -263,11 +254,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms << " Assuming cyclic AMI pairs are colocated" << endl; } - parallel_ = true; - separated_ = false; separation_ = Zero; - forwardT_ = Zero; - reverseT_ = Zero; transform_ = transformer(); diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index 8f7e9c04c7..a43f1a0067 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,8 +81,12 @@ protected: //- Index of other half mutable label nbrPatchID_; + // Specified transformation - // Transformations + // For translation + + //- Offset vector from one side of the cyclic to the other + vector separation_; // For rotation @@ -98,7 +102,6 @@ protected: //- Rotation angle scalar rotationAngle_; - //- AMI interpolation classes mutable PtrList AMIs_;