coupledPolyPatch: Separated ordering from transformation controls

which will allow the transformation calculation functionality to be moved into
cyclic patches.
This commit is contained in:
Henry Weller
2019-12-31 20:24:52 +00:00
parent f8ac6e8d1e
commit 02fc637645
31 changed files with 390 additions and 507 deletions

View File

@ -1081,11 +1081,9 @@ int main(int argc, char *argv[])
0, 0,
patchi, patchi,
mesh.boundaryMesh(), mesh.boundaryMesh(),
cyclicPolyPatch::typeName,
neighbPatchName, neighbPatchName,
cyclicPolyPatch::NOORDERING, cyclicPolyPatch::NOORDERING
Zero,
Zero,
Zero
); );
} }
else else

View File

@ -776,18 +776,10 @@ int main(int argc, char *argv[])
const cyclicPolyPatch& cycpp = const cyclicPolyPatch& cycpp =
refCast<const cyclicPolyPatch>(pp); refCast<const cyclicPolyPatch>(pp);
if (cycpp.transform() == cyclicPolyPatch::TRANSLATIONAL) if (cycpp.transform() != cyclicPolyPatch::TRANSLATIONAL)
{
// Force to wanted separation
Info<< "On cyclic translation patch " << pp.name()
<< " forcing uniform separation of "
<< cycpp.separationVector() << endl;
const_cast<vector&>(cpp.separation()) =
cycpp.separationVector();
}
else
{ {
const cyclicPolyPatch& nbr = cycpp.neighbPatch(); const cyclicPolyPatch& nbr = cycpp.neighbPatch();
const_cast<vector&>(cpp.separation()) = const_cast<vector&>(cpp.separation()) =
nbr[0].centre(mesh.points()) nbr[0].centre(mesh.points())
- cycpp[0].centre(mesh.points()); - cycpp[0].centre(mesh.points());
@ -800,17 +792,8 @@ int main(int argc, char *argv[])
else if (!cpp.parallel()) else if (!cpp.parallel())
{ {
Info<< "On coupled patch " << pp.name() Info<< "On coupled patch " << pp.name()
<< " forcing uniform rotation of " << " uniform rotation of "
<< cpp.forwardT() << endl; << cpp.forwardT() << endl;
// const_cast<tensorField&>
// (
// cpp.forwardT()
// ).setSize(1);
// const_cast<tensorField&>
// (
// cpp.reverseT()
// ).setSize(1);
} }
} }
} }

View File

@ -496,7 +496,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
proci, proci,
curNeighbourProcessors[procPatchi], curNeighbourProcessors[procPatchi],
pcPatch.name(), pcPatch.name(),
pcPatch.transform() pcPatch.ordering()
); );
} }

View File

@ -66,7 +66,7 @@ patches
rotationAxis (1 0 0); rotationAxis (1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
// transform translational; // transform translational;
// separationVector (1 0 0); // separation (1 0 0);
// Optional non-default tolerance to be able to define cyclics // Optional non-default tolerance to be able to define cyclics
// on bad meshes // on bad meshes
@ -98,7 +98,7 @@ patches
rotationAxis (1 0 0); rotationAxis (1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
// transform translational; // transform translational;
// separationVector (1 0 0); // separation (1 0 0);
} }
// How to construct: either from 'patches' or 'set' // How to construct: either from 'patches' or 'set'

View File

@ -37,16 +37,26 @@ namespace Foam
const scalar coupledPolyPatch::defaultMatchTol_ = 1e-4; const scalar coupledPolyPatch::defaultMatchTol_ = 1e-4;
template<> template<>
const char* NamedEnum<coupledPolyPatch::transformType, 5>::names[] = const char* NamedEnum<coupledPolyPatch::orderingType, 3>::names[] =
{ {
"unknown", "unknown",
"rotational",
"translational",
"coincidentFullMatch", "coincidentFullMatch",
"noOrdering" "noOrdering"
}; };
const NamedEnum<coupledPolyPatch::transformType, 5> const NamedEnum<coupledPolyPatch::orderingType, 3>
coupledPolyPatch::orderingTypeNames;
template<>
const char* NamedEnum<coupledPolyPatch::transformType, 4>::names[] =
{
"unspecified",
"none",
"rotational",
"translational"
};
const NamedEnum<coupledPolyPatch::transformType, 4>
coupledPolyPatch::transformTypeNames; coupledPolyPatch::transformTypeNames;
} }
@ -131,12 +141,12 @@ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
( (
const UList<face>& faces, const UList<face>& faces,
const pointField& points, const pointField& points,
const transformType transform const orderingType ordering
) )
{ {
pointField anchors(faces.size()); pointField anchors(faces.size());
if (transform != COINCIDENTFULLMATCH) if (ordering != COINCIDENTFULLMATCH)
{ {
// Return the first point // Return the first point
forAll(faces, facei) forAll(faces, facei)
@ -289,172 +299,6 @@ Foam::label Foam::coupledPolyPatch::getRotation
} }
void Foam::coupledPolyPatch::calcTransformTensors
(
const vectorField& Cf,
const vectorField& Cr,
const vectorField& nf,
const vectorField& nr,
const scalarField& smallDist,
const scalar absTol,
const transformType transform
) const
{
if (debug)
{
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
<< " transform:" << transformTypeNames[transform] << nl
<< " (half)size:" << Cf.size() << nl
<< " absTol:" << absTol << nl
<< " smallDist min:" << min(smallDist) << nl
<< " smallDist max:" << max(smallDist) << nl
<< " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl;
}
// Tolerance calculation.
// - normal calculation: assume absTol is the absolute error in a
// single normal/transformation calculation. Consists both of numerical
// precision (on the order of small and of writing precision
// (from e.g. decomposition)
// Then the overall error of summing the normals is sqrt(size())*absTol
// - separation calculation: pass in from the outside an allowable error.
if (Cf.size() == 0)
{
// Dummy geometry. Assume non-separated, parallel.
parallel_ = true;
separated_ = false;
}
else
{
scalar error = absTol*Foam::sqrt(1.0*Cf.size());
if (debug)
{
Pout<< " error:" << error << endl;
}
if
(
transform == ROTATIONAL
|| (
transform != TRANSLATIONAL
&& transform != COINCIDENTFULLMATCH
&& (sum(mag(nf & nr)) < Cf.size() - error)
)
)
{
// Type is rotation or unknown and normals not aligned
parallel_ = false;
separated_ = false;
separation_ = Zero;
tensorField forwardT(Cf.size());
tensorField reverseT(Cf.size());
forAll(forwardT, facei)
{
forwardT[facei] = rotationTensor(-nr[facei], nf[facei]);
reverseT[facei] = rotationTensor(nf[facei], -nr[facei]);
}
if (sum(mag(forwardT - forwardT[0])) > error)
{
Pout<< "--> FOAM Warning : "
<< " Variation in rotation greater than"
<< " local tolerance " << error << endl;
}
forwardT_ = forwardT[0];
reverseT_ = reverseT[0];
}
else
{
// Translational or (unknown and normals aligned)
parallel_ = true;
forwardT_ = Zero;
reverseT_ = Zero;
// Three situations:
// - separation is zero. No separation.
// - separation is same. Single separation vector.
// - separation differs per face -> error.
// Check for different separation per face
bool sameSeparation = true;
bool doneWarning = false;
const vectorField separation(Cr - Cf);
forAll(separation, facei)
{
const scalar smallSqr = sqr(smallDist[facei]);
// Check if separation differing w.r.t. face 0.
if (magSqr(separation[facei] - separation[0]) > smallSqr)
{
sameSeparation = false;
if (!doneWarning && debug)
{
doneWarning = true;
Pout<< " separation " << separation[facei]
<< " at " << facei
<< " differs from separation[0] " << separation[0]
<< " by more than local tolerance "
<< smallDist[facei]
<< ". Assuming non-uniform separation." << endl;
}
}
}
if (sameSeparation)
{
// Check for zero separation
if (mag(separation[0]) < smallDist[0])
{
if (debug)
{
Pout<< " separation " << mag(separation[0])
<< " less than local tolerance " << smallDist[0]
<< ". Assuming zero separation." << endl;
}
separated_ = false;
separation_ = Zero;
}
else
{
if (debug)
{
Pout<< " separation " << mag(separation[0])
<< " more than local tolerance " << smallDist[0]
<< ". Assuming uniform separation." << endl;
}
separated_ = true;
separation_ = separation[0];
}
}
else
{
Pout<< "--> FOAM Warning : "
<< " Variation in separation greater than"
<< " local tolerance " << smallDist[0] << endl;
separated_ = true;
separation_ = separation[0];
}
}
}
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::coupledPolyPatch::coupledPolyPatch Foam::coupledPolyPatch::coupledPolyPatch
@ -465,12 +309,13 @@ Foam::coupledPolyPatch::coupledPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform const orderingType ordering
) )
: :
polyPatch(name, size, start, index, bm, patchType), polyPatch(name, size, start, index, bm, patchType),
matchTolerance_(defaultMatchTol_), matchTolerance_(defaultMatchTol_),
transform_(transform), ordering_(ordering),
transform_(UNSPECIFIED),
parallel_(true), parallel_(true),
separated_(false) separated_(false)
{} {}
@ -483,16 +328,22 @@ Foam::coupledPolyPatch::coupledPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType defaultTransform const orderingType ordering
) )
: :
polyPatch(name, dict, index, bm, patchType), polyPatch(name, dict, index, bm, patchType),
matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)), matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)),
ordering_
(
dict.found("ordering")
? orderingTypeNames.read(dict.lookup("ordering"))
: ordering
),
transform_ transform_
( (
dict.found("transform") dict.found("transform")
? transformTypeNames.read(dict.lookup("transform")) ? transformTypeNames.read(dict.lookup("transform"))
: defaultTransform : UNSPECIFIED
), ),
parallel_(true), parallel_(true),
separated_(false) separated_(false)
@ -559,6 +410,7 @@ void Foam::coupledPolyPatch::write(Ostream& os) const
{ {
polyPatch::write(os); polyPatch::write(os);
writeEntry(os, "matchTolerance", matchTolerance_); writeEntry(os, "matchTolerance", matchTolerance_);
writeEntry(os, "ordering", orderingTypeNames[ordering_]);
writeEntry(os, "transform", transformTypeNames[transform_]); writeEntry(os, "transform", transformTypeNames[transform_]);
} }

View File

@ -55,17 +55,25 @@ class coupledPolyPatch
{ {
public: public:
enum transformType enum orderingType
{ {
UNKNOWN, // unspecified; automatic ordering UNKNOWN, // Unspecified -> automatic ordering
ROTATIONAL, // rotation along coordinate axis COINCIDENTFULLMATCH,// Assume no transforms
TRANSLATIONAL, // translation
COINCIDENTFULLMATCH,// assume no transforms
// and check the points in faces match // and check the points in faces match
NOORDERING // unspecified, no automatic ordering NOORDERING // Unspecified -> no automatic ordering
}; };
static const NamedEnum<transformType, 5> transformTypeNames; static const NamedEnum<orderingType, 3> orderingTypeNames;
enum transformType
{
UNSPECIFIED, // Unspecified -> automatic transformation
NONE, // No tranformation
ROTATIONAL, // Rotation around a coordinate axis
TRANSLATIONAL // Translation
};
static const NamedEnum<transformType, 4> transformTypeNames;
protected: protected:
@ -78,6 +86,9 @@ protected:
//- Local matching tolerance //- Local matching tolerance
const scalar matchTolerance_; const scalar matchTolerance_;
//- Type of ordering
orderingType ordering_;
//- Type of transformation //- Type of transformation
transformType transform_; transformType transform_;
@ -102,22 +113,6 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Calculate the transformation tensors
// smallDist : matching distance per face
// absTol : absolute error in normal
// if transformType = unknown it first tries rotational, then
// translational transform
void calcTransformTensors
(
const vectorField& Cf,
const vectorField& Cr,
const vectorField& nf,
const vectorField& nr,
const scalarField& smallDist,
const scalar absTol,
const transformType = UNKNOWN
) const;
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&) = 0; virtual void initGeometry(PstreamBuffers&) = 0;
@ -136,7 +131,6 @@ protected:
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(PstreamBuffers&) = 0; virtual void updateMesh(PstreamBuffers&) = 0;
//- Write point in OBJ format //- Write point in OBJ format
static void writeOBJ(Ostream& os, const point& pt); static void writeOBJ(Ostream& os, const point& pt);
@ -165,7 +159,7 @@ protected:
( (
const UList<face>&, const UList<face>&,
const pointField&, const pointField&,
const transformType const orderingType
); );
//- Get the number of vertices face f needs to be rotated such that //- Get the number of vertices face f needs to be rotated such that
@ -196,7 +190,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform const orderingType ordering
); );
//- Construct from dictionary //- Construct from dictionary
@ -207,7 +201,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType defaultTransform = UNKNOWN const orderingType ordering = UNKNOWN
); );
//- Construct as copy, resetting the boundary mesh //- Construct as copy, resetting the boundary mesh
@ -258,16 +252,14 @@ public:
return !owner(); return !owner();
} }
//- Type of transform //- Type of ordering
virtual transformType transform() const virtual orderingType ordering() const
{ {
return transform_; return ordering_;
} }
//- Type of transform //- Type of transform
// This is currently only for use when collapsing generated virtual transformType transform() const
// meshes that can have zero area faces.
virtual transformType& transform()
{ {
return transform_; return transform_;
} }

View File

@ -49,6 +49,173 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::cyclicPolyPatch::calcTransformTensors
(
const vectorField& Cf,
const vectorField& Cr,
const vectorField& nf,
const vectorField& nr,
const scalarField& smallDist,
const scalar absTol,
const orderingType ordering,
const transformType transform
) const
{
if (debug)
{
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
<< " transform:" << transformTypeNames[transform] << nl
<< " (half)size:" << Cf.size() << nl
<< " absTol:" << absTol << nl
<< " smallDist min:" << min(smallDist) << nl
<< " smallDist max:" << max(smallDist) << nl
<< " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl;
}
// Tolerance calculation.
// - normal calculation: assume absTol is the absolute error in a
// single normal/transformation calculation. Consists both of numerical
// precision (on the order of small and of writing precision
// (from e.g. decomposition)
// Then the overall error of summing the normals is sqrt(size())*absTol
// - separation calculation: pass in from the outside an allowable error.
if (Cf.size() == 0)
{
// Dummy geometry. Assume non-separated, parallel.
parallel_ = true;
separated_ = false;
}
else
{
scalar error = absTol*Foam::sqrt(1.0*Cf.size());
if (debug)
{
Pout<< " error:" << error << endl;
}
if
(
transform == ROTATIONAL
|| (
transform != TRANSLATIONAL
&& ordering != COINCIDENTFULLMATCH
&& (sum(mag(nf & nr)) < Cf.size() - error)
)
)
{
// Type is rotation or unknown and normals not aligned
parallel_ = false;
separated_ = false;
separation_ = Zero;
tensorField forwardT(Cf.size());
tensorField reverseT(Cf.size());
forAll(forwardT, facei)
{
forwardT[facei] = rotationTensor(-nr[facei], nf[facei]);
reverseT[facei] = rotationTensor(nf[facei], -nr[facei]);
}
if (sum(mag(forwardT - forwardT[0])) > error)
{
Pout<< "--> FOAM Warning : "
<< " Variation in rotation greater than"
<< " local tolerance " << error << endl;
}
forwardT_ = forwardT[0];
reverseT_ = reverseT[0];
}
else
{
// Translational or (unknown and normals aligned)
parallel_ = true;
forwardT_ = Zero;
reverseT_ = Zero;
// Three situations:
// - separation is zero. No separation.
// - separation is same. Single separation vector.
// - separation differs per face -> error.
// Check for different separation per face
bool sameSeparation = true;
bool doneWarning = false;
const vectorField separation(Cr - Cf);
forAll(separation, facei)
{
const scalar smallSqr = sqr(smallDist[facei]);
// Check if separation differing w.r.t. face 0.
if (magSqr(separation[facei] - separation[0]) > smallSqr)
{
sameSeparation = false;
if (!doneWarning && debug)
{
doneWarning = true;
Pout<< " separation " << separation[facei]
<< " at " << facei
<< " differs from separation[0] " << separation[0]
<< " by more than local tolerance "
<< smallDist[facei]
<< ". Assuming non-uniform separation." << endl;
}
}
}
if (sameSeparation)
{
// Check for zero separation
if (mag(separation[0]) < smallDist[0])
{
if (debug)
{
Pout<< " separation " << mag(separation[0])
<< " less than local tolerance " << smallDist[0]
<< ". Assuming zero separation." << endl;
}
separated_ = false;
separation_ = Zero;
}
else
{
if (debug)
{
Pout<< " separation " << mag(separation[0])
<< " more than local tolerance " << smallDist[0]
<< ". Assuming uniform separation." << endl;
}
separated_ = true;
separation_ = separation[0];
}
}
else
{
Pout<< "--> FOAM Warning : "
<< " Variation in separation greater than"
<< " local tolerance " << smallDist[0] << endl;
separated_ = true;
separation_ = separation[0];
}
}
}
}
Foam::label Foam::cyclicPolyPatch::findMaxArea Foam::label Foam::cyclicPolyPatch::findMaxArea
( (
const pointField& points, const pointField& points,
@ -252,7 +419,7 @@ void Foam::cyclicPolyPatch::calcTransforms
} }
// Calculate transformation tensors // Calculate transformation
if (transform() == ROTATIONAL) if (transform() == ROTATIONAL)
{ {
@ -297,9 +464,53 @@ void Foam::cyclicPolyPatch::calcTransforms
forwardT_ = revT.T(); forwardT_ = revT.T();
reverseT_ = revT; reverseT_ = revT;
} }
else if (transform() == TRANSLATIONAL)
{
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " patch:" << name()
<< " Specified separation vector : "
<< separation_ << endl;
}
const scalarField half0Tols
(
matchTolerance()
*calcFaceTol
(
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
)
);
// Check that separation vectors are same.
const scalar avgTol = average(half0Tols);
if
(
mag(separation_ + neighbPatch().separation_) > avgTol
)
{
WarningInFunction
<< "Specified separation vector " << separation_
<< " differs by that of neighbouring patch "
<< neighbPatch().separation_
<< " by more than tolerance " << avgTol << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName()
<< endl;
}
// Set transformation
parallel_ = true;
separated_ = true;
forwardT_ = Zero;
reverseT_ = Zero;
}
else else
{ {
scalarField half0Tols const scalarField half0Tols
( (
matchTolerance() matchTolerance()
*calcFaceTol *calcFaceTol
@ -318,63 +529,9 @@ void Foam::cyclicPolyPatch::calcTransforms
half1Normals, half1Normals,
half0Tols, half0Tols,
matchTolerance(), matchTolerance(),
ordering(),
transform() transform()
); );
if (transform() == TRANSLATIONAL)
{
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " patch:" << name()
<< " Specified separation vector : "
<< separationVector_ << endl;
}
// Check that separation vectors are same.
const scalar avgTol = average(half0Tols);
if
(
mag(separationVector_ + neighbPatch().separationVector_)
> avgTol
)
{
WarningInFunction
<< "Specified separation vector " << separationVector_
<< " differs by that of neighbouring patch "
<< neighbPatch().separationVector_
<< " by more than tolerance " << avgTol << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName()
<< endl;
}
// Override computed transform with specified.
if (mag(separation() - separationVector_) > avgTol)
{
WarningInFunction
<< "Specified separationVector " << separationVector_
<< " differs from computed separation vector "
<< separation() << endl
<< "This probably means your geometry is not consistent"
<< " with the specified separation and might lead"
<< " to problems." << endl
<< "Continuing with specified separation vector "
<< separationVector_ << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName()
<< endl;
}
// Set tensors
parallel_ = true;
separated_ = true;
separation_ = separationVector_;
forwardT_ = Zero;
reverseT_ = Zero;
}
} }
} }
} }
@ -393,7 +550,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
{ {
// Get geometric data on both halves. // Get geometric data on both halves.
half0Ctrs = pp0.faceCentres(); half0Ctrs = pp0.faceCentres();
anchors0 = getAnchorPoints(pp0, pp0.points(), transform()); anchors0 = getAnchorPoints(pp0, pp0.points(), ordering());
half1Ctrs = pp1.faceCentres(); half1Ctrs = pp1.faceCentres();
if (debug) if (debug)
@ -474,15 +631,15 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
{ {
Pout<< "cyclicPolyPatch::getCentresAndAnchors :" Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
<< " patch:" << name() << " patch:" << name()
<< "Specified translation : " << separationVector_ << "Specified translation : " << separation_
<< endl; << endl;
} }
// Note: getCentresAndAnchors gets called on the slave side // Note: getCentresAndAnchors gets called on the slave side
// so separationVector is owner-slave points. // so separation is owner-slave points.
half0Ctrs -= separationVector_; half0Ctrs -= separation_;
anchors0 -= separationVector_; anchors0 -= separation_;
break; break;
} }
default: default:
@ -591,15 +748,14 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform const orderingType ordering
) )
: :
coupledPolyPatch(name, size, start, index, bm, patchType, transform), coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
neighbPatchName_(word::null), neighbPatchName_(word::null),
neighbPatchID_(-1), neighbPatchID_(-1),
rotationAxis_(Zero), rotationAxis_(Zero),
rotationCentre_(Zero), rotationCentre_(Zero),
separationVector_(Zero),
coupledPointsPtr_(nullptr), coupledPointsPtr_(nullptr),
coupledEdgesPtr_(nullptr) coupledEdgesPtr_(nullptr)
{ {
@ -615,19 +771,16 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
const label start, const label start,
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType,
const word& neighbPatchName, const word& neighbPatchName,
const transformType transform, const orderingType ordering
const vector& rotationAxis,
const point& rotationCentre,
const vector& separationVector
) )
: :
coupledPolyPatch(name, size, start, index, bm, typeName, transform), coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
neighbPatchName_(neighbPatchName), neighbPatchName_(neighbPatchName),
neighbPatchID_(-1), neighbPatchID_(-1),
rotationAxis_(rotationAxis), rotationAxis_(Zero),
rotationCentre_(rotationCentre), rotationCentre_(Zero),
separationVector_(separationVector),
coupledPointsPtr_(nullptr), coupledPointsPtr_(nullptr),
coupledEdgesPtr_(nullptr) coupledEdgesPtr_(nullptr)
{ {
@ -643,16 +796,15 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType defaultTransform const orderingType ordering
) )
: :
coupledPolyPatch(name, dict, index, bm, patchType, defaultTransform), coupledPolyPatch(name, dict, index, bm, patchType, ordering),
neighbPatchName_(dict.lookupOrDefault("neighbourPatch", word::null)), neighbPatchName_(dict.lookupOrDefault("neighbourPatch", word::null)),
coupleGroup_(dict), coupleGroup_(dict),
neighbPatchID_(-1), neighbPatchID_(-1),
rotationAxis_(Zero), rotationAxis_(Zero),
rotationCentre_(Zero), rotationCentre_(Zero),
separationVector_(Zero),
coupledPointsPtr_(nullptr), coupledPointsPtr_(nullptr),
coupledEdgesPtr_(nullptr) coupledEdgesPtr_(nullptr)
{ {
@ -696,7 +848,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
} }
case TRANSLATIONAL: case TRANSLATIONAL:
{ {
dict.lookup("separationVector") >> separationVector_; dict.lookup("separation") >> separation_;
break; break;
} }
default: default:
@ -722,7 +874,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
neighbPatchID_(-1), neighbPatchID_(-1),
rotationAxis_(pp.rotationAxis_), rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_),
separationVector_(pp.separationVector_),
coupledPointsPtr_(nullptr), coupledPointsPtr_(nullptr),
coupledEdgesPtr_(nullptr) coupledEdgesPtr_(nullptr)
{ {
@ -747,7 +898,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
neighbPatchID_(-1), neighbPatchID_(-1),
rotationAxis_(pp.rotationAxis_), rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_),
separationVector_(pp.separationVector_),
coupledPointsPtr_(nullptr), coupledPointsPtr_(nullptr),
coupledEdgesPtr_(nullptr) coupledEdgesPtr_(nullptr)
{ {
@ -779,7 +929,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
neighbPatchID_(-1), neighbPatchID_(-1),
rotationAxis_(pp.rotationAxis_), rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_),
separationVector_(pp.separationVector_),
coupledPointsPtr_(nullptr), coupledPointsPtr_(nullptr),
coupledEdgesPtr_(nullptr) coupledEdgesPtr_(nullptr)
{} {}
@ -1240,7 +1389,7 @@ bool Foam::cyclicPolyPatch::order
rotation.setSize(pp.size()); rotation.setSize(pp.size());
rotation = 0; rotation = 0;
if (transform() == NOORDERING) if (ordering() == NOORDERING)
{ {
// No faces, nothing to change. // No faces, nothing to change.
return false; return false;
@ -1428,11 +1577,7 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const
} }
case TRANSLATIONAL: case TRANSLATIONAL:
{ {
writeEntry(os, "separationVector", separationVector_); writeEntry(os, "separation", separation_);
break;
}
case NOORDERING:
{
break; break;
} }
default: default:

View File

@ -84,11 +84,6 @@ class cyclicPolyPatch
//- Point on axis of rotation for rotational cyclics //- Point on axis of rotation for rotational cyclics
point rotationCentre_; point rotationCentre_;
// For translation
//- Translation vector
vector separationVector_;
//- List of edges formed from connected points. e[0] is the point on //- List of edges formed from connected points. e[0] is the point on
// the first half of the patch, e[1] the corresponding point on the // the first half of the patch, e[1] the corresponding point on the
@ -105,6 +100,23 @@ class cyclicPolyPatch
// Private Member Functions // Private Member Functions
//- Calculate the transformation tensors
// smallDist : matching distance per face
// absTol : absolute error in normal
// if orderingType = unknown it first tries rotational, then
// translational transform
void calcTransformTensors
(
const vectorField& Cf,
const vectorField& Cr,
const vectorField& nf,
const vectorField& nr,
const scalarField& smallDist,
const scalar absTol,
const orderingType = UNKNOWN,
const transformType = UNSPECIFIED
) const;
//- Find amongst selected faces the one with the largest area //- Find amongst selected faces the one with the largest area
static label findMaxArea(const pointField&, const faceList&); static label findMaxArea(const pointField&, const faceList&);
@ -204,7 +216,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform = UNKNOWN const orderingType defaultOrdering = UNKNOWN
); );
//- Construct from components //- Construct from components
@ -215,11 +227,9 @@ public:
const label start, const label start,
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType,
const word& neighbPatchName, const word& neighbPatchName,
const transformType transform, // transformation type const orderingType ordering
const vector& rotationAxis, // for rotation only
const point& rotationCentre, // for rotation only
const vector& separationVector // for translation only
); );
//- Construct from dictionary //- Construct from dictionary
@ -230,7 +240,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType defaultTransform = UNKNOWN const orderingType ordering = UNKNOWN
); );
//- Construct as copy, resetting the boundary mesh //- Construct as copy, resetting the boundary mesh
@ -382,12 +392,6 @@ public:
return rotationCentre_; return rotationCentre_;
} }
//- Translation vector for translational cyclics
const vector& separationVector() const
{
return separationVector_;
}
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)

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-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,10 +69,10 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform = UNKNOWN const orderingType ordering = UNKNOWN
) )
: :
cyclicPolyPatch(name, size, start, index, bm, patchType, transform) cyclicPolyPatch(name, size, start, index, bm, patchType, ordering)
{} {}
//- Construct from dictionary //- Construct from dictionary

View File

@ -334,23 +334,6 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
break; break;
} }
//- Problem: usually specified translation is not accurate enough
//- To get proper match so keep automatic determination over here.
// case TRANSLATIONAL:
//{
// // Transform 0 points.
//
// if (debug)
// {
// Pout<< "oldCyclicPolyPatch::getCentresAndAnchors :"
// << "Specified translation : " << separationVector_
// << endl;
// }
//
// half0Ctrs += separationVector_;
// anchors0 += separationVector_;
// break;
//}
default: default:
{ {
// Assumes that cyclic is planar. This is also the initial // Assumes that cyclic is planar. This is also the initial
@ -564,14 +547,13 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform const orderingType ordering
) )
: :
coupledPolyPatch(name, size, start, index, bm, patchType, transform), coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
featureCos_(0.9), featureCos_(0.9),
rotationAxis_(Zero), rotationAxis_(Zero),
rotationCentre_(Zero), rotationCentre_(Zero)
separationVector_(Zero)
{} {}
@ -587,8 +569,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
coupledPolyPatch(name, dict, index, bm, patchType), coupledPolyPatch(name, dict, index, bm, patchType),
featureCos_(0.9), featureCos_(0.9),
rotationAxis_(Zero), rotationAxis_(Zero),
rotationCentre_(Zero), rotationCentre_(Zero)
separationVector_(Zero)
{ {
if (dict.found("neighbourPatch")) if (dict.found("neighbourPatch"))
{ {
@ -615,7 +596,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
} }
case TRANSLATIONAL: case TRANSLATIONAL:
{ {
dict.lookup("separationVector") >> separationVector_; dict.lookup("separation") >> separation_;
break; break;
} }
default: default:
@ -635,8 +616,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
coupledPolyPatch(pp, bm), coupledPolyPatch(pp, bm),
featureCos_(pp.featureCos_), featureCos_(pp.featureCos_),
rotationAxis_(pp.rotationAxis_), rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_)
separationVector_(pp.separationVector_)
{} {}
@ -652,8 +632,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
coupledPolyPatch(pp, bm, index, newSize, newStart), coupledPolyPatch(pp, bm, index, newSize, newStart),
featureCos_(pp.featureCos_), featureCos_(pp.featureCos_),
rotationAxis_(pp.rotationAxis_), rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_)
separationVector_(pp.separationVector_)
{} {}
@ -1236,7 +1215,7 @@ void Foam::oldCyclicPolyPatch::write(Ostream& os) const
} }
case TRANSLATIONAL: case TRANSLATIONAL:
{ {
writeEntry(os, "separationVector", separationVector_); writeEntry(os, "separation", separation_);
break; break;
} }
default: default:

View File

@ -69,11 +69,6 @@ class oldCyclicPolyPatch
//- Point on axis of rotation for rotational cyclics //- Point on axis of rotation for rotational cyclics
point rotationCentre_; point rotationCentre_;
// For translation
//- Translation vector
vector separationVector_;
// Private Member Functions // Private Member Functions
@ -185,7 +180,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform = UNKNOWN const orderingType ordering = UNKNOWN
); );
//- Construct from dictionary //- Construct from dictionary

View File

@ -56,11 +56,11 @@ Foam::processorPolyPatch::processorPolyPatch
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const transformType transform, const orderingType ordering,
const word& patchType const word& patchType
) )
: :
coupledPolyPatch(name, size, start, index, bm, patchType, transform), coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo), neighbProcNo_(neighbProcNo),
neighbFaceCentres_(), neighbFaceCentres_(),
@ -77,7 +77,7 @@ Foam::processorPolyPatch::processorPolyPatch
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const transformType transform, const orderingType ordering,
const word& patchType const word& patchType
) )
: :
@ -89,7 +89,7 @@ Foam::processorPolyPatch::processorPolyPatch
index, index,
bm, bm,
patchType, patchType,
transform ordering
), ),
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo), neighbProcNo_(neighbProcNo),
@ -525,7 +525,7 @@ void Foam::processorPolyPatch::initOrder
if if
( (
!Pstream::parRun() !Pstream::parRun()
|| transform() == NOORDERING || ordering() == NOORDERING
) )
{ {
return; return;
@ -562,7 +562,7 @@ void Foam::processorPolyPatch::initOrder
if (owner()) if (owner())
{ {
if (transform() == COINCIDENTFULLMATCH) if (ordering() == COINCIDENTFULLMATCH)
{ {
// Pass the patch points and faces across // Pass the patch points and faces across
UOPstream toNeighbour(neighbProcNo(), pBufs); UOPstream toNeighbour(neighbProcNo(), pBufs);
@ -573,7 +573,7 @@ void Foam::processorPolyPatch::initOrder
{ {
const pointField& ppPoints = pp.points(); const pointField& ppPoints = pp.points();
pointField anchors(getAnchorPoints(pp, ppPoints, transform())); pointField anchors(getAnchorPoints(pp, ppPoints, ordering()));
// Get the average of the points of each face. This is needed in // Get the average of the points of each face. This is needed in
// case the face centroid calculation is incorrect due to the face // case the face centroid calculation is incorrect due to the face
@ -719,7 +719,7 @@ bool Foam::processorPolyPatch::order
if if
( (
!Pstream::parRun() !Pstream::parRun()
|| transform() == NOORDERING || ordering() == NOORDERING
) )
{ {
return false; return false;
@ -742,11 +742,11 @@ bool Foam::processorPolyPatch::order
faceMap[patchFacei] = patchFacei; faceMap[patchFacei] = patchFacei;
} }
if (transform() != COINCIDENTFULLMATCH) if (ordering() != COINCIDENTFULLMATCH)
{ {
const pointField& ppPoints = pp.points(); const pointField& ppPoints = pp.points();
pointField anchors(getAnchorPoints(pp, ppPoints, transform())); pointField anchors(getAnchorPoints(pp, ppPoints, ordering()));
// Calculate typical distance from face centre // Calculate typical distance from face centre
scalarField tols scalarField tols
@ -783,7 +783,7 @@ bool Foam::processorPolyPatch::order
matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres()) matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres())
); );
if (transform() == COINCIDENTFULLMATCH) if (ordering() == COINCIDENTFULLMATCH)
{ {
vectorField masterPts; vectorField masterPts;
faceList masterFaces; faceList masterFaces;

View File

@ -93,7 +93,7 @@ protected:
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const transformType transform = UNKNOWN, // transformation type const orderingType defaultOrdering = UNKNOWN,
const word& patchType = typeName const word& patchType = typeName
); );
@ -152,7 +152,7 @@ public:
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const transformType transform = UNKNOWN, // transformation type const orderingType ordering = UNKNOWN,
const word& patchType = typeName const word& patchType = typeName
); );

View File

@ -48,7 +48,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const word& referPatchName, const word& referPatchName,
const transformType transform, const orderingType ordering,
const word& patchType const word& patchType
) )
: :
@ -61,7 +61,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
bm, bm,
myProcNo, myProcNo,
neighbProcNo, neighbProcNo,
transform, ordering,
patchType patchType
), ),
referPatchName_(referPatchName), referPatchName_(referPatchName),
@ -237,7 +237,9 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
if (Pstream::parRun()) if (Pstream::parRun())
{ {
calcTransformTensors cyclicPolyPatch& pp = const_cast<cyclicPolyPatch&>(referPatch());
pp.calcTransformTensors
( (
faceCentres(), faceCentres(),
neighbFaceCentres(), neighbFaceCentres(),
@ -245,6 +247,7 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
neighbFaceAreas()/mag(neighbFaceAreas()), neighbFaceAreas()/mag(neighbFaceAreas()),
matchTolerance()*calcFaceTol(*this, points(), faceCentres()), matchTolerance()*calcFaceTol(*this, points(), faceCentres()),
matchTolerance(), matchTolerance(),
ordering(),
transform() transform()
); );
@ -256,7 +259,7 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
// Update underlying cyclic halves. Need to do both since only one // Update underlying cyclic halves. Need to do both since only one
// half might be present as a processorCyclic. // half might be present as a processorCyclic.
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
pp.calcGeometry pp.calcGeometry
( (
*this, *this,
@ -268,20 +271,16 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
neighbFaceCellCentres() neighbFaceCellCentres()
); );
if (isA<cyclicPolyPatch>(pp)) const_cast<cyclicPolyPatch&>(pp.neighbPatch()).calcGeometry
{ (
const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp); *this,
const_cast<cyclicPolyPatch&>(cpp.neighbPatch()).calcGeometry neighbFaceCentres(),
( neighbFaceAreas(),
*this, neighbFaceCellCentres(),
neighbFaceCentres(), faceCentres(),
neighbFaceAreas(), faceAreas(),
neighbFaceCellCentres(), faceCellCentres()
faceCentres(), );
faceAreas(),
faceCellCentres()
);
}
} }
} }

View File

@ -38,6 +38,7 @@ SourceFiles
#define processorCyclicPolyPatch_H #define processorCyclicPolyPatch_H
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -121,7 +122,7 @@ public:
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const word& referPatchName, const word& referPatchName,
const transformType transform = UNKNOWN, const orderingType ordering = UNKNOWN,
const word& patchType = typeName const word& patchType = typeName
); );
@ -304,10 +305,10 @@ public:
return referPatchID_; return referPatchID_;
} }
const coupledPolyPatch& referPatch() const const cyclicPolyPatch& referPatch() const
{ {
const polyPatch& pp = this->boundaryMesh()[referPatchID()]; const polyPatch& pp = this->boundaryMesh()[referPatchID()];
return refCast<const coupledPolyPatch>(pp); return refCast<const cyclicPolyPatch>(pp);
} }
//- Return message tag to use for communication //- Return message tag to use for communication
@ -325,14 +326,6 @@ public:
return referPatch().transform(); return referPatch().transform();
} }
//- Type of transform
// This is currently only for use when collapsing generated
// meshes that can have zero area faces.
virtual transformType& transform()
{
return const_cast<coupledPolyPatch&>(referPatch()).transform();
}
//- 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(pointField& l) const virtual void transformPosition(pointField& l) const
{ {

View File

@ -137,23 +137,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
{ {
const polyPatch& pp = patches[patchi]; const polyPatch& pp = patches[patchi];
// Note: special check for unordered cyclics. These are in fact if (isA<coupledPolyPatch>(pp))
// transform bcs and should probably be split off.
// Note: We don't want to be finding transforms for patches marked as
// coincident full match. These should have no transform by definition.
if
(
isA<coupledPolyPatch>(pp)
&& !(
isA<cyclicPolyPatch>(pp)
&& refCast<const cyclicPolyPatch>(pp).transform()
== cyclicPolyPatch::NOORDERING
)
&& !(
refCast<const coupledPolyPatch>(pp).transform()
== coupledPolyPatch::COINCIDENTFULLMATCH
)
)
{ {
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp); const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
@ -311,23 +295,7 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
{ {
const polyPatch& pp = patches[patchi]; const polyPatch& pp = patches[patchi];
// Note: special check for unordered cyclics. These are in fact if (isA<coupledPolyPatch>(pp))
// transform bcs and should probably be split off.
// Note: We don't want to be finding transforms for patches marked as
// coincident full match. These should have no transform by definition.
if
(
isA<coupledPolyPatch>(pp)
&& !(
isA<cyclicPolyPatch>(pp)
&& refCast<const cyclicPolyPatch>(pp).transform()
== cyclicPolyPatch::NOORDERING
)
&& !(
refCast<const coupledPolyPatch>(pp).transform()
== coupledPolyPatch::COINCIDENTFULLMATCH
)
)
{ {
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp); const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);

View File

@ -1245,7 +1245,7 @@ void Foam::fvMeshDistribute::addProcPatches
Pstream::myProcNo(), Pstream::myProcNo(),
proci, proci,
pcPatch.name(), pcPatch.name(),
pcPatch.transform() pcPatch.ordering()
); );
procPatchID[proci].insert procPatchID[proci].insert

View File

@ -205,7 +205,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform const orderingType ordering
) )
: :
cyclicAMIPolyPatch cyclicAMIPolyPatch
@ -216,7 +216,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
index, index,
bm, bm,
patchType, patchType,
transform, ordering,
false, false,
AMIInterpolation::imPartialFaceAreaWeight AMIInterpolation::imPartialFaceAreaWeight
), ),

View File

@ -110,7 +110,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform = UNKNOWN const orderingType ordering = UNKNOWN
); );
//- Construct from dictionary //- Construct from dictionary

View File

@ -240,13 +240,12 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
if (debug) if (debug)
{ {
Pout<< "cyclicAMIPolyPatch::calcTransforms : patch:" << name() Pout<< "cyclicAMIPolyPatch::calcTransforms : patch:" << name()
<< " Specified translation : " << separationVector_ << " Specified translation : " << separation_
<< endl; << endl;
} }
parallel_ = true; parallel_ = true;
separated_ = true; separated_ = true;
separation_ = separationVector_;
forwardT_ = Zero; forwardT_ = Zero;
reverseT_ = Zero; reverseT_ = Zero;
@ -480,19 +479,18 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform, const orderingType ordering,
const bool AMIRequireMatch, const bool AMIRequireMatch,
const AMIInterpolation::interpolationMethod AMIMethod const AMIInterpolation::interpolationMethod AMIMethod
) )
: :
coupledPolyPatch(name, size, start, index, bm, patchType, transform), coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
nbrPatchName_(word::null), nbrPatchName_(word::null),
nbrPatchID_(-1), nbrPatchID_(-1),
rotationAxis_(Zero), rotationAxis_(Zero),
rotationCentre_(point::zero), rotationCentre_(point::zero),
rotationAngleDefined_(false), rotationAngleDefined_(false),
rotationAngle_(0.0), rotationAngle_(0.0),
separationVector_(Zero),
AMIs_(), AMIs_(),
AMITransforms_(), AMITransforms_(),
AMIReverse_(false), AMIReverse_(false),
@ -526,7 +524,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationCentre_(point::zero), rotationCentre_(point::zero),
rotationAngleDefined_(false), rotationAngleDefined_(false),
rotationAngle_(0.0), rotationAngle_(0.0),
separationVector_(Zero),
AMIs_(), AMIs_(),
AMITransforms_(), AMITransforms_(),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)), AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
@ -597,7 +594,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
} }
case TRANSLATIONAL: case TRANSLATIONAL:
{ {
dict.lookup("separationVector") >> separationVector_; dict.lookup("separation") >> separation_;
break; break;
} }
default: default:
@ -625,7 +622,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_),
rotationAngleDefined_(pp.rotationAngleDefined_), rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_), rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIs_(), AMIs_(),
AMITransforms_(), AMITransforms_(),
AMIReverse_(pp.AMIReverse_), AMIReverse_(pp.AMIReverse_),
@ -658,7 +654,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_),
rotationAngleDefined_(pp.rotationAngleDefined_), rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_), rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIs_(), AMIs_(),
AMITransforms_(), AMITransforms_(),
AMIReverse_(pp.AMIReverse_), AMIReverse_(pp.AMIReverse_),
@ -698,7 +693,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationCentre_(pp.rotationCentre_), rotationCentre_(pp.rotationCentre_),
rotationAngleDefined_(pp.rotationAngleDefined_), rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_), rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIs_(), AMIs_(),
AMITransforms_(), AMITransforms_(),
AMIReverse_(pp.AMIReverse_), AMIReverse_(pp.AMIReverse_),
@ -1166,11 +1160,7 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
} }
case TRANSLATIONAL: case TRANSLATIONAL:
{ {
writeEntry(os, "separationVector", separationVector_); writeEntry(os, "separation", separation_);
break;
}
case NOORDERING:
{
break; break;
} }
default: default:

View File

@ -99,12 +99,6 @@ protected:
scalar rotationAngle_; scalar rotationAngle_;
// For translation
//- Translation vector
vector separationVector_;
//- AMI interpolation classes //- AMI interpolation classes
mutable PtrList<AMIInterpolation> AMIs_; mutable PtrList<AMIInterpolation> AMIs_;
@ -177,7 +171,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform = UNKNOWN, const orderingType ordering = UNKNOWN,
const bool AMIRequireMatch = true, const bool AMIRequireMatch = true,
const AMIInterpolation::interpolationMethod AMIMethod = const AMIInterpolation::interpolationMethod AMIMethod =
AMIInterpolation::imFaceAreaWeight AMIInterpolation::imFaceAreaWeight
@ -331,9 +325,6 @@ public:
//- Point on axis of rotation for rotational cyclic AMI //- Point on axis of rotation for rotational cyclic AMI
inline const point& rotationCentre() const; inline const point& rotationCentre() const;
//- Translation vector for translational cyclic AMI
inline const vector& separationVector() const;
//- Transform patch-based positions from nbr side to this side //- Transform patch-based positions from nbr side to this side
virtual void transformPosition(pointField&) const; virtual void transformPosition(pointField&) 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-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,10 +50,4 @@ inline const Foam::point& Foam::cyclicAMIPolyPatch::rotationCentre() const
} }
inline const Foam::vector& Foam::cyclicAMIPolyPatch::separationVector() const
{
return separationVector_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -305,7 +305,7 @@ Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform const orderingType ordering
) )
: :
cyclicAMIPolyPatch cyclicAMIPolyPatch
@ -316,7 +316,7 @@ Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
index, index,
bm, bm,
patchType, patchType,
transform, ordering,
false, false,
AMIInterpolation::imFaceAreaWeight AMIInterpolation::imFaceAreaWeight
), ),

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-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,7 +86,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& patchType, const word& patchType,
const transformType transform = UNKNOWN const orderingType ordering = UNKNOWN
); );
//- Construct from dictionary //- Construct from dictionary

View File

@ -31,7 +31,7 @@ baffles
type cyclicAMI; type cyclicAMI;
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch AMI2; neighbourPatch AMI2;
transform noOrdering; ordering noOrdering;
} }
slave slave
{ {

View File

@ -16,7 +16,7 @@ from the constant/polyMesh/boundary file:
nFaces 40; nFaces 40;
startFace 43720; startFace 43720;
matchTolerance 0.0001; matchTolerance 0.0001;
transform noOrdering; ordering noOrdering;
neighbourPatch ACMI2_couple; neighbourPatch ACMI2_couple;
nonOverlapPatch ACMI1_blockage; nonOverlapPatch ACMI1_blockage;
} }
@ -36,7 +36,7 @@ from the constant/polyMesh/boundary file:
nFaces 96; nFaces 96;
startFace 43856; startFace 43856;
matchTolerance 0.0001; matchTolerance 0.0001;
transform noOrdering; ordering noOrdering;
neighbourPatch ACMI1_couple; neighbourPatch ACMI1_couple;
nonOverlapPatch ACMI2_blockage; nonOverlapPatch ACMI2_blockage;
} }
@ -77,7 +77,7 @@ patches) the slave patches are simply defined using 'dummy' entries, e.g.:
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch ACMI2_couple; neighbourPatch ACMI2_couple;
nonOverlapPatch ACMI1_blockage; nonOverlapPatch ACMI1_blockage;
transform noOrdering; ordering noOrdering;
} }
slave // dummy entries only slave // dummy entries only
{ {

View File

@ -42,7 +42,7 @@ baffles
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch ACMI2_couple; neighbourPatch ACMI2_couple;
nonOverlapPatch ACMI1_blockage; nonOverlapPatch ACMI1_blockage;
transform noOrdering; ordering noOrdering;
} }
slave // not used since we're manipulating a boundary patch slave // not used since we're manipulating a boundary patch
{ {
@ -82,7 +82,7 @@ baffles
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch ACMI1_couple; neighbourPatch ACMI1_couple;
nonOverlapPatch ACMI2_blockage; nonOverlapPatch ACMI2_blockage;
transform noOrdering; ordering noOrdering;
} }
slave // not used since we're manipulating a boundary patch slave // not used since we're manipulating a boundary patch
{ {

View File

@ -790,7 +790,7 @@ boundary
{ {
type cyclicAMI; type cyclicAMI;
neighbourPatch AMI2; neighbourPatch AMI2;
transform noOrdering; ordering noOrdering;
/* optional /* optional
surface surface
{ {
@ -817,7 +817,7 @@ boundary
{ {
type cyclicAMI; type cyclicAMI;
neighbourPatch AMI1; neighbourPatch AMI1;
transform noOrdering; ordering noOrdering;
/* optional /* optional
surface surface
{ {

View File

@ -806,7 +806,7 @@ boundary
{ {
type cyclicAMI; type cyclicAMI;
neighbourPatch AMI2; neighbourPatch AMI2;
transform noOrdering; ordering noOrdering;
/* optional /* optional
surface surface
{ {
@ -833,7 +833,7 @@ boundary
{ {
type cyclicAMI; type cyclicAMI;
neighbourPatch AMI1; neighbourPatch AMI1;
transform noOrdering; ordering noOrdering;
/* optional /* optional
surface surface
{ {

View File

@ -80,7 +80,7 @@ baffles
type cyclicAMI; type cyclicAMI;
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch AMI2; neighbourPatch AMI2;
transform noOrdering; ordering noOrdering;
// Switch to zero-gradient for low weights // Switch to zero-gradient for low weights
lowWeightCorrection 0.2; lowWeightCorrection 0.2;
} }
@ -92,7 +92,7 @@ baffles
type cyclicAMI; type cyclicAMI;
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch AMI1; neighbourPatch AMI1;
transform noOrdering; ordering noOrdering;
lowWeightCorrection 0.2; lowWeightCorrection 0.2;
} }
} }

View File

@ -38,7 +38,7 @@ baffles
type cyclicAMI; type cyclicAMI;
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch AMI2; neighbourPatch AMI2;
transform noOrdering; ordering noOrdering;
} }
slave slave
@ -48,7 +48,7 @@ baffles
type cyclicAMI; type cyclicAMI;
matchTolerance 0.0001; matchTolerance 0.0001;
neighbourPatch AMI1; neighbourPatch AMI1;
transform noOrdering; ordering noOrdering;
} }
} }
} }