Modified tolerances to take truncation error into account

This commit is contained in:
mattijs
2010-01-13 19:08:47 +00:00
parent 1e78a14865
commit 0496e18123

View File

@ -199,13 +199,20 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
const face& f = faces[faceI]; const face& f = faces[faceI];
// 1. calculate a typical size of the face. Use maximum distance
// to face centre
scalar maxLenSqr = -GREAT; scalar maxLenSqr = -GREAT;
// 2. as measure of truncation error when comparing two coordinates
// use SMALL * maximum component
scalar maxCmpt = -GREAT;
forAll(f, fp) forAll(f, fp)
{ {
maxLenSqr = max(maxLenSqr, magSqr(points[f[fp]] - cc)); const point& pt = points[f[fp]];
maxLenSqr = max(maxLenSqr, magSqr(pt - cc));
maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt)));
} }
tols[faceI] = matchTol * Foam::sqrt(maxLenSqr); tols[faceI] = max(SMALL*maxCmpt, matchTol*Foam::sqrt(maxLenSqr));
} }
return tols; return tols;
} }