CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Accessing neighbor cells fields

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

Like Tree1Likes
  • 1 Post By duongquaphim

Reply
 
LinkBack Thread Tools Display Modes
Old   December 11, 2012, 16:11
Default Accessing neighbor cells fields
  #1
New Member
 
Join Date: Oct 2011
Posts: 27
Rep Power: 5
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

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
antoniofct is offline   Reply With Quote

Old   December 11, 2012, 16:37
Default
  #2
Member
 
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 92
Rep Power: 8
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);

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
sina.s likes this.
duongquaphim is offline   Reply With Quote

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

Antonio
antoniofct is offline   Reply With Quote

Old   May 13, 2015, 17:53
Default
  #4
New Member
 
Vitor Geraldes
Join Date: Dec 2009
Posts: 11
Rep Power: 7
vitor.geraldes@ist.utl.pt 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?
vitor.geraldes@ist.utl.pt is offline   Reply With Quote

Reply

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 11:05.