GSI Helmholtzzentrum fr Schwerionenforschung Gmb H Optimization methods
GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Optimization methods with py. ORBIT Dr. Sabrina Appel, Accelerator Physics Department, GSI, Darmstadt GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics GSI Helmholtz 14 Centre for Heavy Ion Research Juni 2021 1
Outline § Optimization § Pattern Search Methods § Evolutionary algorithm § Example optimization problem: Multi-Turn Injection Y Septum X § py. ORBIT § General § TEAPOT § Implementation RB RB GSI Helmholtzzentrum für Schwerionenforschung Gmb. H QF QD QF … Sabrina Appel | Accelerator Physics 14 Juni 2021 2
Reasons to use py. ORBIT (GSI/FAIR) OPEN SOURCE + TOP LANGUGAGES Space charge solver ü Longitudinal space charge ü 2/2. 5 space charge ü 3 D space charge q Frozen space charge (Only to PTC) IEEE spectrum ranging (2015) Injection optimization ü General horizontal injection model ü SIS 18 injection model ü Dual rf q Tune variation (to input file) Magnet validation, loss studies, bunch compression ü Error model ü Info of distorted orbit ü Orbit correction Benefits from python + open source ü Space charge matching ü Wide range of optimization algorithms ü Beam parameters at each simulation steps and parameters scan are ‘easy’ possible ü I/O: Different files formats GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 3
Implementation and validation Model: Multi-turn injection Cathode MTI has to respect Liouville’s theorem: Injected beams only in free space Gain factor should be high as possible Injection loss should be low as possible 300 k. V Anode SIS 18 electrostatic injection septum Measured MTI performance in SIS 18 Emittance Injected Beam Septum ≈20 turns Orbit bumps Circulating beam Trev≈5 μs Reduction of orbit amplitude GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 4
Optimization algorithms (derivatives free) Discover by trial and error optimum settings or perform parameter scans Scan Pattern Search Methods like Powell’s method can update the directions using past search results to develop a conjugate set. 1 D optimizer with multi variables 1 D optimizer with two to four variables New approach is the use of genetic algorithms (GA) and particle swarm (PA) Darwin Finches J. Gould, Voyage of the Beagle GSI Helmholtzzentrum für Schwerionenforschung Gmb. H X. Huang, J. Corbett, J. Safranek, J. Wu, “An algorithm for online optimization of accelerators”, Nucl. Instr. Methods, A 726 (2013) 77 -83. Evolutionary algorithms can handle optimization problems with multi variables and multi optimization parameters Sabrina Appel | Accelerator Physics 14 Juni 2021 5
Machine learning (sides remarks) Supervised Learning Unsupervised Learning learn known input/ output pairs no labeled data -> infer structure Reinforcement Learning interact with the environment -> adjust behavior based on reaction GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Source: Auralee. Edelen, ICFA Workshop on ML for Particle Accelerators, SLAC, 27. 02 - 02. 03. 2018 Sabrina Appel | Accelerator Physics 14 Juni 2021 6
Pattern Search Methods and py. ORBIT Powell’s method search over conjugate directions. The method is based on the observation: Line formed by two points obtained by one-dimensional searches with different starting points directed towards the minimum The directions represented by such lines are called conjugate lines Implementation # Implementation of variable depending model GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 7
Variation of model variables in py. ORBIT Tune variation Teapot tracking with ions Optimization with space charge GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Time variation of kickers or skew quads Sabrina Appel | Accelerator Physics 14 Juni 2021 8
Evolutionary algorithms Inspired by natural evolution § § Search for solutions using techniques such as mutation, selection and crossover Evolutionary algorithms are smart parameter scans The fitness measure how good an individual is adapted (evaluated by py. ORBIT) The python package DEAP provide a wide selection of evolutionary algorithms Particle swarm algorithms Genetic algorithms Offspring New properties due to new genes Evaluate fitness GSI Helmholtzzentrum für Schwerionenforschung Gmb. H y of Me mb Global Best (social influence) ocit Vel New a Reproduction Genes are copied, combined, and mutated Inerti Selection Choice of new parents er j Parents Properties determined by genes ve ti ra lo p Ex Exploitive Swarm Member j Sabrina Appel | Accelerator Physics Personal best (personal experience) 14 Juni 2021 9
Evolutionary algorithms implementation Parallel algorithms § Implementation of genetic operators and algorithms § Use MPI to establish a master/slave model § The master performs genetic operations - Generate population, selection, crossover, mutation § The slaves evaluate fitness function for each individual - Accelerator simulation code - “Bottleneck” -> Will be called for each individual at each generation It sounds like a lot of work § Not, if you use available genetic algorithm packages for Python, Java, Matlab, … § And decouple the evolutionary algorithm from accelerator simulation code MPI/Server manger GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Evolutionary algorithm n * m-times Sabrina Appel | Accelerator Physics Code py. ORBIT, Elegant 14 Juni 2021 10
Evolutionary algorithms and py. ORBIT Scoop: Distribution over machines and nodes py. ORBIT DEAP: Evolutionary computation framework # Implementation of variable depending model GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 11
WAIT! Some aspects has to be taken into account § Fast optimization: § Simple model as possible including low or no i/o § Fast tracking Hor. normalized angle § Careful validation of simulation model is necessary § Most of work load Acceptance Septum Hor. normalized position § Still output information for validation must be possible § If cases for output handling GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 12
Teapot tracking and optics functions evaluation TEAPOT tracking RB RB ? QF QD QF … -> As n-Notes Compute linear optics (+ orbit) with tracking by evaluation of transport matrix TRANSPORT map is generally not symplectic. X. Huang, USPAS 2015, Lecture 2: Modeling Accelerators – Calculation of lattice functions and parameters GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 13
Teapot tracking and optics functions evaluation Compute linear optics with Tracking RB RB QF QD QF … -> As n-Notes The transfer matrix can be obtained from tracking with numerical differential 0 1 3 GSI Helmholtzzentrum für Schwerionenforschung Gmb. H … N Sabrina Appel | Accelerator Physics 14 Juni 2021 14
Implementation and validation Septum Orbit bumps py. ORBIT output No distortion outside injection region Degrees of freedom position and angle of closed orbit at septum An analytical solution is known See: C. J. Gardner, Booster technical note no. 197, 1991 GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 15
Implementation and validation MTI performance has been measured as a function injector emittance Round-to-flat transformation with EMTEX Beam line flat beam round beam Excellent agreement between simulation and measurement L. Groening et al: Phys. Rev. Lett. 113 264802 (2014), S. Appel et al: Nucl. Instrum. Methods A 866 (2017), pp. 36 -39 GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 16
Powell’s method can discover solution with low loss after around 300 iteration. Good choice of the initial values is necessary. GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 17
Optimization results (Evolutionary algorithms) Optimization of loss Genetic algorithms can improve MTI Especially for longer injection GA discovers a much better solution Optimization of loss and gain factor Dependence of gain factor on loss Loss-free injection could be found Space charge results in a similar PA front, but with different injection settings GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 18
Optimization results (Evolutionary algorithms) Optimization of loss, gain factor and beam emittance (injector) Dependence of interface parameter 12. 2 m. A allows to define a frame, in which the required beam parameter can be matched at best 14. 2 m. A 13. 2 m. A New Alvarez DTL provide requirement beam brilliance (including errors) S. Appel et al: Nucl. Instrum. Methods A 852 (2017), pp. 73 -79 GSI Helmholtzzentrum für Schwerionenforschung Gmb. H A. Rubin, Beam dynamics design of the new FAIR post-stripper linac, GSI Accelerator Seminar, 14. 05. 17 Sabrina Appel | Accelerator Physics 14 Juni 2021 19
Summary py. ORBIT o Python allow easy access to wide range of algorithms (python is the killer language) o Use of optimization algorithms is easy o Careful validation of simulation model is necessary (intensive work load) It’s your turn GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 20
Thank you for your attention GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics 14 Juni 2021 21
MTI into SIS 18: Model § Multi-objectives: - stacked current (maximize) - beam loss (minimize) - emittance output 1 -2 m § Constraints: - Position of septum - Machine acceptance - Closed orbit (bumper kick) Model in simulation code § Parameters: - Position of incoming beam at septum - Initial bump amplitude and its decreasing - Injected turns - Horizontal tune - Horizontal emittance - Skew quadrupole strength GSI Helmholtzzentrum für Schwerionenforschung Gmb. H Sabrina Appel | Accelerator Physics t 14 Juni 2021 22
Injector brilliance depending EMittance Transfer EXperiment (EMTEX) Gain factor Re-partitioning of beam emittances increase efficiency Beam flatness amount is controlled by solenoid field Twiss-parameters are preserved Emittance EMTEX Beam line L. Groening: Phys. Rev. ST Accel. Beams 14 064201 (2011) C. Xiao et al: Phys. Rev. ST Accel. Beams 16 044201 (2013) GSI Helmholtzzentrum für Schwerionenforschung Gmb. H L. Groening et al: Phys. Rev. Lett. 113 264802 (2014) S. Appel et al: Nucl. Instrum. Methods A 866 (2017), pp. 36 -39 Sabrina Appel | Accelerator Physics 14 Juni 2021 23
- Slides: 23