Skip to content

Comments

Issue #12 Fix#14

Open
ZackaryHoyt wants to merge 2 commits intokavan010:mainfrom
ZackaryHoyt:main
Open

Issue #12 Fix#14
ZackaryHoyt wants to merge 2 commits intokavan010:mainfrom
ZackaryHoyt:main

Conversation

@ZackaryHoyt
Copy link

@ZackaryHoyt ZackaryHoyt commented Aug 12, 2025

This pull request addresses issue #12 (comment), which patches the 2d handling of the null geodesic for when rays get too close to the Schwarzschild Radius and step beyond it through the RK4 update method.

The updated rk4 step method checks the resulting rays computed after each geodesic step for moving beyond r_s. If a ray is found to be beyond r_s, then the rk4 will stop early and update the ray without computing any of the other geodesic steps. This is largely due to the null geodesic being undefined here for r<=r_s, so subsequent steps cannot actually be accurately computed.

@ZackaryHoyt
Copy link
Author

ZackaryHoyt commented Aug 13, 2025

If the first step in the rk4 update fails then the fallback method is the Euler's method, which is somewhat ironic since the rk4 was originally used to replace the Euler's method for its inaccuracies. But I think it's appropriate here because, in addition to the reasons above, it increases the overall fidelity (no potential undefined behaviors) and safely handles the issue (no floating point overflows).

The one other alternative, and what I initially selected to do, would be to clamp the ray's radius r to r_s if the result does move it beyond r_s. I chose the partial rk4 update, as it would require a second check to see if the ray did in fact move beyond r_s and I did not know the best way to set the other values, such as dr if did so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant