BUG: searchableCylinder: point on centreline incorrect nearest

This commit is contained in:
mattijs
2011-03-21 14:57:32 +00:00
parent f663562ca0
commit af60a98681

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,7 +91,24 @@ Foam::pointIndexHit Foam::searchableCylinder::findNearest
// distance to cylinder wall: magV-radius_ // distance to cylinder wall: magV-radius_
// Nearest cylinder point // Nearest cylinder point
point cylPt = sample + (radius_-magV)*v; point cylPt;
if (magV < ROOTVSMALL)
{
// Point exactly on centre line. Take any point on wall.
vector e1 = point(1,0,0) ^ unitDir_;
scalar magE1 = mag(e1);
if (magE1 < SMALL)
{
e1 = point(0,1,0) ^ unitDir_;
magE1 = mag(e1);
}
e1 /= magE1;
cylPt = sample + radius_*e1;
}
else
{
cylPt = sample + (radius_-magV)*v;
}
if (parallel < 0.5*magDir_) if (parallel < 0.5*magDir_)
{ {