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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -92,7 +92,7 @@ void Foam::conformalVoronoiMesh::selectSeparatedCoupledFaces
patches[patchi]
);
if (cpp.separated() || !cpp.parallel())
if (cpp.transform().transformsPosition())
{
forAll(cpp, i)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -84,8 +84,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
refCast<const cyclicLduInterface>(fineInterface).neighbPatchID()
),
owner_(refCast<const cyclicLduInterface>(fineInterface).owner()),
forwardT_(refCast<const cyclicLduInterface>(fineInterface).forwardT()),
reverseT_(refCast<const cyclicLduInterface>(fineInterface).reverseT())
transform_(refCast<const cyclicLduInterface>(fineInterface).transform())
{
// From coarse face to coarse cell
DynamicList<label> dynFaceCells(localRestrictAddressing.size());
@ -159,8 +158,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
GAMGInterface(index, coarseInterfaces, is),
neighbPatchID_(readLabel(is)),
owner_(readBool(is)),
forwardT_(is),
reverseT_(is)
transform_(is)
{}
@ -198,8 +196,7 @@ void Foam::cyclicGAMGInterface::write(Ostream& os) const
GAMGInterface::write(os);
os << token::SPACE << neighbPatchID_
<< token::SPACE << owner_
<< token::SPACE << forwardT_
<< token::SPACE << reverseT_;
<< token::SPACE << transform_;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -238,9 +238,9 @@ public:
template<class Type>
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)
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
#include "polyPatch.H"
#include "transformer.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -107,6 +108,8 @@ protected:
//- Neighbour-cell transformation tensor
mutable tensor reverseT_;
//- Transformation between the coupled patches
mutable transformer transform_;
protected:
@ -270,34 +273,10 @@ 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 transformation between the coupled patches
virtual const transformer& transform() const
{
return parallel_;
}
//- 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_;
return transform_;
}
scalar matchTolerance() const

View File

