cyclic patches: Rationalised the handling of transformation

A single transformer object is now maintained within cyclic patches and returned
from a single virtual functions massively simplifying the interface and allowing
for further rationalisation of the calculation of the transformation.
This commit is contained in:
Henry Weller
2020-01-02 17:05:01 +00:00
parent 745c95849e
commit 4f0e38ce4a
66 changed files with 372 additions and 510 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -92,7 +92,7 @@ void Foam::conformalVoronoiMesh::selectSeparatedCoupledFaces
patches[patchi] patches[patchi]
); );
if (cpp.separated() || !cpp.parallel()) if (cpp.transform().transformsPosition())
{ {
forAll(cpp, i) forAll(cpp, i)
{ {

View File

@ -357,15 +357,15 @@ void syncPoints
// Null any value which is not on neighbouring processor // Null any value which is not on neighbouring processor
nbrPatchInfo.setSize(procPatch.nPoints(), nullValue); nbrPatchInfo.setSize(procPatch.nPoints(), nullValue);
if (!procPatch.parallel()) if (procPatch.transform().rotates())
{ {
hasTransformation = true; hasTransformation = true;
transformList(procPatch.forwardT(), nbrPatchInfo); transformList(procPatch.transform().R(), nbrPatchInfo);
} }
else if (procPatch.separated()) else if (procPatch.transform().translates())
{ {
hasTransformation = true; hasTransformation = true;
nbrPatchInfo -= procPatch.separation(); nbrPatchInfo -= procPatch.transform().t();
} }
const labelList& meshPts = procPatch.meshPoints(); const labelList& meshPts = procPatch.meshPoints();
@ -407,15 +407,15 @@ void syncPoints
half0Values[i] = points[point0]; half0Values[i] = points[point0];
} }
if (!cycPatch.parallel()) if (cycPatch.transform().rotates())
{ {
hasTransformation = true; hasTransformation = true;
transformList(cycPatch.reverseT(), half0Values); transformList(cycPatch.transform().R().T(), half0Values);
} }
else if (cycPatch.separated()) else if (cycPatch.transform().translates())
{ {
hasTransformation = true; hasTransformation = true;
half0Values += cycPatch.separation(); half0Values += cycPatch.transform().t();
} }
forAll(coupledPoints, i) forAll(coupledPoints, i)
@ -765,11 +765,11 @@ int main(int argc, char *argv[])
const coupledPolyPatch& cpp = const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(pp); refCast<const coupledPolyPatch>(pp);
if (cpp.separated()) if (cpp.transform().translates())
{ {
Info<< "On coupled patch " << pp.name() Info<< "On coupled patch " << pp.name()
<< " separation was " << " separation was "
<< cpp.separation() << endl; << cpp.transform().t() << endl;
if (isA<cyclicPolyPatch>(pp) && pp.size()) if (isA<cyclicPolyPatch>(pp) && pp.size())
{ {
@ -784,20 +784,20 @@ int main(int argc, char *argv[])
{ {
const cyclicPolyPatch& nbr = cycpp.neighbPatch(); const cyclicPolyPatch& nbr = cycpp.neighbPatch();
const_cast<vector&>(cpp.separation()) = const_cast<vector&>(cpp.transform().t()) =
nbr[0].centre(mesh.points()) nbr[0].centre(mesh.points())
- cycpp[0].centre(mesh.points()); - cycpp[0].centre(mesh.points());
} }
} }
Info<< "On coupled patch " << pp.name() Info<< "On coupled patch " << pp.name()
<< " forcing uniform separation of " << " forcing uniform separation of "
<< cpp.separation() << endl; << cpp.transform().t() << endl;
} }
else if (!cpp.parallel()) else if (cpp.transform().rotates())
{ {
Info<< "On coupled patch " << pp.name() Info<< "On coupled patch " << pp.name()
<< " uniform rotation of " << " uniform rotation of "
<< cpp.forwardT() << endl; << cpp.transform().R() << endl;
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -138,7 +138,7 @@ void Foam::cyclicPointPatchField<Type>::swapAddSeparated
const edgeList& pairs = cyclicPatch_.transformPairs(); const edgeList& pairs = cyclicPatch_.transformPairs();
if (doTransform()) if (transform().template transforms<Type>())
{ {
// Transform both sides. // Transform both sides.
forAll(pairs, pairi) forAll(pairs, pairi)
@ -147,8 +147,8 @@ void Foam::cyclicPointPatchField<Type>::swapAddSeparated
label nbrPointi = pairs[pairi][1]; label nbrPointi = pairs[pairi][1];
Type tmp = pf[pointi]; Type tmp = pf[pointi];
pf[pointi] = transform(forwardT(), nbrPf[nbrPointi]); pf[pointi] = transform().transform(nbrPf[nbrPointi]);
nbrPf[nbrPointi] = transform(reverseT(), tmp); nbrPf[nbrPointi] = transform().invTransform(tmp);
} }
} }
else else
@ -158,6 +158,7 @@ void Foam::cyclicPointPatchField<Type>::swapAddSeparated
Swap(pf[pairs[pairi][0]], nbrPf[pairs[pairi][1]]); Swap(pf[pairs[pairi][0]], nbrPf[pairs[pairi][1]]);
} }
} }
this->addToInternalField(pField, pf); this->addToInternalField(pField, pf);
nbr.addToInternalField(pField, nbrPf); nbr.addToInternalField(pField, nbrPf);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -141,19 +141,15 @@ public:
//- Does the patch field perform the transformation //- Does the patch field perform the transformation
virtual bool doTransform() const virtual bool doTransform() const
{ {
return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0); return
cyclicPatch_.transform().rotates()
&& pTraits<Type>::rank != 0;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return cyclicPatch_.forwardT(); return cyclicPatch_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicPatch_.reverseT();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -150,10 +150,8 @@ public:
virtual bool doTransform() const virtual bool doTransform() const
{ {
return return
!( procPatch_.procPolyPatch().transform().rotates()
procPatch_.procPolyPatch().parallel() && pTraits<Type>::rank != 0;
|| pTraits<Type>::rank == 0
);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "processorCyclicPointPatchField.H" #include "processorCyclicPointPatchField.H"
#include "transformField.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
@ -165,10 +164,11 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
if (doTransform()) if (doTransform())
{ {
const processorCyclicPolyPatch& ppp = procPatch_.procCyclicPolyPatch().transform().transform
procPatch_.procCyclicPolyPatch(); (
receiveBuf_,
transform(receiveBuf_, ppp.forwardT(), receiveBuf_); receiveBuf_
);
} }
// All points are separated // All points are separated

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -154,10 +154,8 @@ public:
virtual bool doTransform() const virtual bool doTransform() const
{ {
return return
!( procPatch_.procPolyPatch().transform().rotates()
pTraits<Type>::rank == 0 && pTraits<Type>::rank != 0;
|| procPatch_.procPolyPatch().parallel()
);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ SourceFiles
#define cyclicLduInterface_H #define cyclicLduInterface_H
#include "lduInterface.H" #include "lduInterface.H"
#include "transformer.H"
#include "primitiveFieldsFwd.H" #include "primitiveFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,11 +74,8 @@ public:
//- Return processor number //- Return processor number
virtual const cyclicLduInterface& neighbPatch() const = 0; virtual const cyclicLduInterface& neighbPatch() const = 0;
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const = 0; virtual const transformer& transform() const = 0;
//- Return face reverse transformation tensor
virtual const tensor& reverseT() const = 0;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,6 +37,7 @@ SourceFiles
#define processorLduInterface_H #define processorLduInterface_H
#include "lduInterface.H" #include "lduInterface.H"
#include "transformer.H"
#include "primitiveFieldsFwd.H" #include "primitiveFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,12 +94,13 @@ public:
//- Return neighbour processor number (rank in communicator) //- Return neighbour processor number (rank in communicator)
virtual int neighbProcNo() const = 0; virtual int neighbProcNo() const = 0;
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const = 0; virtual const transformer& transform() const = 0;
//- Return message tag used for sending //- Return message tag used for sending
virtual int tag() const = 0; virtual int tag() const = 0;
// Transfer functions // Transfer functions
//- Raw send function //- Raw send function

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(cyclicLduInterfaceField, 0); defineTypeNameAndDebug(cyclicLduInterfaceField, 0);
} }
@ -50,7 +50,7 @@ void Foam::cyclicLduInterfaceField::transformCoupleField
{ {
if (doTransform()) if (doTransform())
{ {
f *= pow(diag(forwardT()).component(cmpt), rank()); f *= pow(diag(transform().R()).component(cmpt), rank());
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ SourceFiles
#define cyclicLduInterfaceField_H #define cyclicLduInterfaceField_H
#include "primitiveFieldsFwd.H" #include "primitiveFieldsFwd.H"
#include "transformer.H"
#include "typeInfo.H" #include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,11 +75,8 @@ public:
//- Is the transform required //- Is the transform required
virtual bool doTransform() const = 0; virtual bool doTransform() const = 0;
//- Return face transformation tensor //- Return the transformation
virtual const tensor& forwardT() const = 0; virtual const transformer& transform() const = 0;
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const = 0;
//- Return rank of component for transform //- Return rank of component for transform
virtual int rank() const = 0; virtual int rank() const = 0;
@ -106,14 +104,14 @@ public:
#include "tensorField.H" #include "tensorField.H"
template<class Type> template<class Type>
void Foam::cyclicLduInterfaceField::transformCoupleField inline void Foam::cyclicLduInterfaceField::transformCoupleField
( (
Field<Type>& f Field<Type>& f
) const ) const
{ {
if (doTransform()) if (doTransform())
{ {
transform(f, forwardT(), f); transform().transform(f, f);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,7 @@ void Foam::processorLduInterfaceField::transformCoupleField
{ {
if (doTransform()) if (doTransform())
{ {
f *= pow(diag(forwardT()).component(cmpt), rank()); f *= pow(diag(transform().R()).component(cmpt), rank());
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ SourceFiles
#define processorLduInterfaceField_H #define processorLduInterfaceField_H
#include "primitiveFieldsFwd.H" #include "primitiveFieldsFwd.H"
#include "transformer.H"
#include "typeInfo.H" #include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,8 +84,8 @@ public:
//- Is the transform required //- Is the transform required
virtual bool doTransform() const = 0; virtual bool doTransform() const = 0;
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const = 0; virtual const transformer& transform() const = 0;
//- Return rank of component for transform //- Return rank of component for transform
virtual int rank() const = 0; virtual int rank() const = 0;
@ -119,7 +120,7 @@ void Foam::processorLduInterfaceField::transformCoupleField
{ {
if (doTransform()) if (doTransform())
{ {
transform(f, forwardT(), f); transform().transform(f, f);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -115,16 +115,10 @@ public:
return doTransform_; return doTransform_;
} }
//- Return face transformation tensor //- Return the transformation
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return cyclicInterface_.forwardT(); return cyclicInterface_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicInterface_.reverseT();
} }
//- Return rank of component for transform //- Return rank of component for transform

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -174,10 +174,10 @@ public:
return doTransform_; return doTransform_;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return procInterface_.forwardT(); return procInterface_.transform();
} }
//- Return rank of component for transform //- Return rank of component for transform

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,8 +84,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
refCast<const cyclicLduInterface>(fineInterface).neighbPatchID() refCast<const cyclicLduInterface>(fineInterface).neighbPatchID()
), ),
owner_(refCast<const cyclicLduInterface>(fineInterface).owner()), owner_(refCast<const cyclicLduInterface>(fineInterface).owner()),
forwardT_(refCast<const cyclicLduInterface>(fineInterface).forwardT()), transform_(refCast<const cyclicLduInterface>(fineInterface).transform())
reverseT_(refCast<const cyclicLduInterface>(fineInterface).reverseT())
{ {
// From coarse face to coarse cell // From coarse face to coarse cell
DynamicList<label> dynFaceCells(localRestrictAddressing.size()); DynamicList<label> dynFaceCells(localRestrictAddressing.size());
@ -159,8 +158,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
GAMGInterface(index, coarseInterfaces, is), GAMGInterface(index, coarseInterfaces, is),
neighbPatchID_(readLabel(is)), neighbPatchID_(readLabel(is)),
owner_(readBool(is)), owner_(readBool(is)),
forwardT_(is), transform_(is)
reverseT_(is)
{} {}
@ -198,8 +196,7 @@ void Foam::cyclicGAMGInterface::write(Ostream& os) const
GAMGInterface::write(os); GAMGInterface::write(os);
os << token::SPACE << neighbPatchID_ os << token::SPACE << neighbPatchID_
<< token::SPACE << owner_ << token::SPACE << owner_
<< token::SPACE << forwardT_ << token::SPACE << transform_;
<< token::SPACE << reverseT_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,11 +60,8 @@ class cyclicGAMGInterface
//- Am I owner? //- Am I owner?
bool owner_; bool owner_;
//- Transformation tensor //- Transformation
tensor forwardT_; transformer transform_;
//- Transformation tensor
tensor reverseT_;
public: public:
@ -138,15 +135,9 @@ public:
} }
//- Return face transformation tensor //- Return face transformation tensor
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return forwardT_; return transform_;
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return reverseT_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -72,7 +72,10 @@ Foam::processorGAMGInterface::processorGAMGInterface
( (
refCast<const processorLduInterface>(fineInterface).neighbProcNo() refCast<const processorLduInterface>(fineInterface).neighbProcNo()
), ),
forwardT_(refCast<const processorLduInterface>(fineInterface).forwardT()), transform_
(
refCast<const processorLduInterface>(fineInterface).transform()
),
tag_(refCast<const processorLduInterface>(fineInterface).tag()) tag_(refCast<const processorLduInterface>(fineInterface).tag())
{ {
// From coarse face to coarse cell // From coarse face to coarse cell
@ -146,7 +149,7 @@ Foam::processorGAMGInterface::processorGAMGInterface
const label coarseComm, const label coarseComm,
const label myProcNo, const label myProcNo,
const label neighbProcNo, const label neighbProcNo,
const tensor& forwardT, const transformer& transform,
const int tag const int tag
) )
: :
@ -160,7 +163,7 @@ Foam::processorGAMGInterface::processorGAMGInterface
comm_(coarseComm), comm_(coarseComm),
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo), neighbProcNo_(neighbProcNo),
forwardT_(forwardT), transform_(transform),
tag_(tag) tag_(tag)
{} {}
@ -176,7 +179,7 @@ Foam::processorGAMGInterface::processorGAMGInterface
comm_(readLabel(is)), comm_(readLabel(is)),
myProcNo_(readLabel(is)), myProcNo_(readLabel(is)),
neighbProcNo_(readLabel(is)), neighbProcNo_(readLabel(is)),
forwardT_(is), transform_(is),
tag_(readLabel(is)) tag_(readLabel(is))
{} {}
@ -217,7 +220,7 @@ void Foam::processorGAMGInterface::write(Ostream& os) const
os << token::SPACE << comm_ os << token::SPACE << comm_
<< token::SPACE << myProcNo_ << token::SPACE << myProcNo_
<< token::SPACE << neighbProcNo_ << token::SPACE << neighbProcNo_
<< token::SPACE << forwardT_ << token::SPACE << transform_
<< token::SPACE << tag_; << token::SPACE << tag_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,8 +63,8 @@ class processorGAMGInterface
//- Neighbouring processor rank in communicator //- Neighbouring processor rank in communicator
label neighbProcNo_; label neighbProcNo_;
//- Transformation tensor //- Transformation
tensor forwardT_; transformer transform_;
//- Message tag used for sending //- Message tag used for sending
int tag_; int tag_;
@ -100,7 +100,7 @@ public:
const label coarseComm, const label coarseComm,
const label myProcNo, const label myProcNo,
const label neighbProcNo, const label neighbProcNo,
const tensor& forwardT, const transformer& transform,
const int tag const int tag
); );
@ -159,10 +159,10 @@ public:
return neighbProcNo_; return neighbProcNo_;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return forwardT_; return transform_;
} }
//- Return message tag used for sending //- Return message tag used for sending

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -926,7 +926,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
comm_, comm_,
myAgglom, myAgglom,
neighbProcNo, neighbProcNo,
Zero, // forwardT transformer(), // forwardT
Pstream::msgType() // tag Pstream::msgType() // tag
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -132,22 +132,10 @@ public:
return refCast<const cyclicPointPatch>(pp); return refCast<const cyclicPointPatch>(pp);
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
bool parallel() const virtual const transformer& transform() const
{ {
return cyclicPolyPatch_.parallel(); return cyclicPolyPatch_.transform();
}
//- Return face transformation tensor
const tensor& forwardT() const
{
return cyclicPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
const tensor& reverseT() const
{
return cyclicPolyPatch_.reverseT();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -238,9 +238,9 @@ public:
template<class Type> template<class Type>
void operator()(const coupledPolyPatch& cpp, UList<Type>& fld) const void operator()(const coupledPolyPatch& cpp, UList<Type>& fld) const
{ {
if (!cpp.parallel()) if (cpp.transform().transforms())
{ {
transformList(cpp.forwardT(), fld); transformList(cpp.transform().R(), fld);
} }
} }
@ -249,9 +249,9 @@ public:
void operator()(const coupledPolyPatch& cpp, Container<Type>& map) void operator()(const coupledPolyPatch& cpp, Container<Type>& map)
const const
{ {
if (!cpp.parallel()) if (cpp.transform().transforms())
{ {
transformList(cpp.forwardT(), map); transformList(cpp.transform().R(), map);
} }
} }
}; };

View File

@ -38,6 +38,7 @@ SourceFiles
#define coupledPolyPatch_H #define coupledPolyPatch_H
#include "polyPatch.H" #include "polyPatch.H"
#include "transformer.H"
#include "diagTensorField.H" #include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -107,6 +108,8 @@ protected:
//- Neighbour-cell transformation tensor //- Neighbour-cell transformation tensor
mutable tensor reverseT_; mutable tensor reverseT_;
//- Transformation between the coupled patches
mutable transformer transform_;
protected: protected:
@ -270,34 +273,10 @@ public:
//- Transform a patch-based position from other side to this side //- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const = 0; virtual void transformPosition(point&, const label facei) const = 0;
//- Are the cyclic planes parallel. //- Return transformation between the coupled patches
virtual bool parallel() const virtual const transformer& transform() const
{ {
return parallel_; return transform_;
}
//- Are the planes separated.
virtual bool separated() const
{
return separated_;
}
//- If the planes are separated the separation vector.
virtual const vector& separation() const
{
return separation_;
}
//- Return face transformation tensor.
virtual const tensor& forwardT() const
{
return forwardT_;
}
//- Return neighbour-cell transformation tensor.
virtual const tensor& reverseT() const
{
return reverseT_;
} }
scalar matchTolerance() const scalar matchTolerance() const

View File

@ -85,6 +85,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
// Dummy geometry. Assume non-separated, parallel. // Dummy geometry. Assume non-separated, parallel.
parallel_ = true; parallel_ = true;
separated_ = false; separated_ = false;
transform_ = transformer();
} }
else else
{ {
@ -129,6 +131,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
forwardT_ = forwardT[0]; forwardT_ = forwardT[0];
reverseT_ = reverseT[0]; reverseT_ = reverseT[0];
transform_ = transformer(forwardT[0]);
} }
else else
{ {
@ -188,6 +192,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
separated_ = false; separated_ = false;
separation_ = Zero; separation_ = Zero;
transform_ = transformer();
} }
else else
{ {
@ -200,6 +206,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
separated_ = true; separated_ = true;
separation_ = separation[0]; separation_ = separation[0];
transform_ = transformer(separation[0]);
} }
} }
else else
@ -210,6 +218,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
separated_ = true; separated_ = true;
separation_ = separation[0]; separation_ = separation[0];
transform_ = transformer(separation[0]);
} }
} }
} }
@ -463,6 +473,8 @@ void Foam::cyclicPolyPatch::calcTransforms
separation_ = Zero; separation_ = Zero;
forwardT_ = revT.T(); forwardT_ = revT.T();
reverseT_ = revT; reverseT_ = revT;
transform_ = transformer(revT.T());
} }
else if (transformType() == TRANSLATIONAL) else if (transformType() == TRANSLATIONAL)
{ {
@ -507,6 +519,8 @@ void Foam::cyclicPolyPatch::calcTransforms
separated_ = true; separated_ = true;
forwardT_ = Zero; forwardT_ = Zero;
reverseT_ = Zero; reverseT_ = Zero;
transform_ = transformer();
} }
else else
{ {
@ -995,45 +1009,45 @@ Foam::label Foam::cyclicPolyPatch::neighbPatchID() const
void Foam::cyclicPolyPatch::transformPosition(pointField& l) const void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
{ {
if (!parallel()) if (transform().rotates())
{ {
if (transformType() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = l =
Foam::transform(forwardT(), l-rotationCentre_) Foam::transform(transform().R(), l-rotationCentre_)
+ rotationCentre_; + rotationCentre_;
} }
else else
{ {
l = Foam::transform(forwardT(), l); l = Foam::transform(transform().R(), l);
} }
} }
else if (separated()) else if (transform().translates())
{ {
// transformPosition gets called on the receiving side, // transformPosition gets called on the receiving side,
// separation gets calculated on the sending side so subtract. // separation gets calculated on the sending side so subtract.
l -= separation(); l -= transform().t();
} }
} }
void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
{ {
if (!parallel()) if (transform().rotates())
{ {
if (transformType() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(forwardT(), l - rotationCentre_) l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
} }
else else
{ {
l = Foam::transform(forwardT(), l); l = Foam::transform(transform().R(), l);
} }
} }
else if (separated()) else if (transform().translates())
{ {
l -= separation(); l -= transform().t();
} }
} }

View File

@ -338,34 +338,10 @@ public:
referPatch().transformPosition(l, facei); referPatch().transformPosition(l, facei);
} }
//- Are the planes separated. //- Return transformation between the coupled patches
virtual bool separated() const virtual const transformer& transform() const
{ {
return referPatch().separated(); return referPatch().transform_;
}
//- If the planes are separated the separation vector.
virtual const vector& separation() const
{
return referPatch().separation();
}
//- Are the cyclic planes parallel.
virtual bool parallel() const
{
return referPatch().parallel();
}
//- Return face transformation tensor.
virtual const tensor& forwardT() const
{
return referPatch().forwardT();
}
//- Return neighbour-cell transformation tensor.
virtual const tensor& reverseT() const
{
return referPatch().reverseT();
} }
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -141,9 +141,9 @@ void Foam::globalIndexAndTransform::determineTransforms()
{ {
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp); const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
if (cpp.separated()) if (cpp.transform().translates())
{ {
const vector& sepVec = cpp.separation(); const vector& sepVec = cpp.transform().t();
if (mag(sepVec) > small) if (mag(sepVec) > small)
{ {
@ -166,9 +166,9 @@ void Foam::globalIndexAndTransform::determineTransforms()
} }
} }
} }
else if (!cpp.parallel()) else if (cpp.transform().rotates())
{ {
const tensor& transT = cpp.reverseT(); const tensor& transT = cpp.transform().R().T();
if (mag(transT - I) > small) if (mag(transT - I) > small)
{ {
@ -299,9 +299,9 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
{ {
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp); const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
if (cpp.separated()) if (cpp.transform().translates())
{ {
const vector& sepVec = cpp.separation(); const vector& sepVec = cpp.transform().t();
if (mag(sepVec) > small) if (mag(sepVec) > small)
{ {
@ -319,9 +319,9 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
patchTransformSign_[patchi] = labelPair(matchTransI, sign); patchTransformSign_[patchi] = labelPair(matchTransI, sign);
} }
} }
else if (!cpp.parallel()) else if (cpp.transform().rotates())
{ {
const tensor& transT = cpp.reverseT(); const tensor& transT = cpp.transform().R().T();
if (mag(transT - I) > small) if (mag(transT - I) > small)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -133,9 +133,19 @@ public:
//- Return true if the rotation tensor is non-I //- Return true if the rotation tensor is non-I
inline bool rotates() const; inline bool rotates() const;
//- Return true if the transformer either translates or rotates //- Return true if the transformer transforms a type
// (i.e. rotates)
inline bool transforms() const; inline bool transforms() const;
//- Return true if the transformer transforms the given type
// (i.e. rotates)
template<typename Type>
inline bool transforms() const;
//- Return true if the transformer transforms a point
// (i.e. translates or rotates)
inline bool transformsPosition() const;
// Edit // Edit
@ -170,6 +180,10 @@ public:
template<class Type> template<class Type>
Type transform(const Type&) const; Type transform(const Type&) const;
//- Transform the given field
template<class Type>
void transform(Field<Type>&, const Field<Type>&) const;
//- Transform the given field //- Transform the given field
template<class Type> template<class Type>
tmp<Field<Type>> transform(const Field<Type>&) const; tmp<Field<Type>> transform(const Field<Type>&) const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,6 +103,19 @@ inline bool Foam::transformer::rotates() const
inline bool Foam::transformer::transforms() const inline bool Foam::transformer::transforms() const
{
return rotates_;
}
template<typename Type>
inline bool Foam::transformer::transforms() const
{
return pTraits<Type>::rank != 0 && (translates_ || rotates_);
}
inline bool Foam::transformer::transformsPosition() const
{ {
return translates_ || rotates_; return translates_ || rotates_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,6 +39,20 @@ Type Foam::transformer::transform(const Type& x) const
} }
template<class Type>
void Foam::transformer::transform
(
Field<Type>& res,
const Field<Type>& fld
) const
{
if (rotates_)
{
return Foam::transform(res, R(), fld);
}
}
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::transformer::transform Foam::tmp<Foam::Field<Type>> Foam::transformer::transform
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -861,9 +861,7 @@ bool Foam::motionSmootherAlgo::scaleMesh
refCast<const coupledPolyPatch>(patches[patchi]); refCast<const coupledPolyPatch>(patches[patchi]);
Pout<< '\t' << patchi << '\t' << pp.name() Pout<< '\t' << patchi << '\t' << pp.name()
<< " parallel:" << pp.parallel() << " transform:" << pp.transform()
<< " separated:" << pp.separated()
<< " forwardT:" << pp.forwardT().size()
<< endl; << endl;
} }
} }
@ -871,6 +869,7 @@ bool Foam::motionSmootherAlgo::scaleMesh
const scalar errorReduction = const scalar errorReduction =
paramDict.lookup<scalar>("errorReduction"); paramDict.lookup<scalar>("errorReduction");
const label nSmoothScale = const label nSmoothScale =
paramDict.lookup<label>("nSmoothScale"); paramDict.lookup<label>("nSmoothScale");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -136,10 +136,7 @@ Foam::cyclicFvPatchField<Type>::patchNeighbourField() const
{ {
forAll(pnf, facei) forAll(pnf, facei)
{ {
pnf[facei] = transform pnf[facei] = transform().transform(iField[nbrFaceCells[facei]]);
(
forwardT(), iField[nbrFaceCells[facei]]
);
} }
} }
else else

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -186,19 +186,15 @@ public:
//- Does the patch field perform the transformation //- Does the patch field perform the transformation
virtual bool doTransform() const virtual bool doTransform() const
{ {
return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0); return
cyclicPatch_.transform().rotates()
&& pTraits<Type>::rank != 0;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return cyclicPatch_.forwardT(); return cyclicPatch_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicPatch_.reverseT();
} }
//- Return rank of component for transform //- Return rank of component for transform

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -158,7 +158,7 @@ Foam::cyclicAMIFvPatchField<Type>::patchNeighbourField() const
if (doTransform()) if (doTransform())
{ {
tpnf.ref() = transform(forwardT(), tpnf()); transform().transform(tpnf.ref(), tpnf());
} }
return tpnf; return tpnf;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -192,19 +192,14 @@ public:
virtual bool doTransform() const virtual bool doTransform() const
{ {
return return
!(cyclicAMIPatch_.parallel() || pTraits<Type>::rank == 0); cyclicAMIPatch_.transform().rotates()
&& pTraits<Type>::rank != 0;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return cyclicAMIPatch_.forwardT(); return cyclicAMIPatch_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicAMIPatch_.reverseT();
} }
//- Return rank of component for transform //- Return rank of component for transform

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -110,10 +110,9 @@ Foam::jumpCyclicFvPatchField<Type>::patchNeighbourField() const
{ {
forAll(*this, facei) forAll(*this, facei)
{ {
pnf[facei] = transform pnf[facei] =
( this->transform().transform(iField[nbrFaceCells[facei]])
this->forwardT(), iField[nbrFaceCells[facei]] - jf[facei];
) - jf[facei];
} }
} }
else else

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -117,7 +117,7 @@ Foam::jumpCyclicAMIFvPatchField<Type>::patchNeighbourField() const
if (this->doTransform()) if (this->doTransform())
{ {
tpnf = transform(this->forwardT(), tpnf); this->transform().transform(tpnf.ref(), tpnf());
} }
tmp<Field<Type>> tjf = jump(); tmp<Field<Type>> tjf = jump();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -297,7 +297,7 @@ void Foam::processorFvPatchField<Type>::evaluate
if (doTransform()) if (doTransform())
{ {
transform(*this, procPatch_.forwardT(), *this); procPatch_.transform().transform<Type>(*this, *this);
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -264,13 +264,15 @@ public:
//- Does the patch field perform the transformation //- Does the patch field perform the transformation
virtual bool doTransform() const virtual bool doTransform() const
{ {
return !(procPatch_.parallel() || pTraits<Type>::rank == 0); return
procPatch_.transform().rotates()
&& pTraits<Type>::rank != 0;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return procPatch_.forwardT(); return procPatch_.transform();
} }
//- Return rank of component for transform //- Return rank of component for transform
@ -278,7 +280,6 @@ public:
{ {
return pTraits<Type>::rank; return pTraits<Type>::rank;
} }
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -157,13 +157,15 @@ public:
//- Does the patch field perform the transformation //- Does the patch field perform the transformation
virtual bool doTransform() const virtual bool doTransform() const
{ {
return !(procPatch_.parallel() || pTraits<Type>::rank == 0); return
procPatch_.transform().rotates()
&& pTraits<Type>::rank != 0;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return procPatch_.forwardT(); return procPatch_.transform();
} }
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,7 +41,7 @@ Foam::extendedCellToCellStencil::extendedCellToCellStencil(const polyMesh& mesh)
const coupledPolyPatch& cpp = const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchi]); refCast<const coupledPolyPatch>(patches[patchi]);
if (!cpp.parallel() || cpp.separated()) if (cpp.transform().transformsPosition())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Coupled patches with transformations not supported." << "Coupled patches with transformations not supported."

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -111,7 +111,7 @@ Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh)
const coupledPolyPatch& cpp = const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchi]); refCast<const coupledPolyPatch>(patches[patchi]);
if (!cpp.parallel() || cpp.separated()) if (cpp.transform().transformsPosition())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Coupled patches with transformations not supported." << "Coupled patches with transformations not supported."

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ Foam::extendedFaceToCellStencil::extendedFaceToCellStencil(const polyMesh& mesh)
const coupledPolyPatch& cpp = const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchi]); refCast<const coupledPolyPatch>(patches[patchi]);
if (!cpp.parallel() || cpp.separated()) if (cpp.transform().transformsPosition())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Coupled patches with transformations not supported." << "Coupled patches with transformations not supported."

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -100,14 +100,8 @@ public:
return coupledPolyPatch_.coupled(); return coupledPolyPatch_.coupled();
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
virtual bool parallel() const = 0; virtual const transformer& transform() const = 0;
//- Return face transformation tensor
virtual const tensor& forwardT() const = 0;
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const = 0;
//- Return faceCell addressing //- Return faceCell addressing
virtual const labelUList& faceCells() const virtual const labelUList& faceCells() const

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,14 +80,14 @@ Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const
vectorField& pdv = tpdv.ref(); vectorField& pdv = tpdv.ref();
// To the transformation if necessary // To the transformation if necessary
if (parallel()) if (transform().rotates())
{ {
forAll(patchD, facei) forAll(patchD, facei)
{ {
vector ddi = patchD[facei]; vector ddi = patchD[facei];
vector dni = nbrPatchD[facei]; vector dni = nbrPatchD[facei];
pdv[facei] = ddi - dni; pdv[facei] = ddi - transform().transform(dni);
} }
} }
else else
@ -97,7 +97,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const
vector ddi = patchD[facei]; vector ddi = patchD[facei];
vector dni = nbrPatchD[facei]; vector dni = nbrPatchD[facei];
pdv[facei] = ddi - transform(forwardT(), dni); pdv[facei] = ddi - dni;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,22 +113,10 @@ public:
); );
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
virtual bool parallel() const virtual const transformer& transform() const
{ {
return cyclicPolyPatch_.parallel(); return cyclicPolyPatch_.transform();
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return cyclicPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicPolyPatch_.reverseT();
} }
const cyclicFvPatch& neighbFvPatch() const const cyclicFvPatch& neighbFvPatch() const

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -139,14 +139,14 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
vectorField& pdv = tpdv.ref(); vectorField& pdv = tpdv.ref();
// do the transformation if necessary // do the transformation if necessary
if (parallel()) if (transform().rotates())
{ {
forAll(patchD, facei) forAll(patchD, facei)
{ {
const vector& ddi = patchD[facei]; const vector& ddi = patchD[facei];
const vector& dni = nbrPatchD[facei]; const vector& dni = nbrPatchD[facei];
pdv[facei] = ddi - dni; pdv[facei] = ddi - transform().transform(dni);
} }
} }
else else
@ -156,7 +156,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
const vector& ddi = patchD[facei]; const vector& ddi = patchD[facei];
const vector& dni = nbrPatchD[facei]; const vector& dni = nbrPatchD[facei];
pdv[facei] = ddi - transform(forwardT(), dni); pdv[facei] = ddi - dni;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -139,22 +139,10 @@ public:
return cyclicAMIPolyPatch_.applyLowWeightCorrection(); return cyclicAMIPolyPatch_.applyLowWeightCorrection();
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
virtual bool parallel() const virtual const transformer& transform() const
{ {
return cyclicAMIPolyPatch_.parallel(); return cyclicAMIPolyPatch_.transform();
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return cyclicAMIPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicAMIPolyPatch_.reverseT();
} }
const cyclicAMIFvPatch& neighbFvPatch() const const cyclicAMIFvPatch& neighbFvPatch() const

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,11 +93,12 @@ Foam::tmp<Foam::vectorField> Foam::processorFvPatch::delta() const
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// To the transformation if necessary // To the transformation if necessary
if (parallel()) if (transform().rotates())
{ {
return return
coupledFvPatch::delta() coupledFvPatch::delta()
- ( -transform().transform
(
procPolyPatch_.neighbFaceCentres() procPolyPatch_.neighbFaceCentres()
- procPolyPatch_.neighbFaceCellCentres() - procPolyPatch_.neighbFaceCellCentres()
); );
@ -106,13 +107,9 @@ Foam::tmp<Foam::vectorField> Foam::processorFvPatch::delta() const
{ {
return return
coupledFvPatch::delta() coupledFvPatch::delta()
- transform - (
( procPolyPatch_.neighbFaceCentres()
forwardT(), - procPolyPatch_.neighbFaceCellCentres()
(
procPolyPatch_.neighbFaceCentres()
- procPolyPatch_.neighbFaceCellCentres()
)
); );
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -126,22 +126,10 @@ public:
return procPolyPatch_; return procPolyPatch_;
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
virtual bool parallel() const virtual const transformer& transform() const
{ {
return procPolyPatch_.parallel(); return procPolyPatch_.transform();
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor.
virtual const tensor& reverseT() const
{
return procPolyPatch_.reverseT();
} }
//- Return delta (P to N) vectors across coupled patch //- Return delta (P to N) vectors across coupled patch

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -85,22 +85,10 @@ public:
return procPolyPatch_; return procPolyPatch_;
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
virtual bool parallel() const virtual const transformer& transform() const
{ {
return procPolyPatch_.parallel(); return procPolyPatch_.transform();
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return procPolyPatch_.reverseT();
} }
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1067,13 +1067,13 @@ void Foam::particle::correctAfterParallelTransfer
const coupledPolyPatch& ppp = const coupledPolyPatch& ppp =
refCast<const coupledPolyPatch>(mesh_.boundaryMesh()[patchi]); refCast<const coupledPolyPatch>(mesh_.boundaryMesh()[patchi]);
if (!ppp.parallel()) if (ppp.transform().rotates())
{ {
transformProperties(ppp.forwardT()); transformProperties(ppp.transform().R());
} }
else if (ppp.separated()) else if (ppp.transform().translates())
{ {
transformProperties(-ppp.separation()); transformProperties(-ppp.transform().t());
} }
// Set the topology // Set the topology

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -277,13 +277,13 @@ void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&)
reflect(); reflect();
// Transform the properties // Transform the properties
if (!receiveCpp.parallel()) if (receiveCpp.transform().rotates())
{ {
transformProperties(receiveCpp.forwardT()); transformProperties(receiveCpp.transform().R());
} }
else if (receiveCpp.separated()) else if (receiveCpp.transform().translates())
{ {
transformProperties(-receiveCpp.separation()); transformProperties(-receiveCpp.transform().t());
} }
} }
@ -373,14 +373,14 @@ void Foam::particle::hitCyclicAMIPatch
transformProperties(AMITransform.t()); transformProperties(AMITransform.t());
} }
if (!receiveCpp.parallel()) if (receiveCpp.transform().rotates())
{ {
transformProperties(receiveCpp.forwardT()); transformProperties(receiveCpp.transform().R());
displacementT = transform(receiveCpp.forwardT(), displacementT); displacementT = transform(receiveCpp.transform().R(), displacementT);
} }
else if (receiveCpp.separated()) else if (receiveCpp.transform().translates())
{ {
transformProperties(-receiveCpp.separation()); transformProperties(-receiveCpp.transform().t());
} }
// If on a boundary and the displacement points into the receiving face // If on a boundary and the displacement points into the receiving face

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -2078,7 +2078,7 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
patches[patchi] patches[patchi]
); );
if (cpp.separated() || !cpp.parallel()) if (cpp.transform().transformsPosition())
{ {
forAll(cpp, i) forAll(cpp, i)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -131,16 +131,10 @@ public:
return doTransform_; return doTransform_;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return cyclicAMIInterface_.forwardT(); return cyclicAMIInterface_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicAMIInterface_.reverseT();
} }
//- Return rank of component for transform //- Return rank of component for transform

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -141,16 +141,10 @@ public:
return AMITransforms_; return AMITransforms_;
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return fineCyclicAMIInterface_.forwardT(); return fineCyclicAMIInterface_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return fineCyclicAMIInterface_.reverseT();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -87,11 +87,8 @@ public:
virtual const List<transformer>& virtual const List<transformer>&
AMITransforms() const = 0; AMITransforms() const = 0;
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const = 0; virtual const transformer& transform() const = 0;
//- Return face reverse transformation tensor
virtual const tensor& reverseT() const = 0;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(cyclicAMILduInterfaceField, 0); defineTypeNameAndDebug(cyclicAMILduInterfaceField, 0);
} }
@ -50,7 +50,7 @@ void Foam::cyclicAMILduInterfaceField::transformCoupleField
{ {
if (doTransform()) if (doTransform())
{ {
f *= pow(diag(forwardT()).component(cmpt), rank()); f *= pow(diag(transform().R()).component(cmpt), rank());
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ SourceFiles
#define cyclicAMILduInterfaceField_H #define cyclicAMILduInterfaceField_H
#include "primitiveFieldsFwd.H" #include "primitiveFieldsFwd.H"
#include "transformer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,11 +74,8 @@ public:
//- Is the transform required //- Is the transform required
virtual bool doTransform() const = 0; virtual bool doTransform() const = 0;
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const = 0; virtual const transformer& transform() const = 0;
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const = 0;
//- Return rank of component for transform //- Return rank of component for transform
virtual int rank() const = 0; virtual int rank() const = 0;
@ -112,7 +110,7 @@ void Foam::cyclicAMILduInterfaceField::transformCoupleField
{ {
if (doTransform()) if (doTransform())
{ {
transform(f, forwardT(), f); transform().transform(f, f);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -129,22 +129,10 @@ public:
return refCast<const cyclicAMIPointPatch>(pp); return refCast<const cyclicAMIPointPatch>(pp);
} }
//- Are the cyclic planes parallel //- Return transformation between the coupled patches
bool parallel() const virtual const transformer& transform() const
{ {
return cyclicAMIPolyPatch_.parallel(); return cyclicAMIPolyPatch_.transform();
}
//- Return face transformation tensor
const tensor& forwardT() const
{
return cyclicAMIPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
const tensor& reverseT() const
{
return cyclicAMIPolyPatch_.reverseT();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -154,8 +154,8 @@ void Foam::cyclicAMIPointPatchField<Type>::swapAddSeparated
if (doTransform()) if (doTransform())
{ {
transform(ptFld, this->reverseT(), ptFld); ptFld = transform().invTransform(ptFld);
transform(nbrPtFld, this->forwardT(), nbrPtFld); nbrPtFld = transform().transform(nbrPtFld);
} }
// convert point field to face field, AMI interpolate, then // convert point field to face field, AMI interpolate, then

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -187,22 +187,14 @@ public:
virtual bool doTransform() const virtual bool doTransform() const
{ {
return return
!( cyclicAMIPatch_.transform().rotates()
cyclicAMIPatch_.parallel() && pTraits<Type>::rank != 0;
|| pTraits<Type>::rank == 0
);
} }
//- Return face transformation tensor //- Return transformation between the coupled patches
virtual const tensor& forwardT() const virtual const transformer& transform() const
{ {
return cyclicAMIPatch_.forwardT(); return cyclicAMIPatch_.transform();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return cyclicAMIPatch_.reverseT();
} }

View File

@ -233,6 +233,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
forwardT_ = revT.T(); forwardT_ = revT.T();
reverseT_ = revT; reverseT_ = revT;
transform_ = transformer(revT.T());
break; break;
} }
case TRANSLATIONAL: case TRANSLATIONAL:
@ -249,6 +251,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
forwardT_ = Zero; forwardT_ = Zero;
reverseT_ = Zero; reverseT_ = Zero;
transform_ = transformer(separation_);
break; break;
} }
default: default:
@ -265,6 +269,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
forwardT_ = Zero; forwardT_ = Zero;
reverseT_ = Zero; reverseT_ = Zero;
transform_ = transformer();
break; break;
} }
} }
@ -272,9 +278,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
if (debug) if (debug)
{ {
Pout<< "patch: " << name() << nl Pout<< "patch: " << name() << nl
<< " forwardT = " << forwardT() << nl << " transform = " << transform() << nl << endl;
<< " reverseT = " << reverseT() << nl
<< " separation = " << separation() << nl << endl;
} }
} }
@ -382,9 +386,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms()
if (debug) if (debug)
{ {
Pout<< "calcTransforms() : patch: " << name() << nl Pout<< "calcTransforms() : patch: " << name() << nl
<< " forwardT = " << forwardT() << nl << " transform = " << transform() << nl << endl;
<< " reverseT = " << reverseT() << nl
<< " separation = " << separation() << nl << endl;
} }
} }
@ -872,23 +874,23 @@ const Foam::scalarField& Foam::cyclicAMIPolyPatch::neighbWeightsSum() const
void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
{ {
if (!parallel()) if (transform().rotates())
{ {
if (transformType() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(forwardT(), l - rotationCentre_) l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
} }
else else
{ {
l = Foam::transform(forwardT(), l); l = Foam::transform(transform().R(), l);
} }
} }
else if (separated()) else if (transform().translates())
{ {
// transformPosition gets called on the receiving side, // transformPosition gets called on the receiving side,
// separation gets calculated on the sending side so subtract // separation gets calculated on the sending side so subtract
l -= separation(); l -= transform().t();
} }
} }
@ -899,21 +901,21 @@ void Foam::cyclicAMIPolyPatch::transformPosition
const label facei const label facei
) const ) const
{ {
if (!parallel()) if (transform().rotates())
{ {
if (transformType() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(forwardT(), l - rotationCentre_) l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
} }
else else
{ {
l = Foam::transform(forwardT(), l); l = Foam::transform(transform().R(), l);
} }
} }
else if (separated()) else if (transform().translates())
{ {
l -= separation(); l -= transform().t();
} }
} }
@ -924,9 +926,9 @@ void Foam::cyclicAMIPolyPatch::transformDirection
const label facei const label facei
) const ) const
{ {
if (!parallel()) if (transform().rotates())
{ {
d = Foam::transform(forwardT(), d); d = Foam::transform(transform().R(), d);
} }
} }
@ -937,21 +939,21 @@ void Foam::cyclicAMIPolyPatch::reverseTransformPosition
const label facei const label facei
) const ) const
{ {
if (!parallel()) if (transform().rotates())
{ {
if (transformType() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(reverseT(), l - rotationCentre_) l = Foam::transform(transform().R().T(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
} }
else else
{ {
l = Foam::transform(reverseT(), l); l = Foam::transform(transform().R().T(), l);
} }
} }
else if (separated()) else if (transform().translates())
{ {
l += separation(); l += transform().t();
} }
} }
@ -962,9 +964,9 @@ void Foam::cyclicAMIPolyPatch::reverseTransformDirection
const label facei const label facei
) const ) const
{ {
if (!parallel()) if (transform().rotates())
{ {
d = Foam::transform(reverseT(), d); d = Foam::transform(transform().R().T(), d);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(cyclicRepeatAMILduInterfaceField, 0); defineTypeNameAndDebug(cyclicRepeatAMILduInterfaceField, 0);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,17 +103,7 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
Tuple2<bool, transformer> bt Tuple2<bool, transformer> bt
( (
transformPatch.size(), transformPatch.size(),
transformer transformPatch.transform()
(
transformPatch.separated()
? transformPatch.separation()
: vector::zero,
transformPatch.separated(),
!transformPatch.parallel()
? transformPatch.forwardT()
: tensor::zero,
!transformPatch.parallel()
)
); );
reduce(bt, keepIfTrueOp<transformer>()); reduce(bt, keepIfTrueOp<transformer>());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -597,11 +597,11 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
} }
// Apply transform to received data for non-parallel planes // Apply transform to received data for non-parallel planes
if (!procPatch.parallel()) if (procPatch.transform().rotates())
{ {
transform transform
( (
procPatch.forwardT(), procPatch.transform().R(),
receiveFaces.size(), receiveFaces.size(),
receiveFacesInfo receiveFacesInfo
); );
@ -669,12 +669,12 @@ void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patch); refCast<const cyclicPolyPatch>(patch);
if (!cycPatch.parallel()) if (cycPatch.transform().rotates())
{ {
// received data from other half // received data from other half
transform transform
( (
cycPatch.forwardT(), cycPatch.transform().R(),
nReceiveFaces, nReceiveFaces,
receiveFacesInfo receiveFacesInfo
); );
@ -743,7 +743,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
) )
); );
if (!nbrPatch.parallel() || nbrPatch.separated()) if (nbrPatch.transform().transformsPosition())
{ {
// Adapt sendInfo for leaving domain // Adapt sendInfo for leaving domain
const vectorField::subField fc = nbrPatch.faceCentres(); const vectorField::subField fc = nbrPatch.faceCentres();
@ -805,17 +805,17 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
} }
// Apply transform to received data for non-parallel planes // Apply transform to received data for non-parallel planes
if (!cycPatch.parallel()) if (cycPatch.transform().rotates())
{ {
transform transform
( (
cycPatch.forwardT(), cycPatch.transform().R(),
receiveInfo.size(), receiveInfo.size(),
receiveInfo receiveInfo
); );
} }
if (!cycPatch.parallel() || cycPatch.separated()) if (cycPatch.transform().transformsPosition())
{ {
// Adapt receiveInfo for entering domain // Adapt receiveInfo for entering domain
const vectorField::subField fc = cycPatch.faceCentres(); const vectorField::subField fc = cycPatch.faceCentres();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -368,9 +368,9 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
//} //}
// Apply transform to received data for non-parallel planes // Apply transform to received data for non-parallel planes
if (!procPatch.parallel()) if (procPatch.transform().rotates())
{ {
transform(procPatch, procPatch.forwardT(), patchInfo); transform(procPatch, procPatch.transform().R(), patchInfo);
} }
// Adapt for entering domain // Adapt for entering domain
@ -453,10 +453,10 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
// Apply rotation for non-parallel planes // Apply rotation for non-parallel planes
if (!cycPatch.parallel()) if (cycPatch.transform().rotates())
{ {
// received data from half1 // received data from half1
transform(cycPatch, cycPatch.forwardT(), nbrInfo); transform(cycPatch, cycPatch.transform().R(), nbrInfo);
} }
// if (debug) // if (debug)