Skip to content

Conversation

@Fuad-HH
Copy link
Contributor

@Fuad-HH Fuad-HH commented Oct 23, 2024

We discovered that the find_exit_face function in pumipic_adjacency.tpp should not work when the useBcc flag is true. A test case is added here to demonstrate the failed scenario.

Briefly, the function here decides which edge the ray crosses by the index of the minimum of the barycentric coordinates of the ray's destination; this is incorrect. The following picture demonstrates this. Although it has the same destination and the origin is in the same triangle, they will intersect different edges.

image

I have added the failing test case to fix it in the future.

Note: It uses a mesh called square2d4elem.msh and it's added to the pumipic_data repository. It's in this pull request

@jacobmerson
Copy link
Contributor

@cwsmith @Angelyr The same problem also exists in the 3D implementation of find_exit_face. We are working on an equivalent test case. We do have a working version that uses barycentric coords in 2D. We worked out the math, but not implemented in 3D.

@cwsmith
Copy link
Contributor

cwsmith commented Oct 24, 2024

@Fuad-HH Thanks for the PR.

I haven't looked at the code yet, but could you explain the difference between the arrow and the line segment in the figure?

@Fuad-HH
Copy link
Contributor Author

Fuad-HH commented Oct 24, 2024

@Fuad-HH Thanks for the PR.

I haven't looked at the code yet, but could you explain the difference between the arrow and the line segment in the figure?

To test if the function provides the correct intersected face, I have simulated these two rays in the picture that share the same destination point. The function gives the correct exit face for the left ray and the wrong exit face for the right. We discovered this by looking at the algorithm used to find the exit face here. It uses the destination's barycentric coordinate to find the exit/intersected face. In this test case, these two rays share the same destination but they intersect two different edges. But as expected, the find_exit_face method returns the same exit face for both of them which is incorrect.

More specifics are provided in the header section of the test case.

added more tests to test_find_exit_face. without bcc passsing, with bcc failing
@Fuad-HH Fuad-HH marked this pull request as draft October 25, 2024 02:05
test passing with two rays starting in element  0 and ending out of the domain. It intersects the correct faces at the correct location. The results are varified on the python notebook
it uses the same rays and mesh as moller trumbore line test. Status: it passes without bcc and fails with bcc as expected(same destination)
the new tests varifies different behaviours of the function
breaking if requireIntersection flag off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants