OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
EnvelopeSlice.cpp
Go to the documentation of this file.
2 #include <Physics/Physics.h>
3 
5 
6  for(auto &slice_param : p) slice_param = 0.0;
7  for(auto &slice_param : p_old) slice_param = 0.0;
8  double initial_gamma = 1.0 + (1.0e6 * Physics::q_e /
10  p[SLI_beta] = sqrt(1.0 / (1.0 - (1.0 / (initial_gamma * initial_gamma))));
11  p[SLI_x] = 1.0e-3;
12  p[SLI_y] = 1.0e-3;
13  isValid_m = 1;
14 
15  hasSliceBeenEmitted_m = false;
16  backup();
17 }
18 
20 
22  for(auto i = 0; i < SLNPAR; i++)
23  p_old[i] = p[i];
24 }
25 
27 
29  for(auto i = 0; i < SLNPAR; i++)
30  p[i] = p_old[i];
31 }
32 
34 
35  int changed = 0;
36  if(isValid_m) {
37  isValid_m = (p[SLI_beta] > 0.0);
38  if(!isValid_m)
39  changed = 1;
40  }
41  return changed;
42 }
43 
y beam size y (rms) [m]
Definition: EnvelopeSlice.h:16
beta normalized velocity (total) [-]
Definition: EnvelopeSlice.h:10
constexpr double c
The velocity of light in m/s.
Definition: Physics.h:52
bool hasSliceBeenEmitted_m
Definition: EnvelopeSlice.h:65
double p[SLNPAR]
parameters
Definition: EnvelopeSlice.h:45
Tps< T > sqrt(const Tps< T > &x)
Square root.
Definition: TpsMath.h:91
number of slice parameters
Definition: EnvelopeSlice.h:28
constexpr double q_e
The elementary charge in As.
Definition: Physics.h:76
x beam size x (rms) [m]
Definition: EnvelopeSlice.h:12
constexpr double EMASS
Definition: Physics.h:140
double p_old[SLNPAR]
parameters before last integration step (backup)
Definition: EnvelopeSlice.h:48