ericagol / NbodyGradient.jl

N-body integrator computes derivatives with respect to initial conditions for TTVs, RV, Photodynamics & more
MIT License
20 stars 9 forks source link

Problem if there are multiple transits in one timestep #90

Open ericagol opened 1 year ago

ericagol commented 1 year ago

I think that the state needs to be reset if a transit is found before a transit is checked to have occurred for the next body. I think at the end of findtransit! the state will be at the time of transit. Then, when gi is computed for the next body on line 13 of timing.jl, it will be using the state at the time of transit of the prior body, not at the current time step:

https://github.com/ericagol/NbodyGradient.jl/blob/85631d64cd22125820474fc9acd8f6da2f29c78f/src/transits/timing.jl#L11-L27

So, I think that this could be fixed by simply moving line 27 to just inside the for loop, just before end on line 26.

ericagol commented 1 year ago

@langfzac I'm still unclear on whether this is an issue, however, since there are enough transit times for TRAPPIST-1 that you would think at least one transit might have been missed if this is a real bug....