|
[Sponsors] |
February 16, 2021, 05:46 |
Looking for cella adjacent to wall patches
|
#1 |
New Member
Join Date: May 2017
Posts: 8
Rep Power: 9 |
Let’s suppose that I have a volScalarField that must be zero everywhere except for cells adjacent to wall patches, where it is expected to be 1 (only near walls, not other types of patches).
Is there a way to loop over cells and identify those being next to a wall? Thank you. |
|
February 16, 2021, 10:43 |
|
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
Yes there is -- I think in the past I've done something similar by looping over patches, checking if the patches are walls, and if so looping over patch face cells. It would look something like :
Code:
//Patch list const fvPatchList& patches = mesh.boundary(); //Patch loop forAll(patches, patchi) { //Current patch const fvPatch& currPatch = patches[patchi]; //Is wall? if (mesh.boundary()[patchi].type() == "wall") { //Patch face cells forAll(currPatch,facei) { //Current face cell label faceCelli = currPatch.faceCells()[facei]; //Do something here with faceCelli } } } Caelan |
|
February 21, 2021, 04:11 |
|
#3 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
Don't use literal strings to check the boundary condition type!! You want isA<wallPolyPatch> which checks based on the class inheritance. |
||
February 21, 2021, 14:52 |
|
#4 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
Absolutely -- good catch. This was old code and should be updated if used.
Caelan |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem using AMI | vinz | OpenFOAM Running, Solving & CFD | 298 | November 13, 2023 09:19 |
temperature correction limited- Star ccm+ | LpSingh | STAR-CCM+ | 15 | September 29, 2020 12:06 |
Expert Parameters in CFX-pre | ebrahem | FLUENT | 0 | December 20, 2019 03:39 |
[mesh manipulation] mergeMeshes problem | Attesz | OpenFOAM Meshing & Mesh Conversion | 3 | July 29, 2015 05:15 |
[ICEM] Meshing adjacent wall geometry and simple ICEM questions | everdimension | ANSYS Meshing & Geometry | 25 | June 20, 2012 05:25 |