CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   who to find the cells with certain isoValue? (https://www.cfd-online.com/Forums/openfoam-programming-development/171580-who-find-cells-certain-isovalue.html)

jaming May 11, 2016 11:06

who to find the cells with certain isoValue?
 
Hi Foamers,

how to find the cells with certain isoValue?

Thanks

risku9 May 11, 2016 17:33

Hi jaming,

You could loop over the cells if that's what you want, is this for post-processing? or for run time calculation, could you be more specific?

There might be a smarter way to do it depending on the scope.

Cheers

jaming May 12, 2016 02:46

Hi risku9

many thanks for your post!
I' m looking for cells containing the isoSurface while runTime.
For serial run I do it with :
after interpolating the alpha1 to the cellPoints in code (pValues)

Code:

Foam::List<int> IsoSurface50;
forAll(alpha1, celli){
    int a=0; b=0;
    labelList CellPoints = mesh.cellPoints()[celli];
    for (Foam::List<int>::iterator it = CellPoints.begin(); it != CellPoints.end(); it++){
        if (pValues[*it]<0.5 and a == 0){a++ ;}
        else if (pValues[*it]>=0.5 and b == 0){b++ ;}

                if (a==1 and b==1){count++; IsoSurface50.append(celli) ; break ;}
            }
        }

But for the parallel run I get some problems i.e. one cell on the ProcBoundaryPatch has a wrong value.

Many thanks


All times are GMT -4. The time now is 21:04.