Nonperturbative algorithm for the resistive wall impedance of general cross-section beam pipes

We present an algorithm for calculating the impedance of infinitely long beam pipes with arbitrary cross section. The method is not restricted to ultrarelativistic beams or perturbative approximations with respect to the wall surface impedance or skin penetration depth. We exemplify our algorithm with a calculation of the impedance for rectangular metallic beam pipes. Unlike the situation in the perturbative regime, where the beam pipe geometry modifies the metallic resistive-wall impedances by only a multiplicative factor, the beam pipe geometry has a more complex influence on the impedance when nonultrarelativistic effects are significant and in the ultrarelativistic regime at both small and large frequencies. Since our algorithm requires the boundary conditions at the beam pipe wall to be provided as linear relations between the transverse components of the electromagnetic field, we discuss a general algorithm to calculate these boundary conditions for multilayer beam pipes with arbitrary cross section.


I. INTRODUCTION
Impedance plays an important role in the beam dynamics of high intensity accelerators, being a leading cause for losses and instabilities. There is a vast literature addressing impedance calculations in accelerators. See, for example, [1][2][3] and the references therein. With a few exceptions, the vast majority of impedance studies address cylindrical [3][4][5][6][7][8][9][10][11][12] and parallel-plane [13][14][15][16] beam pipes. Since these systems are highly symmetric, characteristic modes can be decoupled and analytical expressions for the impedance can be derived. Of particular interest is the calculation of impedance in multilayer beam pipes; the problem has been addressed in the literature for both cylindrical [8][9][10][11][12] and parallel-plane [14,15] geometries. Beam pipes of general cross section have also been addressed in the literature [17][18][19], but only in the ultrarelativistic approximation and for single-layered metallic pipes in the frequency region where perturbation theory with respect to the penetration skin depth is valid.
In this paper, we present a method for calculating the resistive wall impedance for infinitely long beam pipes with general cross section. Unlike previous investigations, our method works for systems with large wall surface impedances and in the nonperturbative regime for metallic pipes at both small and large frequencies. Another important difference from the existing literature is that our method does not impose an ultrarelativistic approximation. The ability to calculate the impedance for nonultrarelativistic beams and for systems with large wall surface impedance is extremely important for machines like the Fermilab Booster synchrotron, which has laminated magnets characterized by very large surface impedance [13,16] and an injection energy of 400M eV (γ = 1.42).
To illustrate our algorithm, we calculate the impedance of a rectangular metallic beam pipe, for both ultrarelativistic and finite-γ cases. The ultrarelativistic perturbative regime is in perfect agreement with the work of Yokoya [18], which showed that the rectangular beam pipe impedance has a behavior similar to that of the circular and the parallel-plane geometries, the difference being only a renormalizing factor. However, we find that this simple renormalization is not valid at small and large frequencies, nor is it valid in the frequency regions where the nonultrarelativistic effects are noticeable.
The algorithm assumes that the electromagnetic field boundary conditions at the pipe walls are known and are provided as linear relations between the field transverse components. An example is the boundary conditions provided via the wall surface impedances. We discuss how the boundary conditions can be calculated for multilayer beam pipes of arbitrary cross section, using a similar numerical method to that used for calculating the impedance.
In order to check the correctness of our code, we compare the simulations with the analytical results for the parallelplane pipe impedance. Since, to our knowledge, the expressions for the non-ultrarelativistic parallel-plane impedance as function of wall surface impedances were never published, we present briefly their calculation in here.
The paper is organized as follows. The impedance algorithm is derived in Section II. In Section III the impedance of the rectangular beam pipe is calculated. Conclusions are presented in Section IV. In Appendix A an algorithm designed to calculate the electromagnetic field boundary conditions in multilayer beam pipes of arbitrary cross section is discussed. In Appendix B we present a derivation of the nonultrarelativistic impedance for the parallel-plane beam pipe. Appendix C presents a modified version of the impedance calculation algorithm which might be useful for numerical optimization.

II. FORMALISM
Inside the vacuum beam pipe, the electric and magnetic fields are given by and where Φ and A are the electric and magnetic vector potentials, respectively. The equations for the potentials in the vacuum beam pipe are Eq. 5 is the Lorentz gauge condition. Within the Lorentz gauge constraint, the potentials can undergo a gauge transformation with the gauge field satisfying The impedance describes the response of a witness particle to the electromagnetic field created in the accelerator walls by a source particle. We assume a source particle with a transverse offset (x 0 , y 0 ) moving in the z (longitudinal) direction with velocity βc. The charge density and electric current are given by We are looking for synchronous solutions H(x, y, z, t) = H(x, y)e i(ωt−kz) .
where k = ω βc . The impedance terms are defined as derivative of a given order of the electromagnetic force acting on the witness particle with respect to the source or/and witness particle displacement. Here we consider only the zero th -and first-order terms.
We assume the following definitions: The zero th -order longitudinal impedance is The first-order horizontal transverse impedances are where Z w x (Z s x ) describes the effect proportional to the displacement of the witness (source) particle. It is customary to define the transverse impedance with a factor of i [4].
For beam pipes with low symmetry it is possible that a vertically displaced source particle kicks the witness particle in the horizontal plane or that a vertical displaced witness particle is kicked horizontally by a term proportional to its vertical displacement [20]. Correspondingly, the following transverse impedances can be defined Similar equations can be written for the vertical impedances.

A. Potential field equations
In Fourier space (x, y, k, ω), for the charge and the current given by Eqs. 9 and 10, the potential equations, Eqs. 3 and 4, read where It is convenient to eliminate the calculation of the z-component of the vector potential by fixing the gauge such that This, together with the Lorentz gauge constraint, Eq. 5, yields the following equation for the remaining components of the vector potential By employing Green's Theorem [21], the solution for Eqs. 18 and 19 can be written formally as Φ(x, y) = Φ 0 (x, y) + D(x, y; r l )Φ(r l )dl − G(x, y; r l )∂ n Φ(r l )dl (23) A x,y (x, y) = D(x, y; r l )A x,y (r l )dl − G(x, y; r l )∂ n A x,y (r l )dl (24) where the one-dimensional integrals are taken along the beam pipe contour in the transverse plane and is the Green function satisfying K 0 is the modified Bessel function of the second kind, Φ 0 is the free space (i.e. no beam pipe) solution and D(x, y; r l ) = ∂ n G(x, y; r l ) (29)

