Accessing neighbor cells fields
I am trying to do an average of cells neighbors. For instance, if I want to get an average of Temperature in the internal field I can easily type
What could be the function to do it just in cell neighbors? Could it be inside geometricField.C?
I think you need to do a bit more for that:
const labelList& neighbour = mesh.cellCells()[celli]
scalar sum = scalar(0);
sum += T[neighbour[i]];
sum /= neighbour.size();
And loop over all the cells with that will give you an average of cell neighbours.
You can find more of functions relating to the mesh information in primitiveMesh class.
thanks a lot, I will give it a try!
This a nice implementation, but, in parallel, it does not recognize neighbour cells if they are in subdomains different from the one of the central cell. Is there a simple implementation to address this problem?
|All times are GMT -4. The time now is 05:30.|