-
Notifications
You must be signed in to change notification settings - Fork 7
Check CGAL wall intersection at microstep intervals #319
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
Conversation
eb52990 to
035ecec
Compare
CGAL 5.6.1 has template issues with GCC 15 in boost/graph/iterator.h. CGAL 6.0.1 fixes these compatibility issues.
The previous implementation checked wall intersection only once per macrostep. With a logarithmic macrostep time grid, late macrosteps become very large and particles can skip over wall intersections. This change adds macrostep_with_wall_check() which checks the STL wall intersection at every microstep of the integrator when wall is enabled. This ensures accurate wall intersection detection regardless of macrostep size. Also update CGAL from 5.6.1 to 6.0.1 for GCC 15 compatibility.
035ecec to
2da4031
Compare
ⓘ Your approaching your monthly quota for Qodo. Upgrade your plan PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
ⓘ Your approaching your monthly quota for Qodo. Upgrade your plan PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||
User description
Summary
macrostep_with_wall_check()subroutine that checks STL wall intersection at intervals within macrosteps (every 32 microsteps or at macrostep end for small macrosteps)Depends on: #320 (CGAL 6.0.1 update)
Motivation
With logarithmic macrostep time grid, late macrosteps become very large. The previous implementation checked wall intersection only once per macrostep, which could potentially miss intersections during large steps.
The new implementation checks at regular intervals within macrosteps to ensure accurate wall hit detection regardless of macrostep size.
Test plan
Notes
Testing showed that for prompt losses (<1ms), the microstep checking gives identical results to macrostep-only checking. This confirms the original implementation was correct for early losses. The microstep checking adds ~2x overhead but provides additional safety for long runs with large macrosteps.
PR Type
Enhancement, Bug fix
Description
Add
macrostep_with_wall_check()for periodic wall intersection checksRefactor
trace_orbit()to use wall-aware macrostep routineUpdate CGAL dependency from 5.6.1 to 6.0.1
Diagram Walkthrough
flowchart LR A["trace_orbit loop"] --> B{"wall_enabled?"} B -->|Yes| C["macrostep_with_wall_check"] B -->|No| D["macrostep"] C --> E["Check wall every 32 microsteps"] E --> F["Detect intersection early"] D --> G["Single macrostep check"] F --> H["Exit with ierr_orbit=77"] G --> HFile Walkthrough
simple_main.f90
Implement microstep-level wall intersection checkingsrc/simple_main.f90
macrostep()subroutine from inline code for reusabilitymacrostep_with_wall_check()subroutine with periodic wallchecking logic
trace_orbit()to conditionally call wall-aware or standardmacrostep
u_ref_cur,x_cur,x_hit, etc.) fromtrace_orbit()CMakeLists.txt
Upgrade CGAL to version 6.0.1CMakeLists.txt