Equilibrium bunch density distribution with passive harmonic cavities in a storage ring

The MAX IV storage rings, currently under construction in Lund, Sweden, will use third harmonic cavities operated passively to lengthen the bunches and alleviate collective instabilities. These cavities are an essential ingredient in the MAX IV design concept and are required for achieving the final design goals in terms of stored current, beam emittance, and beam lifetime — such performance challenges are in fact common to all recent ultralow emittance storage ring designs and harmonic cavities are currently under consideration in several laboratories. In this paper, we report on parametric studies comparing different harmonic cavity settings in terms of the resulting bunch length, peak bunch density, and incoherent synchrotron frequency spread for the MAX IV 3 GeV ring. The equilibrium longitudinal bunch density distribution was calculated by establishing a self-consistent equation for the bunch form factor, describing the bunch shape. The calculations are fully self-consistent in the sense that not only the amplitude but also the phase of the waves excited by the beam in the harmonic cavity were assumed to be a function of the bunch shape, which allowed us to explore a wide parameter range not restricted to the region close to the conditions for which the first and second derivatives of the total rf voltage are zero at the synchronous phase. Our results indicate that up to a factor 5 increase in rms bunch length is achievable with a purely passive system for the MAX IV 3 GeV ring while keeping a relatively large harmonic cavity detuning, thus limiting the unavoidable Robinson antidamping rate from the fundamental mode of a passively operated harmonic cavity to values below the synchrotron radiation damping rate. The paper is complemented by results of measurements performed in the MAX III storage ring, which showed good agreement with calculations following the fully self-consistent approach.


I. INTRODUCTION
The MAX IV facility [1], currently under construction in Lund, Sweden, includes a 3 GeV storage ring optimized for hard x rays and featuring ultralow emittance (down to 0.2 nm rad) and a 1.5 GeV storage ring optimized for soft x rays and UV radiation production. A 3 GeV linear accelerator plays the role of a full-energy injector into both rings as well as delivers the beam to a short pulse facility designed to produce spontaneous radiation from undulators with pulse lengths down to 100 fs.
A key ingredient in achieving stable operation of the MAX IV rings at high beam current (500 mA nominal stored beam current) is the use of a low frequency (100 MHz) rf system [2] and third harmonic rf cavities which, together, lead to rms bunch lengths on the order of 5-6 cm.
The long bunches are essential for achieving the ultimate design performance parameters of the MAX IV rings. In fact, it is only with lengthened bunches that the low emittance can be preserved under the action of intrabeam scattering and the design intensity can be guaranteed against coherent collective effects, in particular, the long bunches help to keep the heat load due to induced fields in vacuum chamber components at an acceptable level and avoid excitation of high frequency trapped (high Q) modes in the chamber structures and rf cavity higher order modes (HOMs). Additionally, the long bunches allow us to cope with coupled-bunch resistive wall instabilities [3] that are enhanced by the very compact design of the storage ring vacuum chamber [4], which is in turn a consequence of the compact magnet design [5] required to reach a very low emittance in a relatively short machine circumference through the multibend achromat lattice concept. Moreover, the harmonic cavities increase the synchrotron frequency spread within the bunches, thus enhancing Landau damping of collective instabilities.
All of the issues mentioned above are in fact common to many recent ultralow emittance storage ring designs and the possibility of using harmonic cavities is contemplated in new projects [6,7] as well as in upgrade proposals [8].
Harmonic cavities have been successfully used for many years in second and third generation light sources in both active [9] as well as passive [10][11][12][13][14] configurations. The basic theory is described in [15] and beam instability analyses under the presence of harmonic cavities have been carried out by several authors (e.g. [16,17]).
In this paper, we focus on the MAX IV 3 GeV ring and describe calculations of the equilibrium longitudinal bunch density distribution in the double rf system (main and harmonic cavities), having in mind that the harmonic cavities will be operated passively, i.e., the fields in those cavities will be excited by the beam itself. Passive operation implies therefore that the fields excited in the harmonic cavities depend on the bunch density distribution, which, in turn, is determined by the sum of the fields in the main cavities and those in the harmonic cavities. Clearly a selfconsistent solution for the density distribution needs to be found.
This problem has been treated by various authors before. In some cases (e.g [18]), the influence of the bunch shape on the excitation of the fields in the harmonic cavity is disregarded, i.e. the bunch lengths are assumed to be negligible when compared to the rf wavelength (even in lengthened conditions). In other cases [11], the influence of the bunch shape on the amplitude of the wave excited by the beam in the harmonic cavity is taken into account by introducing a bunch form factor F, which is equal to unity for a pointlike bunch and decreases as the bunches get longer, as a result of the reduced overlap of the bunch spectrum with the impedance of the fundamental mode of the harmonic cavity. In this way, a self-consistent equation is established for the determination of the equilibrium density distribution, in which the beam frequency spectrum depends on the bunch shape and the frequency response of the harmonic cavity depends on the cavity properties (shunt impedance, quality factor, tuning angle). A more direct, but more time consuming approach is to perform multiparticle tracking including the effects of the long-range wakefields of the harmonic cavities (e.g. [19]).
The self-consistent equation approach described above (which we call a scalar approach) works well for certain ranges of harmonic cavity settings (i.e. harmonic cavity shunt impedance and tuning angle). In particular, if the shunt impedance is low enough, the scalar approach is sufficient for any choice of tuning angle. Moreover, if the shunt impedance and tuning angle are close to the so-called flat potential conditions, in which the first and second derivatives of the longitudinal potential well are zero at the synchronous phase, the density distribution may safely be calculated using the scalar method. However, passive operation of the harmonic cavities implies operation on the Robinson unstable slope of those cavities, generating a Robinson growth rate that needs to be counteracted by other damping mechanisms such as synchrotron radiation damping and Robinson damping in the main cavities. This can be made easier if the harmonic cavities are tuned far away from resonance, which in turn implies the need for high shunt impedance to reach the necessary field amplitudes that provide enough lengthening. Such conditions, with high shunt impedance and far away from flat potential conditions may lead to a significant deformation of the bunch shape and cannot be treated by the scalar selfconsistent approach. Instead, both the amplitude and the phase of the fields in the harmonic cavities must be assumed to depend on the bunch shape when writing up the self-consistent equations, which then become two dimensional-in other words, the bunch form factor that describes the excitation of fields in the harmonic cavities is now a complex number with an amplitude and a phase and we may define a fully self-consistent solution.
Once the equilibrium bunch density distribution is obtained, parameters such as the rms bunch length, the peak bunch density, and the distribution of incoherent synchrotron frequencies within the bunch can be calculated and used to compare different settings for the harmonic cavity system. This paper is structured as follows. In Sec. II, we briefly review the theoretical background to calculations of the equilibrium bunch density distribution in double rf systems-the analysis here is general in the sense that it applies to both active and passive harmonic rf systems. We then go on, in Sec. II A, to the specific case of passive harmonic systems and consider the usual solution to the equilibrium bunch density distribution with the use of a real form factor for defining the bunch shape, whereas the fully self-consistent treatment with a complex form factor is described in Sec. II B. Section III shows the numerical results for the MAX IV 3 GeV ring case-first the difference between the scalar and fully self-consistent solutions is illustrated by analyzing two extreme cases, namely, a low shunt impedance/small detuning case and a high shunt impedance/large detuning case. We then define a metric to quantify the difference between the two approaches and identify the parameter region where the fully self-consistent approach is essential. The resulting beam density distribution is then analyzed and different harmonic cavity settings are compared. Finally, in Sec. IV we present results of longitudinal bunch profile measurements performed in the MAX III storage ring, which are compared to the calculated bunch distribution.

II. EQUILIBRIUM BUNCH DENSITY DISTRIBUTION IN DOUBLE RF SYSTEMS
Double rf systems have been analyzed by many authors (see e.g. [11,15]) to which we refer the reader for a detailed discussion. Below we list the relevant results and establish our notation and conventions. We assume a rf system composed of main and harmonic cavities so that the total accelerating voltage seen by the beam on every turn is given by where V MC ðφÞ ¼ V rf sinðφ þ φ s Þ is the main cavity voltage and V HC ðφÞ ¼ kV rf sinðnφ þ nϕ h Þ is the harmonic cavity voltage. The harmonic cavity is assumed to resonate at a frequency close to the nth harmonic of the radio frequency. The parameters k and ϕ h define the amplitude and phase of the fields in the harmonic cavity. The equations of motion of a particle with phase deviation φ and relative energy deviation ϵ are where α c is the momentum compaction factor, h the harmonic number, E 0 is the nominal beam energy, T 0 is the revolution period, and U 0 is the energy loss due to synchrotron radiation per turn. The synchronous phase in the absence of a harmonic cavity (the unperturbed synchronous phase) is given by while the presence of the harmonic cavity causes the synchronous phase to shift to a new value φ s given by Note that we choose φ s such that cos φ s < 0. The canonical equations of motion above can be derived from a Hamiltonian: where we introduced the unperturbed synchrotron tune and the corresponding equilibrium bunch density distribution is given by where σ p is the equilibrium relative energy spread determined by the interplay between quantum excitation and radiation damping. This distribution in the ðφ; ϵÞ phase space can be projected onto the φ axis to yield the longitudinal equilibrium bunch density distribution: where where the natural bunch length is σ ϕ0 ¼ hα c Q s0 σ p . The equations above are general in the sense that they apply to both actively and passively operated cavities. In the active case, however, both amplitude and phase can be chosen independently, whereas in the passive case, once the cavity shunt impedance is fixed (by its construction) only one parameter is available for optimization, namely, the cavity tuning angle (or equivalently the cavity resonant frequency). In particular, we may choose the harmonic cavity voltage and phase such that both the first and second derivatives of the voltage at the synchronous phase are zero and an approximately quartic potential well is formed. This is achieved when the harmonic cavity voltage and phase are [11] where the subscript fp identifies this as the flat potential case. This is possible for both passive and active operation, but in the passive case, once the harmonic cavity shunt impedance is fixed by its construction, these conditions are only reached at a given beam current and a given harmonic cavity detuning.

A. Scalar self-consistency
The response of the harmonic cavity to the excitation by the beam can be described by the cavity impedance [11] where R s is the cavity shunt impedance, Q the quality factor, and ω r ¼ 2πf r is the resonant frequency. In terms of the harmonic cavity detuning Δf and tuning angle ψ h we may write the voltage induced in the cavity as where I 0 is the stored beam current and we have introduced the (real) bunch form factor given by the absolute value of the Fourier transform of the bunch density distribution at the nth harmonic of the radio frequency, normalized to the dc component and we identify The equations above give us the recipe for finding ρðφÞ, namely, given the beam current, harmonic cavity shunt impedance, harmonic cavity tuning angle, and a bunch form factor, we calculate the harmonic cavity voltage from Eq. (16), determine the total voltage from Eq. (1) and corresponding potential from Eq. (10), and finally calculate the bunch density distribution from Eq. (9). Once the bunch density distribution is known, the bunch form factor can be calculated back from Eq. (17), which leads to a selfconsistent equation in one variable (F) of the form where the functional form f stands for the series of calculations described in the preceding paragraph. The equilibrium bunch form factor, which is a solution of the equation above, can be easily determined numerically as the root of the penalty function (see Appendix C), For the flat potential case, the required shunt impedance and harmonic cavity tuning angle are given by where k fp and ϕ h;fp are given in Eqs. (11) and (12).

B. Full self-consistency
The full self-consistency is implemented by writing the harmonic cavity fields as where we have introduced the form factor phase φ FF and the harmonic phase ϕ h is determined by the harmonic cavity detuning ψ h (Eq. 19), just as in the scalar case. The potential is obtained from Eqs. (5) and (10) by replacing nϕ h with nϕ h − φ FF and the same self-consistent equation (20) above can be used, but the form factor is now a complex quantityF which may be determined from the density distribution ρ bỹ and the numerical root finding algorithm of the scalar case is replaced by a two-dimensional minimization of the penalty function (see Appendix C) which gives us both amplitude and phase of the complex form factorF. Clearly both approaches lead to the same results when the form factor phase φ FF is close to zero, which, as we will see, will be the case for conditions close to the flat potential case or for low harmonic cavity voltage ratios. Table I shows the MAX IV 3 GeV ring parameters assumed in the calculations reported in this paper. Only operation at full current (500 mA) was considered and all 176 bunches were assumed equally populated, which implies that our treatment does not consider transient effects 1 due to the presence of a gap in the bunch train. This limitation is, however, not a problem for the MAX IV case in its baseline configuration, which does not foresee the use of such gaps.

III. RESULTS AND DISCUSSION
The equilibrium bunch parameters when no harmonic cavities are present (or when they are tuned far away from resonance) are shown in Table II. The harmonic cavity was assumed to operate at the third harmonic of the radio frequency and flat potential conditions are realized for k ¼ k fp ¼ 0.277, corresponding to R s;fp ¼ 2.017 MΩ and ψ h;fp ¼ 103.717°or, equivalently a harmonic cavity detuning of Δf ¼ −28.43 kHz, which leads to a rms bunch length of 54.1 mm, a peak bunch current of 8.9 A, and a perturbed synchronous phase φ s ¼ 143.786°.
These figures were confirmed by a direct solution of the scalar (21) and fully self-consistent (27) equations, as shown in Fig. 1. Clearly, in that parameter range, the scalar and fully self-consistent approaches lead to essentially the same results. However, the small detuning implied by the flat potential brings about a significant Robinson growth rate from the interaction of the beam with the fundamental mode of the harmonic cavity. This growth rate (cf. Appendix B) is too large (67 s −1 ) to be compensated by radiation damping alone (39 s −1 ) and Robinson damping from the fundamental mode of the main cavity is required to maintain a stable beam under those conditions. It is, however, possible to reduce the Robinson antidamping due to the harmonic cavity while maintaining significant bunch lengthening, as long as we abandon the flat potential condition and allow the cavity detuning to grow while increasing the cavity shunt impedance. Such a situation is illustrated in Fig. 2, in which the self-consistent distribution calculated using both scalar and fully selfconsistent approaches is shown for R s ¼ 4.2 MΩ and ψ h ¼ 96.558°corresponding to Δf ¼ −60.36 kHz. It is clear that a fully self-consistent calculation is mandatory under such conditions. We also see from the fully selfconsistent results that, even far away from the flat potential conditions, we can reach a comparable rms bunch length (54.2 mm) at the cost of a slightly larger peak density (10.6 A) and an asymmetric bunch profile. The Robinson growth rate is then reduced by more than a factor 4 down to 15.3 s −1 , well within the range in which radiation damping alone can deal with it.
The results above indicate that for some (potentially interesting) parameter ranges, the scalar self-consistency is not capable of predicting the equilibrium density distribution correctly, which naturally raises the question of when one may safely apply the simpler scalar approach. In order to address that issue, we define the parameter ξ to compare two density distributions ρ 1 ðφÞ and ρ 2 ðφÞ and quantify how different they are, where both ρ 1 and ρ 2 are normalized such that R π −π ρ 1 ðφÞdφ ¼ R π −π ρ 2 ðφÞdφ ¼ 2π. Figure 3 shows the parameter ξ as a function of the product R s j cosðψ h Þj, proportional to the harmonic cavity voltage for various values of the harmonic cavity detuning. For any cavity detuning, the difference between the two approaches becomes negligible as the harmonic cavity voltage decreases whereas for a fixed harmonic cavity voltage, the fully  self-consistent approach becomes essential as the harmonic cavity detuning is increased from the value corresponding to flat potential conditions 2 (Δf ¼ −28.43 kHz). This plot confirms and details the trend illustrated by the two extreme cases explored above, which are indicated in Fig. 3 as points A and B.
In order to determine optimum values for shunt impedance and detuning parameters for the harmonic cavity system, we considered three properties of the resulting equilibrium bunch density distribution: rms bunch length, peak bunch density, and incoherent synchrotron frequency spread. Figure 4 shows the rms bunch length vs shunt impedance for various values of harmonic cavity detuning. The bunch length grows monotonically with shunt impedance for all detuning values and we see that lengthening much larger than the lengthening corresponding to flat potential conditions may be obtained. However, as shown in Fig. 5, such overstretched conditions actually lead to peak densities somewhat above the minimum achievable. In fact, the peak density vs shunt impedance curves show a minimum at a shunt impedance value which decreases as the detuning decreases. That minimum peak density varies only slightly as the detuning increases. In other words, by going to larger shunt impedance and detuning (while keeping the harmonic cavity voltage approximately constant), one may obtain essentially the same rms bunch lengths at the cost of a slightly larger peak density. This is in fact the approach adopted for the MAX IV 3 GeV ring, where a significant margin in shunt impedance above the flat potential condition is provided by installing three identical harmonic cavities, each with a shunt impedance of 2.5 MΩ. Having the total shunt impedance split among three different   Fig. 1 and Fig. 2, respectively. cavities allows us to tailor the actual shunt impedance seen by the beam by tuning each cavity independently and additionally permits us to keep the power dissipated in each cavity within acceptable levels.
Another figure of merit that allows us to compare different choices of parameters for the harmonic cavity system is the incoherent synchrotron frequency spread, directly related to the Landau damping of collective instabilities. Figure 6 shows the numerically determined (see Appendix A) density distribution in synchrotron tune space for various cases. Compared to the situation without harmonic cavities, the average synchrotron tune is significantly reduced and the spread is increased when harmonic cavities are included. Even though this increase is larger for conditions close to the flat potential case (R s ¼ 2.017 MΩ) than for the high shunt impedance/large detuning case analyzed earlier (R s ¼ 4.2 MΩ), the tune spread can be reobtained for large detuning by going to even larger shunt impedance (see for example the case R s ¼ 4.4 MΩ in Fig. 6).
One can better understand those results by considering the behavior of synchrotron frequency as a function of the Hamiltonian invariant [Eq. (6)] and the corresponding potential functions [Eq. (10). As the potential well becomes wider (Fig. 7), the tunes are reduced and span a wider range as a function of the Hamiltonian invariant (Fig. 8). Moreover, instead of the usual decrease in synchrotron tune for increasing oscillating amplitude, which characterizes a single rf system, the double rf system actually shows an increasing synchrotron tune as a function of amplitude for amplitudes above a threshold value. This threshold value and the synchrotron tune at the threshold is lower when we are close to flat potential conditions than for the high impedance, large detuning conditions, implying a larger tune spread for the flat potential condition case. 3 However, as the shunt impedance is increased further, the minimum of the synchrotron tune at the threshold is decreased and approaches the flat potential situation, which causes the corresponding tune distribution to extend to lower synchrotron tunes in Fig. 6. Moreover, when the distortion of the potential well is so large that a second stable fixed point of the Hamiltonian (a secondary bucket) is created, as in the case of R s ¼ 4.4 MΩ, a new set of synchrotron   frequencies, corresponding to oscillatory motion around this secondary synchronous phase, appears. These synchrotron frequencies are shown by the magenta curve in Fig. 8 and lead to the extended shoulder to the right of the corresponding tune distribution in Fig. 6.

IV. BUNCH PROFILE MEASUREMENTS IN THE MAX III STORAGE RING
MAX III is a third generation synchrotron light source with an electron energy of 700 MeV intended for synchrotron radiation generation in the infrared and ultraviolet region. It was commissioned in 2006 and characterized in 2008 [20]. The rf system in MAX III consists of three rf cavities: the main cavity at 100 MHz and two passive rf cavities at the third and the fifth harmonic. The fifth harmonic cavity was installed at the startup of MAX III and is currently detuned during regular user operation in order to avoid the excitation of coupled bunch modes by HOMs. The third harmonic cavity, a prototype for the MAX IV harmonic cavity [2], was installed in October 2011 and has been tuned in during user operation since then.
MAX III is equipped with a diagnostic beam line observing the visible synchrotron radiation emitted from the center of a dipole magnet [21]. In order to measure the longitudinal bunch shape, the time structure of the synchrotron light is resolved with an optical sampling oscilloscope (OSO). In the sampling head of the OSO, the incident light is focused and converted into photoelectrons at a photocathode. The electron path is bent by deflecting plates and swept over a slit. The electrons passing the slit impinge on a phosphor screen generating light which is transformed into an electric signal by a photomultiplier tube. The signal was sampled with 2048 points on a 2.4 ns time axis. The total data acquisition time was about 70 sec per measured bunch profile.
The relative energy spread was 6.0 × 10 −4 and the momentum compaction was 0.03288 [22]. The main cavity voltage during the measurements was V rf ¼ 108 AE 1 kV and the rf was 99.925 MHz. The third harmonic cavity with Q ¼ 20430 AE 40 and R s ¼ 2.68 AE 0.015 MΩ had a detuning Δf ¼ −197 AE 1 kHz. The fifth harmonic cavity with Q ¼ 21720 AE 50 and R s ¼ 1.57 AE 0.01 MΩ was detuned by Δf ¼ −703 AE 1 kHz. Despite its large detuning, the fifth harmonic cavity contributes to the total accelerating voltage seen by the beam and has to be considered in calculations. In the case of the fully self-consistent approach applied to the triple rf system of MAX III, two independent complex form factors are required to calculate the voltages in each harmonic cavity. Numerically the selfconsistency has to be found by a now four-dimensional minimization of the penalty function [compare Eq. (27)]. Figure 9 shows three examples of measured bunch shapes together with the corresponding calculations based on the fully self-consistent approach. At low currents (lefthand plot in Fig. 9), the effect of the harmonic cavities is negligible. The bunch shape is Gaussian and the bunch  length is close to the natural bunch length. At medium currents, the fields in the harmonic cavities are excited and lead to bunch lengthening. The conditions for the middle plot in Fig. 9 are close to the flat potential conditions. At higher currents (right-hand plot in Fig. 9) the fields in the harmonic cavities overstretches the bunch and the density in the bunch center decreases.
In order to verify that the overstretched bunch shape was real and not a time-averaging artifact of the optical sampling oscilloscope, measuring on an unstable beam, a measurement of the shape of a single bunch (and in one turn) was done with a fast diode. Although the single-shot bunch shapes were noisy, it was still clear that the overstretched bunch shape was real.
The symmetry of the bunch density distributions suggests that, contrary to the MAX IV case, a treatment with full self-consistency is not required for the range of parameters covered in the MAX III experiments. In fact, the MAX III synchronous phase is closer to 180°and a relevant difference in the result of the scalar and fully selfconsistent approaches is expected only for larger values of the harmonic cavity voltage ratio k, which were not accessible in MAX III (see Fig. 18 in Appendix C 2).

V. CONCLUSIONS
We have analyzed the effect of a passively operated third harmonic cavity in the MAX IV 3 GeV electron storage ring for a uniform fill (i.e. transient effects associated with the presence of a gap in the bunch train are excluded from the analysis). The calculation of a fully self-consistent equilibrium longitudinal beam density distribution, in which both the amplitude and phase of the waves excited by the electron beam in the harmonic cavity are assumed to depend on the bunch current and bunch shape, allowed us to explore a wide range of parameter settings for the harmonic cavity system.
Our results indicate that it is possible to achieve bunch lengthening in MAX IV by about a factor 5 with passive operation even if the harmonic cavity detuning is significantly increased in order to reduce Robinson antidamping due to the interaction of the beam with the fundamental mode of the harmonic cavity. Even though the bunch shape is no longer perfectly flat under those conditions, the rms bunch length is comparable to or longer than what can be obtained by setting the first and second derivatives of the rf voltage to zero at the synchronous phase. The peak bunch density becomes only slightly larger and a comparable incoherent synchrotron frequency spread can also be obtained. The price to be paid in order to allow operation in that regime is a significantly larger harmonic cavity shunt impedance. We have also shown that, under those circumstances, it is essential to take into account the dependence of the phase of the waves induced by the beam in the harmonic cavity on the bunch shape by establishing a fully self-consistent solution for the equilibrium bunch density distribution.
Finally, we found good agreement in a comparison of longitudinal bunch profile measurements done in MAX III with calculations following the fully self-consistent approach. We note that, for the MAX III parameters, the fully self-consistent approach gives approximately the same results as the scalar approach. The MAX IV 3 GeV ring will, on the other hand, offer the opportunity to cover experimentally a range of parameters in which the fully selfconsistent method is essential.

ACKNOWLEDGMENTS
We thank Erik Wallén for highlighting the need to take the phase of the waves excited by the beam into account when calculating the equilibrium density distribution and Galina Skripka for help with the MAX III experiments.

APPENDIX A: EVALUATING EQUILIBRIUM BUNCH DENSITY DISTRIBUTIONS
Given the motivations listed in the introduction for lengthening the bunches, some obvious figures of merit which we can use to compare the effectiveness of two distributions generated by different harmonic cavity settings are the rms bunch length, the peak bunch density, and the distribution of incoherent synchrotron tunes. The first two parameters affect directly the beam lifetime (through the Touschek component) and the heat load on vacuum components due to interaction of the beam with the chamber impedance, whereas the third affects how the beam center-of-mass motion reacts to the wakefields produced by the beam itself. In fact, lengthening of the bunches alleviates the impact of coherent collective instabilities in two complementary ways-on the one hand by reducing the driving forces to the instabilities, i.e. reducing the excitation of unstable modes through a reduction of the overlap of the bunch spectrum with the machine impedance and on the other hand by reducing the responsiveness of the beam to those wakefields through an increase in synchrotron frequency spread and the ensuing Landau damping of the instabilities.
The calculation of the rms bunch length and peak bunch densities are trivial once the density distribution is known. In order to calculate the distribution of synchrotron tunes, we must first obtain the expression of the synchrotron period corresponding to a given oscillating orbit in ðϵ; φÞ phase space, identified by the motion invariant H The integral is to be done over half an oscillation cycle, during which _ φ does not change sign and the integration limits correspond to two return points of the oscillation, where ϵ ¼ _ φ ¼ 0. For the limiting case of a single rf cavity, this reduces to a complete elliptic integral leading to the familiar decrease of the oscillation frequency as a function of invariant amplitude H. In the case of a double rf system tuned such that the first and second derivatives of the total rf voltage at the synchronous phase are zero, the potential Φ becomes approximately quartic close to the synchronous phase and the potential well is flat. Approximate expressions for the synchrotron period as a function of the invariant amplitude valid in that limit are given in [15]. For the general case of a double rf system tuned to arbitrary conditions, one is forced to resort to numerical integration. The area encircled by an oscillating orbit with invariant H is and the distribution of synchrotron tunes can be written as where the distribution ρðHÞ is given by Eq. (8).
Numerical calculation of the functions Q s and A as a function of H then yields the tune distribution through the numerical differentiations above. Alternatively, one may construct histograms in tune space by generating a particle distribution in the ðφ; ϵÞ phase space following the distribution ρðHÞ and calculating the synchrotron tune for every particle.
Even though the procedure outlined above is general, one must keep in mind that, depending on the relative amplitudes and phases of the main and harmonic voltages, situations may arise in which additional stable fixed points of the Hamiltonian (i.e. more than one synchronous phase) exist within a narrow phase range. In that case, the tune of trajectories around each stable point must be calculated and the resulting distributions must be combined to generate the full distribution, since there is no longer a one-to-one relationship between the invariant H and a tune valueinstead the same H value may correspond to different trajectories, around different stable fixed points.

APPENDIX B: ROBINSON GROWTH RATES FROM THE FUNDAMENTAL MODE OF THE HARMONIC CAVITY
The growth rate for the lowest order Robinson mode for a multibunch beam in the short bunch approximation driven by a high Q resonance of shunt impedance R s and quality factor Q at the angular frequency ω r close to the mth revolution harmonic is given by [23] where ω 0 is the angular revolution frequency, ω s is the angular synchrotron frequency, and Z jj 0 is a longitudinal resonator impedance Figure 10 shows the real part of the harmonic cavity impedance and corresponding beam harmonic and synchrotron sidebands for the cases of Fig. 1 so that the growth rate becomes and we obtain finally where x ¼ mω 0 ω r . APPENDIX C: SOLVING THE SELF-CONSISTENT EQUATIONS

Direct solution
The Brent method [24] as implemented in IGOR [25] is used to obtain the numerical solution of the scalar selfconsistent equation (20) for the real form factor F, or equivalently to find the roots of the penalty function g defined in Eq. (21). On physical grounds, the roots are conveniently bracketed to the interval [0, 1]. Figure 11 shows example plots of the penalty function g for two different sets of harmonic cavity shunt impedance and harmonic cavity tuning angle.
In order to solve the fully self-consistent equation (27), the IGOR implementation of the optimization method by Dennis and Schnabel [26] is used to obtain approximate zeros of the penalty function gðFÞ, whereF is the complex form factor. Again, we can bracket the search for a minimum of g to the interval ð0 < jFj < 1Þ and ð−π < φ FF < πÞ. A rough search on a rectangular grid within this interval is used to generate an initial guess for the desired root as an input to the minimization algorithm. Figure 12 shows a contour plot of the penalty function g for R s ¼ 2.017 MΩ and Δf ¼ −28.43 kHz on the (jFj; φ FF ) plane. While at this relatively low harmonic cavity shunt impedance the penalty function g presents a single root in the interval ð−π < φ FF < πÞ, for combinations of shunt impedance and tuning angle such that two minima of the potential function (or two stable fixed points of the corresponding Hamiltonian) are formed, the penalty function has more than one root, as can be seen in the contour plot in Fig. 13, which is calculated for R s ¼ 4.4 MΩ and Δf ¼ −60.36 kHz. Note however that the various possible solutions correspond to the same physical situation, but with a different (arbitrary) choice of synchronous phase-one can indeed choose any of the extrema (maxima or minima) of the potential function as a synchronous phase φ s in the equation defining the cavity voltage V MC ðφÞ ¼ V rf sinðφ þ φ s Þ without changing any of the equations in Sec. II. In other words, the selfconsistent equations as written in Secs. II A and II B assume a phase coordinate whose origin (φ ¼ 0) is always  at a point for which the energy gain from the main cavity exactly compensates for the energy lost to synchrotron radiation as well as the energy loss to excite the fields in the harmonic cavity-and more than one phase satisfying that condition may exist.
Since any one of those possible solutions leads to the same physical properties (bunch length, bunch density, synchrotron frequency spread), this has no practical consequences, except if one is interested in comparing distributions calculated with different methods, as done in Sec. III. In order for Eq. (28) to be a valid comparison, one has to make sure that both calculations are done with the same phase axes origin and a convenient way to do that is to rewrite the equations in Secs. II A and II B in the phase coordinate system for which the main cavity voltage is V MC ðφÞ ¼ V rf sinðφÞ. When this is done, the g function has a single minimum in the interval ð−π < φ FF < πÞ, as shown in Fig. 14. As expected, the calculated selfconsistent form factor amplitude is independent of the choice of phase coordinate system origin.

Implicit solution
Even though the approach described above is straightforward and conceptually simple to describe, it is possible to determine self-consistent solutions without actually solving the self-consistent equations by first determining a density distribution and calculating back the shunt impedance and tuning angle that correspond to that solution. This "implicit" solution approach has the advantage not to involve any iterative numerical procedure, with associated convergence issues, and is useful as a cross-check as well as a way to illustrate some of relevant scaling laws of the problem.
For the scalar self-consistency problem, the implicit approach consists in taking an assumed ratio k of harmonic cavity voltage to main cavity voltage and determining the resulting density distribution, which gives the corresponding bunch form factor F. The shunt impedance that leads to that particular equilibrium is then calculated back from Eq. (18). Note that R s has now become an output parameter of the problem, and by scanning a range of values of k one generates a set of values of R s to choose from. Figure 15 shows an example of such a calculation, for the MAX IV parameters. It is interesting to note that the shunt impedance vs k curve is not monotonic, i.e. the same value of shunt impedance may correspond to two different values of k-or correspondingly, as shown in Fig. 16 one solution of the scalar self-consistent equation with different bunch form factors may exist for a given set of R s , ψ h values. In the direct approach described in the previous section, such cases show up in the form of multiple roots of the penalty function in the (0, 1) interval. There is, however, no fundamental physical meaning to these degenerate solutions-as soon as the full self-consistency is implemented, and both phase and amplitude of the bunch form factor are allowed to depend on the bunch distribution, the indeterminacy is eliminated and there is a single solution to the self-consistent equations. This is another indication of the limitations of the scalar approach to obtaining equilibrium distributions.
Following the same reasoning above, one may also implement an implicit solution for the full self-consistency problem, by making use of the following property of the potential function ΦðφÞ and its corresponding distribution: In other words, given assumed values for k, ψ h , and φ FF , the corresponding potential and density distribution functions do not change if we keep k fixed and shift the phases ψ h and φ FF by the same amount and in opposite directions. That gives us a simple recipe to construct self-consistent solutions (in the full self-consistency sense), namely, start with assumed values of k and φ FF , determine the resulting distribution and calculate the corresponding form factor amplitude and phase. If the calculated form factor phase differs from the assumed φ FF , then calculate a new tuning angle ψ h shifted from the initially assumed ψ h by the difference between assumed and calculated bunch form factors. Once a new ψ h is determined, the shunt impedance may again be calculated as for the scalar case and we thus obtain a pair of values R s , ϕ h which self-consistently generates the distribution with the assumed k and φ FF .
Even though the approach described in the preceding paragraph does provide a handy cross-check for the direct solution approach, it is not as convenient to use as the implicit approach for the scalar case-in fact, instead of a onedimensional map from k to R s one is now confronted with a two-dimensional nonlinear map from ðk; φ FF Þ to ðψ h ; R s Þ.
We conclude this appendix by using the implicit solution to the scalar self-consistent equation to consider once more the issue of when the full self-consistency is mandatory. Full self-consistency will be relevant whenever the phase of the form factor calculated through the scalar approach is significantly different from zero. Figure 17 shows how the form factor phase determined by the scalar approach varies with harmonic cavity voltage ratio for different harmonic cavity tuning angles. We see the same trends as in Fig. 3, namely, that the difference between scalar and full self-consistency approaches increases significantly for harmonic cavity voltage ratios above the flat potential condition k fp . Moreover, for k=k fp slightly above 1, the differences become larger as the harmonic cavity tuning angle deviates from the flat potential detuning ψ h;fp . In particular, full self-consistency becomes important as the tuning angle is brought towards 90°in order to reduce the Robinson growth rate. Figure 18 shows the corresponding curves calculated for the MAX III parameters (ϕ s0 ¼ 173.204°, σ φ0 ¼ 47.46 mm) and indicates that the  full self-consistency is less relevant in that parameter range. This is basically a result of the larger unperturbed synchronous phase of MAX III compared to MAX IV, which leads to a larger flat potential harmonic cavity voltage ratio k fp and to a flat potential tuning angle ψ h;fp closer to 90°, making higher shunt impedances necessary to enter a regime significantly far from flat potential conditions.