Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

amereghe
Copy link
Contributor

@amereghe amereghe commented Apr 17, 2019

This PR aims at foxifying e-lenses. The most difficult part was to get into the logics of fox and to foxify elenses with an electron radial profile from measurements - there, I moved from a linear interpolation to a polinomial interpolation around the point of interest of order that can be chosen by the user.

I took inspiration for the foxification of elenses from wireda, hence with a subroutine defined in the elens module called in six_fox.f90. A variable states if the elens should be considered or not in fox, defaulting to .true.; anyway, the user is free to explicitly tell SixTrack if to consider or not each elens for FOX in the fort.3 file. Anyway, the elens kick is taken into account in the FOX calculation only if the closed orbit goes through the electron distribution, i.e. the hollow part does not contribute to FOX.

The polinomial interpolation is essentially general, implemented in the utils module, and it can be used anywhere needed. I have added also an integration subroutine, trying to be more consistent with the polinomial interpolation when computing the integral of the interpolated function. Polinomial interpolation of radial elens profiles is presently set to linear, but it can be changed in the future; the user can change this setting via the fort.3.

Major changes involve:

  • elens module;
  • utils module;
  • addition of a couple of tests about the FOX part:
    1. a test verifying that the kicks considered by the FOX part are consistent with the kicks used during regular tracking;
    2. a test verifying that for a uniform, non hollow lens, the tune shift due to the elens is similar to that of a quadrupole, with the same sign on both planes.

Other minor changes:

  • introduced elens_kz, storing the type in fort.2 (i.e. 29), and elens_ktrack (i.e. 63) and used throughout the code - hence few modules have been affected (eg dynk);
  • kick from elenses moved from the include file to a subroutine coded in the elens module;
  • added a constant in numerical_constants (needed for polinomial interpolation);
  • elens tests updated;
  • increased acceptable repo size to 660k kB;

   * check it actually works
   * have a more appropriate handling of measured radial profiles - need to
     re-think interpolation...
   * implement user-interface to veto/request CO calculation with elens in...
At the same time:
   * added ldebug flag in utils, for the moment set to .true.;
   * improved some output on fort.6
   * improved use statements
@amereghe amereghe mentioned this pull request Apr 18, 2019
Copy link
Member

@vkbo vkbo left a comment

Choose a reason for hiding this comment

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

I know you're not done yet, but one of these files were open on my editor, and I just spotted a few things.

@amereghe
Copy link
Contributor Author

Hi Veronica,
thanks for the feedback. I have also this line in the CR part of elenses:

write(lout,"(a,i0)") "READERR in elens_crcheck; fileUnit = ",fileUnit
write(93,  "(a,i0)") "READERR in elens_crcheck; fileUnit = ",fileUnit

shall I replace lout by lerr?
Thanks,

@vkbo
Copy link
Member

vkbo commented Apr 24, 2019

Yes. The error messages from CR should also go to lerr, and start with SIXTRACR> ERROR. This is not done consistently throughout SixTrack, but it's good to clean up as we go.

vkbo
vkbo previously approved these changes Apr 24, 2019
@vkbo vkbo self-requested a review April 24, 2019 13:02
@vkbo vkbo dismissed their stale review April 24, 2019 13:04

Sorry, just clicking buttons ...

@amereghe
Copy link
Contributor Author

amereghe commented Nov 12, 2019

ok I think I am done with the FOX part.
@tpersson @rdemaria could you please review the code? Please ignore the test files, as I will further update them...
If the code is correct, then I will update the tests once forever and proceed with the other PRs.
Thanks!
Cheers,
A.

@amereghe
Copy link
Contributor Author

For the record - without the check that RRA is zero, you get:

                                      
ELENS> ELENS_KICK_FOX computing at XA= 0.0000000000000000E+00 - YA= 0.0000000000000000E+00
DAFUN> ERROR SQRT does not exist for vector 474 const term =  0.00000E+00
DABNEW> ERROR DAFUN 

    +++++++++++++++++++++++++++++
    +      ERROR DETECTED!      +
    + RUN TERMINATED ABNORMALLY +
    +++++++++++++++++++++++++++++

@amereghe
Copy link
Contributor Author

ok issue solved skipping the SQRT and setting RR directly to ZERO via FOX

amereghe added a commit to amereghe/SixTrack that referenced this pull request Jan 21, 2020
Canonicals and .png files are excluded.
@amereghe
Copy link
Contributor Author

Ready for merge! @rdemaria @tpersson

@amereghe amereghe changed the title WIP foxifying e-lenses foxifying e-lenses Jan 24, 2020
@amereghe
Copy link
Contributor Author

@rdemaria @tpersson could you please review this PR?
It is there since a couple of weeks ago, and it should be merged in before the other one on e-lenses...
Thanks!
Cheers,

@rdemaria
Copy link
Contributor

I am off this week, I can approve, but I have not looked in detail

@amereghe
Copy link
Contributor Author

Hi @rdemaria ,

ok. I think that the implementation is sound, as there is a specific test that verifies that for a (full) electron lens I get a detuning similar to that of a quadrupole of the same gradient, with the same sign on both Qx and Qy (contrary to the case of the quad).

@tpersson @rdemaria , shall I wait for a detailed review (it would be good, though maybe not immediate) or shall I merge straight away?

@amereghe
Copy link
Contributor Author

Hi @rdemaria ,
please find attached a new .pdf for discussion, with the correct math (the previous .pdf had some errors, sorry about it), and trying to be as short as possible. You will find a slide with the case of the regular e-lens, followed by one for the case of full e-lens and (radially) thin e-lens.

@amereghe
Copy link
Contributor Author

As agreed with @rdemaria , at r=R1 and r=R2 kick and derivatives of elens will be dictated by the corona part.
For ease of life, we merge this PR (and the following one), and the final FOX implementation will arrive soon with a clean, new PR.

@amereghe amereghe merged commit a2aaf2e into SixTrack:master Feb 20, 2020
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.

3 participants