CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   who to find the cells with certain isoValue? (

jaming May 11, 2016 12:06

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

how to find the cells with certain isoValue?


risku9 May 11, 2016 18: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.


jaming May 12, 2016 03: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)


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 14:25.