CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Technical] How to identify cell neighbours

Register Blogs Community New Posts Updated Threads Search

Like Tree30Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2009, 11:31
Default How to identify cell neighbours
  #1
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Hello,

i am new in openFoam and i donīt know how to identify and output the neighbours of a cell[i]!

Is it possible in openFaom?

I hope someone can help me!

Thanks and kind regards
Khaled
booz is offline   Reply With Quote

Old   February 14, 2009, 14:52
Default Hi Khaled mesh.cellCell
  #2
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Hi Khaled

mesh.cellCells()[cellI] gives the neighbours of cell cellI

su junwei
masb, sina_mech, sina.s and 7 others like this.
su_junwei is offline   Reply With Quote

Old   February 15, 2009, 05:58
Default Hi su junwei, thanks very m
  #3
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Hi su junwei,

thanks very much.

And with "Info<< mesh.cellCells()[celli]<< endl;" I put out the neighbours of celli?

Regards,
Khaled
Kummi likes this.
booz is offline   Reply With Quote

Old   February 15, 2009, 06:16
Default Yes, Khaled, you can print the
  #4
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Yes, Khaled, you can print them out. This is a list of cell index in the neighbourhood.
Junwei
su_junwei is offline   Reply With Quote

Old   February 15, 2009, 06:30
Default Thanks Su. Iīll try it now.
  #5
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Thanks Su. Iīll try it now.

Btw. do you know how to integrate over a special patch or is it possible with openfoam?

Thanks and regards
khaled
booz is offline   Reply With Quote

Old   February 15, 2009, 06:41
Default Hi Khaled patchIntegra
  #6
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Hi Khaled

patchIntegrate can be used to integrate over a special patch, you can use it like this

patchIntegrate fieldname patchname.

This is a postprocessing utility.

Junwei
songwukong and Kummi like this.
su_junwei is offline   Reply With Quote

Old   February 15, 2009, 07:07
Default Hi Su Junwei, oh ok, thanks
  #7
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Hi Su Junwei,

oh ok, thanks.

But mybe i hope you ask my last question here.

Exactly i want to integrate over the patch "outlet" of the pressure field "p". So then i only write

patchIntegrate p [1]

if the patchname is [1]?

Thanks,
Khaled
booz is offline   Reply With Quote

Old   February 15, 2009, 14:19
Default Hi khaled yes. That's Ok.
  #8
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Hi khaled
yes. That's Ok. Just test it.
Junwei
su_junwei is offline   Reply With Quote

Old   June 2, 2010, 12:24
Default number of cell neighbours
  #9
New Member
 
Ritu Marpu
Join Date: Oct 2009
Posts: 3
Rep Power: 17
Ritu Marpu is on a distinguished road
Hi Su,

Thanks for the hint, it was very helpful. I was wondering if there is a command to find the number of cell neighbours for a cell.

mesh.cellCells()[cellI] gives <no. of neighbouring cells>(<neighbours>)

If I want just the <no. of neighbouring cells> alone, how do I get it ?

Thanks.
Ritu Marpu is offline   Reply With Quote

Old   June 6, 2010, 03:04
Default
  #10
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Hi Ritu

Just using the size function like this
label neighbourCount=mesh.cellCells()[cellI].size()

sorry for late response
Junwei
su_junwei is offline   Reply With Quote

Old   November 16, 2010, 17:31
Default closest cell from point
  #11
Member
 
Pascal
Join Date: Jun 2009
Location: Montreal
Posts: 65
Rep Power: 17
Pascal_doran is on a distinguished road
Hi Su Junwei and Khaled,

Does anyone know how to select the closest cell near the point (x,y,z)?

Thank you,

Pascal
Pascal_doran is offline   Reply With Quote

Old   November 17, 2010, 01:16
Default
  #12
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Hi Pascal
you can use the following code

meshSearch ms(mesh);
label nearestCellIndex = ms.findNearestCell(p);

p is your point for searching nearest cell. nearestCellIndex is the cell index that you want.
Don't forget to include "meshSearch.H"

Junwei
su_junwei is offline   Reply With Quote

Old   November 17, 2010, 02:58
Default
  #13
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17
kathrin_kissling is on a distinguished road
Hi Pascal,

alternatively you can use

label labelOfClosestCell mesh.findCell(c y z);


Best Kathrin
songwukong, bkassar, Kummi and 1 others like this.
kathrin_kissling is offline   Reply With Quote

Old   December 9, 2010, 10:38
Default
  #14
Member
 
O R
Join Date: Mar 2009
Posts: 50
Rep Power: 17
arkangel is on a distinguished road
Hi

I was looking in the forum and I hope you might help me?

I want to identify cells whose face(s) are in a patch and give them a value

what would it the the best way ?

Thanks


O. R.
arkangel is offline   Reply With Quote

Old   December 9, 2010, 17:33
Default post processing
  #15
Member
 
Yashar Afarin
Join Date: May 2010
Location: Toronto- Canada
Posts: 40
Rep Power: 16
yashar.afarin is on a distinguished road
Send a message via Skype™ to yashar.afarin
Hi everybody,

I am trying to model a free turbulent jet with LES. In part of my project I have to determine value of some variables along a specific line inside my domain to compare my results with my refrences results but I dont know how I can do that?
I would appreciate any help.

best regards,
Yashar
yashar.afarin is offline   Reply With Quote

Old   December 10, 2010, 09:42
Default
  #16
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Quote:
Originally Posted by yashar.afarin View Post
Hi everybody,

I am trying to model a free turbulent jet with LES. In part of my project I have to determine value of some variables along a specific line inside my domain to compare my results with my refrences results but I dont know how I can do that?
I would appreciate any help.

best regards,
Yashar
Just use sample tool in OpenFOAM. see Openfoam's user's guide
su_junwei is offline   Reply With Quote

Old   December 10, 2010, 09:45
Default
  #17
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Quote:
Originally Posted by arkangel View Post
Hi

I was looking in the forum and I hope you might help me?

I want to identify cells whose face(s) are in a patch and give them a value

what would it the the best way ?

Thanks


O. R.

Just use faceCells in polyPatch class.

faceCells give you the index of a cell who owns the current patch face.

Regards, Junwei
su_junwei is offline   Reply With Quote

Old   December 10, 2010, 13:14
Default
  #18
Member
 
Yashar Afarin
Join Date: May 2010
Location: Toronto- Canada
Posts: 40
Rep Power: 16
yashar.afarin is on a distinguished road
Send a message via Skype™ to yashar.afarin
Quote:
Originally Posted by su_junwei View Post
Just use sample tool in OpenFOAM. see Openfoam's user's guide
Hi Su,

thank you very much for your response.
indeed, I want to compute my jet width along the jet centreline. for that reason, I have to determine the centreline velocity(u(x,0,0)) that is function of x-axis then compute distance from jet centreline in y-direction where the x component of velocity become half of the centreline velocity.
is there any utility that can do that for me or I have to write a code?
yashar.afarin is offline   Reply With Quote

Old   December 11, 2010, 04:50
Default
  #19
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Quote:
Originally Posted by yashar.afarin View Post
Hi Su,

thank you very much for your response.
indeed, I want to compute my jet width along the jet centreline. for that reason, I have to determine the centreline velocity(u(x,0,0)) that is function of x-axis then compute distance from jet centreline in y-direction where the x component of velocity become half of the centreline velocity.
is there any utility that can do that for me or I have to write a code?
A possible way can be described as follows:
1) Cut several planes along centreline transversely.
2) select points on these planes. These points are not necessary on the cell center.
3) interpolate values to the selected points
4) find the point who has maximum velocity on each plane, and this point is on the cenerline
5) loop all the planes. In each planes, fix Y, and change z from min to maximum, and find the two points who has the most approaching value to half the maximum velocity. Distance between these two points is the jet width on this line. In 3D the wide should be different for different Y.

The points you selected shoud cover your jets. The algorithm is an approximated method.

If you have problem in implementation, please let me know.

Regards, Junwei
songwukong and dasa like this.
su_junwei is offline   Reply With Quote

Old   December 11, 2010, 10:40
Smile
  #20
Member
 
Yashar Afarin
Join Date: May 2010
Location: Toronto- Canada
Posts: 40
Rep Power: 16
yashar.afarin is on a distinguished road
Send a message via Skype™ to yashar.afarin
Quote:
Originally Posted by su_junwei View Post
A possible way can be described as follows:
1) Cut several planes along centreline transversely.
2) select points on these planes. These points are not necessary on the cell center.
3) interpolate values to the selected points
4) find the point who has maximum velocity on each plane, and this point is on the cenerline
5) loop all the planes. In each planes, fix Y, and change z from min to maximum, and find the two points who has the most approaching value to half the maximum velocity. Distance between these two points is the jet width on this line. In 3D the wide should be different for different Y.
Hi Su

I really appreciate all the help you gave me.
basically, I think that it would better for me to export my result to a .dat file and write a separate(from OF) code to digest in my data but I would appreciate if you could answer my question:
how I could export my data so that I could specify and link for each point(cell centre) , the position(x,y,z) and velocity(u,v,w) variables of that point as a same file?


Best regards,
Yashar
yashar.afarin is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
Determining cell neighbours on unstructured grid orxan.shibli Main CFD Forum 4 September 25, 2011 06:29
Help Me, what's the Cell Above any given cell in 3D. gomane8 Main CFD Forum 3 September 11, 2011 22:29
neighbours of a cell Asghari FLUENT 17 October 7, 2010 18:41
neighbours of a cell Asghari FLUENT 0 July 9, 2006 14:28


All times are GMT -4. The time now is 15:33.