Sampling does not stop at 'end'
Hi,
I stumbled over a bug, namely that running with the function object 'sets', then sampling continues beyond the point 'end' in the set definition. This bug is reproducible with the damBreak case. Simply test with this function object (sorry for the formatting):
functions { testSet { type sets; functionObjectLibs ("libsampling.so");
writeControl timeStep; //adjustableRunTime;
writeInterval 1;
setFormat raw;
interpolationScheme cellPointFace;
fields ( alpha.water );
sets
(
gauge_1
{
type face;
axis y;
start (0.02 0.20 0.005);
end (0.02 0.25 0.005);
nPoints 100;
}
gauge_2
{
type face;
axis y;
start (0.2 0.03 0.005);
end (0.2 0.55 0.005);
nPoints 100;
}
);
}
}
The problem is fixed by changing line 78 in faceOnlySet.C from
OLD>> if (mag(trackPt - end_) < smallDist)
to
NEW>> if (smallDist < ((trackPt - end_) & (end_ - start_)))
The old formulation only ends, if the absolute distance is less than smallDist, which will hardly ever happen. The new formulation makes a projection along the search direction and the search stops as soon as the value become larger than smallDist.
A quick check showed the same error in foam-extend-3.1, so the bug seems to have been around for a long time.
Kind regards
Niels