The research of dynamics of the capture and subsequent surfatron acceleration of electrons by electromagnetic waves, propagating perpendicular to the magnetic field in cosmic plasma is conducted on the basis of nonlinear numerical calculations. The optimal conditions for the realization of ultra-relativistic electron acceleration by wave packets in cosmic plasma including favorable initial phase of the wave on the particle trajectory, the sign of electron initial impulse in the direction of the wave front, the magnitude of the phase velocity of the wave are formulated. The asymptotic behavior of the electron characteristics under hard acceleration (relativistic factor, the impulse components and the captured particle velocity, position of the bottom of the effective potential well, etc.) is obtained. It is shown that the trajectories have the form of a spiral on the phase plane for trapped electrons and gradually approach the singular point of the type of stable focus. The bottom position of effective non-stationary potential well for the trapped electrons is different because it depends on the charge sign of the accelerated particle. For trapped electrons the wave phase graphics on the particle trajectory correspond to oscillations with an increasing period and decreasing amplitude with the increase of energy of the particle. The bottom of an effective non-stationary potential well is achieved by trapped particle asymptotically. Thus, the trapped electrons with different initial wave phases in their trajectory are gradually condensed on the bottom of the effective non-stationary potential well. It is important to emphasize that the packets of electromagnetic waves in the vicinity of relatively quiet stars (like the Sun) can be local sources of additional acceleration of the spectrum of cosmic rays with initial energies of the order of GeV up to the energies of hundreds of GeV and a dozen of TeV, which provides the observed variation of the spectrum of cosmic rays in this area depending on the space weather. Much more additional acceleration of cosmic rays can be in the plasma of local interstellar clouds at distances from the Sun of about parsecs. The analysis of surfatron generation mechanism of relativistic particles charged with electromagnetic waves in the relatively tranquil cosmic plasma is important for understanding the causes of the observed variability of the energy spectra of cosmic rays and the appearance of various features in their energy spectrum. This allows giving a correct interpretation of the experimental data. It is important to note that the flows of cosmic rays can significantly affect the vertical profiles of atmospheric temperature, precipitation, and the dynamics of large-scale tropical cyclogenesis