Beta Beating Correction in presence of errors

Moderators: cyao, michael_borland

Post Reply
SDastan
Posts: 34
Joined: 21 May 2018, 07:08

Beta Beating Correction in presence of errors

Post by SDastan » 30 Jun 2022, 06:19

Dear all,

I am doing optimization for the Elettra 2.0 lattice with MOGA in Elegant. I need to do beta beating correction after optimization and apply errors to compare the result with AT. I know there is a simplex method that matches the ref twiss function of bare lattice to perturbed ones, but it doesn't show a good result to me. I mean it reached %8 and %12 in both planes and does not show a good result for dispersion function at all. Does anybody have any experience to correct beta beating in Elegant?

Regards,
Sara
Sara

sajaev
Posts: 4
Joined: 11 Jun 2008, 11:58

Re: Beta Beating Correction in presence of errors

Post by sajaev » 06 Jul 2022, 09:37

Dear Sara,

We do not use Elegant itself for beta beating correction. We use an external script that works much like orbit correction. First, it calculates beta function response matrix with respect to quadrupoles. The beta function response matrix is constructed this way: every column is a change due to a single quadrupole in horizontal beta function, vertical beta function, and horizontal dispersion. Then the quadrupole corrections are calculated by multiplying the pseudoinverse beta function response matrix with the vector of beta function errors (constructed the same way as the matrix columns). The achievable accuracy could be well below 1%, but depends on the number of singular values used for matrix inversion.

Vadim

michael_borland
Posts: 1796
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Beta Beating Correction in presence of errors

Post by michael_borland » 06 Jul 2022, 16:37

Sara,

The SR LOCO Response Matrix Fitting, at the bottom of our software page, might be a good starting point.

--Michael

SDastan
Posts: 34
Joined: 21 May 2018, 07:08

Re: Beta Beating Correction in presence of errors

Post by SDastan » 07 Sep 2022, 06:40

Dear all,

I used Elegant for beta beating and coupling correction in the presence of errors with the wonderful and great support of Vadim Sajaev and I think It could be helpful for others so I share the process and steps here. The method is precious and much faster than the simplex method. I try to explain it by all the details, so I did as below:

1. Get the "SR LOCO Response Matrix Fitting" APS website.

2. Copy all the command files in the SRLOCOFitting to the bin of your Elegant or alternatively add the parent folder of these files to the PATH environment variable using your own preferred method, e.g. from CalculateLOCOFit to SRLOCOFitting.

3. Add these lines to the .bashrc or run it in the terminal that you want to use srlocofitting:

Code: Select all

export LOCO_BINDIR=path_to_where_you_placed_CalculateLOCOFit_and_other_command_files
export LOCO_CONFDIR=path_to_where_you_placed_SRLOCOFitting/SRLOCOFitting/work
4. Now the system is prepared for LOCOFitting to do beta and coupling correction, so get the files from the attachment.

5. Copy the "calculateTwissCorrection" file in the attachment to the Elegant bin.

Now, You can do the correction with the attached files, each file can be explained as below:

calculateTwissCorrection -- correction program
converted.lte -- the lte file
elements.sdds -- list of elements to use by correction program for correction created by step 2 in running procedure.
elettra.ele -- the closed orbit correction in the presence of errors
errors.param -- the error files
fittingProcedures.tcl -- required file for calculateTwissCorrection
makeElementListFile -- short script to create elements.sdds file
result.beta.param -- quadrupole corrections calculated by the correction program created by step 3 in the running procedure.
result.coupling.param -- contains skew quadrupole corrections created by step 4 in the running procedure.
runCorrection -- short script to run calculateTwissCorrection
/tmp -- subdirectory with results of the correction calculations created during the correction.

For running the correction, do as below:

1. elegant elettra.ele
2. ./makeElementListFile -listFile elements.sdds
3. Beta function correction: ./runCorrection -workDir `pwd` -correctionMode beta -measLatticeParamFile step3.param -outputFile result.beta.param
4. Coupling correction: ./runCorrection -workDir `pwd` -correctionMode coupling -measLatticeParamFile "step3.param result.beta.param" -outputFile result.coupling.param

The corrected lattice is presented by three files: "step3.param result.beta.param result.coupling.param". I should mention that I worked in ubuntu with Elegant version of 2021.4.0.

I hope you find it helpful.

Regards,
Sara
Attachments
Beta_Couling_Correction.zip
(278 KiB) Downloaded 4 times
Last edited by SDastan on 13 Oct 2022, 01:41, edited 4 times in total.
Sara

michael_borland
Posts: 1796
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Beta Beating Correction in presence of errors

Post by michael_borland » 19 Sep 2022, 13:22

Sara,

Thanks for your post!

--Michael

Post Reply