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

Be careful when calling meshSearch::findNearestFace with a seed face

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 6, 2018, 08:38
Default Be careful when calling meshSearch::findNearestFace with a seed face
  #1
Senior Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12
t.oliveira is on a distinguished road
Hi,

I was using meshSearch::findNearestFace (OpenFOAM v5) to find a face label from its coordinates. The function declaration is
Code:
label findNearestFace
(
    const point& location,
    const label seedFacei = -1,
    const bool useTreeSearch = true
) const;
I was providing as seedFacei the label of a nearby face, in the hope of speeding up the search. However, in some specific cases, I was not getting the results I expected.

If seedFacei != -1 is provided, findNearestFace calls findNearestFaceWalk. From what I understood reading findNearestFaceWalk's implementation, it does not find the correct face in cases such as the one below.

Consider the attached figure. 'X' marks the location and 'f' is the seed face. findNearestFaceWalk does the following:
Code:
distanceSqr = distance between 'X' and the center of 'f';
for every face of cell A and cell B
{
    if ( (distance between 'X' and the center of face) < distanceSqr )
    {
        face is the new best candidate for nearest face;
        distanceSqr = (distance between 'X' and the center of face);
    }

}
As you can see in the figure, no other face center of A or B is closer to 'X' than the center of face f. As a result, the face over which 'X' lies is never found.

I decided not to use seedFacei when calling findNearestFace. It defaults to seedFacei=-1 and, if useTreeSearch is true (its default value), findNearestFace uses findNearestFaceTree instead of findNearestFaceWalk. I did not check if the performance got worse. The result of the search is now as expected.

Kind regards,
Thomas
Attached Images
File Type: png findNearestFace.png (4.2 KB, 9 views)
t.oliveira is offline   Reply With Quote

Reply

Tags
find face, mesh search


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
area does not match neighbour by ... % -- possible face ordering problem St.Pacholak OpenFOAM 10 February 7, 2024 21:50
[ICEM] Error in mesh writing helios ANSYS Meshing & Geometry 21 August 19, 2021 14:18
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Meshing & Mesh Conversion 53 March 8, 2019 09:42
(gambit)projecting just a part of mesh on another face? gholamghar ANSYS Meshing & Geometry 2 March 14, 2011 17:14
WARNING: non-positive face area exist. Alan Main CFD Forum 4 August 17, 2006 07:33


All times are GMT -4. The time now is 11:58.