Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interpolation stencil misalignment in RotatingStar #6260

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

ncorsobh
Copy link
Contributor

Proposed changes

In RotatingStar, the setup of the stencils for the interpolation of the RotNS data was slightly offset. This resulted in rare edge cases where the target point could fall outside of the stencil if the rounding behaved unfavorably, especially at high resolutions. However, even when the target point fell inside the stencil, it would likely be closer to its upper edge.

This PR both fixes the rounding issue that resulted in the target point falling outside of the stencil and improves on the stencil construction overall. Now, if the stencil size is an even number, the target point will always be placed between the middle two points of the stencil, and if the stencil size is an odd number, the target point will be closest to the central point in the stencil.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

Copy link
Member

@wthrowe wthrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look fine. Is there anything here that it is possible to test?

};
if (target_abs_cos_theta > cos_theta_[angular_index]) {
angular_stencil_adjust++;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional] Two extra semicolons.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squashed the semicolons immediately. Added the unit test in a fixup commit. The test attempts to interpolate at a point which would've caused the original stencil construction to fail (I tested it with the old method and it did indeed fail).

@ncorsobh ncorsobh force-pushed the RotatingStarFix branch 2 times, most recently from 4437f7d to a0ae0b9 Compare September 11, 2024 15:39
@wthrowe
Copy link
Member

wthrowe commented Sep 11, 2024

Looks good. Squash.

@wthrowe wthrowe merged commit e5c08ea into sxs-collaboration:develop Sep 11, 2024
23 checks passed
@ncorsobh ncorsobh deleted the RotatingStarFix branch September 11, 2024 18:54
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.

2 participants