Skip to content

Feature: Implement NonlinearKicker element#745

Open
senyue-hub wants to merge 3 commits intoxsuite:mainfrom
senyue-hub:feature/nonlinear-kicker
Open

Feature: Implement NonlinearKicker element#745
senyue-hub wants to merge 3 commits intoxsuite:mainfrom
senyue-hub:feature/nonlinear-kicker

Conversation

@senyue-hub
Copy link
Copy Markdown

Description

This PR adds a new beam element NonlinearKicker for beam injection studies. It is based on the existing Wire element logic.

Key Features:

  1. Vectorized Calculation: Allows simulating multiple wire sources in a single element

  2. C Implementation: Core logic implemented in C with an optimized loop over wires, including singularity protection for numerical stability.

  3. Validation: Verified against a reference sequence of standard xt.Wire elements in tests/test_nonlinearkicker.py.

  4. Cross-Context: Compatibility (CPU/GPU) has been verified using xobjects test helpers.

Note on Physics Consistency: I noticed a potential discrepancy between the current Wire element code and the Physics Guide. It appears that the current implementation does not account for the wire tilt effect on the B field. I have kept the NonlinearKicker logic consistent with the existing Wire element for now to ensure a direct benchmark, but this might be worth investigating in a future update.

Checklist

Mandatory:

  • I have added tests to cover my changes
  • All the tests are passing, including my new ones
  • I described my changes in this PR description

Optional:

  • The code I wrote follows good style practices (Verified with black)
  • I have updated the docs in relation to my changes, if applicable
  • I have tested also GPU contexts

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