Discretized equations
Eqs. 23 and 24 show that the solution is determined once the potentials and their normal components on the beam pipe's wall are known. Our algorithm finds the solution numerically, by taking N points at position r i on the contour. The discretized equations for the surface potentials Φ(r i ) ≡Φ i and ∂ n Φ(r i ) ≡ ∂Φ i arē The bars over the potentials indicate in our notation that they are evaluated on the surface contour. The equations can be written in a compact matrix form:Φ We have 6N variables,Φ i ,Ā xi ,Ā y i , ∂Φ i , ∂A xi , ∂A y i , i = 1, N , and 3N equations, Eqs. 30, 31, 32. The gauge fixing condition, Eq. 22, and the field boundary conditions provide the other set of 3N equations required to solve the problem. A straightforward way to solve the problem is to consider all 6N independent variables and to reduce the problem to a system of 6N complex linear equations, as described in the Appendix C. However, it is possible reduce the problem to a set of 2N linear equations. From Eqs 30, 31, 32 one can write the potentials' normal derivatives as function of the potentials and ∂Φ ∞ is the normal derivative of the potential of a perfectly conducting beam pipe (with conductivity σ = ∞).
So far the 3N surface potentials (Φ i ,Ā xi ,Ā yi ) , i = 1, N , have been considered as independent variables. The gauge fixing constraint Eq. 22, eliminates one more set of N variables. Eq. 22 can be written as a function of the normal and tangential derivative of the vector potentials. By considering the discretized tangential derivative of the potential to the surface to be where 2h i is the distance on the surface between the points r i+1 and r i−1 , one can write the tangential derivative matrix as However, depending on the surface characteristics, a more suitable discretization of the tangential derivative can be chosen. At any point r i , the surface is characterized by a tangential vector t i = t xi i + t y i j and a surface normal vector n i = n xi i + n y i j. Eq. 22 on the surface reads Employing Eqs. 37 and 38 the gauge constraint becomes Eq. 44 allows us to writeĀ x andĀ y as function of single independent variableĀ, thus For example, one can chooseĀ x as the independent variable and expressĀ y as function ofĀ x However, other choices might be more convenient, depending on the particular problem.
We reduced the number of independent variables to 2N , (Φ i ,Ā i ), i = 1, N . They are to be determined from the continuity conditions of the tangential fields at the wall. Using the potential equations Eqs. 36, 37, 38, 45 and 46 in Eqs. 1 and 2, the fields at the wall becomē Our algorithm assumes the boundary conditions form of a system of 2N linear equations where the matrix R elements depend on the wall geometry and on the electromagnetic properties of the medium outside the beam pipe. Often the boundary conditions can be determined as an independent problem. We present an algorithm for determining the boundary conditions for a multilayer beam pipe with arbitrary cross section in Appendix A.
As an example, assume that the wall surface impedances, are known at every point on the surface. This would correspond to R 11ij = δ ij R z , R 12 = R 21 = 0 and R 22ij = δ ij R t . These boundary conditions are specific to metallic beam pipes characterized by large conductivity. The equations for (Φ,Ā) become The problem reduces to the linear equation where M is a complex 2N × 2N matrix and P = (Φ,Ā) and S ∝ ∂Φ ∞ ∝Φ 0 are vectors of size 2N . For our choice of the boundary conditions given by Eqs. 56 and 57, S = (0, Rz Z0 βG −1Φ 0 ).
For beam pipes with specific symmetries the number of independent variables can be reduced by a factor equal to the number of symmetries. For example, for the calculation of the longitudinal impedance in a rectangular beam pipe, the size of the problem can be reduced by a factor of four. For the calculation of the rectangular transverse impedances, which require an off-centered source along one transverse direction, the size of the problem can be reduced by a factor of two.
Many applications, such as numerical beam dynamics simulations, require knowledge of the contribution of the wall finite conductivity to the impedance. For this it is necessary to subtract the contribution corresponding to the perfectly conducting wall. For an ideal conductor The wall finite conductivity contribution to the potential is We would like to highlight a subtlety in the calculation of the discrete Green function matrices G and D. These matrices connect points along the wall surface and should be derived from Eq. 23 by taking proper limit when the wall is approached from inside. Since G(R) is singular for R = 0, and at small R where γ e = 0.57721 is the Euler's constant, we take A careful examination of when r is on the integration contour shows that

B. Impedances
The forces acting on the witness particle are The impedances defined in Eqs. 13, 14, 15, 16 and 17 become Z wy The calculation of Z w x and Z wy x require the derivatives of the potential at the witness particle position and Note that only the solution of Eq. 60 for a centered source is required, as is the case for the longitudinal impedance. Thus the calculation of the transverse impedance due to the witness particle displacement requires very small extra computational effort after the longitudinal impedance has been calculated and (Φ, ∂Φ) determined. Calculation of Z s x requires the derivation with respect to the source particle position Since the potentials on the contour are found by solving a linear equation, the derivative with respect to x 0 can be found by solving where ∂P ∂x0 = ∂Φ ∂x0 , ∂Ā ∂x0 . Similar equations can be written for ∂P ∂y0 which is required for calculating Z sy x . The calculation of the transverse impedances caused by the source particle displacement requires solving 2N linear complex equations which are different from the one corresponding to the longitudinal impedance.

A. Discussion
The metallic beam pipes are characterized by large conductivity and, implicitly, by small surface impedance where δ is the penetration skin depth. Therefore the first order approximation in R z works very well in the ultrarelativistic limit in the frequency region relevant for most beam dynamics problems. In this approximation the impedance is proportional to R z . The approximation fails at small frequencies when and at large frequency when as can be deduced from the analytical expression of the impedance for the circular and parallel-plane geometries [13,16]. For typical metallic pipes the small frequency regime is relevant for distances larger than z > ∼ 10 6 m − 10 7 m, while the large frequency regime is relevant at short range, z < ∼ 10µm − 100µm. One might argue that these length scales make only the perturbative region of interest for beam dynamics. However, note that the short (long) length scale is proportionally increased (decreased) by the increase in the wall surface impedance, as can be inferred from Eqs. 80 and 81. The wall surface impedance can easily be increased by orders of magnitude by increasing the magnetic permeability and/or by reducing the conductivity. More complicated structures, like laminated chambers, are also characterized by orders of magnitude higher wall surface impedance [13,16]. The small frequency regime is relevant for large distance effects such as coherent tune shift in chambers with low symmetries [24]. The methods for impedance calculations for beam pipes with arbitrary cross section described in [17] and in [18] do not address this region.
The large frequency regime is relevant for short bunches; it is called the short-range resistive wall regime in the literature [23]. For circular chambers in the ultrarelativistic limit Bane [23] showed that the impedance in the large frequency regime can be modeled by a low-Q resonator. The method described in [17] does not address this region. Yokoya's algorithm [18] addresses the large frequency regime but neglects the contribution of the tangential surface impedance R t . While the contribution of R t to the coupling impedance is small in the ultrarelativistic limit, it becomes important in the nonultrarelativistic regime at large frequencies. By inspecting the analytical results for the parallel-planes (Eqs. B35 and B36) and circular (Eq. 20 in [10]) geometries, one can see that the first order R t correction is O( kRt γ 2 ), similar in magnitude to the R z correction term (which is O(kR z )). Our algorithm calculates the impedance at small and at large frequency and in the perturbative region, for both nonultrarelativistic and ultrarelativistic regimes, as we show in the next section.

B. Results
We present results for a rectangular steel beam pipe with the conductivity σ = 0.23 × 10 7 Ω −1 m −1 and dimension 2a × 2b. The longitudinal surface impedance R z is given by Eq. 79 and R t = −R z . Ultrarelativistic, γ = 1000, and non-ultrarelativistic, γ = 1.42, cases are considered. The vertical dimension is kept constant b = 3 cm while the horizontal one is varied such as the ratio a b increases from 1 to 3. For a = 2b we find that the impedance is already close to the corresponding parallel-plane limit.
First we benchmarked our algorithm by comparing the simulations for a parallel-plane beam pipe with the analytical results. The parallel-plane problem can be solved analytically as shown in Appendix B. We find that the algorithm converges to the exact results for N of order of thousands. In the ultrarelativistic regime and in the perturbative region defined outside the range of validity of Eqs. 80 and 81, the longitudinal impedance is proportional to ω 1 2 while the transverse impedances are proportional to ω − 1 2 . The same behavior is known for circular and parallel-plane impedances. We define the proportionality coefficients c l , c wy , c wx , c sy , c sx by as in Yokoya's paper [18]. Our results agree with those presented by Yokoya [18], as can be seen in Fig. 1. Here we plot the coefficients on top of Fig.8 from Ref [18]. Note that the longitudinal impedance for a square pipe, i.e., for a = b, is equal to that corresponding to a parallel plane chamber, i.e., for a ≫ b. Starting from a square pipe and increasing a b , the longitudinal impedance decreases slightly until a b ≈ 1.35 ( a−b a+b ≈ 0.15) where c l = 0.94, and then increases asymptotically back. The transverse impedance caused by the witness particle displacement increases form zero to the value corresponding to the parallel-plane chamber when a b ( a−b a+b ) is varied from 1 to 2 (0 to 0.33). Due to the Panofsky-Wenzel theorem, Z w x = −Z w y in the ultrarelativistic limit. The zero value of Z w x and Z w y for a square pipe is a consequence of the large degree of symmetry [20]. The vertical transverse impedance caused by the source particle's displacement, Z s y , has a small dependence on a b while Z s x decreases to half of its initial value when a b ( a−b a+b ) is varied from 1 to 2 (0 to 0.33).
The ultrarelativistic impedance in the high frequency regime is presented in Fig. 2. For our parameters the perturbation theory fails when f >≈ 60GHz. At large frequencies the longitudinal impedance and the vertical impedances caused by the source displacement decrease with increasing a b , while the transverse impedance caused by the witness particle displacement increases with increasing a b . Non-ultrarelativistic effects dramatically change the impedance at high frequency. In Fig. 3 we show the impedance for γ = 1.42. The ω unlike in the ultrarelativistic case. Unlike the ultrarelativistic case, Z w x = −Z w y as can be seen in Fig. 3 -b. The horizontal transverse impedance caused by the source displacement, Z s x , Fig. 3 -c, decreases with increasing a b while Z s y , Fig. 3 -d, show negligible dependence of a b . The small-frequency nonperturbative regime for γ = 1.42 is shown in Fig. 4. At small frequencies the nonultrarelativistic corrections are negligible aside a multiplicative factor of β for the transverse impedance [14]. For our beam pipe parameters, this regime is effective for f <≈ 100KHz. An increase in the value of the wall surface impedance will, however, increase the characteristic frequency of this regime by a similar order of magnitude. The longitudinal impedance has a similar behavior to the one characteristic of the perturbative regime, i.e., a small decrease followed by an asymptotic increase when going from the square beam pipe to the parallel-planes limit. However, the longitudinal impedance has no perfect ω 1 2 behavior and the difference between the real and the imaginary part is noticeable. The transverse impedances caused by the witness particle displacement, −Z w x = Z w y , increase from zero to the value corresponding to the parallel-planes limit. The horizontal impedances caused by the source displacement Z s x decreases to half when going from the square beam pipe to parallel-plane limit. The vertical impedance Z s y shows a small decrease with increasing a b . Note that our algorithm captures well the low frequency features of the transverse impedance, namely that the real part goes to zero and the imaginary part goes to a finite value when the frequency approaches zero [13].

IV. CONCLUSIONS
We present an algorithm for calculating the impedance in beam pipes with arbitrary cross section. The method is nonperturbative, works at small and large frequencies, and does not assume the ultrarelativistic approximation. The equations for the electromagnetic potentials are discretized and the solution is obtained after solving a system of linear algebraic equations.
The impedance algorithm assumes that the electromagnetic field boundary conditions at the beam pipe wall are known and are provided as linear relations between the field transverse components. We describe an algorithm to calculate the boundary conditions for the general case of the multilayer beam pipe of arbitrary cross section. Our simulations are checked against the analytical results for the parallel-plane beam pipe. We present an analytical derivation of the non-ultrarelativistic parallel-plane impedance as function of wall surface impedance.
We show results for a rectangular metallic beam pipe, for both ultrarelativistic and finite-γ cases. The ultrarelativistic perturbative regime is in perfect agreement with the work of Yokoya [18]. The rectangular longitudinal beam pipe impedance is proportional to ω 1 2 while the rectangular transverse impedances behave as ω − 1 2 . This behavior is similar to the one characteristic of the circular and the parallel-plane beam pipes, the influence of the beam pipe geometry being captured by a renormalization factor. We find that this simple renormalization is not valid when the nonultrarelativistic effects are important or in the ultrarelativistic approximation at small and at large frequencies.

V. ACKNOWLEDGMENTS
This work was performed at Fermilab, operated by Fermi Research Alliance, LLC under Contract No. De-AC02-07CH11359 with the United States Department of Energy. It was also supported by the ComPASS project, funded through the Scientific Discovery through Advanced Computing program in the DOE Office of High Energy Physics.