Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 384
    • Issues 384
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #745

Closed
Open
Created Feb 27, 2018 by Admin@OpenFOAM-adminMaintainer

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

Assignee
Assign to
Time tracking