|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
deok-kyu choi
Join Date: Feb 2012
Location: Rep. of Korea
Posts: 12
Rep Power: 15 ![]() |
is it possible to extract cells from multiple cell zones?
and how can i set the vector value to selected cells? regards, |
|
|
|
|
|
|
|
|
#2 | |
|
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 41 ![]() ![]() |
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]
}
}
|
||
|
|
|
||
|
|
|
#3 | |
|
New Member
deok-kyu choi
Join Date: Feb 2012
Location: Rep. of Korea
Posts: 12
Rep Power: 15 ![]() |
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, |
||
|
|
|
||
|
|
|
#4 | |
|
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 41 ![]() ![]() |
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)
{
...
}
}
|
||
|
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |