|
[Sponsors] |
Selecting and iterating over cells in a cellzone |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 10, 2022, 14:03 |
Selecting and iterating over cells in a cellzone
|
#1 |
New Member
George
Join Date: Oct 2020
Posts: 24
Rep Power: 6 |
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); } |
|
Tags |
cellzones, fvoptions |
|
|