How to get a 27 cell stencil in OpenFOAM.
Posted January 31, 2012 at 10:30 by tomislav_maric
Tags cpccelltocellstencil, stencil, wide
The primitiveMesh::cellCells returns with a cross cell stencil of 6 cells (the cell in question is excluded). This computation comes from the basis of OpenFOAM: face addressing. Although it is very efficient, this kind of computation introduces errros e.g. in the gradient reconstruction of sharp fields.
Try to generate a field that has a jump in a single layer of cells, whose iso surface is a plane, and try to compute the normal field of this plane from the fraction gradient using any interpolation and gradient scheme available in OF, then you'll see what I mean.
However, in OpenFOAM there is a possibility to get the full 27 cell stencil although the mesh is unstructured. The class for this is CPCCelltoCellStencil, and it's extremely easy to use (once, you find it ):
There are other stencils available: look in /src/finiteVolume/fvMesh/extendedStencil. Some create lists of faces, others allow to collect cell centres from the stencil directly, etc. They are used e.g. for higher order grad schemes.
Try to generate a field that has a jump in a single layer of cells, whose iso surface is a plane, and try to compute the normal field of this plane from the fraction gradient using any interpolation and gradient scheme available in OF, then you'll see what I mean.
However, in OpenFOAM there is a possibility to get the full 27 cell stencil although the mesh is unstructured. The class for this is CPCCelltoCellStencil, and it's extremely easy to use (once, you find it ):
Code:
CPCCellToCellStencil wideStencil(mesh); // Get the stencil of a single cell. const labelList& cell27stencil = wideStencil[cellID];
Total Comments 2
Comments
-
Posted February 8, 2013 at 16:42 by lakeat -
How is it possible to use this class in parallel computing?
I mean if I want to apply it to a cell next to the cpu interface some of the stencil labels will refer to cells of other cpu that are not visible then.
Please correct me if I am wrong.Posted July 11, 2013 at 15:20 by alexmogavero