CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Problems accessing neighbour cells

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By styleworker

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2013, 08:30
Default Problems accessing owner cells
  #1
Member
 
Join Date: May 2012
Posts: 55
Rep Power: 14
styleworker is on a distinguished road
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
    }
}
The error occurs during the first outer loop, when label ownCell tries to get access to mesh.owner()[24]. It is obvious, because the owner index ranges from 0 to 23 and the faceI index ranges from 0 to 71.

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
Attached Images
File Type: jpg cells.jpg (25.2 KB, 32 views)
File Type: jpg points.jpg (36.8 KB, 24 views)
Attached Files
File Type: txt owner.txt (1.1 KB, 10 views)

Last edited by styleworker; December 4, 2013 at 10:31.
styleworker is offline   Reply With Quote

Old   December 4, 2013, 11:08
Default
  #2
Member
 
Join Date: May 2012
Posts: 55
Rep Power: 14
styleworker is on a distinguished road
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;
But I actually need the owner of the boundary cells, too.
styleworker is offline   Reply With Quote

Old   December 4, 2013, 11:39
Default
  #3
Member
 
Join Date: May 2012
Posts: 55
Rep Power: 14
styleworker is on a distinguished road
I've used the wrong function!

mesh.owner(): returns nInternalFaces (24)
mesh.faceOwner(): returns nFaces (72)
D.R., skyoon and Michael@UW like this.
styleworker is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 22:08.