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/)
-   -   list of faces of a patch (https://www.cfd-online.com/Forums/openfoam-programming-development/213063-list-faces-patch.html)

omarabozaid December 13, 2018 10:12

list of faces of a patch
 
Dear Foamers!,


I have some search to in oder to get a list of the boundary faces in openfoam but i still do not know how can i do that.



In a nutshell, i managed to create isoContour of a field and I want to calculated the distance between the nearest point of the contour to each face centre on the boundaries.


so i want to loop each face on the boundaries, access its centre and then find the minimum distance to the contour. my problem is only the first step how can i get the face ID ?




any suggestion ?

zwlwf December 14, 2018 02:20

Quote:

Originally Posted by omarabozaid (Post 719096)
Dear Foamers!,


I have some search to in oder to get a list of the boundary faces in openfoam but i still do not know how can i do that.



In a nutshell, i managed to create isoContour of a field and I want to calculated the distance between the nearest point of the contour to each face centre on the boundaries.


so i want to loop each face on the boundaries, access its centre and then find the minimum distance to the contour. my problem is only the first step how can i get the face ID ?




any suggestion ?

the face id in boundary patch only store a start id and total number of faces. so you can try following code to list the id of boundary patch of for example "inlet",

polyPatch patch = mesh.boundaryMesh()[“inlet”];
forAll( patch, pi)
{
Info<<patch.start()+pi<<endl;
}

zwlwf December 14, 2018 02:28

what is more,
polyPatch::faceCentres() function can return the face center of a patch directly.


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