Commit eaa6a98f authored by mattijs's avatar mattijs
Browse files

ENH: cyclicPolyPatch.C: debug printing of area match

parent a3739657
...@@ -185,6 +185,9 @@ void Foam::cyclicPolyPatch::calcTransforms ...@@ -185,6 +185,9 @@ void Foam::cyclicPolyPatch::calcTransforms
vectorField half0Normals(half0Areas.size()); vectorField half0Normals(half0Areas.size());
vectorField half1Normals(half1Areas.size()); vectorField half1Normals(half1Areas.size());
scalar maxAreaDiff = -GREAT;
label maxAreaFacei = -1;
forAll(half0, facei) forAll(half0, facei)
{ {
scalar magSf = mag(half0Areas[facei]); scalar magSf = mag(half0Areas[facei]);
...@@ -199,35 +202,58 @@ void Foam::cyclicPolyPatch::calcTransforms ...@@ -199,35 +202,58 @@ void Foam::cyclicPolyPatch::calcTransforms
half0Normals[facei] = point(1, 0, 0); half0Normals[facei] = point(1, 0, 0);
half1Normals[facei] = half0Normals[facei]; half1Normals[facei] = half0Normals[facei];
} }
else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol)
{
FatalErrorIn
(
"cyclicPolyPatch::calcTransforms()"
) << "face " << facei << " area does not match neighbour by "
<< 100*mag(magSf - nbrMagSf)/avSf
<< "% -- possible face ordering problem." << endl
<< "patch:" << name()
<< " my area:" << magSf
<< " neighbour area:" << nbrMagSf
<< " matching tolerance:" << coupledPolyPatch::matchTol
<< endl
<< "Mesh face:" << start()+facei
<< " fc:" << half0Ctrs[facei]
<< endl
<< "Neighbour fc:" << half1Ctrs[facei]
<< endl
<< "Rerun with cyclic debug flag set"
<< " for more information." << exit(FatalError);
}
else else
{ {
half0Normals[facei] = half0Areas[facei] / magSf; scalar areaDiff = mag(magSf - nbrMagSf)/avSf;
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
if (areaDiff > maxAreaDiff)
{
maxAreaDiff = areaDiff;
maxAreaFacei = facei;
}
if (areaDiff > coupledPolyPatch::matchTol)
{
FatalErrorIn
(
"cyclicPolyPatch::calcTransforms()"
) << "face " << facei
<< " area does not match neighbour by "
<< 100*areaDiff
<< "% -- possible face ordering problem." << endl
<< "patch:" << name()
<< " my area:" << magSf
<< " neighbour area:" << nbrMagSf
<< " matching tolerance:" << coupledPolyPatch::matchTol
<< endl
<< "Mesh face:" << start()+facei
<< " fc:" << half0Ctrs[facei]
<< endl
<< "Neighbour fc:" << half1Ctrs[facei]
<< endl
<< "Rerun with cyclic debug flag set"
<< " for more information." << exit(FatalError);
}
else
{
half0Normals[facei] = half0Areas[facei] / magSf;
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
}
} }
} }
// Print area match
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " Max area error:" << 100*maxAreaDiff << "% at face:"
<< maxAreaFacei << " at:" << half0Ctrs[maxAreaFacei]
<< " coupled face at:" << half1Ctrs[maxAreaFacei]
<< endl;
}
// Calculate transformation tensors // Calculate transformation tensors
if (transform_ == ROTATIONAL) if (transform_ == ROTATIONAL)
...@@ -458,6 +484,9 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors ...@@ -458,6 +484,9 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
<< endl; << endl;
} }
// Note: getCentresAndAnchors gets called on the slave side
// so separationVector is owner-slave points.
half0Ctrs -= separationVector_; half0Ctrs -= separationVector_;
anchors0 -= separationVector_; anchors0 -= separationVector_;
break; break;
...@@ -833,6 +862,9 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const ...@@ -833,6 +862,9 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
} }
else if (separated()) else if (separated())
{ {
// transformPosition gets called on the receiving side,
// separation gets calculated on the sending side so subtract.
const vectorField& s = separation(); const vectorField& s = separation();
if (s.size() == 1) if (s.size() == 1)
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment