CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Accessing neighbor cells fields

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By duongquaphim

LinkBack Thread Tools Display Modes
Old   December 11, 2012, 16:11
Default Accessing neighbor cells fields
New Member
Join Date: Oct 2011
Posts: 27
Rep Power: 8
antoniofct is on a distinguished road
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


What could be the function to do it just in cell neighbors? Could it be inside geometricField.C?


antoniofct is offline   Reply With Quote

Old   December 11, 2012, 16:37
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 93
Rep Power: 10
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim
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.

sina.s and JackW like this.
duongquaphim is offline   Reply With Quote

Old   December 11, 2012, 16:41
New Member
Join Date: Oct 2011
Posts: 27
Rep Power: 8
antoniofct is on a distinguished road
thanks a lot, I will give it a try!

antoniofct is offline   Reply With Quote

Old   May 13, 2015, 17:53
New Member
Vitor Geraldes
Join Date: Dec 2009
Location: Lisbon, Portugal
Posts: 20
Rep Power: 9 is on a distinguished road
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? is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time averaged fields on a defined time range Yann OpenFOAM Post-Processing 7 November 19, 2014 09:52
Accessing fields and dictionaries from within a BC implementation alberto OpenFOAM Running, Solving & CFD 12 December 6, 2011 10:30
Missing fields in reconstructPar flowris OpenFOAM 1 July 9, 2010 02:48
domainIntegrate, dieselFoam and Lagrangian Fields mturcios777 OpenFOAM 0 May 14, 2010 15:16
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 09:15

All times are GMT -4. The time now is 12:06.