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

[Other] Cell Numbering (cellIDs) of cellZones

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By ashishmagar600
  • 1 Post By ashishmagar600

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2019, 05:10
Default Cell Numbering (cellIDs) of cellZones
  #1
Member
 
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 9
ashishmagar600 is on a distinguished road
Hello,

Is there any specific way OF orders/numbers the cells in different cellZones.

Are there any exceptions made while numbering?

I could not find any doc explaining this stuff.

Thanks
Ximena likes this.
ashishmagar600 is offline   Reply With Quote

Old   April 30, 2019, 05:49
Default
  #2
Member
 
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 9
ashishmagar600 is on a distinguished road
Okay.. so decided to answer this myself.

I don't know how the cell ordering takes place, but anyway I needed it in the code for doing some consistent operations using the cellIds.

Using some information from other threads, I found out a method to get the list of cellIds (of any set or zone) is:

Code:
cellSet test(mesh, name);
labelList cellIds = test.toc();
However, the toc() function returns the Ids in some random manner, and not in which they are present in polyMesh/sets/ .

Well, in case of averaging (or weighted averaging) the order does not matter.
But in my case, I needed them in the order.

I could not solve it, rather I found a workaround, by reading the cellIds from sets/ and use them for the purpose I intended.


If anyone has a better method, please feel free to post here.

Thanks,
Ashish Magar
Sun likes this.
ashishmagar600 is offline   Reply With Quote

Old   May 7, 2019, 07:28
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
The cell Ids of the cellZone depend on how the zone was defined. It is generally good practice to have this in sorted order, but any order is allowed provided that there are no duplicate ids.

If you want to create a sorted set of ids from a cellSet (which is inherently unordered), just specify the appropriate method:
Code:
cellSet test(mesh, name);
labelList cellIds(test.sortedToc());
You can also sort later if you want:
Code:
Foam::sort(cellIds);
olesen 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
Neighboring cells in tetrahedral mesh vishwesh OpenFOAM Programming & Development 9 November 10, 2017 07:06
Doubt about parallel processing vishwesh OpenFOAM Programming & Development 0 November 10, 2017 06:20
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 12:25
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 14:06
cell to cell relation CMB Siemens 1 December 4, 2003 04:05


All times are GMT -4. The time now is 17:59.