Skip to content
Snippets Groups Projects
Commit af60a986 authored by mattijs's avatar mattijs
Browse files

BUG: searchableCylinder: point on centreline incorrect nearest

parent f663562c
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -91,7 +91,24 @@ Foam::pointIndexHit Foam::searchableCylinder::findNearest
// distance to cylinder wall: magV-radius_
// 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_)
{
......
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