CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Selecting and iterating over cells in a cellzone

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2022, 14:03
Default Selecting and iterating over cells in a cellzone
  #1
New Member
 
George
Join Date: Oct 2020
Posts: 24
Rep Power: 6
Dicanic is on a distinguished road
Hi all,

I am trying to add a source to a specific cellZone but when I run my solver, it just adds the source to the bottom of the mesh (probably starting from cell ID 0).

So my question is, what is the best way to reference the mesh, a cellzone in the mesh, and then iterate over it so that the cell information for that cellzone is correctly referenced.

Relevant code that I have tried:

Code:
const scalarField& V = mesh_.V();	//Volume field

// x, y, z coordinates
const scalarField cellx = mesh_.C().component(0);
const scalarField celly = mesh_.C().component(1);
const scalarField cellz = mesh_.C().component(2);

const label coreZoneID = mesh_.cellZones().findZoneID("TheCoolZone");
const labelList coreCellsZone = mesh_.cellZones()[coreZoneID]; 

forAll(coreCellsZone, i)
{
		    	scalar V_i = mesh_.V()[coreCellsZone[i]];
		    	double x = mesh_.C()[coreCellsZone[i]].component(0);
		    	double y = mesh_.C()[coreCellsZone[i]].component(1);
		    	double z = mesh_.C()[coreCellsZone[i]].component(2);
}
Any help is appreciated!
Dicanic is offline   Reply With Quote

Reply

Tags
cellzones, fvoptions


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



All times are GMT -4. The time now is 16:01.