Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

Poisson’s equation is broadly used in many areas, such as electrostatics, mechanical engineering and theoretical physics—for instance in gravitational potential calculation and in beam dynamics simulations in particle accelerators. Particle accelerators have a long history. In fact, the first basics go back to Crookes who discovered cathode rays (1870), Thompson who showed that the cathode rays are composed of electrons (1896) and Röntgen who discovered X-rays (1895). The first milestone on the path to particle accelerators for high energy physics was Rutherford’s scattering of alpha particles on a gold foil (1909). Modern accelerators for high energy physics still basically use the principle of scattering experiments. Since the energy of the electrons in cathodic ray tubes is limited, in the 1930s new types of generators for higher electric fields have been developed. Examples are the Van de Graff generator (1929) and the Cockcroft-Walton generator (1932) or the first cyclotron by Lawrence (1931). To overcome the limitations of these machines and achieve much higher energies of the electrons, radio-frequency (RF) cavities started to be used (and now are key elements of all accelerators) in which the energy of the high-frequency field is transferred to the passing electrons (or other elementary particles). Accelerators for high energy physics are either ring-like machines such as the Large Hadron Collider (LHC) at CERN or linear accelerators such as the design study for the International Linear Collider (ILC). The elementary particles are highly relativistic, i.e. have practically speed of light, and have very high energies. Synchrotron light sources, which are used for material studies, exploit the electromagnetic radiation which arises when an electron is forced (by magnets) on a curved path. Elaborating this principle more and more, new generations of brilliant light sources have been designed such as the European X-ray free-electron laser (XFEL) which is currently being built at DESY in Hamburg. Further, accelerators are used in medicine for cancer therapy.

No matter which type of accelerator is regarded, all of them start with a particle source where the elementary particles are produced (e.g. cathode, photocathode, ion source), some magnetic focusing elements and sections in which the stream of particles is bunched and a first acceleration takes place. Thus, a bunch is a large number of charged elementary particles. It achieves its relativistic speed and its higher and higher energy passing through RF cavities.

As long as the particles are non-relativistic, their self-electric space charge field is influencing the particles in the bunch while space charge fields don’t play a role anymore for the highly relativistic particles. The space charge effect is of crucial importance for the next generation accelerators with their ultrashort, very dense bunches of high power, such as in the XFEL, since this naturally implies higher space charge effects. If one wouldn’t do a careful design study, one possible effect could be e.g. that the bunch, which indeed should stay in tight dimensions, extremely grows due to the space charge effect and hits the wall of the vacuum chamber. The specific bunch characteristics of future accelerators makes simulation studies of space charge effects more challenging than before.

The most prominent, classical methodology for numerical space charge studies is known as the Particle-in-Cell (PIC) model [1]. The considered bunch is embedded in the computational domain Ω, which usually is a cubic or a cylindrical domain. The computational domain Ω is discretized and the charge of the particles inside each cell is assigned to neighboring grid points by algorithms like the Nearest Grid Point (NGP) or the Cloud in Cell (CIC) schemes. Note, that so-called macro-particles are introduced in order to achieve a computational load which is still manageable. Then, the space charge has to be calculated, applied to the (macro-)particles and the equation of motion has to be solved. A usual procedure is to use the Lorentz transformation in each time step to transfer between the laboratory system and the rest frame (of special relativity) and then compute the space charge fields in the rest frame. The self-electric field can be derived by solving Poisson’s equation (in the rest frame). It is transferred back to the laboratory system by the Lorentz transformation with the Lorentz factor γ.

In this contribution, we concentrate on the efficient solution of Poisson’s equation:

$$\displaystyle{\left (\frac{\mathrm{d}^{2}\varphi (x,y,z)} {\mathrm{d}x^{2}} + \frac{\mathrm{d}^{2}\varphi (x,y,z)} {\mathrm{d}y^{2}} + \frac{\mathrm{d}^{2}\varphi (x,y,z)} {\mathrm{d}z^{2}} \right ) = -\frac{\rho (x,y,z)} {\varepsilon _{0}},\quad (x,y,z) \in \varOmega }$$

where ρ(x, y, z) is the charge density, \(\varepsilon _{0}\) is the permittivity of vacuum and \(\varphi (x,y,z)\) is the electrostatic potential, i.e. we study this problem in Cartesian coordinates in 3D. Free space boundary (or some say open boundary) conditions are regarded. Although this is not true in the real accelerator, this consideration is well-introduced and most common in the simulation of space charge effects as long as the bunch is far enough apart from the walls of the enclosing vacuum tube. The common way to solve this equation is to convolute the density of charged particles and the Green’s function in free space, known as the Green’s function method. However, in some cases such as a very long cigar-shape or short pancake-shape bunch the numerical calculation may suffer from errors. The so-called integrated Green’s function (IGF) [2, 3] has especially been invented for such issues. It deals with an analytical integration rather than a numerical integration. However, the computation is rather involved and time-consuming and thus calls for an improvement to higher efficiency.

We present some appropriate methods, as accurate as the IGF method yet costing less CPU time for different practical problems. In general, the reduced integrated Green’s function (RIGF) method is suitable for all problems applying the IGF method—for instance the near-bunch field calculation. In contrast, the cutting (integrated) Green’s function (CIGF) method is only advantageous for far-bunch field calculation. A further new method, denoted as cutting reduced integrated Green’s function (CRIGF) method can accelerate the calculations even more. This routine can also be used in other Poisson solver codes to improve efficiency.

2 GF, IGF and RIGF Integral for Poisson’s Equation

The Green’s function-type methods are often-used methods to solve Poisson’s equation in free space, i.e. with open boundaries. The Green’s function is given as:

$$\displaystyle{ G(x,x',y,y',z,z') = \frac{1} {\sqrt{(x - x')^{2 } + (y - y')^{2 } + (z - z')^{2}}}. }$$
(1)

Using the Green’s function, the solution of Poisson’s equation in R 3, i.e. the continuous electrostatic potential \(\varphi\), reads as [1, 2]:

$$\displaystyle{ \varphi (x,y,z) = \frac{1} {4\pi \varepsilon _{0}} \cdot \int \int \int \rho (x',y',z')G(x,x',y,y',z,z')\mathrm{d}x'\mathrm{d}y'\mathrm{d}z'. }$$
(2)

Now, regard a cubic computational domain Ω which is discretized by N x , N y and N z steps, respectively, in each coordinate direction with equidistant step sizes h x , h y , h z . Then, the discrete integral formula is given by

$$\displaystyle{ \varphi (x_{i},y_{j},z_{k}) \approx \frac{1} {4\pi \varepsilon _{0}} \cdot \sum _{i'=1}^{N_{x} }\sum _{j'=1}^{N_{y} }\sum _{k'=1}^{N_{z} }\rho (x_{i'},y_{j'},z_{k'})\tilde{G}(x_{i},x_{i'},y_{j},y_{j'},z_{k},z_{k'}), }$$
(3)

where the grid points (x i , y j , z k ) are the center points of each integral. The integral cell is equal to the individual grid cells with side lengths h x , h y and h z . Thus, the integral over one grid cell reads as:

$$\displaystyle{ \tilde{G}(x_{i},x_{i'},y_{j},y_{j'},z_{k},z_{k'}) =\int _{ x_{i}-h_{x}/2}^{x_{i}+h_{x}/2}\int _{ y_{j}-h_{y}/2}^{y_{j}+h_{y}/2}\int _{ z_{k}-h_{z}/2}^{z_{k}+h_{z}/2}G(x_{ i},x',y_{j},y',z_{k},z')\mathrm{d}x'\mathrm{d}y'\mathrm{d}z'. }$$
(4)

In the following, for the different kinds of integrals, \(\tilde{G}\) will be specified by different subscripts. Further, regarding the calculation of the Green’s function values we will apply a coordinate translation, substituting ww′ by w for w in {x, y, z} and thus use w instead of ww′. If we apply the midpoint rule, the numerical integral is known as GF integral:

$$\displaystyle{ \tilde{G}_{GF}(x_{i},y_{j},z_{k}) = h_{x}h_{y}h_{z}G(x_{i},y_{j},z_{k}). }$$
(5)

In many applications, the midpoint rule can readily be used. Yet, often higher accuracy is needed. This can be achieved by higher order numerical integration rules or by the IGF integral:

$$\displaystyle\begin{array}{rcl} \tilde{G}_{IGF}(x_{i},y_{j},z_{k}) =\int _{ x_{i}-h_{x}/2}^{x_{i}+h_{x}/2}\int _{ y_{j}-h_{y}/2}^{y_{j}+h_{y}/2}\int _{ z_{k}-h_{z}/2}^{z_{k}+h_{z}/2}G(x',y',z')\mathrm{d}x'\mathrm{d}y'\mathrm{d}z'& & \\ = IGF(x_{i} + \frac{h_{x}} {2},y_{j} + \frac{h_{y}} {2},z_{k} + \frac{h_{z}} {2} ) - IGF(x_{i} + \frac{h_{x}} {2},y_{j} + \frac{h_{y}} {2},z_{k} -\frac{h_{z}} {2} )& & \\ -IGF(x_{i} + \frac{h_{x}} {2},y_{j} -\frac{h_{y}} {2},z_{k} + \frac{h_{z}} {2} ) - IGF(x_{i} -\frac{h_{x}} {2},y_{j} + \frac{h_{y}} {2},z_{k} + \frac{h_{z}} {2} )& & \\ +IGF(x_{i} -\frac{h_{x}} {2},y_{j} -\frac{h_{y}} {2},z_{k} + \frac{h_{z}} {2} ) + IGF(x_{i} + \frac{h_{x}} {2},y_{j} -\frac{h_{y}} {2},z_{k} -\frac{h_{z}} {2} )& & \\ +IGF(x_{i} -\frac{h_{x}} {2},y_{j} + \frac{h_{y}} {2},z_{k} -\frac{h_{z}} {2} ) - IGF(x_{i} -\frac{h_{x}} {2},y_{j} -\frac{h_{y}} {2},z_{k} -\frac{h_{z}} {2} ),& &{}\end{array}$$
(6)

where the IGF(x, y, z) function is the primitive function (antiderivative) of (1), which can be expressed as:

$$\displaystyle\begin{array}{rcl} & & IGF(x,y,z)\doteq\int \int \int \frac{1} {\sqrt{x^{2 } + y^{2 } + z^{2}}}\mathrm{d}x\mathrm{d}y\mathrm{d}z = -\frac{z^{2}} {2} \arctan ( \frac{xy} {z\sqrt{x^{2 } + y^{2 } + z^{2}}}) \\ & & -\frac{y^{2}} {2} \arctan ( \frac{xz} {y\sqrt{x^{2 } + y^{2 } + z^{2}}}) -\frac{x^{2}} {2} \arctan ( \frac{yz} {x\sqrt{x^{2 } + y^{2 } + z^{2}}}) + yz\ln (x \\ & & +\sqrt{x^{2 } + y^{2 } + z^{2}}) + xz\ln (y + \sqrt{x^{2 } + y^{2 } + z^{2}}) + xy\ln (z + \sqrt{x^{2 } + y^{2 } + z^{2}}). \\ & & {}\end{array}$$
(7)

Here, we present the simple form from [3].

RIGF integral: In order to figure out the improvement of the IGF integral compared to the GF integral, we define the local Green’s function integral relative fraction as: \(\eta _{G}(x_{i},y_{j},z_{k}) = \left \vert \delta \tilde{G}_{GF}(x_{i},y_{j},z_{k})/\tilde{G}_{IGF}(x_{i},y_{j},z_{k})\right \vert \), where \(\delta \tilde{G}_{k} =\|\tilde{ G}_{IGF_{k}} -\tilde{ G}_{GF_{k}}\|\). To evaluate the variation of η G (x i , y j , z k ) visually and easily in the grid, we chose a computational domain with a large aspect ratio: L x : L y : L z  = 1: 1: 30, where L x , L y L z are the edge lengths of the cubical domain Ω. It is discretized by 32 × 32 × 32 = 32, 768 grid points (In calculation, Green’s function needs one more point on each axis, i.e. 33 × 33 × 33 = 35, 937 [2]). In Fig. 1 (left), we use a boxplot of η G(: , : , z k ). Each column corresponds to one slice of index k. We can observe that the local relative errors exponentially decrease with an increasing value of k (z k ). Only in the very first slices, the errors are large and strongly varying. For increasing k, the errors inside a slice and compared with the neighbor slices errors coincide more and more.

Fig. 1
figure 1

(Left): The local relative error of the GF integral. (Right): A schematic plot of cutting Green’s function domain for Cartesian coordinates

The motivation of the RIGF integral is relatively natural and simple. In the calculation of \(\tilde{G}(x_{i},y_{j},z_{k})\), the IGF integral \(\tilde{G}_{IGF}(x_{i},y_{j},z_{k})\) has higher complexity than the numerical GF integral \(\tilde{G}_{GF}(x_{i},y_{j},z_{k})\), i.e. for each \(\tilde{G}_{IGF}(x_{i},y_{j},z_{k})\) we have to calculate eight terms in (6) and every term should be calculated by (7). Yet, \(\tilde{G}_{GF}(x_{i},y_{j},z_{k})\) has just one simple term, which is also faster to be evaluated. Thus, we calculate the \(\tilde{G}_{IGF}(x_{i},y_{j},z_{k})\) by the exact integral only over those grid cells where it is necessary and everywhere else we replace it by the numerical integral \(\tilde{G}_{GF}(x_{i},y_{j},z_{k})\). Practically, this means that only the near-origin parts, where the bunch is located, are treated by the IGF model. The remaining parts of the integral are calculated by the simpler standard GF model. We determine integer parameters (R x , R y , R z ) indicating at which grid line to switch from the IGF model to the GF model (see Fig. 1 (right) blue line between Ω IGF and Ω GF ). For the following, we suppose that the large aspect ratio direction is on the z-axis. Then the new integral reads as follows:

$$\displaystyle{\begin{array}{l} \tilde{G}_{RIGF}(x_{i},y_{j},z_{k}) = \left \{\begin{array}{ll} \tilde{G}_{IGF}(x_{i},y_{j},z_{k}),&(1,1,1) \leq (i,j,k) \leq (R_{x},R_{y},R_{z}); \\ \tilde{G}_{GF}(x_{i},y_{j},z_{k}),\ &\mbox{ otherwise};\\ \end{array} \right. \end{array}}$$

It has been investigated how these parameters (R x , R y , R z ) should be chosen. There are two general key aspects which should be balanced in the chosen strategy: the computational time and the achieved accuracy.

With respect to the computational time, it would be an option to choose \(R_{w} = (N_{w} + 1)/s_{w}\) for w in {x, y, z}. The larger value of s, the less computational time is needed by the IGF calculation. Regarding the cigar-shape bunch as an example, it is reasonable to choose \(R_{w} = N_{w} + 1\) for w in {x, y}. Then, the computational time depends linearly on s which ranges from 1 (IGF routine) to N z + 1 (GF routine):

$$\displaystyle{ t_{RIGF} = \frac{N_{z} + 1 - R_{z}} {N_{z} + 1} t_{GF} + \frac{R_{z}} {N_{z} + 1}t_{IGF} = \frac{R_{z}} {N_{z} + 1}(t_{IGF} - t_{GF}) + t_{GF}. }$$
(8)

On the other hand, with respect to the computational errors of the numerical integral which imply errors of the final result as well, a different strategy would be appropriate. Since the \(\tilde{G}_{IGF}\) is decreasing very fast with respect to the distance from the center of the bunch, the location where it starts to remain more or less stationary should be determined first. In practice, we use a reference function f(N z ) to locate the stationary area. For example, we choose \(1/\log _{2}N_{z}\) as f(N z ) to locate k by \(\|\tilde{G}_{IGFk-1} -\tilde{ G}_{IGFk}\|/\tilde{G}_{IGFk-1} < f(N_{z})\). Secondly, we determine the accuracy tolerance: Choose the proper R z given by the first k for which the magnitude of \(\delta \tilde{G}_{k}/\delta \tilde{G}_{k\mbox{ stable}}\) drops down to 10s, s ≥ 0, where \(\delta \tilde{G}_{k} =\|\tilde{ G}_{IGF_{k}} -\tilde{ G}_{GF_{k}}\|\). Note, s is the accuracy control integer for the RIGF. Of course, these parameters have to be determined individually for different problems under study.

3 CRIGF Method for Poisson’s Equation

In many applications, the computational domain will be considerably larger than the domain occupied by the charged bunch. As shown in Fig. 1 (right), the bunch domain Ω Bunch (the shadowed domain) lies in the center of the computational domain Ω. In this case, of course, all terms with zero charge density ρ (factor of the tilde Green’s function) can be omitted in the summation of (3). Based on the convolution theory, the irrelevance of these terms should be still true if we take a Fourier transform and use it in the fast Poisson solver. Therefore, the CIGF [4] integral is recommended for high efficiency:

$$\displaystyle{\begin{array}{l} \tilde{G}_{CIGF}(x_{i},y_{j},z_{k}) = \left \{\begin{array}{ll} \tilde{G}_{IGF}(x_{i},y_{j},z_{k}),&(1,1,1) \leq (i,j,k) \leq (C_{x},C_{y},C_{z}); \\ 0,\ &\mbox{ otherwise};\\ \end{array} \right.\end{array}}$$

where (C x , C y , C z ) is determined by the domain-bunch ratio \(\alpha _{w} = L_{w\mbox{ Bunch}}/L_{w\mbox{ Domain}}\), L w is the length for w in {x, y, z} and \(C_{w} = [(2 +\alpha _{w})/2\alpha _{w}]\). The CIGF is as accurate as the IGF. For far-bunch domain space charge simulation, the CIGF integral is efficient and does not waste calculations. When the near-bunch domain simulation takes place, the CIGF is not valid anymore. However, the RIGF can always be applied.

In total, we have the following CRIGF integral: The combination of RIGF and CIGF as the CRIGF should be more efficient than the pure CIGF for the same problem,

$$\displaystyle{\begin{array}{l} \tilde{G}_{CRIGF}(x_{i},y_{j},z_{k}) = \left \{\begin{array}{ll} \tilde{G}_{IGF}(x_{i},y_{j},z_{k}),&(1,1,1) \leq (i,j,k) \leq (R_{x},R_{y},R_{z}); \\ \tilde{G}_{GF}(x_{i},y_{j},z_{k}), &(R_{x},R_{y},R_{z}) \leq (i,j,k) \leq (C_{x},C_{y},C_{z}); \\ 0,\ &\mbox{ otherwise};\\ \end{array} \right. \end{array} }$$

where (C x , C y , C z ) and (R x , R y , R z ) are chosen as above.

In order to make the calculation of (3) more efficient, we should implement it as a cyclic convolution. The charge density ρ ex is obtained by padding ρ with zeros in all expansion grid points, the tilde Green’s function \(\tilde{G}\) is expanded symmetrically as \(\tilde{G}_{ex}\). Using 3D discrete Fourier transformation \(\mathfrak{F}\) and convolution theory, the expanded potential expression is given by:

$$\displaystyle{ [\varphi _{ex}]_{i,j,k} = \frac{1} {4\pi \varepsilon _{0}}\mathfrak{F}^{-1}\{[\mathfrak{F}\tilde{G}_{ ex}]_{i,j,k} \cdot [\mathfrak{F}\rho _{ex}]_{i,j,k}\}_{2N_{x},2N_{y},2N_{z}}. }$$
(9)

The routine of (9) can be further improved with respect to both- less storage requirement and less time consumption [1]. We use a similar procedure. Then, the storage requirement of the convolution method is 2N x × N y × N z plus two temporary 2D arrays sized 2N y × N z and 2N y × 2N z . In fact, our algorithm uses a pruned Fourier transform, whose purpose is to save time while avoiding the wasteful transforms of zeros in each direction.

4 Discussions and Examples

We regard a uniformly charged ellipsoid to achieve an analytical validation. For the longitudinal-to-transverse ratio, we choose 30. The domain-bunch ratio is 2. The relative errors are defined as follows:

$$\displaystyle{ \eta _{\varphi }(i,j,k):= \frac{\vert \varphi _{i,j,k} -\varphi _{true_{i,j,k}}\vert } {\max _{i,j,k}\vert \varphi _{true_{i,j,k}}\vert },\ \mbox{ and }\hat{\eta }_{\varphi }:=\max _{i,j,k}(\eta _{\varphi }(i,j,k)).}$$

Here, the notations are, \(\eta _{\varphi }(i,j,k)\), \(\hat{\eta }_{\varphi }\), \(\varphi _{i,j,k}\) and \(\varphi _{true_{i,j,k}}\) as the relative error of the potential at index (i, j, k), the global relative error of the potential, the computed potential at index (i, j, k) and the true potential for the same index, respectively. The algorithm is implemented in C language on an Intel 2.6 GHz CPU.

Firstly, we compare the computation time of different GF integrals with increasing grid resolution as shown in Fig. 2 (left). Here N = N w , R w  = 8 with w in {x, y, z}. RIGF is nearly 10 times faster than IGF, while CRIGF is more than 20 times faster for a domain-bunch ratio of 2. In Fig. 2 (right), we study the convergence of CRIGF with s = 2 for the accuracy control comparing to IGF and GF. As we can see, the CRIGF method agrees very well with the IGF method.

Fig. 2
figure 2

(Left): Comparison of different Green’s function integrals’ elapsed time with increasing grid resolution. (Right): Convergence study of CRIGF, IGF and GF method

The whole implementation is carried out by using the FFTW [5] package. For the serial algorithm, the speed-up is around 15–25 % including the calculation of the discrete convolution. This needs to be further improved, since the convolution’s calculation still takes most of the computational time. The efficiency results will be updated in our future studies, either by implementing a parallel algorithm or by applying a different discrete convolution routine.

5 Conclusion

In this paper, we introduced a 3D RIGF Poisson solver together with a routine called CRIGF method for beam dynamics simulations. We tested the new method with a model problem. On the practical side, RIGF is less time consuming, while it achieves almost the same accuracy as IGF for the electric potential. So we suggest to use the CRIGF routine rather than the IGF in order to speed up calculations.