From 03207b15384897c05cfecd835a8aad6acc251915 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 25 Dec 2019 11:26:30 +0000 Subject: [PATCH] Coupled patch transformations: Removed the hideous and unphysical non-uniform transformation support The implementation of the optional non-uniform transformations in coupled patches was based on transform property lists which could be either length 0 for no transformation, 1 for uniform transformation or n-faces for non-uniform transformation. This complexity was maintenance nightmare but kept to support the hack in the original film implementation to partially work around the conservation error. Now that film has been re-implemented in fully mass conservative form this unphysical non-uniform transformation support is no longer needed and the coupled patch transformations have been completely refactored to be simpler and more rational with single values for the transformation properties and boolians to indicate which transformations are needed. --- .../manipulation/createPatch/createPatch.C | 78 +++------- .../constraint/cyclic/cyclicPointPatchField.C | 6 +- .../constraint/cyclic/cyclicPointPatchField.H | 9 +- .../processorCyclicPointPatchField.C | 5 +- .../lduInterface/cyclicLduInterface.H | 6 +- .../lduInterface/processorLduInterface.H | 2 +- .../cyclicLduInterfaceField.C | 11 +- .../cyclicLduInterfaceField.H | 15 +- .../processorLduInterfaceField.C | 11 +- .../processorLduInterfaceField.H | 13 +- .../cyclicGAMGInterfaceField.H | 4 +- .../processorGAMGInterfaceField.H | 2 +- .../cyclicGAMGInterface/cyclicGAMGInterface.H | 8 +- .../processorGAMGInterface.C | 2 +- .../processorGAMGInterface.H | 6 +- .../meshes/lduMesh/lduPrimitiveMesh.C | 2 +- .../constraint/cyclic/cyclicPointPatch.H | 4 +- .../basic/coupled/coupledPolyPatch.C | 128 ++++++++-------- .../basic/coupled/coupledPolyPatch.H | 44 +++--- .../constraint/cyclic/cyclicPolyPatch.C | 63 ++------ .../constraint/processor/processorPolyPatch.C | 11 -- .../processorCyclicPolyPatch.C | 10 ++ .../processorCyclicPolyPatch.H | 14 +- .../globalIndexAndTransform.C | 145 +++++++----------- .../constraint/cyclic/cyclicFvPatchField.C | 4 +- .../constraint/cyclic/cyclicFvPatchField.H | 4 +- .../cyclicAMI/cyclicAMIFvPatchField.H | 4 +- .../jumpCyclic/jumpCyclicFvPatchField.C | 4 +- .../processor/processorFvPatchField.H | 2 +- .../processorCyclicFvPatchField.H | 2 +- .../fvPatches/basic/coupled/coupledFvPatch.H | 10 +- .../constraint/cyclic/cyclicFvPatch.C | 2 +- .../constraint/cyclic/cyclicFvPatch.H | 4 +- .../constraint/cyclicAMI/cyclicAMIFvPatch.C | 2 +- .../constraint/cyclicAMI/cyclicAMIFvPatch.H | 4 +- .../constraint/processor/processorFvPatch.H | 4 +- .../processorCyclic/processorCyclicFvPatch.H | 4 +- src/lagrangian/basic/particle/particle.C | 16 +- .../basic/particle/particleTemplates.C | 34 +--- .../cyclicAMIGAMGInterfaceField.H | 4 +- .../cyclicAMIGAMGInterface.H | 4 +- .../cyclicAMILduInterface.H | 6 +- .../cyclicAMILduInterfaceField.C | 11 +- .../cyclicAMILduInterfaceField.H | 15 +- .../cyclicAMIPointPatch/cyclicAMIPointPatch.H | 4 +- .../cyclicAMIPointPatchField.C | 7 +- .../cyclicAMIPointPatchField.H | 4 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 111 ++++---------- .../cyclicRepeatAMIPolyPatch.C | 23 +-- .../algorithms/MeshWave/FaceCellWave.C | 22 +-- .../algorithms/MeshWave/FaceCellWave.H | 2 +- .../algorithms/PointEdgeWave/PointEdgeWave.C | 26 +--- .../algorithms/PointEdgeWave/PointEdgeWave.H | 2 +- 53 files changed, 322 insertions(+), 618 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 7aabfc7862..969d2b4aa2 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -261,38 +261,6 @@ void writeCyclicMatchObjs(const fileName& prefix, const polyMesh& mesh) } -void separateList -( - const vectorField& separation, - UList& field -) -{ - if (separation.size() == 1) - { - // Single value for all. - - forAll(field, i) - { - field[i] += separation[0]; - } - } - else if (separation.size() == field.size()) - { - forAll(field, i) - { - field[i] += separation[i]; - } - } - else - { - FatalErrorInFunction - << "Sizes of field and transformation not equal. field:" - << field.size() << " transformation:" << separation.size() - << abort(FatalError); - } -} - - // Synchronise points on both sides of coupled boundaries. template void syncPoints @@ -397,7 +365,7 @@ void syncPoints else if (procPatch.separated()) { hasTransformation = true; - separateList(-procPatch.separation(), nbrPatchInfo); + nbrPatchInfo -= procPatch.separation(); } const labelList& meshPts = procPatch.meshPoints(); @@ -447,7 +415,7 @@ void syncPoints else if (cycPatch.separated()) { hasTransformation = true; - separateList(cycPatch.separation(), half0Values); + half0Values += cycPatch.separation(); } forAll(coupledPoints, i) @@ -800,8 +768,8 @@ int main(int argc, char *argv[]) if (cpp.separated()) { Info<< "On coupled patch " << pp.name() - << " separation[0] was " - << cpp.separation()[0] << endl; + << " separation was " + << cpp.separation() << endl; if (isA(pp) && pp.size()) { @@ -814,19 +782,15 @@ int main(int argc, char *argv[]) Info<< "On cyclic translation patch " << pp.name() << " forcing uniform separation of " << cycpp.separationVector() << endl; - const_cast(cpp.separation()) = - pointField(1, cycpp.separationVector()); + const_cast(cpp.separation()) = + cycpp.separationVector(); } else { const cyclicPolyPatch& nbr = cycpp.neighbPatch(); - const_cast(cpp.separation()) = - pointField - ( - 1, - nbr[0].centre(mesh.points()) - - cycpp[0].centre(mesh.points()) - ); + const_cast(cpp.separation()) = + nbr[0].centre(mesh.points()) + - cycpp[0].centre(mesh.points()); } } Info<< "On coupled patch " << pp.name() @@ -835,22 +799,18 @@ int main(int argc, char *argv[]) } else if (!cpp.parallel()) { - Info<< "On coupled patch " << pp.name() - << " forcing uniform rotation of " - << cpp.forwardT()[0] << endl; - - const_cast - ( - cpp.forwardT() - ).setSize(1); - const_cast - ( - cpp.reverseT() - ).setSize(1); - Info<< "On coupled patch " << pp.name() << " forcing uniform rotation of " << cpp.forwardT() << endl; + + // const_cast + // ( + // cpp.forwardT() + // ).setSize(1); + // const_cast + // ( + // cpp.reverseT() + // ).setSize(1); } } } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C index 576b1eceba..48e44111aa 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -147,8 +147,8 @@ void Foam::cyclicPointPatchField::swapAddSeparated label nbrPointi = pairs[pairi][1]; Type tmp = pf[pointi]; - pf[pointi] = transform(forwardT()[0], nbrPf[nbrPointi]); - nbrPf[nbrPointi] = transform(reverseT()[0], tmp); + pf[pointi] = transform(forwardT(), nbrPf[nbrPointi]); + nbrPf[nbrPointi] = transform(reverseT(), tmp); } } else diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H index 26e9f4d14f..4175beb71e 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H @@ -127,7 +127,7 @@ public: // Member Functions - //- Constraint handling + // Constraint handling //- Return the constraint type this pointPatchField implements virtual const word& constraintType() const @@ -135,7 +135,8 @@ public: return cyclicPointPatch::typeName; } - //- Cyclic coupled interface functions + + // Cyclic coupled interface functions //- Does the patch field perform the transformation virtual bool doTransform() const @@ -144,13 +145,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicPatch_.reverseT(); } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C index df77ae4b4c..d7a924d00b 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -167,9 +167,8 @@ void Foam::processorCyclicPointPatchField::swapAddSeparated { const processorCyclicPolyPatch& ppp = procPatch_.procCyclicPolyPatch(); - const tensor& forwardT = ppp.forwardT()[0]; - transform(receiveBuf_, forwardT, receiveBuf_); + transform(receiveBuf_, ppp.forwardT(), receiveBuf_); } // All points are separated diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.H index 76ae917064..46738f13d4 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,10 +74,10 @@ public: virtual const cyclicLduInterface& neighbPatch() const = 0; //- Return face transformation tensor - virtual const tensorField& forwardT() const = 0; + virtual const tensor& forwardT() const = 0; //- Return face reverse transformation tensor - virtual const tensorField& reverseT() const = 0; + virtual const tensor& reverseT() const = 0; }; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H index 19cfbe9781..37ee99bacd 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H @@ -94,7 +94,7 @@ public: virtual int neighbProcNo() const = 0; //- Return face transformation tensor - virtual const tensorField& forwardT() const = 0; + virtual const tensor& forwardT() const = 0; //- Return message tag used for sending virtual int tag() const = 0; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C index 40632215c8..7fe4188ced 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,14 +50,7 @@ void Foam::cyclicLduInterfaceField::transformCoupleField { if (doTransform()) { - if (forwardT().size() == 1) - { - f *= pow(diag(forwardT()[0]).component(cmpt), rank()); - } - else - { - f *= pow(diag(forwardT())().component(cmpt), rank()); - } + f *= pow(diag(forwardT()).component(cmpt), rank()); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H index cc194ab7c7..17fbc1d5b3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,10 +75,10 @@ public: virtual bool doTransform() const = 0; //- Return face transformation tensor - virtual const tensorField& forwardT() const = 0; + virtual const tensor& forwardT() const = 0; //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const = 0; + virtual const tensor& reverseT() const = 0; //- Return rank of component for transform virtual int rank() const = 0; @@ -113,14 +113,7 @@ void Foam::cyclicLduInterfaceField::transformCoupleField { if (doTransform()) { - if (forwardT().size() == 1) - { - transform(f, forwardT()[0], f); - } - else - { - transform(f, forwardT(), f); - } + transform(f, forwardT(), f); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C index 5337233caa..b6177259c4 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,14 +50,7 @@ void Foam::processorLduInterfaceField::transformCoupleField { if (doTransform()) { - if (forwardT().size() == 1) - { - f *= pow(diag(forwardT()[0]).component(cmpt), rank()); - } - else - { - f *= pow(diag(forwardT())().component(cmpt), rank()); - } + f *= pow(diag(forwardT()).component(cmpt), rank()); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H index 93b8d74b23..66edd906eb 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ public: virtual bool doTransform() const = 0; //- Return face transformation tensor - virtual const tensorField& forwardT() const = 0; + virtual const tensor& forwardT() const = 0; //- Return rank of component for transform virtual int rank() const = 0; @@ -119,14 +119,7 @@ void Foam::processorLduInterfaceField::transformCoupleField { if (doTransform()) { - if (forwardT().size() == 1) - { - transform(f, forwardT()[0], f); - } - else - { - transform(f, forwardT(), f); - } + transform(f, forwardT(), f); } } 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 09469528b7..078bdd4871 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H @@ -116,13 +116,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicInterface_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicInterface_.reverseT(); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H index 1efbce5138..723956eaf4 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H @@ -175,7 +175,7 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return procInterface_.forwardT(); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H index c371282c64..27e1d5a4dc 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H @@ -61,10 +61,10 @@ class cyclicGAMGInterface bool owner_; //- Transformation tensor - tensorField forwardT_; + tensor forwardT_; //- Transformation tensor - tensorField reverseT_; + tensor reverseT_; public: @@ -138,13 +138,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return forwardT_; } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return reverseT_; } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C index 8eaff8df60..3d85fe54ed 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C @@ -146,7 +146,7 @@ Foam::processorGAMGInterface::processorGAMGInterface const label coarseComm, const label myProcNo, const label neighbProcNo, - const tensorField& forwardT, + const tensor& forwardT, const int tag ) : diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H index da2db72d0a..ce1cb0308f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H @@ -64,7 +64,7 @@ class processorGAMGInterface label neighbProcNo_; //- Transformation tensor - tensorField forwardT_; + tensor forwardT_; //- Message tag used for sending int tag_; @@ -100,7 +100,7 @@ public: const label coarseComm, const label myProcNo, const label neighbProcNo, - const tensorField& forwardT, + const tensor& forwardT, const int tag ); @@ -160,7 +160,7 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return forwardT_; } diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C index 3c0c9c5093..dfcafd0a18 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C @@ -926,7 +926,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh comm_, myAgglom, neighbProcNo, - tensorField(), // forwardT + Zero, // forwardT Pstream::msgType() // tag ) ); diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H index 6ffc6beb07..8dbb826516 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H @@ -139,13 +139,13 @@ public: } //- Return face transformation tensor - const tensorField& forwardT() const + const tensor& forwardT() const { return cyclicPolyPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - const tensorField& reverseT() const + const tensor& reverseT() const { return cyclicPolyPatch_.reverseT(); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index cbe97362b2..28bbbb71f0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -322,10 +322,8 @@ void Foam::coupledPolyPatch::calcTransformTensors if (Cf.size() == 0) { // Dummy geometry. Assume non-separated, parallel. - separation_.setSize(0); - forwardT_.clear(); - reverseT_.clear(); - collocated_.setSize(0); + parallel_ = true; + separated_ = false; } else { @@ -348,70 +346,56 @@ void Foam::coupledPolyPatch::calcTransformTensors { // Type is rotation or unknown and normals not aligned - // Assume per-face differing transformation, correct later + parallel_ = false; + separated_ = false; + separation_ = Zero; - separation_.setSize(0); + tensorField forwardT(Cf.size()); + tensorField reverseT(Cf.size()); - forwardT_.setSize(Cf.size()); - reverseT_.setSize(Cf.size()); - collocated_.setSize(Cf.size()); - collocated_ = false; - - forAll(forwardT_, facei) + forAll(forwardT, facei) { - forwardT_[facei] = rotationTensor(-nr[facei], nf[facei]); - reverseT_[facei] = rotationTensor(nf[facei], -nr[facei]); + forwardT[facei] = rotationTensor(-nr[facei], nf[facei]); + reverseT[facei] = rotationTensor(nf[facei], -nr[facei]); } - if (debug) + if (sum(mag(forwardT - forwardT[0])) > error) { - Pout<< " sum(mag(forwardT_ - forwardT_[0])):" - << sum(mag(forwardT_ - forwardT_[0])) - << endl; + Pout<< "--> FOAM Warning : " + << " Variation in rotation greater than" + << " local tolerance " << error << endl; } - if (sum(mag(forwardT_ - forwardT_[0])) < error) - { - forwardT_.setSize(1); - reverseT_.setSize(1); - collocated_.setSize(1); - - if (debug) - { - Pout<< " difference in rotation less than" - << " local tolerance " - << error << ". Assuming uniform rotation." << endl; - } - } + forwardT_ = forwardT[0]; + reverseT_ = reverseT[0]; } else { // Translational or (unknown and normals aligned) - forwardT_.setSize(0); - reverseT_.setSize(0); + parallel_ = true; - separation_ = Cr - Cf; + forwardT_ = Zero; + reverseT_ = Zero; - collocated_.setSize(separation_.size()); // Three situations: // - separation is zero. No separation. // - separation is same. Single separation vector. - // - separation differs per face. Separation vectorField. + // - separation differs per face -> error. // Check for different separation per face bool sameSeparation = true; bool doneWarning = false; - forAll(separation_, facei) - { - scalar smallSqr = sqr(smallDist[facei]); + const vectorField separation(Cr - Cf); - collocated_[facei] = (magSqr(separation_[facei]) < smallSqr); + forAll(separation, facei) + { + const scalar smallSqr = sqr(smallDist[facei]); // Check if separation differing w.r.t. face 0. - if (magSqr(separation_[facei] - separation_[0]) > smallSqr) + if (magSqr(separation[facei] - separation[0]) > smallSqr) { sameSeparation = false; @@ -419,9 +403,9 @@ void Foam::coupledPolyPatch::calcTransformTensors { doneWarning = true; - Pout<< " separation " << separation_[facei] + Pout<< " separation " << separation[facei] << " at " << facei - << " differs from separation[0] " << separation_[0] + << " differs from separation[0] " << separation[0] << " by more than local tolerance " << smallDist[facei] << ". Assuming non-uniform separation." << endl; @@ -431,39 +415,42 @@ void Foam::coupledPolyPatch::calcTransformTensors if (sameSeparation) { - // Check for zero separation (at 0 so everywhere) - if (collocated_[0]) + // Check for zero separation + if (mag(separation[0]) < smallDist[0]) { if (debug) { - Pout<< " separation " << mag(separation_[0]) + Pout<< " separation " << mag(separation[0]) << " less than local tolerance " << smallDist[0] << ". Assuming zero separation." << endl; } - separation_.setSize(0); - collocated_ = boolList(1, true); + separated_ = false; + separation_ = Zero; } else { if (debug) { - Pout<< " separation " << mag(separation_[0]) + Pout<< " separation " << mag(separation[0]) << " more than local tolerance " << smallDist[0] << ". Assuming uniform separation." << endl; } - separation_.setSize(1); - collocated_ = boolList(1, false); + separated_ = true; + separation_ = separation[0]; } } - } - } + else + { + Pout<< "--> FOAM Warning : " + << " Variation in separation greater than" + << " local tolerance " << smallDist[0] << endl; - if (debug) - { - Pout<< " separation_:" << separation_.size() << nl - << " forwardT size:" << forwardT_.size() << endl; + separated_ = true; + separation_ = separation[0]; + } + } } } @@ -483,7 +470,9 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(name, size, start, index, bm, patchType), matchTolerance_(defaultMatchTol_), - transform_(transform) + transform_(transform), + parallel_(true), + separated_(false) {} @@ -504,7 +493,9 @@ Foam::coupledPolyPatch::coupledPolyPatch dict.found("transform") ? transformTypeNames.read(dict.lookup("transform")) : defaultTransform - ) + ), + parallel_(true), + separated_(false) {} @@ -516,7 +507,9 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(pp, bm), matchTolerance_(pp.matchTolerance_), - transform_(pp.transform_) + transform_(pp.transform_), + parallel_(true), + separated_(false) {} @@ -531,7 +524,9 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(pp, bm, index, newSize, newStart), matchTolerance_(pp.matchTolerance_), - transform_(pp.transform_) + transform_(pp.transform_), + parallel_(true), + separated_(false) {} @@ -546,7 +541,9 @@ Foam::coupledPolyPatch::coupledPolyPatch : polyPatch(pp, bm, index, mapAddressing, newStart), matchTolerance_(pp.matchTolerance_), - transform_(pp.transform_) + transform_(pp.transform_), + parallel_(true), + separated_(false) {} @@ -561,11 +558,8 @@ Foam::coupledPolyPatch::~coupledPolyPatch() void Foam::coupledPolyPatch::write(Ostream& os) const { polyPatch::write(os); - // if (matchTolerance_ != defaultMatchTol_) - { - writeEntry(os, "matchTolerance", matchTolerance_); - writeEntry(os, "transform", transformTypeNames[transform_]); - } + writeEntry(os, "matchTolerance", matchTolerance_); + writeEntry(os, "transform", transformTypeNames[transform_]); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 67cc5dae4b..9778545a6d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -68,9 +68,9 @@ public: static const NamedEnum transformTypeNames; -private: +protected: - // Private Data + // Protected Data //- Default matching tolerance static const scalar defaultMatchTol_; @@ -81,17 +81,21 @@ private: //- Type of transformation transformType transform_; + //- 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 vectorField separation_; + mutable vector separation_; //- Face transformation tensor - mutable tensorField forwardT_; + mutable tensor forwardT_; //- Neighbour-cell transformation tensor - mutable tensorField reverseT_; + mutable tensor reverseT_; - //- Are faces collocated. Either size 0,1 or length of patch. - mutable boolList collocated_; protected: @@ -274,42 +278,36 @@ public: //- Transform a patch-based position from other side to this side virtual void transformPosition(point&, const label facei) const = 0; + //- Are the cyclic planes parallel. + virtual bool parallel() const + { + return parallel_; + } + //- Are the planes separated. virtual bool separated() const { - return separation_.size(); + return separated_; } //- If the planes are separated the separation vector. - virtual const vectorField& separation() const + virtual const vector& separation() const { return separation_; } - //- Are the cyclic planes parallel. - virtual bool parallel() const - { - return forwardT_.empty(); - } - //- Return face transformation tensor. - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return forwardT_; } //- Return neighbour-cell transformation tensor. - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return reverseT_; } - //- Are faces collocated. Either size 0,1 or length of patch - virtual const boolList& collocated() const - { - return collocated_; - } - scalar matchTolerance() const { return matchTolerance_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index cf5e0a7063..b37d6cb25b 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -291,10 +291,11 @@ void Foam::cyclicPolyPatch::calcTransforms ); const tensor revT(E1.T() & E0); - const_cast(forwardT()) = tensorField(1, revT.T()); - const_cast(reverseT()) = tensorField(1, revT); - const_cast(separation()).setSize(0); - const_cast(collocated()) = boolList(1, false); + parallel_ = false; + separated_ = false; + separation_ = Zero; + forwardT_ = revT.T(); + reverseT_ = revT; } else { @@ -351,11 +352,7 @@ void Foam::cyclicPolyPatch::calcTransforms // Override computed transform with specified. - if - ( - separation().size() != 1 - || mag(separation()[0] - separationVector_) > avgTol - ) + if (mag(separation() - separationVector_) > avgTol) { WarningInFunction << "Specified separationVector " << separationVector_ @@ -372,14 +369,11 @@ void Foam::cyclicPolyPatch::calcTransforms } // Set tensors - const_cast(forwardT()).clear(); - const_cast(reverseT()).clear(); - const_cast(separation()) = vectorField - ( - 1, - separationVector_ - ); - const_cast(collocated()) = boolList(1, false); + parallel_ = true; + separated_ = true; + separation_ = separationVector_; + forwardT_ = Zero; + reverseT_ = Zero; } } } @@ -869,19 +863,7 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const { // transformPosition gets called on the receiving side, // separation gets calculated on the sending side so subtract. - - const vectorField& s = separation(); - if (s.size() == 1) - { - forAll(l, i) - { - l[i] -= s[0]; - } - } - else - { - l -= s; - } + l -= separation(); } } @@ -890,32 +872,19 @@ void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const { if (!parallel()) { - const tensor& T = - ( - forwardT().size() == 1 - ? forwardT()[0] - : forwardT()[facei] - ); - if (transform() == ROTATIONAL) { - l = Foam::transform(T, l-rotationCentre_) + rotationCentre_; + l = Foam::transform(forwardT(), l - rotationCentre_) + + rotationCentre_; } else { - l = Foam::transform(T, l); + l = Foam::transform(forwardT(), l); } } else if (separated()) { - const vector& s = - ( - separation().size() == 1 - ? separation()[0] - : separation()[facei] - ); - - l -= s; + l -= separation(); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index ca03d3ff62..1c9d12b5ba 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -308,17 +308,6 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf; } } - - calcTransformTensors - ( - faceCentres(), - neighbFaceCentres_, - faceNormals, - nbrFaceNormals, - matchTolerance()*tols, - matchTolerance(), - transform() - ); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index c9a09f35b1..505f798daf 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -237,6 +237,16 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) if (Pstream::parRun()) { + calcTransformTensors + ( + faceCentres(), + neighbFaceCentres(), + faceAreas()/mag(faceAreas()), + neighbFaceAreas()/mag(neighbFaceAreas()), + matchTolerance()*calcFaceTol(*this, points(), faceCentres()), + matchTolerance(), + transform() + ); // Where do we store the calculated transformation? // - on the processor patch? diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index a872387dca..9e40ddc794 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -352,7 +352,7 @@ public: } //- If the planes are separated the separation vector. - virtual const vectorField& separation() const + virtual const vector& separation() const { return referPatch().separation(); } @@ -364,24 +364,17 @@ public: } //- Return face transformation tensor. - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return referPatch().forwardT(); } //- Return neighbour-cell transformation tensor. - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return referPatch().reverseT(); } - //- Are faces collocated. Either size 0,1 or length of patch - virtual const boolList& collocated() const - { - return referPatch().collocated(); - } - - //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; @@ -399,7 +392,6 @@ public: labelList& rotation ) const; - //- Write the polyPatch data as a dictionary virtual void write(Ostream&) const; }; diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C index 4a6000dd9d..853f1a3a0b 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -159,61 +159,51 @@ void Foam::globalIndexAndTransform::determineTransforms() if (cpp.separated()) { - const vectorField& sepVecs = cpp.separation(); + const vector& sepVec = cpp.separation(); - forAll(sepVecs, sVI) + if (mag(sepVec) > small) { - const vector& sepVec = sepVecs[sVI]; + vectorTensorTransform transform(sepVec); - if (mag(sepVec) > small) - { - vectorTensorTransform transform(sepVec); - - if + if + ( + matchTransform ( - matchTransform - ( - localTransforms, - dummyMatch, - transform, - cpp.matchTolerance(), - false - ) == 0 - ) - { - localTransforms.append(transform); - localTols.append(cpp.matchTolerance()); - } + localTransforms, + dummyMatch, + transform, + cpp.matchTolerance(), + false + ) == 0 + ) + { + localTransforms.append(transform); + localTols.append(cpp.matchTolerance()); } } } else if (!cpp.parallel()) { - const tensorField& transTensors = cpp.reverseT(); + const tensor& transT = cpp.reverseT(); - forAll(transTensors, tTI) + if (mag(transT - I) > small) { - const tensor& transT = transTensors[tTI]; + vectorTensorTransform transform(transT); - if (mag(transT - I) > small) - { - vectorTensorTransform transform(transT); - - if + if + ( + matchTransform ( - matchTransform - ( - localTransforms, - dummyMatch, - transform, - cpp.matchTolerance(), - false - ) == 0 - ) - { - localTransforms.append(transform); - localTols.append(cpp.matchTolerance()); - } + localTransforms, + dummyMatch, + transform, + cpp.matchTolerance(), + false + ) == 0 + ) + { + localTransforms.append(transform); + localTols.append(cpp.matchTolerance()); } } } @@ -343,60 +333,43 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign() if (cpp.separated()) { - const vectorField& sepVecs = cpp.separation(); + const vector& sepVec = cpp.separation(); - // This loop is implicitly expecting only a single - // value for separation() - forAll(sepVecs, sVI) + if (mag(sepVec) > small) { - const vector& sepVec = sepVecs[sVI]; + vectorTensorTransform t(sepVec); - if (mag(sepVec) > small) - { - vectorTensorTransform t(sepVec); - - label matchTransI; - label sign = matchTransform - ( - transforms_, - matchTransI, - t, - cpp.matchTolerance(), - true - ); - patchTransformSign_[patchi] = - labelPair(matchTransI, sign); - } + label matchTransI; + label sign = matchTransform + ( + transforms_, + matchTransI, + t, + cpp.matchTolerance(), + true + ); + patchTransformSign_[patchi] = labelPair(matchTransI, sign); } - } else if (!cpp.parallel()) { - const tensorField& transTensors = cpp.reverseT(); + const tensor& transT = cpp.reverseT(); - // This loop is implicitly expecting only a single - // value for reverseT() - forAll(transTensors, tTI) + if (mag(transT - I) > small) { - const tensor& transT = transTensors[tTI]; + vectorTensorTransform t(transT); - if (mag(transT - I) > small) - { - vectorTensorTransform t(transT); + label matchTransI; + label sign = matchTransform + ( + transforms_, + matchTransI, + t, + cpp.matchTolerance(), + true + ); - label matchTransI; - label sign = matchTransform - ( - transforms_, - matchTransI, - t, - cpp.matchTolerance(), - true - ); - - patchTransformSign_[patchi] = - labelPair(matchTransI, sign); - } + patchTransformSign_[patchi] = labelPair(matchTransI, sign); } } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 3d1d85acc8..a5dd13d2c2 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,7 +138,7 @@ Foam::cyclicFvPatchField::patchNeighbourField() const { pnf[facei] = transform ( - forwardT()[0], iField[nbrFaceCells[facei]] + forwardT(), iField[nbrFaceCells[facei]] ); } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H index 22f54ac405..8bed3bae51 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H @@ -190,13 +190,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicPatch_.reverseT(); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H index 382373abf4..3e59faa445 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H @@ -196,13 +196,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicAMIPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicAMIPatch_.reverseT(); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index b82be55b0b..0d7c5310bb 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,7 +112,7 @@ Foam::jumpCyclicFvPatchField::patchNeighbourField() const { pnf[facei] = transform ( - this->forwardT()[0], iField[nbrFaceCells[facei]] + this->forwardT(), iField[nbrFaceCells[facei]] ) - jf[facei]; } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index d9e2a1340d..556cb9924f 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -268,7 +268,7 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return procPatch_.forwardT(); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H index c9101f4852..e60735cbfc 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H @@ -161,7 +161,7 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return procPatch_.forwardT(); } diff --git a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H index 23bf7fa221..c04cd4a201 100644 --- a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H @@ -100,14 +100,14 @@ public: return coupledPolyPatch_.coupled(); } - //- Are the cyclic planes parallel. + //- Are the cyclic planes parallel virtual bool parallel() const = 0; - //- Return face transformation tensor. - virtual const tensorField& forwardT() const = 0; + //- Return face transformation tensor + virtual const tensor& forwardT() const = 0; - //- Return neighbour-cell transformation tensor. - virtual const tensorField& reverseT() const = 0; + //- Return neighbour-cell transformation tensor + virtual const tensor& reverseT() const = 0; //- Return faceCell addressing virtual const labelUList& faceCells() const diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C index ff7ff06732..93f00ba92b 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C @@ -97,7 +97,7 @@ Foam::tmp Foam::cyclicFvPatch::delta() const vector ddi = patchD[facei]; vector dni = nbrPatchD[facei]; - pdv[facei] = ddi - transform(forwardT()[0], dni); + pdv[facei] = ddi - transform(forwardT(), dni); } } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H index 5384b49dc3..3494baa99c 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H @@ -120,13 +120,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicPolyPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicPolyPatch_.reverseT(); } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C index 2b0a9ba1ec..874343f39d 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C @@ -156,7 +156,7 @@ Foam::tmp Foam::cyclicAMIFvPatch::delta() const const vector& ddi = patchD[facei]; const vector& dni = nbrPatchD[facei]; - pdv[facei] = ddi - transform(forwardT()[0], dni); + pdv[facei] = ddi - transform(forwardT(), dni); } } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H index 5aad5b33ce..cca5a76a18 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H @@ -146,13 +146,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicAMIPolyPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicAMIPolyPatch_.reverseT(); } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H index d4e8ddb620..33155229e5 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H @@ -133,13 +133,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return procPolyPatch_.forwardT(); } //- Return neighbour-cell transformation tensor. - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return procPolyPatch_.reverseT(); } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H index 12020662ae..ce05321432 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H @@ -92,13 +92,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return procPolyPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return procPolyPatch_.reverseT(); } diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index e30e376f86..7f1d975bdc 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -1069,23 +1069,11 @@ void Foam::particle::correctAfterParallelTransfer if (!ppp.parallel()) { - const tensor& T = - ( - ppp.forwardT().size() == 1 - ? ppp.forwardT()[0] - : ppp.forwardT()[facei_] - ); - transformProperties(T); + transformProperties(ppp.forwardT()); } else if (ppp.separated()) { - const vector& s = - ( - (ppp.separation().size() == 1) - ? ppp.separation()[0] - : ppp.separation()[facei_] - ); - transformProperties(-s); + transformProperties(-ppp.separation()); } // Set the topology diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index c8c927b7a7..84a6e12e44 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -280,23 +280,11 @@ void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&) // Transform the properties if (!receiveCpp.parallel()) { - const tensor& T = - ( - receiveCpp.forwardT().size() == 1 - ? receiveCpp.forwardT()[0] - : receiveCpp.forwardT()[receiveFacei] - ); - transformProperties(T); + transformProperties(receiveCpp.forwardT()); } else if (receiveCpp.separated()) { - const vector& s = - ( - (receiveCpp.separation().size() == 1) - ? receiveCpp.separation()[0] - : receiveCpp.separation()[receiveFacei] - ); - transformProperties(-s); + transformProperties(-receiveCpp.separation()); } } @@ -388,24 +376,12 @@ void Foam::particle::hitCyclicAMIPatch if (!receiveCpp.parallel()) { - const tensor& T = - ( - receiveCpp.forwardT().size() == 1 - ? receiveCpp.forwardT()[0] - : receiveCpp.forwardT()[facei_] - ); - transformProperties(T); - displacementT = transform(T, displacementT); + transformProperties(receiveCpp.forwardT()); + displacementT = transform(receiveCpp.forwardT(), displacementT); } else if (receiveCpp.separated()) { - const vector& s = - ( - (receiveCpp.separation().size() == 1) - ? receiveCpp.separation()[0] - : receiveCpp.separation()[facei_] - ); - transformProperties(-s); + transformProperties(-receiveCpp.separation()); } // If on a boundary and the displacement points into the receiving face diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H index 534b176e0a..c99d49ddff 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H @@ -132,13 +132,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicAMIInterface_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicAMIInterface_.reverseT(); } diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H index fe593dc292..b0c547705e 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H @@ -142,13 +142,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return fineCyclicAMIInterface_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return fineCyclicAMIInterface_.reverseT(); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H index f38ca281ff..2feb8a2e49 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,10 +88,10 @@ public: AMITransforms() const = 0; //- Return face transformation tensor - virtual const tensorField& forwardT() const = 0; + virtual const tensor& forwardT() const = 0; //- Return face reverse transformation tensor - virtual const tensorField& reverseT() const = 0; + virtual const tensor& reverseT() const = 0; }; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C index 9fb5142fa8..3f088dc83a 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,14 +50,7 @@ void Foam::cyclicAMILduInterfaceField::transformCoupleField { if (doTransform()) { - if (forwardT().size() == 1) - { - f *= pow(diag(forwardT()[0]).component(cmpt), rank()); - } - else - { - f *= pow(diag(forwardT())().component(cmpt), rank()); - } + f *= pow(diag(forwardT()).component(cmpt), rank()); } } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H index 8232ee6f12..5f892b39e8 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,10 +74,10 @@ public: virtual bool doTransform() const = 0; //- Return face transformation tensor - virtual const tensorField& forwardT() const = 0; + virtual const tensor& forwardT() const = 0; //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const = 0; + virtual const tensor& reverseT() const = 0; //- Return rank of component for transform virtual int rank() const = 0; @@ -112,14 +112,7 @@ void Foam::cyclicAMILduInterfaceField::transformCoupleField { if (doTransform()) { - if (forwardT().size() == 1) - { - transform(f, forwardT()[0], f); - } - else - { - transform(f, forwardT(), f); - } + transform(f, forwardT(), f); } } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H index 87491ef22a..23237bcf19 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H @@ -136,13 +136,13 @@ public: } //- Return face transformation tensor - const tensorField& forwardT() const + const tensor& forwardT() const { return cyclicAMIPolyPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - const tensorField& reverseT() const + const tensor& reverseT() const { return cyclicAMIPolyPatch_.reverseT(); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C index 1c88b2b926..af05eaf937 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C @@ -154,11 +154,8 @@ void Foam::cyclicAMIPointPatchField::swapAddSeparated if (doTransform()) { - const tensor& forwardT = this->forwardT()[0]; - const tensor& reverseT = this->reverseT()[0]; - - transform(ptFld, reverseT, ptFld); - transform(nbrPtFld, forwardT, nbrPtFld); + transform(ptFld, this->reverseT(), ptFld); + transform(nbrPtFld, this->forwardT(), nbrPtFld); } // convert point field to face field, AMI interpolate, then diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H index 32ffba3cd7..114b9f8ede 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H @@ -194,13 +194,13 @@ public: } //- Return face transformation tensor - virtual const tensorField& forwardT() const + virtual const tensor& forwardT() const { return cyclicAMIPatch_.forwardT(); } //- Return neighbour-cell transformation tensor - virtual const tensorField& reverseT() const + virtual const tensor& reverseT() const { return cyclicAMIPatch_.reverseT(); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index 6247d08fc3..853b05e98c 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -227,10 +227,11 @@ void Foam::cyclicAMIPolyPatch::calcTransforms } } - const_cast(forwardT()) = tensorField(1, revT.T()); - const_cast(reverseT()) = tensorField(1, revT); - const_cast(separation()).setSize(0); - const_cast(collocated()) = boolList(1, false); + parallel_ = false; + separated_ = false; + separation_ = Zero; + forwardT_ = revT.T(); + reverseT_ = revT; break; } @@ -243,14 +244,11 @@ void Foam::cyclicAMIPolyPatch::calcTransforms << endl; } - const_cast(forwardT()).clear(); - const_cast(reverseT()).clear(); - const_cast(separation()) = vectorField - ( - 1, - separationVector_ - ); - const_cast(collocated()) = boolList(1, false); + parallel_ = true; + separated_ = true; + separation_ = separationVector_; + forwardT_ = Zero; + reverseT_ = Zero; break; } @@ -262,10 +260,11 @@ void Foam::cyclicAMIPolyPatch::calcTransforms << " Assuming cyclic AMI pairs are colocated" << endl; } - const_cast(forwardT()).clear(); - const_cast(reverseT()).clear(); - const_cast(separation()).setSize(0); - const_cast(collocated()) = boolList(1, true); + parallel_ = true; + separated_ = false; + separation_ = Zero; + forwardT_ = Zero; + reverseT_ = Zero; break; } @@ -276,8 +275,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms Pout<< "patch: " << name() << nl << " forwardT = " << forwardT() << nl << " reverseT = " << reverseT() << nl - << " separation = " << separation() << nl - << " collocated = " << collocated() << nl << endl; + << " separation = " << separation() << nl << endl; } } @@ -387,8 +385,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms() Pout<< "calcTransforms() : patch: " << name() << nl << " forwardT = " << forwardT() << nl << " reverseT = " << reverseT() << nl - << " separation = " << separation() << nl - << " collocated = " << collocated() << nl << endl; + << " separation = " << separation() << nl << endl; } } @@ -897,19 +894,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const { // transformPosition gets called on the receiving side, // separation gets calculated on the sending side so subtract - - const vectorField& s = separation(); - if (s.size() == 1) - { - forAll(l, i) - { - l[i] -= s[0]; - } - } - else - { - l -= s; - } + l -= separation(); } } @@ -922,32 +907,19 @@ void Foam::cyclicAMIPolyPatch::transformPosition { if (!parallel()) { - const tensor& T = - ( - forwardT().size() == 1 - ? forwardT()[0] - : forwardT()[facei] - ); - if (transform() == ROTATIONAL) { - l = Foam::transform(T, l - rotationCentre_) + rotationCentre_; + l = Foam::transform(forwardT(), l - rotationCentre_) + + rotationCentre_; } else { - l = Foam::transform(T, l); + l = Foam::transform(forwardT(), l); } } else if (separated()) { - const vector& s = - ( - separation().size() == 1 - ? separation()[0] - : separation()[facei] - ); - - l -= s; + l -= separation(); } } @@ -960,14 +932,7 @@ void Foam::cyclicAMIPolyPatch::transformDirection { if (!parallel()) { - const tensor& T = - ( - forwardT().size() == 1 - ? forwardT()[0] - : forwardT()[facei] - ); - - d = Foam::transform(T, d); + d = Foam::transform(forwardT(), d); } } @@ -980,32 +945,19 @@ void Foam::cyclicAMIPolyPatch::reverseTransformPosition { if (!parallel()) { - const tensor& T = - ( - reverseT().size() == 1 - ? reverseT()[0] - : reverseT()[facei] - ); - if (transform() == ROTATIONAL) { - l = Foam::transform(T, l - rotationCentre_) + rotationCentre_; + l = Foam::transform(reverseT(), l - rotationCentre_) + + rotationCentre_; } else { - l = Foam::transform(T, l); + l = Foam::transform(reverseT(), l); } } else if (separated()) { - const vector& s = - ( - separation().size() == 1 - ? separation()[0] - : separation()[facei] - ); - - l += s; + l += separation(); } } @@ -1018,14 +970,7 @@ void Foam::cyclicAMIPolyPatch::reverseTransformDirection { if (!parallel()) { - const tensor& T = - ( - reverseT().size() == 1 - ? reverseT()[0] - : reverseT()[facei] - ); - - d = Foam::transform(T, d); + d = Foam::transform(reverseT(), d); } } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C index eb10c3be7a..dab9479fc4 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C @@ -100,31 +100,18 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const << "This is not allowed." << exit(FatalError); } - if - ( - transformPatch.separation().size() > 1 - || transformPatch.forwardT().size() > 1 - ) - { - FatalErrorInFunction - << "Transform patch " << transformPatch.name() << " for " - << typeName << " patch " << name() << " has a non-uniform " - << "transformation. This is not allowed." - << exit(FatalError); - } - Tuple2 bt ( transformPatch.size(), vectorTensorTransform ( - transformPatch.separation().size() > 0 - ? transformPatch.separation()[0] + transformPatch.separated() + ? transformPatch.separation() : vector::zero, - transformPatch.forwardT().size() > 0 - ? transformPatch.forwardT()[0] + !transformPatch.parallel() + ? transformPatch.forwardT() : tensor::zero, - transformPatch.forwardT().size() > 0 + !transformPatch.parallel() ) ); diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.C b/src/meshTools/algorithms/MeshWave/FaceCellWave.C index c5698a2304..9d130149fe 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWave.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -457,28 +457,14 @@ void Foam::FaceCellWave::enterDomain template void Foam::FaceCellWave::transform ( - const tensorField& rotTensor, + const tensor& rotTensor, const label nFaces, List& faceInfo ) { - // Transform. Implementation referred to Type - - if (rotTensor.size() == 1) + for (label facei = 0; facei < nFaces; facei++) { - const tensor& T = rotTensor[0]; - - for (label facei = 0; facei < nFaces; facei++) - { - faceInfo[facei].transform(mesh_, T, td_); - } - } - else - { - for (label facei = 0; facei < nFaces; facei++) - { - faceInfo[facei].transform(mesh_, rotTensor[facei], td_); - } + faceInfo[facei].transform(mesh_, rotTensor, td_); } } diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.H b/src/meshTools/algorithms/MeshWave/FaceCellWave.H index 03337063ff..5ea9e85f44 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWave.H +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.H @@ -215,7 +215,7 @@ protected: //- Apply transformation to Type void transform ( - const tensorField& rotTensor, + const tensor& rotTensor, const label nFaces, List& faceInfo ); diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C index 817de72683..00af3c13f0 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,31 +119,13 @@ template void Foam::PointEdgeWave::transform ( const polyPatch& patch, - const tensorField& rotTensor, + const tensor& rotTensor, List& pointInfo ) const { - if (rotTensor.size() == 1) + forAll(pointInfo, i) { - const tensor& T = rotTensor[0]; - - forAll(pointInfo, i) - { - pointInfo[i].transform(T, td_); - } - } - else - { - FatalErrorInFunction - << "Non-uniform transformation on patch " << patch.name() - << " of type " << patch.type() - << " not supported for point fields" - << abort(FatalError); - - forAll(pointInfo, i) - { - pointInfo[i].transform(rotTensor[i], td_); - } + pointInfo[i].transform(rotTensor, td_); } } diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H index 08bbd9435a..48cdbcc50b 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H @@ -160,7 +160,7 @@ class PointEdgeWave void transform ( const polyPatch& patch, - const tensorField& rotTensor, + const tensor& rotTensor, List& pointInfo ) const;