1 Introduction

Today accelerator physics is a multidisciplinary kind of science. Not only physicists working in this area. Mathematicians, engineers, programmers are also involved in this process. It is obvious that the progress of further research depends more on new technologies and IT industry, which can be truly helpful for theoretical physics. Of course, all this can be said not only about accelerator physics [1, 2].

Fig. 1.
figure 1

Working process of virtual accelerator system

There are a lot of well known software packages, which are used practically everywhere. Our opinion is that the use of this or that package depends mostly on the laboratory and the research. However, the main are COSY Infinity [3], MaryLie [4], MAD [5], Trace (with different modifications) [6]. Some of them are cross-platform, others not. Though there are a FORTRAN-based applications [7, 8] among them, there trustful and stable work is out of doubt. That is the reason why scientists do not want to change anything and start working with other applications. To tell the truth, there is no new modern product that is really different from the old ones. COSY Infinity is working in the field of nonlinear dynamics, where it is used for the computation of perturbation expansions of Poincare maps to high orders. In MaryLia another approach is used. It is based on Lie algebraic methods, which may be used for particle tracking around or through a lattice and for analysis of linear and nonlinear lattice properties. In addition to single-particle tracking, Lie algebraic methods may also be used to determine how particle phase-space distribution functions evolve under transport through both linear and nonlinear elements. These methods are useful for the self-consistent treatment of space-charge effects and for the study of how moments and emittance evolve. These two approaches are rather quick, but the disadvantage is the need of recalculate all the equations if it is necessary to change the parameter.

Alternative to described above approaches became the Particle-In-cell method [9,10,11], which came from gas dynamics at the beginning of the 21 century. The main advantage of PIC method is that it does not need to approximate the equation of state. On the other hand, it is very much time depending, because of the amount of data. At present, there are a lot of modifications of PIC method using parallelization on multiple processors [12], hybrid systems [13] and the Intel XEON PHI [14]. But it does not crucially influence on the problem of data sending.

Fig. 2.
figure 2

General view of accelerator ring

The other idea of helping scientists with there work is to solve the problem of analysing data. There are plenty of works [15,16,17,18,19], where the words “Virtual Accelerator” standing near by with the control system describing. The main task for such environment is to collect data from different detectors and handled them before it can be analysed. On the Fig. 1 the work of such system is shown. The machine operator is the essential component of it. The work of operator is to coordinate the send-received collected data between different detectors and the Virtual Accelerator system. Besides, the operator detects the control system to get the instructions for what should be done to fix the errors and improve the results. But all this Virtual Accelerators are just program module working above the real machine. They are rigidly tied to one type of accelerators, and need crucial changes to be used on another.

However, the software packages for modelling beam dynamics and Virtual Accelerator for analysing data are without a doubt an essential part of accelerator physics. On our point of view, it is better to merge these two approaches and make them independent from real facilities.

2 The Main Concept

The idea of using 3D graphics for visualization is a part of a huge project of constructing so called Virtual Accelerator Laboratory (VAL) [20, 21]. The idea is to develop a model of real machine and test the behaviour of the beam inside this virtual system of control elements. As it was said above, there are a lot of projects using the words of “Virtual Accelerator” [22] and a number of packages to modelling beam dynamics. The concept of VAL is to provide the user (scientist) with block of different components, such as:

 

the block of control elements: :

with the help of it the user can construct the main view of the future accelerator. The general view of circular machine is shown on Fig. 2.

the block of particle distribution: :

which forms the initial particle distribution coming from the source.

the block of data: :

the data base with all calculated results.

the block of expert system: :

where the collected data is analysed and the main reasons of received errors are given as a result to user (see Fig. 3).

 

Fig. 3.
figure 3

The working process of the expert system

The advantage of using such VAL is that we can construct a machine before it is really exist. And based on the results of the expert system the advices to build the real accelerator can be done. That significantly saves time and financial resources. Besides, the prediction of particle motion with different nonlinear effects can be made. VAL works in a distributed environment that is why, the user of the system can use different electronic devices to check the intermediate results of the work. Figure 4 shows this idea.

Fig. 4.
figure 4

Distributed environment of VAL

On Fig. 5 the general scheme of program modules is shown.

Fig. 5.
figure 5

Main modules of the system

3 About the Approach

The main idea of the method was described in [20]. We have the initial distribution and the control system of elements. If we speak about elements, everything is well known and there are no great problems to construct such system. On the contrary, the difficulty is how to form the initial distribution. There is no proved and stable approach to do this easily.

The easy task is to work with the uniform distribution, but in real case we could not get it from the source. We are trying to use normal and some other distributions, described in [23], to make it more natural. Passing throw the control system the initial distribution, created on the first step and formed as matrix is modified in new intermediate matrix \(\mathbf{X} { }\).

$$\begin{aligned} {\mathbf{X} { }}_0 = \left( \begin{array}{cccc} X_1 &{} X_2 &{} \dots &{} X_n\\ Y_1 &{} XY_2 &{} \dots &{} Y_n\\ Px_1 &{} Px_2 &{} \dots &{} Px_n\\ Py_1 &{} Py_2 &{} \dots &{} Py_n\\ \dots &{} \dots &{} \dots &{} \dots \\ \end{array} \right) \end{aligned}$$

Following the predictor-corrector algorithm [24] this new matrix is the base matrix to correct the initial distribution and form it for the new turn. The Fig. 6 shows this idea.

Fig. 6.
figure 6

Correction of beam distribution

The general view of the equation of motion is

$$\begin{aligned} X = \sum ^k_{i=0} P^{1i} (t) X^{[i]}_0 \end{aligned}$$
(1)

