Skip to content

RK4 Permits Rays beyond the Schwarzschild Radius #12

@ZackaryHoyt

Description

@ZackaryHoyt

As the rays approach the Schwarzschild Radius, there is a computational issue in the null geodesic functions that result in unexpected behaviors. This was observed in the "2D_lensing.cpp" code, but I'm seeing the same math in the other implementations of the null geodesic function.

The equation f = 1 - r_s / r can go to below 0 even though rays with r<=r_s are skipped, as during the rk4 loop subsequent rays can then go beyond r_s. This can result in some imprecise behaviors, causing either large leaps in the radius (beyond what the rays should be experiencing) and even overflow for some extreme cases as shown in the attached screenshot.

Image

I found a few solutions to limit the impact, such as introducing a floor to f at 1e-64, but there are still some rays that persistently cause issues afterwards (I tried lower the floor as much as to 1e-256 without further improvements).

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions