-
Notifications
You must be signed in to change notification settings - Fork 55
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
DVGeoMulti test fix #199
DVGeoMulti test fix #199
Conversation
Codecov Report
@@ Coverage Diff @@
## main #199 +/- ##
==========================================
- Coverage 64.86% 64.86% -0.01%
==========================================
Files 47 47
Lines 11945 11944 -1
==========================================
- Hits 7748 7747 -1
Misses 4197 4197
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. @anilyil are these tests trained on |
pygeo/parameterization/DVGeoMulti.py
Outdated
@@ -1508,8 +1508,8 @@ def update(self, ptSetName, delta): | |||
# Compute denominators for the integral evaluations | |||
# Add an epsilon so that these terms never become zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but maybe this comment should also be updated slightly now that we use min?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the comment. Please check if the new version makes sense. I also moved the definition of eps to the init so that it is defined once to be consistent between the analysis and derivative routines. Previously it was defined in two places which could have caused some issues if someone forgot to change one of them.
@eirikurj, as we discussed in our call, the updated reference is trained with the public:u22-gcc-ompi-latest image, with x86 platform, running under emulation on my ARM based mac. This should not cause issues because the same x86 image running on my mac was passing the tests that were failing on the arm image. The changes in this PR removes the discrepancy from the two platforms so they both pass now. |
Purpose
The inverse distance warping math in DVGeoMulti uses a small number "eps" to prevent some denominators from being zero or getting a wrong sign. Previously, this clipping was not done in a good way, and the eps value was selected to be too small. See the diff in this PR for the relevant code in DVGeoMulti.
In this PR, I changed the clipping to more accurately represent the computational goal, increased eps from 1e-50 to 1e-20, and retrained the tests.
This is done to address the issue discussed in this PR: #195
This tolerance issue is coming up on this test because some test points are defined to be exactly on the intersection curve. This is a worst-case scenario in terms of numerical accuracy and this is what the eps-based clipping was trying to prevent. Real cases with intersection curves that are not straight are very unlikely to get CFD mesh points that are exactly on the curve. As a result, this change should not affect any real life application.
Increasing eps is the main mechanism that fixes this issue for the worst-case test point. However, while I was at it, I also fixed the clipping math so that its more accurate.
Finally, with the eps value of 1e-50, the ARM and X86 architectures were getting very different answers because of the numerical instability in the algorithm. Slight changes in the updated point coordinates were causing large changes in derivatives as expected. The increased eps value fixes these and the updated points are now consistent to around 10 digits instead of 4-5 with the original eps value.
Expected time until merged
1-2 days
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable