coupledPolyPatch: Separated ordering from transformation controls
which will allow the transformation calculation functionality to be moved into cyclic patches.
This commit is contained in:
@ -1081,11 +1081,9 @@ int main(int argc, char *argv[])
|
||||
0,
|
||||
patchi,
|
||||
mesh.boundaryMesh(),
|
||||
cyclicPolyPatch::typeName,
|
||||
neighbPatchName,
|
||||
cyclicPolyPatch::NOORDERING,
|
||||
Zero,
|
||||
Zero,
|
||||
Zero
|
||||
cyclicPolyPatch::NOORDERING
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -776,18 +776,10 @@ int main(int argc, char *argv[])
|
||||
const cyclicPolyPatch& cycpp =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
|
||||
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
|
||||
if (cycpp.transform() != cyclicPolyPatch::TRANSLATIONAL)
|
||||
{
|
||||
const cyclicPolyPatch& nbr = cycpp.neighbPatch();
|
||||
|
||||
const_cast<vector&>(cpp.separation()) =
|
||||
nbr[0].centre(mesh.points())
|
||||
- cycpp[0].centre(mesh.points());
|
||||
@ -800,17 +792,8 @@ int main(int argc, char *argv[])
|
||||
else if (!cpp.parallel())
|
||||
{
|
||||
Info<< "On coupled patch " << pp.name()
|
||||
<< " forcing uniform rotation of "
|
||||
<< " uniform rotation of "
|
||||
<< cpp.forwardT() << endl;
|
||||
|
||||
// const_cast<tensorField&>
|
||||
// (
|
||||
// cpp.forwardT()
|
||||
// ).setSize(1);
|
||||
// const_cast<tensorField&>
|
||||
// (
|
||||
// cpp.reverseT()
|
||||
// ).setSize(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
proci,
|
||||
curNeighbourProcessors[procPatchi],
|
||||
pcPatch.name(),
|
||||
pcPatch.transform()
|
||||
pcPatch.ordering()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ patches
|
||||
rotationAxis (1 0 0);
|
||||
rotationCentre (0 0 0);
|
||||
// transform translational;
|
||||
// separationVector (1 0 0);
|
||||
// separation (1 0 0);
|
||||
|
||||
// Optional non-default tolerance to be able to define cyclics
|
||||
// on bad meshes
|
||||
@ -98,7 +98,7 @@ patches
|
||||
rotationAxis (1 0 0);
|
||||
rotationCentre (0 0 0);
|
||||
// transform translational;
|
||||
// separationVector (1 0 0);
|
||||
// separation (1 0 0);
|
||||
}
|
||||
|
||||
// How to construct: either from 'patches' or 'set'
|
||||
|
||||
@ -37,16 +37,26 @@ namespace Foam
|
||||
const scalar coupledPolyPatch::defaultMatchTol_ = 1e-4;
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<coupledPolyPatch::transformType, 5>::names[] =
|
||||
const char* NamedEnum<coupledPolyPatch::orderingType, 3>::names[] =
|
||||
{
|
||||
"unknown",
|
||||
"rotational",
|
||||
"translational",
|
||||
"coincidentFullMatch",
|
||||
"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;
|
||||
}
|
||||
|
||||
@ -131,12 +141,12 @@ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
|
||||
(
|
||||
const UList<face>& faces,
|
||||
const pointField& points,
|
||||
const transformType transform
|
||||
const orderingType ordering
|
||||
)
|
||||
{
|
||||
pointField anchors(faces.size());
|
||||
|
||||
if (transform != COINCIDENTFULLMATCH)
|
||||
if (ordering != COINCIDENTFULLMATCH)
|
||||
{
|
||||
// Return the first point
|
||||
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 * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coupledPolyPatch::coupledPolyPatch
|
||||
@ -465,12 +309,13 @@ Foam::coupledPolyPatch::coupledPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform
|
||||
const orderingType ordering
|
||||
)
|
||||
:
|
||||
polyPatch(name, size, start, index, bm, patchType),
|
||||
matchTolerance_(defaultMatchTol_),
|
||||
transform_(transform),
|
||||
ordering_(ordering),
|
||||
transform_(UNSPECIFIED),
|
||||
parallel_(true),
|
||||
separated_(false)
|
||||
{}
|
||||
@ -483,16 +328,22 @@ Foam::coupledPolyPatch::coupledPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType defaultTransform
|
||||
const orderingType ordering
|
||||
)
|
||||
:
|
||||
polyPatch(name, dict, index, bm, patchType),
|
||||
matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)),
|
||||
ordering_
|
||||
(
|
||||
dict.found("ordering")
|
||||
? orderingTypeNames.read(dict.lookup("ordering"))
|
||||
: ordering
|
||||
),
|
||||
transform_
|
||||
(
|
||||
dict.found("transform")
|
||||
? transformTypeNames.read(dict.lookup("transform"))
|
||||
: defaultTransform
|
||||
: UNSPECIFIED
|
||||
),
|
||||
parallel_(true),
|
||||
separated_(false)
|
||||
@ -559,6 +410,7 @@ void Foam::coupledPolyPatch::write(Ostream& os) const
|
||||
{
|
||||
polyPatch::write(os);
|
||||
writeEntry(os, "matchTolerance", matchTolerance_);
|
||||
writeEntry(os, "ordering", orderingTypeNames[ordering_]);
|
||||
writeEntry(os, "transform", transformTypeNames[transform_]);
|
||||
}
|
||||
|
||||
|
||||
@ -55,17 +55,25 @@ class coupledPolyPatch
|
||||
{
|
||||
public:
|
||||
|
||||
enum transformType
|
||||
enum orderingType
|
||||
{
|
||||
UNKNOWN, // unspecified; automatic ordering
|
||||
ROTATIONAL, // rotation along coordinate axis
|
||||
TRANSLATIONAL, // translation
|
||||
COINCIDENTFULLMATCH,// assume no transforms
|
||||
UNKNOWN, // Unspecified -> automatic ordering
|
||||
COINCIDENTFULLMATCH,// Assume no transforms
|
||||
// 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:
|
||||
@ -78,6 +86,9 @@ protected:
|
||||
//- Local matching tolerance
|
||||
const scalar matchTolerance_;
|
||||
|
||||
//- Type of ordering
|
||||
orderingType ordering_;
|
||||
|
||||
//- Type of transformation
|
||||
transformType transform_;
|
||||
|
||||
@ -102,22 +113,6 @@ protected:
|
||||
|
||||
// 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
|
||||
virtual void initGeometry(PstreamBuffers&) = 0;
|
||||
|
||||
@ -136,7 +131,6 @@ protected:
|
||||
//- Update of the patch topology
|
||||
virtual void updateMesh(PstreamBuffers&) = 0;
|
||||
|
||||
|
||||
//- Write point in OBJ format
|
||||
static void writeOBJ(Ostream& os, const point& pt);
|
||||
|
||||
@ -165,7 +159,7 @@ protected:
|
||||
(
|
||||
const UList<face>&,
|
||||
const pointField&,
|
||||
const transformType
|
||||
const orderingType
|
||||
);
|
||||
|
||||
//- Get the number of vertices face f needs to be rotated such that
|
||||
@ -196,7 +190,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform
|
||||
const orderingType ordering
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -207,7 +201,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType defaultTransform = UNKNOWN
|
||||
const orderingType ordering = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
@ -258,16 +252,14 @@ public:
|
||||
return !owner();
|
||||
}
|
||||
|
||||
//- Type of transform
|
||||
virtual transformType transform() const
|
||||
//- Type of ordering
|
||||
virtual orderingType ordering() const
|
||||
{
|
||||
return transform_;
|
||||
return ordering_;
|
||||
}
|
||||
|
||||
//- Type of transform
|
||||
// This is currently only for use when collapsing generated
|
||||
// meshes that can have zero area faces.
|
||||
virtual transformType& transform()
|
||||
virtual transformType transform() const
|
||||
{
|
||||
return transform_;
|
||||
}
|
||||
|
||||
@ -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
|
||||
(
|
||||
const pointField& points,
|
||||
@ -252,7 +419,7 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
}
|
||||
|
||||
|
||||
// Calculate transformation tensors
|
||||
// Calculate transformation
|
||||
|
||||
if (transform() == ROTATIONAL)
|
||||
{
|
||||
@ -297,9 +464,53 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
forwardT_ = revT.T();
|
||||
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
|
||||
{
|
||||
scalarField half0Tols
|
||||
const scalarField half0Tols
|
||||
(
|
||||
matchTolerance()
|
||||
*calcFaceTol
|
||||
@ -318,63 +529,9 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
half1Normals,
|
||||
half0Tols,
|
||||
matchTolerance(),
|
||||
ordering(),
|
||||
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.
|
||||
half0Ctrs = pp0.faceCentres();
|
||||
anchors0 = getAnchorPoints(pp0, pp0.points(), transform());
|
||||
anchors0 = getAnchorPoints(pp0, pp0.points(), ordering());
|
||||
half1Ctrs = pp1.faceCentres();
|
||||
|
||||
if (debug)
|
||||
@ -474,15 +631,15 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
|
||||
{
|
||||
Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
|
||||
<< " patch:" << name()
|
||||
<< "Specified translation : " << separationVector_
|
||||
<< "Specified translation : " << separation_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Note: getCentresAndAnchors gets called on the slave side
|
||||
// so separationVector is owner-slave points.
|
||||
// so separation is owner-slave points.
|
||||
|
||||
half0Ctrs -= separationVector_;
|
||||
anchors0 -= separationVector_;
|
||||
half0Ctrs -= separation_;
|
||||
anchors0 -= separation_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -591,15 +748,14 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
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),
|
||||
neighbPatchID_(-1),
|
||||
rotationAxis_(Zero),
|
||||
rotationCentre_(Zero),
|
||||
separationVector_(Zero),
|
||||
coupledPointsPtr_(nullptr),
|
||||
coupledEdgesPtr_(nullptr)
|
||||
{
|
||||
@ -615,19 +771,16 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const word& neighbPatchName,
|
||||
const transformType transform,
|
||||
const vector& rotationAxis,
|
||||
const point& rotationCentre,
|
||||
const vector& separationVector
|
||||
const orderingType ordering
|
||||
)
|
||||
:
|
||||
coupledPolyPatch(name, size, start, index, bm, typeName, transform),
|
||||
coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
|
||||
neighbPatchName_(neighbPatchName),
|
||||
neighbPatchID_(-1),
|
||||
rotationAxis_(rotationAxis),
|
||||
rotationCentre_(rotationCentre),
|
||||
separationVector_(separationVector),
|
||||
rotationAxis_(Zero),
|
||||
rotationCentre_(Zero),
|
||||
coupledPointsPtr_(nullptr),
|
||||
coupledEdgesPtr_(nullptr)
|
||||
{
|
||||
@ -643,16 +796,15 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
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)),
|
||||
coupleGroup_(dict),
|
||||
neighbPatchID_(-1),
|
||||
rotationAxis_(Zero),
|
||||
rotationCentre_(Zero),
|
||||
separationVector_(Zero),
|
||||
coupledPointsPtr_(nullptr),
|
||||
coupledEdgesPtr_(nullptr)
|
||||
{
|
||||
@ -696,7 +848,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
}
|
||||
case TRANSLATIONAL:
|
||||
{
|
||||
dict.lookup("separationVector") >> separationVector_;
|
||||
dict.lookup("separation") >> separation_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -722,7 +874,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
neighbPatchID_(-1),
|
||||
rotationAxis_(pp.rotationAxis_),
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
separationVector_(pp.separationVector_),
|
||||
coupledPointsPtr_(nullptr),
|
||||
coupledEdgesPtr_(nullptr)
|
||||
{
|
||||
@ -747,7 +898,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
neighbPatchID_(-1),
|
||||
rotationAxis_(pp.rotationAxis_),
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
separationVector_(pp.separationVector_),
|
||||
coupledPointsPtr_(nullptr),
|
||||
coupledEdgesPtr_(nullptr)
|
||||
{
|
||||
@ -779,7 +929,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
neighbPatchID_(-1),
|
||||
rotationAxis_(pp.rotationAxis_),
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
separationVector_(pp.separationVector_),
|
||||
coupledPointsPtr_(nullptr),
|
||||
coupledEdgesPtr_(nullptr)
|
||||
{}
|
||||
@ -1240,7 +1389,7 @@ bool Foam::cyclicPolyPatch::order
|
||||
rotation.setSize(pp.size());
|
||||
rotation = 0;
|
||||
|
||||
if (transform() == NOORDERING)
|
||||
if (ordering() == NOORDERING)
|
||||
{
|
||||
// No faces, nothing to change.
|
||||
return false;
|
||||
@ -1428,11 +1577,7 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const
|
||||
}
|
||||
case TRANSLATIONAL:
|
||||
{
|
||||
writeEntry(os, "separationVector", separationVector_);
|
||||
break;
|
||||
}
|
||||
case NOORDERING:
|
||||
{
|
||||
writeEntry(os, "separation", separation_);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -84,11 +84,6 @@ class cyclicPolyPatch
|
||||
//- Point on axis of rotation for rotational cyclics
|
||||
point rotationCentre_;
|
||||
|
||||
// For translation
|
||||
|
||||
//- Translation vector
|
||||
vector separationVector_;
|
||||
|
||||
|
||||
//- 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
|
||||
@ -105,6 +100,23 @@ class cyclicPolyPatch
|
||||
|
||||
// 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
|
||||
static label findMaxArea(const pointField&, const faceList&);
|
||||
|
||||
@ -204,7 +216,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform = UNKNOWN
|
||||
const orderingType defaultOrdering = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
@ -215,11 +227,9 @@ public:
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const word& neighbPatchName,
|
||||
const transformType transform, // transformation type
|
||||
const vector& rotationAxis, // for rotation only
|
||||
const point& rotationCentre, // for rotation only
|
||||
const vector& separationVector // for translation only
|
||||
const orderingType ordering
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -230,7 +240,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType defaultTransform = UNKNOWN
|
||||
const orderingType ordering = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
@ -382,12 +392,6 @@ public:
|
||||
return rotationCentre_;
|
||||
}
|
||||
|
||||
//- Translation vector for translational cyclics
|
||||
const vector& separationVector() const
|
||||
{
|
||||
return separationVector_;
|
||||
}
|
||||
|
||||
|
||||
//- Initialize ordering for primitivePatch. Does not
|
||||
// refer to *this (except for name() and type() etc.)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,10 +69,10 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
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
|
||||
|
||||
@ -334,23 +334,6 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
|
||||
|
||||
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:
|
||||
{
|
||||
// Assumes that cyclic is planar. This is also the initial
|
||||
@ -564,14 +547,13 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
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),
|
||||
rotationAxis_(Zero),
|
||||
rotationCentre_(Zero),
|
||||
separationVector_(Zero)
|
||||
rotationCentre_(Zero)
|
||||
{}
|
||||
|
||||
|
||||
@ -587,8 +569,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
|
||||
coupledPolyPatch(name, dict, index, bm, patchType),
|
||||
featureCos_(0.9),
|
||||
rotationAxis_(Zero),
|
||||
rotationCentre_(Zero),
|
||||
separationVector_(Zero)
|
||||
rotationCentre_(Zero)
|
||||
{
|
||||
if (dict.found("neighbourPatch"))
|
||||
{
|
||||
@ -615,7 +596,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
|
||||
}
|
||||
case TRANSLATIONAL:
|
||||
{
|
||||
dict.lookup("separationVector") >> separationVector_;
|
||||
dict.lookup("separation") >> separation_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -635,8 +616,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
|
||||
coupledPolyPatch(pp, bm),
|
||||
featureCos_(pp.featureCos_),
|
||||
rotationAxis_(pp.rotationAxis_),
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
separationVector_(pp.separationVector_)
|
||||
rotationCentre_(pp.rotationCentre_)
|
||||
{}
|
||||
|
||||
|
||||
@ -652,8 +632,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
|
||||
coupledPolyPatch(pp, bm, index, newSize, newStart),
|
||||
featureCos_(pp.featureCos_),
|
||||
rotationAxis_(pp.rotationAxis_),
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
separationVector_(pp.separationVector_)
|
||||
rotationCentre_(pp.rotationCentre_)
|
||||
{}
|
||||
|
||||
|
||||
@ -1236,7 +1215,7 @@ void Foam::oldCyclicPolyPatch::write(Ostream& os) const
|
||||
}
|
||||
case TRANSLATIONAL:
|
||||
{
|
||||
writeEntry(os, "separationVector", separationVector_);
|
||||
writeEntry(os, "separation", separation_);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -69,11 +69,6 @@ class oldCyclicPolyPatch
|
||||
//- Point on axis of rotation for rotational cyclics
|
||||
point rotationCentre_;
|
||||
|
||||
// For translation
|
||||
|
||||
//- Translation vector
|
||||
vector separationVector_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -185,7 +180,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform = UNKNOWN
|
||||
const orderingType ordering = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
|
||||
@ -56,11 +56,11 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const transformType transform,
|
||||
const orderingType ordering,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
coupledPolyPatch(name, size, start, index, bm, patchType, transform),
|
||||
coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
|
||||
myProcNo_(myProcNo),
|
||||
neighbProcNo_(neighbProcNo),
|
||||
neighbFaceCentres_(),
|
||||
@ -77,7 +77,7 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const transformType transform,
|
||||
const orderingType ordering,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
@ -89,7 +89,7 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
index,
|
||||
bm,
|
||||
patchType,
|
||||
transform
|
||||
ordering
|
||||
),
|
||||
myProcNo_(myProcNo),
|
||||
neighbProcNo_(neighbProcNo),
|
||||
@ -525,7 +525,7 @@ void Foam::processorPolyPatch::initOrder
|
||||
if
|
||||
(
|
||||
!Pstream::parRun()
|
||||
|| transform() == NOORDERING
|
||||
|| ordering() == NOORDERING
|
||||
)
|
||||
{
|
||||
return;
|
||||
@ -562,7 +562,7 @@ void Foam::processorPolyPatch::initOrder
|
||||
|
||||
if (owner())
|
||||
{
|
||||
if (transform() == COINCIDENTFULLMATCH)
|
||||
if (ordering() == COINCIDENTFULLMATCH)
|
||||
{
|
||||
// Pass the patch points and faces across
|
||||
UOPstream toNeighbour(neighbProcNo(), pBufs);
|
||||
@ -573,7 +573,7 @@ void Foam::processorPolyPatch::initOrder
|
||||
{
|
||||
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
|
||||
// case the face centroid calculation is incorrect due to the face
|
||||
@ -719,7 +719,7 @@ bool Foam::processorPolyPatch::order
|
||||
if
|
||||
(
|
||||
!Pstream::parRun()
|
||||
|| transform() == NOORDERING
|
||||
|| ordering() == NOORDERING
|
||||
)
|
||||
{
|
||||
return false;
|
||||
@ -742,11 +742,11 @@ bool Foam::processorPolyPatch::order
|
||||
faceMap[patchFacei] = patchFacei;
|
||||
}
|
||||
|
||||
if (transform() != COINCIDENTFULLMATCH)
|
||||
if (ordering() != COINCIDENTFULLMATCH)
|
||||
{
|
||||
const pointField& ppPoints = pp.points();
|
||||
|
||||
pointField anchors(getAnchorPoints(pp, ppPoints, transform()));
|
||||
pointField anchors(getAnchorPoints(pp, ppPoints, ordering()));
|
||||
|
||||
// Calculate typical distance from face centre
|
||||
scalarField tols
|
||||
@ -783,7 +783,7 @@ bool Foam::processorPolyPatch::order
|
||||
matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres())
|
||||
);
|
||||
|
||||
if (transform() == COINCIDENTFULLMATCH)
|
||||
if (ordering() == COINCIDENTFULLMATCH)
|
||||
{
|
||||
vectorField masterPts;
|
||||
faceList masterFaces;
|
||||
|
||||
@ -93,7 +93,7 @@ protected:
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const transformType transform = UNKNOWN, // transformation type
|
||||
const orderingType defaultOrdering = UNKNOWN,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
@ -152,7 +152,7 @@ public:
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const transformType transform = UNKNOWN, // transformation type
|
||||
const orderingType ordering = UNKNOWN,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const word& referPatchName,
|
||||
const transformType transform,
|
||||
const orderingType ordering,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
@ -61,7 +61,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
bm,
|
||||
myProcNo,
|
||||
neighbProcNo,
|
||||
transform,
|
||||
ordering,
|
||||
patchType
|
||||
),
|
||||
referPatchName_(referPatchName),
|
||||
@ -237,7 +237,9 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
calcTransformTensors
|
||||
cyclicPolyPatch& pp = const_cast<cyclicPolyPatch&>(referPatch());
|
||||
|
||||
pp.calcTransformTensors
|
||||
(
|
||||
faceCentres(),
|
||||
neighbFaceCentres(),
|
||||
@ -245,6 +247,7 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
neighbFaceAreas()/mag(neighbFaceAreas()),
|
||||
matchTolerance()*calcFaceTol(*this, points(), faceCentres()),
|
||||
matchTolerance(),
|
||||
ordering(),
|
||||
transform()
|
||||
);
|
||||
|
||||
@ -256,7 +259,7 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
|
||||
// Update underlying cyclic halves. Need to do both since only one
|
||||
// half might be present as a processorCyclic.
|
||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
|
||||
|
||||
pp.calcGeometry
|
||||
(
|
||||
*this,
|
||||
@ -268,20 +271,16 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
neighbFaceCellCentres()
|
||||
);
|
||||
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp);
|
||||
const_cast<cyclicPolyPatch&>(cpp.neighbPatch()).calcGeometry
|
||||
(
|
||||
*this,
|
||||
neighbFaceCentres(),
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres(),
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres()
|
||||
);
|
||||
}
|
||||
const_cast<cyclicPolyPatch&>(pp.neighbPatch()).calcGeometry
|
||||
(
|
||||
*this,
|
||||
neighbFaceCentres(),
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres(),
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#define processorCyclicPolyPatch_H
|
||||
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -121,7 +122,7 @@ public:
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const word& referPatchName,
|
||||
const transformType transform = UNKNOWN,
|
||||
const orderingType ordering = UNKNOWN,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
@ -304,10 +305,10 @@ public:
|
||||
return referPatchID_;
|
||||
}
|
||||
|
||||
const coupledPolyPatch& referPatch() const
|
||||
const cyclicPolyPatch& referPatch() const
|
||||
{
|
||||
const polyPatch& pp = this->boundaryMesh()[referPatchID()];
|
||||
return refCast<const coupledPolyPatch>(pp);
|
||||
return refCast<const cyclicPolyPatch>(pp);
|
||||
}
|
||||
|
||||
//- Return message tag to use for communication
|
||||
@ -325,14 +326,6 @@ public:
|
||||
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
|
||||
virtual void transformPosition(pointField& l) const
|
||||
{
|
||||
|
||||
@ -137,23 +137,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
|
||||
// Note: special check for unordered cyclics. These are in fact
|
||||
// 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
|
||||
)
|
||||
)
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
{
|
||||
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
|
||||
|
||||
@ -311,23 +295,7 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
|
||||
// Note: special check for unordered cyclics. These are in fact
|
||||
// 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
|
||||
)
|
||||
)
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
{
|
||||
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
|
||||
|
||||
|
||||
@ -1245,7 +1245,7 @@ void Foam::fvMeshDistribute::addProcPatches
|
||||
Pstream::myProcNo(),
|
||||
proci,
|
||||
pcPatch.name(),
|
||||
pcPatch.transform()
|
||||
pcPatch.ordering()
|
||||
);
|
||||
|
||||
procPatchID[proci].insert
|
||||
|
||||
@ -205,7 +205,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform
|
||||
const orderingType ordering
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch
|
||||
@ -216,7 +216,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
index,
|
||||
bm,
|
||||
patchType,
|
||||
transform,
|
||||
ordering,
|
||||
false,
|
||||
AMIInterpolation::imPartialFaceAreaWeight
|
||||
),
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform = UNKNOWN
|
||||
const orderingType ordering = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
|
||||
@ -240,13 +240,12 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "cyclicAMIPolyPatch::calcTransforms : patch:" << name()
|
||||
<< " Specified translation : " << separationVector_
|
||||
<< " Specified translation : " << separation_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
parallel_ = true;
|
||||
separated_ = true;
|
||||
separation_ = separationVector_;
|
||||
forwardT_ = Zero;
|
||||
reverseT_ = Zero;
|
||||
|
||||
@ -480,19 +479,18 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform,
|
||||
const orderingType ordering,
|
||||
const bool AMIRequireMatch,
|
||||
const AMIInterpolation::interpolationMethod AMIMethod
|
||||
)
|
||||
:
|
||||
coupledPolyPatch(name, size, start, index, bm, patchType, transform),
|
||||
coupledPolyPatch(name, size, start, index, bm, patchType, ordering),
|
||||
nbrPatchName_(word::null),
|
||||
nbrPatchID_(-1),
|
||||
rotationAxis_(Zero),
|
||||
rotationCentre_(point::zero),
|
||||
rotationAngleDefined_(false),
|
||||
rotationAngle_(0.0),
|
||||
separationVector_(Zero),
|
||||
AMIs_(),
|
||||
AMITransforms_(),
|
||||
AMIReverse_(false),
|
||||
@ -526,7 +524,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
rotationCentre_(point::zero),
|
||||
rotationAngleDefined_(false),
|
||||
rotationAngle_(0.0),
|
||||
separationVector_(Zero),
|
||||
AMIs_(),
|
||||
AMITransforms_(),
|
||||
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
|
||||
@ -597,7 +594,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
}
|
||||
case TRANSLATIONAL:
|
||||
{
|
||||
dict.lookup("separationVector") >> separationVector_;
|
||||
dict.lookup("separation") >> separation_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -625,7 +622,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
rotationAngleDefined_(pp.rotationAngleDefined_),
|
||||
rotationAngle_(pp.rotationAngle_),
|
||||
separationVector_(pp.separationVector_),
|
||||
AMIs_(),
|
||||
AMITransforms_(),
|
||||
AMIReverse_(pp.AMIReverse_),
|
||||
@ -658,7 +654,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
rotationAngleDefined_(pp.rotationAngleDefined_),
|
||||
rotationAngle_(pp.rotationAngle_),
|
||||
separationVector_(pp.separationVector_),
|
||||
AMIs_(),
|
||||
AMITransforms_(),
|
||||
AMIReverse_(pp.AMIReverse_),
|
||||
@ -698,7 +693,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
rotationAngleDefined_(pp.rotationAngleDefined_),
|
||||
rotationAngle_(pp.rotationAngle_),
|
||||
separationVector_(pp.separationVector_),
|
||||
AMIs_(),
|
||||
AMITransforms_(),
|
||||
AMIReverse_(pp.AMIReverse_),
|
||||
@ -1166,11 +1160,7 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
|
||||
}
|
||||
case TRANSLATIONAL:
|
||||
{
|
||||
writeEntry(os, "separationVector", separationVector_);
|
||||
break;
|
||||
}
|
||||
case NOORDERING:
|
||||
{
|
||||
writeEntry(os, "separation", separation_);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -99,12 +99,6 @@ protected:
|
||||
scalar rotationAngle_;
|
||||
|
||||
|
||||
// For translation
|
||||
|
||||
//- Translation vector
|
||||
vector separationVector_;
|
||||
|
||||
|
||||
//- AMI interpolation classes
|
||||
mutable PtrList<AMIInterpolation> AMIs_;
|
||||
|
||||
@ -177,7 +171,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform = UNKNOWN,
|
||||
const orderingType ordering = UNKNOWN,
|
||||
const bool AMIRequireMatch = true,
|
||||
const AMIInterpolation::interpolationMethod AMIMethod =
|
||||
AMIInterpolation::imFaceAreaWeight
|
||||
@ -331,9 +325,6 @@ public:
|
||||
//- Point on axis of rotation for rotational cyclic AMI
|
||||
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
|
||||
virtual void transformPosition(pointField&) const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,10 +50,4 @@ inline const Foam::point& Foam::cyclicAMIPolyPatch::rotationCentre() const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vector& Foam::cyclicAMIPolyPatch::separationVector() const
|
||||
{
|
||||
return separationVector_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -305,7 +305,7 @@ Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform
|
||||
const orderingType ordering
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch
|
||||
@ -316,7 +316,7 @@ Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
|
||||
index,
|
||||
bm,
|
||||
patchType,
|
||||
transform,
|
||||
ordering,
|
||||
false,
|
||||
AMIInterpolation::imFaceAreaWeight
|
||||
),
|
||||
|
||||
@ -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-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -86,7 +86,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform = UNKNOWN
|
||||
const orderingType ordering = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
|
||||
@ -31,7 +31,7 @@ baffles
|
||||
type cyclicAMI;
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch AMI2;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
}
|
||||
slave
|
||||
{
|
||||
|
||||
@ -16,7 +16,7 @@ from the constant/polyMesh/boundary file:
|
||||
nFaces 40;
|
||||
startFace 43720;
|
||||
matchTolerance 0.0001;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
neighbourPatch ACMI2_couple;
|
||||
nonOverlapPatch ACMI1_blockage;
|
||||
}
|
||||
@ -36,7 +36,7 @@ from the constant/polyMesh/boundary file:
|
||||
nFaces 96;
|
||||
startFace 43856;
|
||||
matchTolerance 0.0001;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
neighbourPatch ACMI1_couple;
|
||||
nonOverlapPatch ACMI2_blockage;
|
||||
}
|
||||
@ -77,7 +77,7 @@ patches) the slave patches are simply defined using 'dummy' entries, e.g.:
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch ACMI2_couple;
|
||||
nonOverlapPatch ACMI1_blockage;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
}
|
||||
slave // dummy entries only
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ baffles
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch ACMI2_couple;
|
||||
nonOverlapPatch ACMI1_blockage;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
}
|
||||
slave // not used since we're manipulating a boundary patch
|
||||
{
|
||||
@ -82,7 +82,7 @@ baffles
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch ACMI1_couple;
|
||||
nonOverlapPatch ACMI2_blockage;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
}
|
||||
slave // not used since we're manipulating a boundary patch
|
||||
{
|
||||
|
||||
@ -790,7 +790,7 @@ boundary
|
||||
{
|
||||
type cyclicAMI;
|
||||
neighbourPatch AMI2;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
@ -817,7 +817,7 @@ boundary
|
||||
{
|
||||
type cyclicAMI;
|
||||
neighbourPatch AMI1;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
|
||||
@ -806,7 +806,7 @@ boundary
|
||||
{
|
||||
type cyclicAMI;
|
||||
neighbourPatch AMI2;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
@ -833,7 +833,7 @@ boundary
|
||||
{
|
||||
type cyclicAMI;
|
||||
neighbourPatch AMI1;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
|
||||
@ -80,7 +80,7 @@ baffles
|
||||
type cyclicAMI;
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch AMI2;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
// Switch to zero-gradient for low weights
|
||||
lowWeightCorrection 0.2;
|
||||
}
|
||||
@ -92,7 +92,7 @@ baffles
|
||||
type cyclicAMI;
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch AMI1;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
lowWeightCorrection 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ baffles
|
||||
type cyclicAMI;
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch AMI2;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
}
|
||||
|
||||
slave
|
||||
@ -48,7 +48,7 @@ baffles
|
||||
type cyclicAMI;
|
||||
matchTolerance 0.0001;
|
||||
neighbourPatch AMI1;
|
||||
transform noOrdering;
|
||||
ordering noOrdering;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user