Increase numerical robustness of cylindrical and spherical distance to boundary checks#3923
Increase numerical robustness of cylindrical and spherical distance to boundary checks#3923GuySten wants to merge 3 commits intoopenmc-dev:developfrom
Conversation
|
It is not clear to my how this improves robustness. I would appreciate an explanation for what motivates these changes. I looked back at #3792 and didn't find any explanation there. There was a link to a discourse post that it was addressing, but there is a leap between the symptoms discussed in that post and the particular solution implemented there. The changes here look mostly subtle except for the substantive change on the tolerance for determining that a point is coincident with a cylindrical/spherical surface. I'd like to understand the scaling of that change and why it's the necessary/best approach. |
|
@pshriwise, wrote a nice summary of this issue: My motivation came from noticing that for small spheres, openmc falsely detect overlap for points close to the boundary (because the distance to boundary check is not robust enough). These changes fix that problem. |
|
Would be good to have a test which fails with the old OpenMC and passes with these changes. For example, a test of the overlap condition in |
Thanks for sharing that summary by @pshriwise. Two follow-ups:
|
|
Regarding your second point, the difference is that the new way is using a relative tolerance of FP_COINCIDENT in addition to an absolute tolerance of FP_COINCIDENT. Regarding your first point, I am not sure. I think the way it is done now is more "natural" but your suggestion might also work. |
| assert len(redundant_surfs) == 0 | ||
|
|
||
|
|
||
| def test_sphere_overlap(run_in_tmpdir): |
There was a problem hiding this comment.
I'm wondering if this test should use openmc.lib to actually confirm what cell it's in and what cell it thinks it's in, similar to the conditions in geometry.cpp to confirm that there is no overlap detected
Lines 44 to 52 in fd1bc26
I'm not sure if any tests actually test using
openmc -g but that could be another way to do the same thing
There was a problem hiding this comment.
I am using geometry_debug=True which is equivalent to openmc -g.
There was a problem hiding this comment.
Missed that, my bad. Looks good!
|
Some good news. My previous overlap check failed on batch 57, and I've just now made it to batch 58! The overlap checking is definitely going slower, which is to be expected due to the additional I am going to let the overlap checker keep going just to be sure. The eigenvalues seem to be within statistical noise of each other, so I'm guessing this means some point containment decisions resulted in different answers with this new change, but not enough to drastically change results. |
Description
This PR apply the same fixes that were done in #3792 to the spherical and cylindrical surfaces themselves.
Checklist
I have followed the style guidelines for Python source files (if applicable)I have made corresponding changes to the documentation (if applicable)