-
Notifications
You must be signed in to change notification settings - Fork 38
Modular computation of diffusion matrices #742
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
Conversation
80f7ae0 to
8d9ca6b
Compare
|
The processing of the diffusion matrix requires two things:
So there is a significant work to provide the “exact” bends. ON the other hand I think that all ingredients are there for the wiggler. |
|
As it is now, this is already better than the present computation: one could redirect the missing (non-upgraded) passmethods to The hard-coded list avoids that, but it has to be maintained… If you think of another way, let us know. If this is solved, one could think of merging this as it is, or with the |
|
This study revealed three problems with the present implementation:
I propose to open another pull request to solve points 1 and 3: it will allow vertical bends and make comparisons straightforward. What's your opinion on that? |
|
Hello @lfarv, I think we discussed this and came to a conclusion on the strategy did you update the code to switch passmethods when necessary? |
10a4316 to
f6c8ebb
Compare
9888d3e to
b43dd7d
Compare
|
@ZeusMarti, @joanarenillas
|
|
Hi @lfarv , I'll try to help though I'm not sure I understand all the details.
Regarding the tests I can think about some possibilities:
Not sure if any of this sounds interesting to you, I should be able to help but our MAC is in too weeks so I could really start looking into after Nov 12... |
91ac0b1 to
6fe822f
Compare
|
Hi all, This branch is now ready. To summarise:
|
|
The number of modified files is very large. Here is a summary of the modifications:
Concerning the wigglers, I keep the modification discussed above for the propagation of the diffusion matrix (differing from FDW.c). This has to be validated. |
d7c6c4a to
1cab607
Compare
@lfarv I think you found the function I was looking for the last months but was unable to find because I was going through the diffussion matrices and not the tracking. I agree this is an error. For me I think that Apart from this issue in the transverse plane, there might be discrepancy in the longitudinal plane due to the difference between |
|
@oscarxblanco: thanks for your analysis. As it is now, in this branch While you are on it, I have another concern: when computing the radiation kick ( /* B^2 in T^2 */
B2 = (Bxy[0]*Bxy[0]) + (Bxy[1]*Bxy[1]);
...
/* Beam rigidity in T*m */
H = 1.0e9 * pWig->Po * __E0 / C0;
/* 1/rho^2 */
irho2 = B2/(H*H);
...
/* Classical radiation loss */
dDelta = -(pWig->srCoef)*dFactor*irho2*dl;Normally, one should use the field component perpendicular to the trajectory, as it is done in other RadPass methods (ex. B2P = B2perp(ImSum, ReSum, x, xpr, y, ypr);
...
/* Momentum loss */
r6[4] -= rad_const * B2P * factor;where This should not make a big difference, but maybe one should do it ? |
@lfarv right, I agree with you. One should calculate the B field perpendicular to the particle trajectory. I cannot yet find it anywhere for the wiggler, this implementation assumes the particle is parallel to the longitudinal axis. |
|
Hi @lfarv and @oscarxblanco , I'm not sure this is exactly what you meant but I remember Joan implemented something similar: see commit before merge: Line 607 in 57f9003
I remember removing this new formula because we could not make the Runge-Kutta precise enough to validate such an small effect (not even for an unrealistic 30T 1m ID). The same argument can be used to actually include it so, as you prefer! Cheers, |
|
Dear @ZeusMarti , do you remember what were the longitudinal harmonics you tested ? In AT matlab it is called B5 on the |
|
Dear @ZeusMarti and @lfarv , I have checked the function
|
|
Thanks @oscarxblanco , Sorry guys, I should have checked Joan's work more thoughtfully... |
|
Dear @lfarv, how would you like to proceed ? I have just talked with @ZeusMarti , and @ZeusMarti and me still miss to answer your second question.
|
|
Concerning "question 2", it is not specific to wiggler, it's just about the proper way of cumulating and propagating diffusion matrices. I am still convinced that the modified version is correct, and I would keep for the moment. For the rest: this version is exactly as merged by @joanarenillas in #759 (which does not include the For this one, coming back to the topic of "Modular computation of diffusion matrices", I would like to have feedback from @swhite2401, @simoneliuzzo, @carmignani and others. As long as the PR is not approved, improvements on GWigSymplecticRadPass are of course still welcome! |
|
I just created #860 to continue the work on wiggler radiation, and I would like to merge this one. So please @swhite2401, @carmignani, @simoneliuzzo, @oscarxblanco, give you comments or approval so that we can go on… |




While the tracking in AT is modular (pass methods may be modified or added easily), the computation of the diffusion matrices used in
ohmi_envelopeis centralised and difficult to maintain.The computation is done in
findmpoleraddiffmatrix.cfor all magnets, straight or curved. Wigglers are ignored. This C function combines the tracking and the computation of diffusion matrices and is based onBnd/StrMPoleSymplectic4RadPass.This PR is a proof of concept where the computation of diffusion matrices is included as optional in each
*RadPasspassmethod. This allows the computation to be consistent for each tracking variant, and has the following main advantages:Bnd/StrMPoleSymplectic4RadPass(on-axis, all methods should be equivalent).As an example, in this branch, the following passmethods include the computation of the diffusion matrix:
BndMPoleSymplectic4RadPass,StrMPoleSymplectic4RadPass(with strictly identical results as before) andExactMultipoleRadPass(with a slightly different result for large off-momentum). A new C functiondiffusion_matrix.cis added to replacefindmpoleraddiffmatrix.cusing the new pass methods while keeping a similar interface.ohmi_envelopeis modified to call this new function, with a test mode allowing to switch easily betweenfindmpoleraddiffmatrix.canddiffusion_matrix.c.This approach will require all
*RadPassmethods to be modified, which is a significant task. As it is now, a non-modified method generates a zero contribution to the diffusion (but still propagates correctly the cumulated matrix): as if the element does not contribute to the emittance.This PR is open to discuss the potential of this method and identify the difficulties before going further on. It follows the discussion in #715 and integrates the proposal of @carmignani (#715 (comment)) which makes the transition easier.