1 response matrix
play

1 Response Matrix Analytical Implementation of TwissResponse - PowerPoint PPT Presentation

1 Response Matrix Analytical Implementation of TwissResponse Joschua Dilly VIA at CERN 2 Analytical Formulas Implementation Testing Setup Response Comparison MAD-X Comparison Conclusions Response Matrix - Analytical Implementation of


  1. 1

  2. Response Matrix Analytical Implementation of TwissResponse Joschua Dilly VIA at CERN 2

  3. Analytical Formulas Implementation Testing Setup Response Comparison MAD-X Comparison Conclusions Response Matrix - Analytical Implementation of TwissResponse 3 J. Dilly

  4. Analytical Formulas Implementation Testing Setup Response Comparison MAD-X Comparison Conclusions Response Matrix - Analytical Implementation of TwissResponse 4 J. Dilly

  5. Phase Advances ΔΦ z , wj = ( Φ z , j − Φ z , w ) , if Φ z , j > Φ z , w ΔΦ z , wj = ( Φ z , j − Φ z , w ) + 2 π Q z , if Φ z , j <= Φ z , w τ z , wj = Δ Φ z , wj − π Q z Π wj = s w < s j Response Matrix - Analytical Implementation of TwissResponse 5 J. Dilly

  6. Advances ∝ δ K 1 β z , m δ Q z = ± δ K 1, m ∑ 4 π m β z , m cos (2 τ z , mj ) δβ z , j = ∓ β z , j ∑ δ K 1, m × 2 sin (2 π Q z ) m β z , m δ Φ z , wj = ± δ K 1, m × ∑ 4 m sin (2 τ z , mj ) − sin (2 τ z , mw ) { 2 [ Π mj − Π mw + Π jw ] + } sin (2 π Q z ) Hints: • : plane or z x y • : elements of interest j • : magnets contibuting to K m δ • : in our case w ≡ j − 1 Response Matrix - Analytical Implementation of TwissResponse 6 J. Dilly

  7. Dispersion Advances ‾ ‾ ‾‾ β x , m cos ( τ x , mj ) √ δ D x , j = + β x , j ‾ ‾ ‾ δ K 0, m × √ ∑ 2 sin ( π Q x ) m ‾ ‾ ‾‾ β x , m cos ( τ x , mj ) √ + β x , j ‾ ‾ ‾ δ K 1 S , m D y , m × √ ∑ 2 sin ( π Q x ) m ‾ ‾ β y , m ‾‾ cos ( τ y , mj ) √ δ D y , j = − β y , j ‾ ‾ ‾ δ K 0 S , m × √ ∑ 2 sin ( π Q y ) m ‾ ‾ ‾‾ β y , m cos ( τ y , mj ) √ + β y , j ‾ ‾ ‾ δ K 1 S , m D x , m × √ ∑ 2 sin ( π Q y ) m Hints: • : plane or z x y • : elements of interest j • : magnets contibuting to K m δ Response Matrix - Analytical Implementation of TwissResponse 7 J. Dilly

  8. Analytical Formulas Implementation Testing Setup Response Comparison MAD-X Comparison Conclusions Response Matrix - Analytical Implementation of TwissResponse 8 J. Dilly

  9. TwissResponse Class twiss = TwissResponse(path_sequence, path_model, path_variables, exclude_categories) where: • path_sequence : madx-sequence file, e.g. saved from madx by save, sequence=lhcb1, file=lhcb1_full.seq; • path_model : tfs model file, e.g. saved from madx by twiss, sequence=lhcb1, file=twiss_lhcb1.dat; • path_variables : .json file, containing the different madx-variables that will be used. The variables are assumed to be in categories (or at least one category). An easy way to create such a file can be found in twiss_optics/sequence_parser.py: sequence_parser.varpmap_variables_to_json(path_sequence) • exclude_categories : Categories of the json file, that will not be used. Response Matrix - Analytical Implementation of TwissResponse 9 J. Dilly

  10. TwissResponse Class • Generates response matrices for beta , dispersion , phase and tune . • Via analytical formulas from previous section. • A mapping is a applied: From the MadX-variables to the actual magnets , hence the return is not a response of but . δ K δ Var • Response is returned via getter-functions of class-object: twiss.get_beta() • Return of the K response via: δ twiss.get_beta(mapped=False) Returns dictionaries with X and Y entries, containing the response matrices as dataframes. (In case of dispersion there are: X_K0L , X_K1SL , Y_K0SL , Y_K1SL entries) • Imitating behavoiur of response_pandas.py also possible: twiss.get_fullresponse() Returns a dictionary with BETX , BETY , MUX , MUY , DX , DY and Q dataframes. Response Matrix - Analytical Implementation of TwissResponse 10 J. Dilly

  11. Hints • Generating the response matrices takes a few seconds, but is about 4 times faster than MadX (on my setup 30s analytical vs 130s MadX). • TwissResponse is not parallelized (as is MadX), so maybe some tuning is possible (e.g. parallel calculation for the different beam parameters.) Yet: Half of the time is dedicated to phase advance response calculation. • To perform matrix multiplication for all paramters automatically, M resp ⋅ δ K use from twiss_optics/response_class.py : fullresponse = twiss.get_fullresponse() response_class.get_delta(fullresponse, delta_k) Response Matrix - Analytical Implementation of TwissResponse 11 J. Dilly

  12. Sequence parsing assumptions: • Magnets defined as "mb" are characterized by their bending radius and are hence immutable ! • Sequence is saved in a way, that magnets definitions contain 'knl:={}', 'ksl:={}' or 'K#:=' . • There is only one value in each knl/ksl array . • Zero-offset , i.e. no fixed number summation (e.g. no 'magnet := 2 + kq.xxx').* • linearity , i.e. variables do not multiply with each other (will result in zeros).* • the variable-name is final (i.e. it is not reassigned by ':=' somewhere else). • the variable-name does not start with "l." (reserved for length multiplier). • the length multiplier is given by l.<magnettype>. • apart from the length, there are no other named multipliers (numbers are fine). • If a magnet is redefined, last definition is used. * this is due to the way the mapping is found. All variables apart from one are set to zero, and then the magnet values are checked. It is of course possible to implement it in a different, way e.g. with multiple values for the variables. Response Matrix - Analytical Implementation of TwissResponse 12 J. Dilly

  13. Analytical Formulas Implementation Testing Setup Response Comparison MAD-X Comparison Conclusions Response Matrix - Analytical Implementation of TwissResponse 13 J. Dilly

  14. Error Function The physical parameter-functions can be arbitrarily close to zero, e.g. dispersion: 3 twiss results madx results 2 Dispersion X [m] 1 0 −1 −2 −3 0 5000 10,000 15,000 20,000 25,000 Position [m] Response Matrix - Analytical Implementation of TwissResponse 14 J. Dilly

  15. Error Function Hence, the relative error between two different calculation methods, can be arbitrarily large: A solution can be to use a "normalized" error instead: 4 error relative error mean-normalized 2 0 −2 Error −4 −6 −8 −10 −12 0 5000 10,000 15,000 20,000 25,000 Position [m] Response Matrix - Analytical Implementation of TwissResponse 15 J. Dilly Processing math: 100%

  16. Gathering Statistics • 25x: Pick 1(="single") or 10(="multi") variables at random from list (e.g. "K1L"). • 5x: Change variable strength(s) by "gaussian w/ cutoff" distributed around , i.e. 10 λ ± ϵ for . 10 λ 10 λ ϵ ∈ [.4 ⋅ , 1.6 ⋅ ] • 12x: Increase stepwise: λ λ ∈ [ − 6 : .5 : 0) • At each step: Calculate the via twiss response , madx response and δ ( D / β / ΔΦ / Q ) madx directly. ⇒ • Calculate RMS-Error of the statistics. • Average over the different variable sets. Min/Max define error-bars. • Plot over λ Response Matrix - Analytical Implementation of TwissResponse 16 J. Dilly

  17. Analytical Formulas Implementation Testing Setup Response Comparison MAD-X Comparison Conclusions Response Matrix - Analytical Implementation of TwissResponse 17 J. Dilly

  18. Comparison Analytical- and Mad-X Response Matrices Response Matrix - Analytical Implementation of TwissResponse 18 J. Dilly

  19. Single Variable Change δ K 1 L 2 10 BETX BETY 10 DX 1 DY MUX −1 10 MUY RMS Error QX −2 10 QY −3 10 −4 10 −5 10 −6 10 −7 10 −6 −5 −4 −3 −2 −1 Approximate log(10) of δK • BET-Y shows the most differences between results (max ~5% RMS) • Still all results in agreement with each other. Response Matrix - Analytical Implementation of TwissResponse 19 J. Dilly

  20. Multi Variable Change δ K 1 L 2 10 BETX BETY 10 DX 1 DY MUX −1 10 MUY RMS Error QX −2 10 QY −3 10 −4 10 −5 10 −6 10 −7 10 −6 −5 −4 −3 −2 −1 Approximate log(10) of δK • Tunes show wider spread, disagreement up to 40% RMS • Other parameters in agreement Response Matrix - Analytical Implementation of TwissResponse 20 J. Dilly

  21. Single Variable Change δ K 0 L 2 10 BETX BETY 10 DX 1 DY MUX −1 10 MUY RMS Error QX −2 10 QY −3 10 −4 10 −5 10 −6 10 −7 10 −6 −5 −4 −3 −2 −1 Approximate log(10) of δK • DX values agree with each other Response Matrix - Analytical Implementation of TwissResponse 21 J. Dilly

  22. Multi Variable Change δ K 0 L 2 10 BETX BETY 10 DX 1 DY MUX −1 10 MUY RMS Error QX −2 10 QY −3 10 −4 10 −5 10 −6 10 −7 10 −6 −5 −4 −3 −2 −1 Approximate log(10) of δK • Wider spread compared to single- test, but still good agreement of DX δ K Response Matrix - Analytical Implementation of TwissResponse 22 J. Dilly

  23. Single Variable Change δ K 1 SL 2 10 BETX BETY 10 DX 1 DY MUX −1 10 MUY RMS Error QX −2 10 QY −3 10 −4 10 −5 10 −6 10 −7 10 −6 −5 −4 −3 −2 −1 Approximate log(10) of δK • DY results are in full agreement Response Matrix - Analytical Implementation of TwissResponse 23 J. Dilly

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend