Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/AdePT/magneticfield/fieldPropagatorRungeKutta.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ inline __host__ __device__ double fieldPropagatorRungeKutta<Field_t, RkDriver_t,
if (!continueIteration) {
// Let's move to the other side of this boundary -- this side we cannot progress !!
move = Navigator_t::kBoundaryPush; // curvedStep
position += move * chordDir;
Copy link
Contributor

@agheata agheata Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure about this: it introduces a semantics change after crossing the boundary; instead of leaving the point on the boundary, it will slightly push it, which may have adverse effects in case of back-scattering. On the other hand, you are right that the stepDone is updated with the move, which makes it inconsistent. I wonder if we should rather not readjust stepDone with this tiny move.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of back scattering, it should never reach that part because of this:

      if (move <= kDistCheckPush) {
#if ADEPT_DEBUG_TRACK > 0
        if (verbose) {
          printf("| BACK-SCATTERING or WRONG RELOCATION detected hitting ");
          next_state.Print();
        }
#endif
        zero_first_step = true;
        return 0.;

But of course I am open to just delete the entire block with

if (!continueIteration) {

because if it doesn't update the position, it doesn't do anything useful. Then we don't even need the continueIteration
either anymore... So definitely in the current state it doesn't do anything useful, we should see how to resolve it, this would be only a quick fix to make it consistent, not to address the whole problem.

It is not super urgent, it doesn't fix stuck tracks, but this should be reviewed and fixed

}
#if ADEPT_DEBUG_TRACK > 0
if (verbose)
Expand All @@ -302,7 +303,7 @@ inline __host__ __device__ double fieldPropagatorRungeKutta<Field_t, RkDriver_t,
// move = fraction * safeArc; // curvedStep
#ifndef ENDPOINT_ON_CURVE
// Primitive approximation of end direction and linearStep to the crossing point ...
position = position + move * chordDir; // linearStep
position += move * chordDir; // linearStep
direction = direction * (1.0 - fraction) + endDirection * fraction;
direction = direction.Unit();
momentumVec = momentumMag * direction;
Expand Down