mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cyclicPolyPatch : add checking for faces non-aligned to rotation axis
Added constructor from components.
This commit is contained in:
@ -194,6 +194,9 @@ void Foam::cyclicPolyPatch::calcTransforms
|
|||||||
vectorField half0Normals(half0Areas.size());
|
vectorField half0Normals(half0Areas.size());
|
||||||
vectorField half1Normals(half1Areas.size());
|
vectorField half1Normals(half1Areas.size());
|
||||||
|
|
||||||
|
scalar maxCos = -GREAT;
|
||||||
|
label maxFacei = -1;
|
||||||
|
|
||||||
forAll(half0, facei)
|
forAll(half0, facei)
|
||||||
{
|
{
|
||||||
scalar magSf = mag(half0Areas[facei]);
|
scalar magSf = mag(half0Areas[facei]);
|
||||||
@ -233,8 +236,33 @@ void Foam::cyclicPolyPatch::calcTransforms
|
|||||||
{
|
{
|
||||||
half0Normals[facei] = half0Areas[facei] / magSf;
|
half0Normals[facei] = half0Areas[facei] / magSf;
|
||||||
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
|
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
|
||||||
|
|
||||||
|
if (transform_ == ROTATIONAL)
|
||||||
|
{
|
||||||
|
scalar cos = mag(half0Normals[facei] & rotationAxis_);
|
||||||
|
if (cos > maxCos)
|
||||||
|
{
|
||||||
|
maxCos = cos;
|
||||||
|
maxFacei = facei;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxCos > sqrt(SMALL))
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"cyclicPolyPatch::calcTransforms()"
|
||||||
|
) << "on patch " << name()
|
||||||
|
<< " face:" << maxFacei << " fc:" << half0Ctrs[maxFacei]
|
||||||
|
<< " is not perpendicular to the rotationAxis." << endl
|
||||||
|
<< "This might cause conservation problems"
|
||||||
|
<< " or problems with geometry or topology changes." << endl
|
||||||
|
<< "rotation axis : " << rotationAxis_ << endl
|
||||||
|
<< "face normal : " << half0Normals[maxFacei] << endl
|
||||||
|
<< "cosine of angle : " << maxCos << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate transformation tensors
|
// Calculate transformation tensors
|
||||||
calcTransformTensors
|
calcTransformTensors
|
||||||
@ -450,6 +478,35 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const word& neighbPatchName,
|
||||||
|
const transformType transform,
|
||||||
|
const vector& rotationAxis,
|
||||||
|
const point& rotationCentre,
|
||||||
|
const vector& separationVector
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(name, size, start, index, bm),
|
||||||
|
neighbPatchName_(neighbPatchName),
|
||||||
|
neighbPatchID_(-1),
|
||||||
|
transform_(transform),
|
||||||
|
rotationAxis_(rotationAxis),
|
||||||
|
rotationCentre_(rotationCentre),
|
||||||
|
separationVector_(separationVector),
|
||||||
|
coupledPointsPtr_(NULL),
|
||||||
|
coupledEdgesPtr_(NULL)
|
||||||
|
{
|
||||||
|
// Neighbour patch might not be valid yet so no transformation
|
||||||
|
// calculation possible.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::cyclicPolyPatch::cyclicPolyPatch
|
Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
|
|||||||
@ -213,6 +213,21 @@ public:
|
|||||||
const polyBoundaryMesh& bm
|
const polyBoundaryMesh& bm
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
cyclicPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
cyclicPolyPatch
|
cyclicPolyPatch
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user