CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   full cell stencil with parallelisation (

matthias April 11, 2012 14:51

full cell stencil with parallelisation

I'm trying to get the cell centered values surrounding an arbitrary given cell in a certain volField, i.e. volVectorField U. First I have used a search algorithm that finds for a given cell all neighbour cells and returns the cell values but all in all, it's not working in parallel due to missing diagonal dependencies in the mesh.

Afterwards, I got a hint that the extendedStencil stuff could possibly be used for this. So I'm trying to make it work but ...hmm ... no success till now (especially not in parallel).


CPCCellToCellStencil wideStencil(mesh());

 forAll(mesh().C(), lcellI)
      const labelList& cell27Stencil=wideStencil[lcellI];
      forAll(cell27Stencil, cellI)
          // now it becomes tricky ...

        // that's not working since the global addressing of the volField is wrong
        Pout << " center value: " << unFilteredField().[cell27Stencil[cellI]] << endl;

Furthermore I have no idea how to get correctly the values from the boundary fields (and processor patches) using the stencil stuff.

So I would be grateful for suggestions how to solve this messy problem! Maybe somebody has already done this or has some experience with the stencil stuff.

Best regards


kmooney April 13, 2012 11:48

Hi Matthias,

While I don't have much experience in this matter, there is an extended stencil implementation of leastSquares here:


You might be able to gain some insight if you haven't already checked it out.

Good luck,


All times are GMT -4. The time now is 22:10.