![]() |
Accessing neighbor cells fields
Hello all,
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 Code:
sum(T.internalField())/mesh.nCells()What could be the function to do it just in cell neighbors? Could it be inside geometricField.C? Thanks! António |
I think you need to do a bit more for that:
const labelList& neighbour = mesh.cellCells()[celli] scalar sum = scalar(0); forAll(neighbour,i) { 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. Duong |
thanks a lot, I will give it a try!
Antonio |
| All times are GMT -4. The time now is 22:07. |