In the case of space charge, using the described approach [20], Eq. (1) can be rewritten

$$\begin{aligned} \frac{d\mathbf{X} { }}{ds} = \sum _{k=1}^{\infty }\left( {\mathbb {P}}^{1k}_{ext}(s) + {\mathbb {P}}^{1k}_{self}(s)\right) \mathbf{X} { }^{[k]} \end{aligned}$$
(2)

For example, the control matrix \({\mathbb {P}}^{11}\) in this case can take the following view

$$\begin{aligned} {\mathbb {P}}^{11}(s) = {\mathbb {P}}^{11}_{ext}(s) + {\mathbb {P}}^{11}_{self}(s) \end{aligned}$$

where

$$\begin{aligned} {\mathbb {P}}^{11}_{ext}(s) = \left( \begin{array}{cccc} 0 &{} 1 &{} 0 &{} 0 \\ -k_x &{} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} 0 &{} 1 \\ 0 &{} 0 &{} -k_y &{} 0\\ \end{array} \right) , \end{aligned}$$
$$\begin{aligned} {\mathbb {P}}^{11}_{self}(s) = \left( \begin{array}{cccc} 0 &{} 0 &{} 0 &{} 0 \\ -{\eta }_x &{} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} {\eta }_y &{} 0\\ \end{array} \right) , \end{aligned}$$

If we speak about nonlinear case, the described above equations can be also used with some modifications.

The matrix for \(\mathbf{X} { }\) is formed by the Kronecker composition:

$$\begin{aligned} {\mathbf{X} { }}^3 = \left( \begin{array}{c} \mathbf{X} { }\\ \mathbf{Y} { }\\ {\mathbf{X} { }}^{[3]}\\ {\mathbf{X} { }}^{[2]}\bigotimes \mathbf{Y} { }\\ \mathbf{X} { }\bigotimes {\mathbf{Y} { }}^{[2]}\\ {\mathbf{Y} { }}^{[3]} \end{array} \right) . \end{aligned}$$

And for matrices \(\mathbb {P}\) we add new order:

$$\begin{aligned} {\mathbb {P}}^{11} = \left( \begin{array}{cc} {\mathbb {P}}^{11}_x &{} \mathbb {O}\\ \mathbb {O}&{} {\mathbb {P}}^{11}_y \end{array} \right) , \end{aligned}$$
$$\begin{aligned} {\mathbb {P}}^{13} = \left( \begin{array}{cccc} {\mathbb {Q}}^{11}_x &{} \mathbb {O}&{} {\mathbb {Q}}^{13}_x &{} \mathbb {O}\\ \mathbb {O}&{} {\mathbb {Q}}^{22}_y &{} \mathbb {O}&{} {\mathbb {Q}}^{24}_y \end{array} \right) , \end{aligned}$$

where, for example, elements of \({\mathbb {Q}}^{11}_x\) can be

$$\begin{aligned} \mathbb {A}(1,1) = h \frac{13\cos (l\sqrt{|h|}) - \cos (3 l\sqrt{|h|}) - 36 l\sqrt{|h|} \sin (l\sqrt{|h|})}{192} \end{aligned}$$
$$\begin{aligned} \mathbb {A}(1,2) = \sqrt{|h|}\frac{-5\sin (l \sqrt{|h|}) - 13 \sin (3 l \sqrt{|h|}) + 12 l \sqrt{|h|} cos(l \sqrt{|h|})}{64} \end{aligned}$$
$$\begin{aligned} \mathbb {A}(1,3) = - \frac{\cos (l\sqrt{|h|}) - \cos (3 l \sqrt{|h|}) + 12 l\sqrt{|h| sin(l\sqrt{|h|})}}{64} \end{aligned}$$
$$\begin{aligned} \mathbb {A}(1,4) = \frac{36 l\sqrt{|h|} \cos (l\sqrt{|h|}) + 13\sin (3 l \sqrt{|h|}) - 75\sin (l\sqrt{|h|})}{192\sqrt{|h|}} \end{aligned}$$

4 Reasons of Using Graphical Processors

As it was said above there are a lot of works describing the parallezation of principally PIC method (see works [12, 25]). Though, the approach we use is a matrix based method of Ordinary Differential Equation solving and it gives us some advantages of paralleling them on SMP systems, for example, it became clear that there it is no matter how much resources we have, using only this technologies we a limited. As the method allows to present the intermediate results and the solution of the system in the form of matrices it is better to use the graphical processors [26].

Fig. 7.
figure 7

Parallel code different number of turns using OpenMP concept

The present research shows that there is no great benefit via parallelization of computational code for one particle by using OpenMP library (see Fig. 7). In this case overhead on data sending is significant. On the other hand, we forms the initial distribution and the intermediate results in the form of matrices and that allows us to use GPUs for there direct appointment. But the idea is to use graphical processor not only for general purpose but for drawing as well.

To simplify this process the 3D Virtual Cluster [27] is going to be used. It helps to visualized the results of calculations with some modified based resources.

5 Conclusion

Our goal is to provide the scientist with a clear and easy environment to simulate and predict the behaviour of the beam. The result of the simulation should be shown as a motion picture. We do not guarantee the work of the system in the real time, but it should be the problem-solving environment, that can help the user to construct the needed structure of the accelerator. The previous work was devoted to the particle simulation using matrix approach. Some parallelization of this method was made. But the results showed that there can be some other benefits for modelling beam dynamics using this approach. In this work we sum up all that was done before to transform the simulation method to the problem-solving environment.