CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Access cell value (

skabilan September 1, 2011 15:53

Access cell value
Dear Foamers,

Within the forAll loop, I need to find the owner of faceI and get the cell value of T.

fixedGradientFvPatchScalarField& bufferField= refCast<fixedGradientFvPatchScalarField>(T.boundar yField()[patchIndex]);
scalarField& bufferMesh = bufferField.gradient();
forAll (bufferField, faceI)


Thanks all in advance

marupio September 2, 2011 16:16

I think it's in lduMesh. Look through fvMesh, lduMesh, primitiveMesh. It'll be owner_ or something like that. One of them will give you access. Discretization schemes use it... look in GaussConvection, or Laplacian.

skabilan September 2, 2011 17:19


Thanks for the tip. Just for others who might have the same issue...below is the code that should be within the forAll loop to access the cell value:

const unallocLabelList& owner = mesh.owner();
Info << T[owner[faceI]];


All times are GMT -4. The time now is 09:48.