CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   extended cell stencil (http://www.cfd-online.com/Forums/openfoam-programming-development/96703-extended-cell-stencil.html)

tomislav_maric January 30, 2012 07:40

extended cell stencil
 
Hi everyone,

mesh.cellCells() gives a cross-like 6 cell stencil for hex cells. I'm in need of a 27 cell stencil, or at least a wider stencil of computation surrounding a face. There are some classes in

src/finiteVolume/fvMesh/extendedStencil

that may help. I've been trying them out, and the faceToCellStencil (extended -//-) seems interesting, but for a simple 3D cavity case it builds up nothing: 0 sized label list.

Does anyone here have any experience with these parts of the code?

tomislav_maric January 31, 2012 09:40

Well, to answer myself:

take a look at CPCCellToCellStencil: it constructs a point based neighbourhood of the cell, thus picking up the 27 cell stencil often used for linear regression in the gradient reconstruction of sharp fields on structured meshes.

The labelListList is filled with with per-cell constructed labels of the surrounding cells. The first label is the label of the cell in question, the rest are the labels of the surrounding cells.

:D

kmooney January 31, 2012 17:24

I just recently took a gander at the extendedLeastSquares fvScheme. That uses a point-to-cells connectivity that would return the 27 cell stencil for a hex mesh you are looking for.

Lines 164 on in leastSquaresVectors.C performs a loop over all cells connected to all the points bounding a given cell.

Good Luck!

tomislav_maric February 1, 2012 04:38

Quote:

Originally Posted by kmooney (Post 342176)
I just recently took a gander at the extendedLeastSquares fvScheme. That uses a point-to-cells connectivity that would return the 27 cell stencil for a hex mesh you are looking for.

Lines 164 on in leastSquaresVectors.C performs a loop over all cells connected to all the points bounding a given cell.

Good Luck!

Thanks a lot for the advice! I've tried this as well, but ended up using volPointInterpolation + face average + Gauss linear, it gives great results! :)

I gave up on leastSquares when I read this:

http://www.openfoam.com/mantisbt/view.php?id=141

check out the last comment in the discussion.

For my fields, leastSquares did not help at all, I'll try extended once more and see what happens.

tomislav_maric February 1, 2012 10:38

I've tried the extendedLeastSquares with the minDet = 8 to get the most cells, and the gradient reconstruction is unstable (in a symmetric way with respect to the mesh alignment) for a sharp spherical field.

Kyle, do you have any docs on this class that you can share? I'm happy with my gradient computation right now, but I will maybe spend some time to assemble the 27 cell stencil, cell based symm tensor for the linear regression myself, if it turns out to be necessary at some point.

I didn't analyze the code of extendedLs in depth, but it seems that the tensor is assembled based on owner-neighbour relationship, which will introduce problems for reconstruction of linear gradient (if it is xtremely sharp) in the skew direction....


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