@ -85,6 +85,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
// Dummy geometry. Assume non-separated, parallel.
parallel_ = true;
separated_ = false;
transform_ = transformer();
}
else
{
@ -129,6 +131,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
forwardT_ = forwardT[0];
reverseT_ = reverseT[0];
transform_ = transformer(forwardT[0]);
}
else
{
@ -188,6 +192,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
separated_ = false;
separation_ = Zero;
transform_ = transformer();
}
else
{
@ -200,6 +206,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
separated_ = true;
separation_ = separation[0];
transform_ = transformer(separation[0]);
}
}
else
@ -210,6 +218,8 @@ void Foam::cyclicPolyPatch::calcTransformTensors
separated_ = true;
separation_ = separation[0];
transform_ = transformer(separation[0]);
}
}
}
@ -463,6 +473,8 @@ void Foam::cyclicPolyPatch::calcTransforms
separation_ = Zero;
forwardT_ = revT.T();
reverseT_ = revT;
transform_ = transformer(revT.T());
}
else if (transformType() == TRANSLATIONAL)
{
@ -507,6 +519,8 @@ void Foam::cyclicPolyPatch::calcTransforms
separated_ = true;
forwardT_ = Zero;
reverseT_ = Zero;
transform_ = transformer();
}
else
{
@ -995,45 +1009,45 @@ Foam::label Foam::cyclicPolyPatch::neighbPatchID() const
void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
{
if (!parallel())
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l =
Foam::transform(forwardT(), l-rotationCentre_)
Foam::transform(transform().R(), l-rotationCentre_)
+ rotationCentre_;
}
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,
// separation gets calculated on the sending side so subtract.
l -= separation();
l -= transform().t();
}
}
void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
{
if (!parallel())
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(forwardT(), l - rotationCentre_)
l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_;
}
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);
}
//- Are the planes separated.
virtual bool separated() const
//- Return transformation between the coupled patches
virtual const transformer& transform() const
{
return referPatch().separated();
}
//- 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();
return referPatch().transform_;
}
//- Initialize ordering for primitivePatch. Does not

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -141,9 +141,9 @@ void Foam::globalIndexAndTransform::determineTransforms()
{
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)
{
@ -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)
{
@ -299,9 +299,9 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
{
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)
{
@ -319,9 +319,9 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
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)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -133,9 +133,19 @@ public:
//- Return true if the rotation tensor is non-I
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;
//- 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
@ -170,6 +180,10 @@ public:
template<class Type>
Type transform(const Type&) const;
//- Transform the given field
template<class Type>
void transform(Field<Type>&, const Field<Type>&) const;
//- Transform the given field
template<class Type>
tmp<Field<Type>> transform(const Field<Type>&) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -103,6 +103,19 @@ inline bool Foam::transformer::rotates() 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_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -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>
Foam::tmp<Foam::Field<Type>> Foam::transformer::transform
(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -157,13 +157,15 @@ public:
//- Does the patch field perform the transformation
virtual bool doTransform() const
{
return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
return
procPatch_.transform().rotates()
&& pTraits<Type>::rank != 0;
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
//- Return transformation between the coupled patches
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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ Foam::extendedCellToCellStencil::extendedCellToCellStencil(const polyMesh& mesh)
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchi]);
if (!cpp.parallel() || cpp.separated())
if (cpp.transform().transformsPosition())
{
FatalErrorInFunction
<< "Coupled patches with transformations not supported."

View File

@ -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-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,7 +111,7 @@ Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh)
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchi]);
if (!cpp.parallel() || cpp.separated())
if (cpp.transform().transformsPosition())
{
FatalErrorInFunction
<< "Coupled patches with transformations not supported."

View File

@ -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-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,7 +43,7 @@ Foam::extendedFaceToCellStencil::extendedFaceToCellStencil(const polyMesh& mesh)
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchi]);
if (!cpp.parallel() || cpp.separated())
if (cpp.transform().transformsPosition())
{
FatalErrorInFunction
<< "Coupled patches with transformations not supported."

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,14 +80,14 @@ Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const
vectorField& pdv = tpdv.ref();
// To the transformation if necessary
if (parallel())
if (transform().rotates())
{
forAll(patchD, facei)
{
vector ddi = patchD[facei];
vector dni = nbrPatchD[facei];
pdv[facei] = ddi - dni;
pdv[facei] = ddi - transform().transform(dni);
}
}
else
@ -97,7 +97,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const
vector ddi = patchD[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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -113,22 +113,10 @@ public:
);
}
//- Are the cyclic planes parallel
virtual bool parallel() const
//- Return transformation between the coupled patches
virtual const transformer& transform() const
{
return cyclicPolyPatch_.parallel();
}
//- 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();
return cyclicPolyPatch_.transform();
}
const cyclicFvPatch& neighbFvPatch() const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,14 +139,14 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
vectorField& pdv = tpdv.ref();
// do the transformation if necessary
if (parallel())
if (transform().rotates())
{
forAll(patchD, facei)
{
const vector& ddi = patchD[facei];
const vector& dni = nbrPatchD[facei];
pdv[facei] = ddi - dni;
pdv[facei] = ddi - transform().transform(dni);
}
}
else
@ -156,7 +156,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
const vector& ddi = patchD[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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,22 +139,10 @@ public:
return cyclicAMIPolyPatch_.applyLowWeightCorrection();
}
//- Are the cyclic planes parallel
virtual bool parallel() const
//- Return transformation between the coupled patches
virtual const transformer& transform() const
{
return cyclicAMIPolyPatch_.parallel();
}
//- 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();
return cyclicAMIPolyPatch_.transform();
}
const cyclicAMIFvPatch& neighbFvPatch() const

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1067,13 +1067,13 @@ void Foam::particle::correctAfterParallelTransfer
const coupledPolyPatch& ppp =
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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -277,13 +277,13 @@ void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&)
reflect();
// 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());
}
if (!receiveCpp.parallel())
if (receiveCpp.transform().rotates())
{
transformProperties(receiveCpp.forwardT());
displacementT = transform(receiveCpp.forwardT(), displacementT);
transformProperties(receiveCpp.transform().R());
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -233,6 +233,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
forwardT_ = revT.T();
reverseT_ = revT;
transform_ = transformer(revT.T());
break;
}
case TRANSLATIONAL:
@ -249,6 +251,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
forwardT_ = Zero;
reverseT_ = Zero;
transform_ = transformer(separation_);
break;
}
default:
@ -265,6 +269,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
forwardT_ = Zero;
reverseT_ = Zero;
transform_ = transformer();
break;
}
}
@ -272,9 +278,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
if (debug)
{
Pout<< "patch: " << name() << nl
<< " forwardT = " << forwardT() << nl
<< " reverseT = " << reverseT() << nl
<< " separation = " << separation() << nl << endl;
<< " transform = " << transform() << nl << endl;
}
}
@ -382,9 +386,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms()
if (debug)
{
Pout<< "calcTransforms() : patch: " << name() << nl
<< " forwardT = " << forwardT() << nl
<< " reverseT = " << reverseT() << nl
<< " separation = " << separation() << nl << endl;
<< " transform = " << transform() << nl << endl;
}
}
@ -872,23 +874,23 @@ const Foam::scalarField& Foam::cyclicAMIPolyPatch::neighbWeightsSum() const
void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
{
if (!parallel())
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(forwardT(), l - rotationCentre_)
l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_;
}
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,
// 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
{
if (!parallel())
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(forwardT(), l - rotationCentre_)
l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_;
}
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
{
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
{
if (!parallel())
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(reverseT(), l - rotationCentre_)
l = Foam::transform(transform().R().T(), l - rotationCentre_)
+ rotationCentre_;
}
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
{
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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMILduInterfaceField, 0);
defineTypeNameAndDebug(cyclicRepeatAMILduInterfaceField, 0);
}

View File

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

View File

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

View File

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