Robust exit of particle from mesh when determining segments #165
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change makes an exit of a particle from the mesh more robust.
During tally operations when a particle is declared to be exiting the mesh we then perform a ray tracing operation on all faces on the boundary of the mesh to determine if the ray passed will re-enter the mesh in a new location. By nature of the the updated ray position being exactly on the face of the boundary element, it's possible that a zero or near-zero intersection will be returned for that face.
Update: I didn't complete my thought as to the specific as to the pathology this addresses in the original post. When we encounter these zero or near-zero distances with the current surface the particle will become stuck, intersecting that same face over and over again.
In DAGMC geometry, we handle this by recording previously hit faces (triangles) and masking them out in subsequent hits until it's appropriate to clear the record. This changeset applies the same logic when rays are on the boundary of the mesh attempting to re-enter.
I'll note that it's very well possible that this is caused by inconsistent normals on the boundary of the mesh. In the previous version, we were using orientation filtering to avoid entering hits and as such this situation should not occur in theory. Without embedded geometry, it's possible that elements do not provide consistent canonical connectivity ordering at the boundary of mesh to guarantee that normals of the faces face outward from the boundary element. This approach should remove the restriction for outward facing normals and allow these operations to succeed.