CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   find the adjacent face on the boundary (https://www.cfd-online.com/Forums/openfoam-programming-development/103686-find-adjacent-face-boundary.html)

bojiezhang June 23, 2012 10:12

find the adjacent face on the boundary
 
Hello everyone:

I want to find the cells surround one cell "on the boundary", (the cell is face). If I know one face ID, how can I find the faces ID around this face? For example, if the face is quadrangle, I want to find the other 8 faces around it.

Could someone know how to deal with it? Thank you!

bojiezhang

olesen June 25, 2012 03:36

Quote:

Originally Posted by bojiezhang (Post 367950)
Hello everyone:

I want to find the cells surround one cell "on the boundary", (the cell is face). If I know one face ID, how can I find the faces ID around this face? For example, if the face is quadrangle, I want to find the other 8 faces around it.

Could someone know how to deal with it? Thank you!

bojiezhang

Finding the immediate neighbouring faces (eg, 4 neighbouring faces from a quad) shouldn't be too bad:
- from boundary face, get the owner cell
- for this owner cell, get all the associated faces
- get the neighbouring cells from the faces
- loop through to find the which of the neighbour cell faces to find a boundary face.

If you need the "corner" faces, my first approach would be brute force.
- from the boundary face you know the vertices, place them in a labelHashSet.
- loop through the boundary faces and tag each face that shares a vertex with the original face. A labelHashSet of the face Ids might be useful here.

This should work. Instead of looping across all boundary faces, you may want to restrict your search to a particular patch though - for efficency and to avoid finding a neighbour with a different BC treatment.

Tushar@cfd September 16, 2014 05:05

use of GroovyBC to acess the data
 
Dear olesen,

Quote:

Finding the immediate neighbouring faces (eg, 4 neighbouring faces from a quad) shouldn't be too bad:
- from boundary face, get the owner cell
- for this owner cell, get all the associated faces
- get the neighbouring cells from the faces
- loop through to find the which of the neighbour cell faces to find a boundary face.
Thank you for the valuable information.

How to get all the associated faces for the owner cell? I wish to use groovyBC for the same.

PicklER November 9, 2014 14:52

Hello

The function name is bit confusing, but to get the faces of a cell called FaceIOwner:

Code:

const cell& facesOfOwner = mesh.cells()[FaceIOwner];

Tushar@cfd November 10, 2014 07:50

Thank you for the info.

-
Best Regards!


All times are GMT -4. The time now is 02:55.