Site perso : Emmanuel Branlard

Subsections

8.1 Testing method

8.1.1 Principle

Once the space charge algorithm has been tested and validated, the rotation algorithm needed to be tested. For this, we used graphical comparisons. In order to validate our algortihm we want:
- the fields calculated for a non rotated distribution going in a direction parallel to the $ z$-axis,
and
- the fields calculated for a non rotated distribution going in a direction parallel to the $ z$-axis,
to be the same when the second ones are expressed in the proper rotated frame. Indeed, in the proper rotated frame, the second distribution is exactly the same than the first one, and the problem of solving Poisson equation is exactly the same.

8.1.2 Method used

We introduced a switch in our program allowing or not the rotation of the frame for the space charge calculation. Let's call algo-norot the algorithm that calculate the space charge without trying to find an adapted frame, and algo-rot, the one that does. With the software R ([7]) we developped a series of scripts to setup the comparison(rotating bunch, generating directions..), and do the post production(rotations and plotting of the fiedls) of the program output. The main of our stand alone algorithm, astraimpulse_main.f, has been modified to allow the output of fields values on specific points.

We used the following protocole: (figure 8.1 will help the understanding)

8.1.2.0.1 Step 1: calculating reference fields values for a non rotated distribution

  • Generate a non rotated distribution
  • Generate canonical directions (series of points aligned) with respect to the bunch dimensions on which the fields will be calculated. On figure 8.1, each direction is represented with a different color.
  • Run algo-norot and output the fields value on these points. This will be the reference values of the space charge fields.
  • Plot the fields for each directions

8.1.2.0.2 Step 2: calculating fields values for a rotated distribution

  • Rotate the previous ditribution (position and momentum multiplied by a rotation matrix $ R$)
  • Generate canonical directions for the rotated bunch. These directions correspond to the non-rotated bunch directions multiplied by $ R$.
  • Run algo-rot and output the fields value on these directions. Note that the fields returned are expressed in the laboratory frame.
  • Plot the fields for each directions

8.1.2.0.3 Step 3: rotate the fields from lab frame to rotated frame

  • The three Fields components from step 2 are rotated so that their components are expressed in the rotated frame and not in the laboratory frame.
  • Plot the rotated fields for each directions. Compare them with the one obtained at step 1.

We will further present several situations of tests, and different fields plots comparing step1 step2 and step3. These comparisons were made for each field component, plotted on each directions, along each frame axis: $ E_x$ along $ x$,$ y$,$ z$, ... $ B_z$ along $ x$,$ y$,$ z$. We won't display all of these fields components. Only one has been selected for each studied case. The reader will notice that the results from step3 and step1 are in each case identical. No other tests were performed, eventhough we are aware that a simple comparison of plots for different situations can not really be taken for a rigourous demonstration. Nevertheless, more than 30 canonical cases were studied, varying: axis of rotation, number of rotations, size, shape, and energy of the bunch. Each time, a perfect matching in shape and amplitude has been observed between step1 and step3 plots. From this, we can agree on the validity of the rotation algorithm.

Figure 8.1: Canonical directions on which the fields are plotted. for the benchmarking of rotation algorithm. Positions of the lines are according to the dimension of the bunch $ z/\sigma_z$ and $ r/\sigma_r$. (a)Original bunch - (b) rotated bunch
Image ellipsoid113-directions3 (a) Image ellipsoid113-Xpi6-directions(b)


8.1.3 Technical details

All the functions concerning the directions generation and the post-production of the results are located in the R script file LabFieldsRotCheck.r. The rotation of the bunch is part of the functions present in the file bunch.r.

8.1.3.0.1 Rotations

: One has to be carefull to rotate position and momentum. We tried to give explicit file names for the rotated distribution. If ellipse.ini is the original distribution file, and we rotate it from an angle of $ \pi/4$ around the X axis, the rotated distribution will be: ellipse-Xpi4.ini

8.1.3.0.2 Directions definition

: 15 directions are generated, each consisting of a line of $ n=100$ points. The length of each line is equal to twice the length of the bunch in this direction. For a non-rotated bunch, the directions are parallel to the laboratory axis. Five directions parallel to X or Y are plotted for $ z/\sigma_z\ \in \left\{-2 ; -1 ;0 ;1 ;2 \right\}$. Five directions parallel to Z are plotted for $ r/\sigma_r\ in \left\{0 ; 0.37 ; 0.75 ; 1.12 ; 1.5\right\}$.

8.1.3.0.3 Directions files

: Directions files are stored in the folder /bunches/directions, that's where the fortran progam will look for. The name of the file containing the directions has to be the name of the distribution, followed by -directions, for instance: ellipse-Xpi4.ini-directions. The file consist of three columns of coordinates X, Y, Z and $ 15\times n$ lines. The $ 5\times n$ first lines concern the directions parallel to X and so on for Y and Z.

8.1.3.0.4 Program output

: The ``main'' of the stand alone algorithm output a file E_DIR.out which contain the three same first columns than the direction files, with the three following columns being the three components of the electrical field expressed in the laboratory frame.








Emmanuel Branlard