CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Got a question on finding the boundary value with a known boundary face label (https://www.cfd-online.com/Forums/openfoam/92343-got-question-finding-boundary-value-known-boundary-face-label.html)

frankyux September 11, 2011 15:36

Got a question on finding the boundary value with a known boundary face label
 
Hi all,

Just got a question on finding the boundary value with a known boundary face label, it seems quite straight forward but somehow confused me.

I can do the following to find a boundary face label:

meshSearch ms(mesh());
label faceLabel = ms.findNearestBoundaryFace(X);

and trying to get the corresponding value on the boundary:

"vf.boundaryField()[ ? ][faceLabel]"

Now in the question mark [?], unlike internalField, boundaryField contains more than one patches, thus I will need to know the patch label in front of the face label. One way I can do is just make a loop for all patches and check which is the one the face belongs to, but it seems stupid. I just wondering if there's any simple ways to solve it.

Thanks.

regards
Frank

frankyux September 14, 2011 14:26

Found something useful, I can use

label patchId=mesh().boundaryMesh().whichPatch(myFaceLab el);

to identify the patch index with given face label.


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