|
[Sponsors] |
May 2, 2012, 23:18 |
Extract cells from multiple cell zones
|
#1 |
New Member
deok-kyu choi
Join Date: Feb 2012
Location: Rep. of Korea
Posts: 12
Rep Power: 14 |
is it possible to extract cells from multiple cell zones?
and how can i set the vector value to selected cells? regards, |
|
May 3, 2012, 03:30 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
Code:
// cellZoneIds with the IDs of your cell zones // mesh_ is a reference to the mesh forAll(cellZoneIds, zoneI) { const labelList& cells = mesh_.cellZones()[cellZoneIds[zoneI]]; forAll(cells, i) { // do something for cells[i] } } |
||
May 4, 2012, 06:46 |
|
#3 | |
New Member
deok-kyu choi
Join Date: Feb 2012
Location: Rep. of Korea
Posts: 12
Rep Power: 14 |
Quote:
finally I did by olesen's favor! But I'd like to do something more. Following screenshot, it seems to be calculated for every cells. How can i apply coriolis force for selected cell zone (celltable_2) ? zone of celltable_2 is circle area in box. Here is my code, but is just a guide forAll(mesh.cellZones(),i) { const cellZone& zone = mesh.cellZones()[i]; if (zone.name()=="cellTable_2") { const labelList& cellLabels = mesh.cellZones()[i]; Info << "Found matching zone " << zone.name() << " with " << cellLabels.size() << " cells." << endl; forAll(cellLabels, i) { // Calculate the coriolis force in selected cells (cellTable_2) volVectorField Fcoriolis = Omega ^ (mesh.C() - Origin); Fcoriolis.write(); } } } regards, |
||
May 4, 2012, 07:39 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
1. if you will only ever have a single zone: Code:
label zoneId = mesh.cellZones().findIndex("cellTable_2"); if (zoneId != -1) { const labelList& cellIds = mesh.cellZones()[zoneId]; forAll(cellIds, i) { ... } } Code:
labelList zoneIds = mesh.cellZones().findIndices("cellTable_[1-3]"); forAll(zoneIds, zoneI) { const labelList& cellIds = mesh.cellZones()[zoneIds[zoneI]]; forAll(cellIds, i) { ... } } |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
Cells with t below lower limit | Purushothama | Siemens | 2 | May 31, 2010 22:58 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |
two adjacent cell zones. | Thejasvi | FLUENT | 3 | November 26, 2001 09:35 |
Tracking/Modifying Cell Zones | Greg Perkins | FLUENT | 1 | November 7, 2000 00:35 |