mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: cylicAMI - corrected case for specified rotation - mantis #1206
This commit is contained in:
@ -151,13 +151,14 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
|
|||||||
-rotationAxis_.y(), rotationAxis_.x(), 0
|
-rotationAxis_.y(), rotationAxis_.x(), 0
|
||||||
);
|
);
|
||||||
|
|
||||||
tensor RPos
|
tensor revTPos
|
||||||
(
|
(
|
||||||
T
|
T
|
||||||
+ cos(rotationAngle_)*(tensor::I - T)
|
+ cos(rotationAngle_)*(tensor::I - T)
|
||||||
+ sin(rotationAngle_)*S
|
+ sin(rotationAngle_)*S
|
||||||
);
|
);
|
||||||
tensor RNeg
|
|
||||||
|
tensor revTNeg
|
||||||
(
|
(
|
||||||
T
|
T
|
||||||
+ cos(-rotationAngle_)*(tensor::I - T)
|
+ cos(-rotationAngle_)*(tensor::I - T)
|
||||||
@ -166,28 +167,27 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
|
|||||||
|
|
||||||
// check - assume correct angle when difference in face areas
|
// check - assume correct angle when difference in face areas
|
||||||
// is the smallest
|
// is the smallest
|
||||||
vector transformedAreaPos = sum(half0Areas & RPos);
|
vector transformedAreaPos = gSum(half1Areas & revTPos);
|
||||||
vector transformedAreaNeg = sum(half0Areas & RNeg);
|
vector transformedAreaNeg = gSum(half1Areas & revTNeg);
|
||||||
vector area1 = sum(half1Areas);
|
vector area0 = gSum(half0Areas);
|
||||||
reduce(transformedAreaPos, sumOp<vector>());
|
|
||||||
reduce(transformedAreaNeg, sumOp<vector>());
|
|
||||||
reduce(area1, sumOp<vector>());
|
|
||||||
|
|
||||||
scalar errorPos = mag(transformedAreaPos - area1);
|
// areas have opposite sign, so sum should be zero when
|
||||||
scalar errorNeg = mag(transformedAreaNeg - area1);
|
// correct rotation applied
|
||||||
|
scalar errorPos = mag(transformedAreaPos + area0);
|
||||||
|
scalar errorNeg = mag(transformedAreaNeg + area0);
|
||||||
|
|
||||||
if (errorPos < errorNeg)
|
if (errorPos < errorNeg)
|
||||||
{
|
{
|
||||||
revT = RPos;
|
revT = revTPos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
revT = RNeg;
|
revT = revTNeg;
|
||||||
rotationAngle_ *= -1;
|
rotationAngle_ *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar areaError =
|
scalar areaError =
|
||||||
min(errorPos, errorNeg)/(mag(area1) + ROOTVSMALL);
|
min(errorPos, errorNeg)/(mag(area0) + ROOTVSMALL);
|
||||||
|
|
||||||
if (areaError > matchTolerance())
|
if (areaError > matchTolerance())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user