View Issue Details

IDProjectCategoryView StatusLast Update
0002488OpenFOAMBugpublic2017-03-07 10:09
Reporterali.sh Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformGNU/LinuxOSUbuntuOS Version14.04
Summary0002488: sample and sampleField functions return repeated results
DescriptionWhen you use sample function of e.g. class sampledPlane the output length is twice what expected. This means that e.g. consider a cavity case with 20*20*1 cells in xyz direction. A cutting plane is defined with a normal vector (0 1 0) in the middle of the box. You expect to have 20 cells cut by this face but the reported result is 40.
Not surprisingly the function meshCells() reports 40 cutted cells.
The reported cellIDs is sth like this:
(cell0 cell0 cell1 cell1 cell2 cell2 ...)

Am I did or understood sth wrong?
Steps To Reproduceadd #include "sampledPlane.H" in icoFoam.C
add required libraries in options file:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/cfdTools \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/surfMesh/lnInclude \
    -I$(LIB_SRC)/triSurface/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
    -lfiniteVolume \
    -lmeshTools \
    -lsurfMesh \
    -ltriSurface \
    -lsampling


in createFields create:
IOdictionary sampleDict
(
    IOobject
    (
        "sampleDict",
        runTime.constant(),
        mesh,
        IOobject::MUST_READ_IF_MODIFIED,
        IOobject::NO_WRITE
    )
);
word aa("aa");
sampledPlane splane1(aa,mesh,sampleDict);

in the main function we have:

splane1.update();
scalarField sU=splane1.sample(p);
Info<<" sample U is " <<sU<<endl;
Info<<" cutcells are " <<splane1.cutCells()<<endl;

create sampleDict in constant forlder of cavity tut:
normalVector (0 1 0);
basePoint (0.0025 0.0925 0.005);
TagsNo tags attached.

Activities

wyldckat

2017-03-06 20:17

updater   ~0007862

Quick question: Did you inspect the resulting surface?

ali.sh

2017-03-07 10:01

reporter   ~0007865

When I saw the face centers by Cf(), I found out that the oroginal hex faces are triangulated! That is why you see everything twice.

So the solution is to set triangulate to false while creating cutting planes.

Thanks a lot Bruno!

Issue History

Date Modified Username Field Change
2017-03-06 17:54 ali.sh New Issue
2017-03-06 20:17 wyldckat Note Added: 0007862
2017-03-07 10:01 ali.sh Note Added: 0007865
2017-03-07 10:09 henry Assigned To => henry
2017-03-07 10:09 henry Status new => closed
2017-03-07 10:09 henry Resolution open => no change required