Fix negative distances from bins_crossed for CylindricalMesh #3370
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.
Description
For some context, during the process of tracing a track segment along the mesh elements, the
PeriodicMesh::distance_to_grid_boundary
method uses the initial position as-is, while theget_indices
transforms the initial coordinates to local coordinates by default. I'd like to change this to be something more consistent, but I'll save that for another PR.Two problems are fixed here:
bins_crossed
for cylindrical meshes. They are adjusted in onceraytrace_mesh
and again in theCylindricalMesh
implementation ofdistance_to_grid_boundary
. The additional transformation indistance_to_grid_boundary
has been removed.get_indices
call is used to determine which element the particle passes into (if it does at all). The coordinates passed have already been transformed and an additional, incorrect, transformation is applied within this method.I've updated the
filter_mesh
regression test to use an origin with a z-value and adjusted the z grid of the original mesh to obtain an equivalent mesh with an origin. Without the changes here inmesh.cpp
the regression results failed produced negative flux values. With the changes applied the test passes without changes to the regression results.Fixes #3369
Checklist