|
[Sponsors] |
December 4, 2013, 08:30 |
Problems accessing owner cells
|
#1 |
Member
Join Date: May 2012
Posts: 55
Rep Power: 14 |
Hello foamers,
I want to access the owner cells of a partical face. Sorry for the wrong topic title. My mesh (see attached pictures) consists 72 nfaces with 24 nInternalFaces. With the following code, I'm gathering informations about points and faces for some other calculation. Code:
forAll(mesh.cells(), cellI) { cell faces = mesh.cells()[cellI]; // contains face indices of cellI: cellI=0: 6(0 1 24 36 40 41)) forAll(faces, j) { label faceI = faces[j]; face points = mesh.faces()[faceI]; Info << mesh.owner().size() << endl; // size for this mesh is 24 label ownCell = mesh.owner()[faceI]; //this line causes an error during calculation } } I'm a bit confused about the ordering. If I have a look at the constant/polyMesh/owner file (attached), I can see 72 entries which actually corresponds to the faceI range?! Can anybody help? P.S. I don't know if it's important, but the mesh was generated with Gmsh and converted via gmshToFoam. Kind regards Willy Last edited by styleworker; December 4, 2013 at 10:31. |
|
December 4, 2013, 11:08 |
|
#2 |
Member
Join Date: May 2012
Posts: 55
Rep Power: 14 |
I've found out, that the first 24 entries in constant/polyMesh/owner are identical to the values stored in mesh.owner(). As far as I know the first entries in a faceList are internal faces. This means, that mesh.owner() just stores internalFaces. Since mesh.cells()[faceI] includes boundary faces it won't work accessing boundary faces in mesh.owner().
I guess, I have to include an additional condition, which checks whether the face is an internalFace or not. Something like this Code:
if(!mesh.isInternalFace(faceI)) continue; |
|
December 4, 2013, 11:39 |
|
#3 |
Member
Join Date: May 2012
Posts: 55
Rep Power: 14 |
I've used the wrong function!
mesh.owner(): returns nInternalFaces (24) mesh.faceOwner(): returns nFaces (72) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing neighbor cells fields | antoniofct | OpenFOAM Programming & Development | 7 | May 3, 2021 03:14 |
accessing neighbour cells in parallel computing | impecca | OpenFOAM Programming & Development | 4 | April 11, 2019 04:09 |
[snappyHexMesh] SnappyHexMesh for internal Flow | vishwa | OpenFOAM Meshing & Mesh Conversion | 24 | June 27, 2016 08:54 |
killed "snappyHexMesh" | parkh32 | OpenFOAM Pre-Processing | 2 | April 8, 2012 17:12 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 19:43 |