Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zero-strength quad case = drift. #730

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Oct 9, 2024

A thick quadrupole with zero focusing strength requires special treatment in the limit k=0, and the element should be equivalent to a drift of the same length.

  • update Quad.H
  • update ChrQuad.H

// nothing to do for zero focusing strength
// advance position and momentum (zero strength = drift)
xout = x + slice_ds * px;
// pxout = px;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
xout = x + slice_ds * px;
// pxout = px;
yout = y + slice_ds * py;
// pyout = py;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
yout = y + slice_ds * py;
// pyout = py;
tout = t + (slice_ds/betgam2) * pt;
// ptout = pt;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@cemitch99 cemitch99 requested a review from ax3l October 9, 2024 21:48
} else {
// advance transverse position and momentum (zero focusing strength = drift)
x = xout + slice_ds * px / delta1;
// pxout = px;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
x = xout + slice_ds * px / delta1;
// pxout = px;
y = yout + slice_ds * py / delta1;
// pyout = py;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
term = (-1_prt+bet*pt)*term;
term = term/(2_prt * std::pow(bet,3) * std::pow(gam,2));
t = tout - slice_ds * (1_prt / bet + term /std::pow(delta1, 3));
// ptout = pt;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
-(std::pow(p1,2) + std::pow(p2,2))*slice_ds - (std::pow(q1,2)-pow(q2,2)) * std::pow(w,2)*slice_ds);
t = t0 + (-1_prt+bet*pt)/(8_prt*bet * std::pow(delta1,3)*omega)
*(term1+term2+term3+term4+term5);
// ptout = pt;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@ax3l ax3l self-assigned this Oct 9, 2024
@ax3l ax3l added the component: elements Elements/external fields label Oct 9, 2024
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

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

Thank you!

From a performance perspective, keeping element code small (register usage) would be another possibility by changing under the hood user-specified quads that have no field strengths to drift elements in lattices.

@ax3l ax3l merged commit 08172bf into ECP-WarpX:development Oct 10, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: elements Elements/external fields
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants