Conversation
…element and adds RandomGen class
- Adds quantum excitation effects in quadrupole passmethods; - Corrects the unit of measurement of radiation constant. Since CGAMMA has units of [m]/[Gev^3], then CGAMMA*(accelerator.energy^3) will have units of [m]
…ar field instead rho
|
good job @jquentino, congrats! |
fernandohds564
left a comment
There was a problem hiding this comment.
very nice @jquentino ! Congrats! I just have a few questions and suggestions in the code.
|
To keep the group members that were on vacation updated about this PR when they return: In some talks with @fernandohds564, we decide to change the
The idea is that the user can set one of the three options by passing the correspondent integer number or a string. The feature is being developed in the branch |
**Changes summary** - Creates a struct called RadState to acess the radiative states by they name; - Creates the rad_dict, used in Pyaccel to help to define the radiative states there; - Code adaptation to use the new version of radiation_on.
| if (accelerator.radiation_on) { | ||
| T pnorm = 1 / (1 + pos.de); | ||
| if (rad_const != 0) { | ||
| T&& pnorm = 1 / (1 + pos.de); |
There was a problem hiding this comment.
should we not redefine pnorm = (1 + pos.de) here too?
I am a bit confused: the two code sections seem inconsistent to me.
There was a problem hiding this comment.
@xresende, the idea of defining the second appearance of pnorm was to avoid the unnecessary floating point division operation and substitute the other divisions by multiplications.
There was a problem hiding this comment.
the optimization idea I understand. but in one case the variable pnorm is set to (1 + pos.de) and in another to 1 / (1 + pos.de). There seems to be a name inconsistency. maybe we should use pnorm_invin one of the cases.
There was a problem hiding this comment.
I didn't want to create a new variable. The inconsistency is pointed out in the comment in front of the definition, for clarity.
Introduction
This PR contains a set of modifications in the TrackCPP structure to implement the quantum excitation (or quantum diffusion) in our tracking algorithms. Including this effect will make it possible to reach equilibrium conditions by particle tracking. The related PR in Pyaccel is: lnls-fac/pyaccel#113
In
trackcpp, theradiation_onproperty was changed to accept the integers0, 1, or 2, with each number meaning a different radiation state:no radiation,dampinganddamping+quantum excitation, respectively.In Pyaccel, it is possible to set the property with an integer, string, or a boolean (due to backward compatibility), with the following options:
The random quantum kicks can be generated from a
normaldistribution or from auniformdistribution. In Pyaccel, this can be controlled by the functionpyaccel.utils.set_distribution. It is also possible to set a seed in the pseudo-random number generator withpyaccel.utils.set_random_seed, allowing the repeatability of the simulations. By default, the distribution is'normal'and the seed is randomly chosen.In the following sections, I will show some performance tests and the results of some simulations.
Performance Tests
In addition to the inclusion of radiation effects, some pass methods were refactored to improve the tracking performance and reduce the simulation time. Special thanks to @fernandohds564, responsible for the great part of this refactorization, and to @xresende who helped to build a fast random number generator.
The below table shows the meantime to simulate a single particle for 500 turns in the SIRIUS lattice for different configurations of radiative effects. The mean was computed over 10 simulations and the uncertainty corresponds to the standard deviation.
CPU details:
Convergence to equilibrium parameters
The following Figure shows the beam's second momenta evolution in the SIRIUS model with fitted coupling and vertical dispersion (lnls-fac/pymodels#85). The simulation was carried out with 2000 particles for 25000 turns, with all particles starting from the fixed point$\approx$
[0,0,0,0,0,0]. The equilibrium values (the straight black lines in the figure) were taken from the equilibrium beam envelope matrix.Normal distributed quantum kicks:
Uniform distributed quantum kicks:
The non-diagonal terms of the beam envelope matrix were observed to oscillate around the equilibrium values. To express the oscillation amplitude in terms of more intuitive quantities, they were normalized by the correspondent diagonal terms (normalized covariance):
which ranges from -1 to 1.$i$ and $j$ are any 6D phase space coordinates pair. The results are shown below.
Normal distributed quantum kicks:
Uniform distributed quantum kicks:
Excitation rate and damping times fitting.
The above simulation was repeated in a model without coupling and for fewer turns (5000). In the absence of coupling, the beam size growth and the energy deviation evolution are simply described by the following equations:
I integrated them and fitted$Q_x$ , $Q_{\epsilon}$ and the damping times. The Figures below show the results:
Comparing the obtained values with the nominal values: