Repository navigation
Conversation
After a reflection the particle sits on the surface, so the quadric of that surface has a root at t = 0. Round-off turned this into small positive roots (1e-9 to 1e-4 m away), and traceSingleNeutron then hit the same surface again from the outside, upon which reflectNeutronConic absorbed the neutron. This lost ~6% of the focused intensity in Test_Conics_pairs at default settings, ~25% for Paraboloid/Hyperboloid pairs, and ~half without figure error. For the surface hit in the previous step, the next collision is now computed from the exact factorisation (C = 0, other root t = -B/A) via the new getTimeOfNextCollisionConic/Flat(). traceNeutronConic/Flat() now take the collision time from traceSingleNeutron instead of recomputing it. Changes simulation results of Conics_* (more intensity). FlatSurf-based FlatEllipse_finite_mirror/NMO are unchanged in all tested configurations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #2793 (base branch
conic-followup-2787). Merge #2793 first, then retarget this PR tomain. McStas only.Problem
After a reflection, a neutron sits on the surface it just left, so that surface's quadric has a root at t = 0. Round-off in
solveQuadturned this into small positive roots 1e-9 to 1e-4 m away.traceSingleNeutronthen "hit" the same surface again from the outside, andreflectNeutronConicabsorbed the neutron (vn > 0).The bias depended strongly on the figure error. With exact normals about half of the doubly-reflected neutrons were lost, which made results sensitive to a 1 µrad figure error for no physical reason.
Fix
getTimeOfNextCollisionConic/Flat().traceNeutronConic/Flat()now receive the collision time fromtraceSingleNeutroninstead of recomputing it. Both functions are only called fromtraceSingleNeutron.tis the value that used to be recomputed.A post-reflection "nudge" was evaluated and rejected. The spurious roots extend to about 0.1 mm, so a nudge needs about 1 mm to remove all of them, and at that size it already loses genuine hits.
Results of
Conics_*change; intensities go up.Test_Conics_pairs(1e6 rays, seed 1), reflections at the focus (2 m monitor):Reference values (
%Example) change by +6% (EH/HE), +33% (PH), +0.2% (PP), and 0% for thefs=8 fi=6cases. They are updated in this PR.Tested
--seed 1, single process, McStas 3.9.2 with this branch's files.Test_NMOandTest_FlatEllipse_finite_mirror, both with default settings and with a silicon substrate (mirror_width=0.0005,mb=0andmb=4). The FlatSurf part is preventive; no FlatSurf configuration tested showed the problem.Test_Mirror_conicandTest_Mirror_FlatEllipse.WOFSANS width=0.15(PSD_10 = 3.50e9 ± 0.57e9, stored reference 4e9).-Wall -Wextra: no new warnings from conic.h.🤖 Generated with Claude Code