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 a bug at roundoff error in block_logical_coords #4510

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

nilsvu
Copy link
Member

@nilsvu nilsvu commented Dec 13, 2022

This bug appeared when interpolating between two BBH domains with bulged frustums. Points at inner frustum edges were not mapped to the source domain because the frustum inverse reports logical coordinates outside [-1, 1] by roundoff error.

Proposed changes

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

@nilsvu nilsvu added the bugfix label Dec 13, 2022
Copy link
Member

@kidder kidder left a comment

Choose a reason for hiding this comment

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

please add a test that would fail/pass before/after this change

@markscheel
Copy link
Contributor

markscheel commented Dec 13, 2022

Should this bug be fixed in Frustrum instead? (That is, should Frustrum be changed to never return logical coords outside of [-1,1]? ).

I worry that this change ignores #3913 and similar places where we assume logical coords are 1.0 and/or -1.0 on the boundary.

Or maybe #3913 and other places need to account for roundoff differently.

@nilsvu
Copy link
Member Author

nilsvu commented Dec 13, 2022

Many map inverses currently return values outside -1,1. Yea, maybe we should require all maps to ensure they return only values within their range. That's a lot of work though and needs to be tested thoroughly. Not all maps inverses return logical coords either, right? I haven't made up my mind on what's the best way to handle this.

@kidder
Copy link
Member

kidder commented Dec 13, 2022

  • So as @markscheel says checking exact vs checking within roundoff should probably be a choice of the user of this function.
  • The testing of maps needs to be done on the maps held by the Blocks, which are usually a composition of multiple maps, not individual maps.

This bug appeared when interpolating between two BBH
domains with bulged frustums. Points at inner frustum edges
were not mapped to the source domain because the frustum inverse
reports logical coordinates outside [-1, 1] by roundoff error.
@nilsvu nilsvu force-pushed the fix_block_logical_coords branch from ea0e224 to 3a4e693 Compare December 16, 2022 03:30
@nilsvu
Copy link
Member Author

nilsvu commented Dec 16, 2022

This is now ready to review for whoever wants to @kidder @markscheel @nilsdeppe @wthrowe

Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

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

LGTM

@kidder kidder merged commit 2ca7bd7 into sxs-collaboration:develop Dec 16, 2022
@nilsvu nilsvu deleted the fix_block_logical_coords branch December 16, 2022 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants