Linac Simulation Linac Simulation Primer Primer J.-F. Ostiguy - - PowerPoint PPT Presentation

linac simulation linac simulation primer primer
SMART_READER_LITE
LIVE PREVIEW

Linac Simulation Linac Simulation Primer Primer J.-F. Ostiguy - - PowerPoint PPT Presentation

Linac Simulation Linac Simulation Primer Primer J.-F. Ostiguy APC ostiguy@fnal.gov September 2013 Ostiguy Linac Simulation Primer - Sep 2013 Introduction This talk is not a summary of recent linac simulation work it is meant


slide-1
SLIDE 1

Ostiguy – Linac Simulation Primer - Sep 2013

Linac Simulation Linac Simulation Primer Primer

J.-F. Ostiguy APC

  • stiguy@fnal.gov

September 2013

slide-2
SLIDE 2

Ostiguy – Linac Simulation Primer - Sep 2013

Introduction

  • This talk is not a summary of recent

linac simulation work

  • it is meant to be a very brief tutorial
  • n ion linac simulations
slide-3
SLIDE 3

Ostiguy – Linac Simulation Primer - Sep 2013

Ion Linac Basics

  • A few types of cavities, optimized for

increasing velocities. More types = more efficient acceleration, but higher cost.

  • Regular periodic sections are based on a

specific cavity type

  • Sections are “matched” to each other (both

lattice functions and phase advance/length)

slide-4
SLIDE 4

Ostiguy – Linac Simulation Primer - Sep 2013

Longitudinal – Transverse Longitudinal – Transverse Coupling Coupling

  • The presence of RF defocusing

strongly couples the longitudinal to the transverse dynamics

  • Transverse focusing lenses

(solenoids, quads) have limited impact on the longitudinal dynamics.

  • the longitudinal dynamics is

addressed first.

slide-5
SLIDE 5

Ostiguy – Linac Simulation Primer - Sep 2013

Some Design Rules

  • Within a section, the transverse phase advance/cell

should not exceed 90 deg (envelope instability)

  • Longitudinal phase advance/cell should also be limited

~90 deg to avoid instability. Typically it is lower than the transverse, but not necessarily.

  • The ratio transverse/long phase advance must be chose

to avoid driving a parametric resonance.

  • phase adv/length should be a smooth, monotone function
slide-6
SLIDE 6

Ostiguy – Linac Simulation Primer - Sep 2013

Longitudinal Dynamics and Period Length

  • At low energy, the bunches are long. This favors a

low rf frequency and requires an accelerating phase phi_s far from crest.

  • RF defocusing is large (maximum at phi_ = -90),

acceleration is reduced, RF focusing (phase advance/length) is strong.

  • Conclusion: a low energy, the period must be short
  • Compact design: cavity +solenoid inside the same

cryomodule.

slide-7
SLIDE 7

Ostiguy – Linac Simulation Primer - Sep 2013

Typical Beam Envelopes

slide-8
SLIDE 8

Ostiguy – Linac Simulation Primer - Sep 2013

Typical Phase Advance Plot

slide-9
SLIDE 9

Ostiguy – Linac Simulation Primer - Sep 2013

