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

checking if cell is within a cellzone

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2024, 06:42
Default checking if cell is within a cellzone
  #1
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 365
Rep Power: 8
geth03 is on a distinguished road
hi,

is it possible to check if a cell is within a cellzone?

i could basically store a checkId and then loop over all cells within that cellzone and then check if Id of both are equal. but that would take up so much computation time for my domain size.

is there a faster way of doing that?
geth03 is offline   Reply With Quote

Old   June 17, 2024, 12:50
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 724
Rep Power: 14
Tobermory will become famous soon enough
You could set up a list, one entry per cell, with a 1 if it's in the cellZone and 0 if not. Do this at the start of the run, and then keep the list. For later iterations, then it's just a simple look-up in the list, i.e. ultra fast.
Tobermory is offline   Reply With Quote

Old   June 18, 2024, 05:50
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by geth03 View Post
hi,

is it possible to check if a cell is within a cellzone?

i could basically store a checkId and then loop over all cells within that cellzone and then check if Id of both are equal. but that would take up so much computation time for my domain size.

is there a faster way of doing that?

Something as simple as this?
Code:
label zonei = mesh.cellZones().whichZone(cellId);


if (zonei < 0)
{
    ...
}
Can also use zoneMap() if that helps.
dlahaye and Tobermory like this.
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
[CGNS] CGNS converters available mbeaudoin OpenFOAM Meshing & Mesh Conversion 137 December 14, 2018 04:20
[foam-extend.org] Installation problem for foam-extend-3.2 on Ubuntu 14.04 ahmet OpenFOAM Installation 5 July 4, 2018 02:51
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 12:25
HELP! grid check failed in parallel fluent restart FLUENT 0 March 5, 2011 09:55
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 flakid OpenFOAM Installation 16 December 28, 2010 08:48


All times are GMT -4. The time now is 14:27.