What a Simulation Code Should Provide

  • An easy way to switch between envelope and particle tracking modes
  • Good support for optical matching, many types of constraints etc
  • Matching in envelope and/or particle mode
  • Multiple space charge solvers (based on symmetry
  • Approximations, symmetry speed up computations dramatically.
  • “Brute force”, no compromise 3D space charge is important to validate approximations, confirm the soundness of a final design,
  • r to perform “numerical experiments”
  • Solver should be able to take advantage of multiple cores if present
  • A “longitudinal only” mode
  • An interactive mode
  • A pure batch mode for large scale statistical error studies.
  • Ability to handle a wide variety of field map types
  • Ability to generate / read particle distributions
  • No arbitrary artificial hard-wired limitation on the number of particles that can be tracked. On

modern hardware > 10**6 particles is becoming routine.

  • Explicit, human readable lattice description in an easily parsable format
  • Well documented input/output formats for all files
  • Facilities to compute, plot, tabulate all quantities of interest (emittances, beam size, lattice

parameters, phase advances etc …

  • A plugin architecture to allow user to implement custom elements, distribution filters etc …
slide-10
SLIDE 10

Ostiguy – Linac Simulation Primer - Sep 2013

The Matching Problem The Matching Problem

  • In a linac it is essential for the beam envelope

(longitudinal and transverse) to be as smooth as possible (envelope modulation drives halo formation)

  • Matching between sections usually involves 6

parameters (α, β in all planes)

  • The presence of longitudinal-transverse coupling

and the nonlinearity of RF focusing makes the matching problem harder to deal with than for high energy beamlines/rings.

  • A good code need to support a wide variety of linac-

specific constraints.

slide-11
SLIDE 11

Ostiguy – Linac Simulation Primer - Sep 2013

Reference Particle

  • In contrast with a typical (high energy) synchrotron, the particle velocity changes
  • rapidly. In fact it can change significantly within a single cavity.
  • The cavity phases are usually specified w/r to the synchronous phase. Internally the

code must uses “absolute” phases; they need to be determined for each run.

  • This is done by tracking a reference particle. As the reference particle reaches a

cavity, the absolute phase (modulo 2π) corresponding to the synchronous phase is determined and the absolute phase in the cavity is set.

  • The reference particle is often (but not necessarily) also tracked simultaneously with

the bunch. This makes it easy to express the coordinates w/r to those of the reference particle (not necessarily the same as the beam centroid coordinates)

slide-12
SLIDE 12

Ostiguy – Linac Simulation Primer - Sep 2013

RF Phase & Synchronous Phase

  • For all cavities, one must define a

phase reference. In a code, two references are used

  • Phase when the reference particle

arrives at the cavity entrance

  • Synchronous phase: usually defined

as the phase that results in the maximum energy gain.

slide-13
SLIDE 13

Ostiguy – Linac Simulation Primer - Sep 2013

Synchronous Phase

Assuming that the velocity is constant through the cavity, one can define the synchronous phase as follows: Note that under this assumption, the energy gain can be computed for any phase φ once φs has been determined

slide-14
SLIDE 14

Ostiguy – Linac Simulation Primer - Sep 2013

Generalized Definition of φs

At low energy, the velocity may change significantly while going through the cavity. In that case, one may generalize the definition is the phase that maximizes the integral (energy gain) Of course, when the velocity is nearly constant, this definition is equivalent to the previous one.

slide-15
SLIDE 15

Ostiguy – Linac Simulation Primer - Sep 2013

Setting Absolute Phases

Note: not all codes use the same definition of “synchronous phase”. TRACK (ANL) uses a definition based on maximum gain. TraceWin (CEA/Saclay) uses an alternate definition which facilitates the determination of the parameters for an equivalent thin gap . Unless the relative change in velocity within a cavity is substantial, the phases determined with either convention are essentially the same.

slide-16
SLIDE 16

Ostiguy – Linac Simulation Primer - Sep 2013

RF Cavity Model

  • Especially at low particle velocity when the phase slippage is

large, RF cavities must be modeled with a full EM field map.

  • In many practical situations, one can assume that the fields are

axi-symmetric. In that case, an axial field map is sufficient to characterize the full 3D field.

  • Arbitrary 3D field maps are useful to account for asymmetries

due to rf couplers etc ...

  • Axial or full field maps are obtained using a separate EM code

(e.g. MWS ).

slide-17
SLIDE 17

Ostiguy – Linac Simulation Primer - Sep 2013

Axial Field Expansions

The coefficients Am are obtained by expanding the on-axis E_z(z). For a cavity:

Similar expansions are available for solenoids (Bz) or for electrostatic lenses (V(z) ).

slide-18
SLIDE 18

Ostiguy – Linac Simulation Primer - Sep 2013

Independent Variable : Time or Space ?

  • Accelerator and beamline elements are ordered sequentially along some

reference orbit.

  • In a code, elements are treated as independent blocks (i.e. not aware of
  • thers) with local properties (e.g. field map). This is the motivation for

using s (or z) as the independent (integration) variable.

  • To account for space charge, one must know the position of all particles

at a fixed time t. This provides the motivation for choosing t as the integration variable. The downside with this choice is this simple question: at time t within which element does a particle lie ?

  • Codes based either choice are used
  • For most ion linac simulation work, a s-based code is a more practical

choice and leads to less code complexity. t is a better choice (more accurate) at very low energy, for example within an RFQ.

slide-19
SLIDE 19

Ostiguy – Linac Simulation Primer - Sep 2013

Equations of Motion Equations of Motion (Single particle) (Single particle)

In principle, all we need to do is to integrate In a general curvilinear coordinate system, the explicit form can get quite complicated.

slide-20
SLIDE 20

Ostiguy – Linac Simulation Primer - Sep 2013

Trajectory Equations Trajectory Equations (in cartesian coordinates) (in cartesian coordinates)

State Variables: This is a system of first order differential equations. It can be numerically integrated (usually using a RK integrator). Independent (Integration) Variable: s These equations do not involve any simplifications.

slide-21
SLIDE 21

Ostiguy – Linac Simulation Primer - Sep 2013

Maps

  • Numerical integration is generally used for

cavities, solenoids, einzel (electrostatic) lenses for which a field map is provided.

  • To speed up calculations, for most other

elements --in particular for drift space-- (linear) maps are used.

  • It is assumed that a map can be parametrized

w/r to the element length i.e. the code can easily split an element into N identical ones of length L/N to introduce space charge kicks.

slide-22
SLIDE 22

Ostiguy – Linac Simulation Primer - Sep 2013

Self-Fields (“Space Charge”)

  • Beam Physics specific approximation:

In the bunch frame, there is (almost) no magnetic field. The self-field problem reduces to the solution of Laplace's equation.

  • Fields are computed in the bunch frame then transformed and applied in the lab frame.
  • A wide variety of methods are available
  • Green's function
  • FFT
  • FD, FEM
  • Etc
  • Different levels/types of approximations, use of symmetry
  • Axisymmetric (r-z)
  • “2 ½ D”
  • Boundary Conditions may or may not be included :
  • pen or periodic (longitudinal), open or n x E = 0 on beam chamber wall etc …
slide-23
SLIDE 23

Ostiguy – Linac Simulation Primer - Sep 2013

Green's Function

In the absence of boundaries (e.g. vacuum chamber), the solution

  • f Laplace's equation is obtained by linear superposition of the

contribution of individual point charges (this is basically Coulomb's law) On an n x n x n = N node grid, this integration requires O(N**2) operations.

slide-24
SLIDE 24

Ostiguy – Linac Simulation Primer - Sep 2013

FFT Method

Observation: the free-space GF solution is a convolution. The fastest way to do a convolution is via the Fast Fourier Transform. With an FFT this requires only O(N log(N) operations. Note that effectively, the FFT method amounts to an expansion of the charge density and potential as Fourier series. For each component of the series, the Laplace

  • perator can be applied trivially
slide-25
SLIDE 25

Ostiguy – Linac Simulation Primer - Sep 2013

FFT vs Direct Integration

  • The convolution integral makes no assumption

about periodicity

  • The FFT based convolution implicitly assumes

that the distribution is a periodic extension of the actual distribution. This is a source of error (aliasing).

  • One can make the spatial period longer but this

means adding nodes i.e. “padding”.

slide-26
SLIDE 26

Ostiguy – Linac Simulation Primer - Sep 2013

Integrating by Expanding the the charge Density in terms of Basis Functions sometimes referred to as an “integrated Green's function” can be computed once and for all or expressed in terms of a few parameters

slide-27
SLIDE 27

Ostiguy – Linac Simulation Primer - Sep 2013

Integrating by Expanding the the charge Density in terms of Basis Functions

  • This technique is nothing new; it is a central idea of numerical
  • integration. For example, in 1D, the basis functions are often

chosen as polynomials over a limited support.

  • In the context of space charge calculations, it is the basis of the

SCHEFF solver in PARMILA. SCHEFF is an axisymmetric solver; the basis functions are uniformly charged“rings”

  • In 3D, a similar solver was developed by N. Pichoff (CEA/Saclay).

In that case, the basis functions are uniformly charged“bricks”.

  • Obviously, the choice of a basis to expand the charge density is

limited only by one's imagination !

slide-28
SLIDE 28

Ostiguy – Linac Simulation Primer - Sep 2013

Differential Methods

  • In principle, one can use FD or FEM to solve

Poisson's equation at each kick location. This is not often done because naively factoring the discretized system of equations is a O(N**3) task; That said, O(N**(4/3)) or even ~O(N) may be achieved with a fancier technique e.g. by taking advantage of sparsity. The code is then significantly more complex.

  • At least one commercially successful “linac” code uses a FD

Multigrid solver (GPT from Pulsar Research)

slide-29
SLIDE 29

Ostiguy – Linac Simulation Primer - Sep 2013

Boundary Conditions

  • The perturbation caused by the vacuum chamber wall is usually small.
  • Many linac codes choose to simply ignore transverse boundary

conditions when computing SC fields.

  • To include transverse BC in a general case is straightforward (but has a

cost in terms of simulation time).

  • If we restrict to a specific shape, e.g. a circular chamber, one can use a Green's function that

accounts for the presence of the chamber.

  • One can first find the free space solution and add to it a solution to the Laplace equation

where V is set as -V[free] on the boundary.

  • Longitudinal boundary conditions matter. Usually, we want to enforce a

periodic condition (to model a train of bunches). There are different ways of achieving this.

  • If the FFT method is used, if the the longitudinal extent of the FFT grid is βλ, longitudinal

periodic boundary conditions are automatic.

  • One can compute the field for one bunch assuming open boundaries and subsequently add the

field from neighboring bunches using simple translation.

slide-30
SLIDE 30

Ostiguy – Linac Simulation Primer - Sep 2013

Longitudinal Periodic BCs

slide-31
SLIDE 31

Ostiguy – Linac Simulation Primer - Sep 2013

Statistical Errors

  • Low level beam losses are a main concern for high intensity linacs.
  • Losses should typically be < 1W/m.

At 1 MW , this is 10e-6 of the beam so it become necessary to track >> 10**6 particles to get statistically significant results.

  • Many 100s of linac with different set of errors (phase, gradient for cavities,

element mislagnments, etc .. are analyzed.) Typically this is done in parallel with each node associated with a different linac.

  • The details of the procedures used to submit jobs, collect results and

present them are site specific and custom scripts almost always need to be developed.

  • Commercial codes use protection that may be incompatible with some

installations (e.g. special client-server architecture, required communication with license manager process etc … )

slide-32
SLIDE 32

Ostiguy – Linac Simulation Primer - Sep 2013

Some Real World Codes

All these codes use fundamentally similar approaches.

  • IMPACT (s and t versions, LBNL)
  • Developed for large scale simulations (huge no of particles) optimized to run in parallel.
  • TraceWin/PARTRAN (CEA/Saclay)
  • General Purpose. Handles optics (envelope mode) and tracking in a relatively seamless
  • manner. Can run in parallel (batch mode and /or on multicore machines). Commercial.
  • TRACK (ANL)
  • Mostly a tracking code. Can run in batch mode on a cluster. Not commercial – but no
  • source. A parallelized version exists (PTRACK) but is not generally available.
  • PARMILA (LANL)
  • The linac codes grand-daddy. Not commercial, but no sources
  • DYNAMION (ITEP)
slide-33
SLIDE 33

Ostiguy – Linac Simulation Primer - Sep 2013

A bit more about TraceWin ...

slide-34
SLIDE 34

Ostiguy – Linac Simulation Primer - Sep 2013

TraceWin

slide-35
SLIDE 35

Ostiguy – Linac Simulation Primer - Sep 2013

TraceWin

slide-36
SLIDE 36

Ostiguy – Linac Simulation Primer - Sep 2013

TraceWin