OPAL (Object Oriented Parallel Accelerator Library)
2.2.0
OPAL
|
Finds a closed orbit of a cyclotron for a given energy. More...
#include <ClosedOrbitFinder.h>
Public Types | |
typedef Value_type | value_type |
Type of variables. More... | |
typedef Size_type | size_type |
Type for specifying sizes. More... | |
typedef std::vector< value_type > | container_type |
Type of container for storing quantities (path length, orbit, etc.) More... | |
typedef std::vector< value_type > | state_type |
Type for holding state of ODE values. More... | |
typedef std::function< void(const state_type &, state_type &, const double)> | function_t |
Public Member Functions | |
ClosedOrbitFinder (value_type E0, size_type N, Cyclotron *cycl, bool domain=true, int Nsectors=1) | |
Sets the initial values for the integration and calls findOrbit(). More... | |
container_type | getInverseBendingRadius (const value_type &angle=0) |
Returns the inverse bending radius (size of container N+1) More... | |
container_type | getPathLength (const value_type &angle=0) |
Returns the step lengths of the path (size of container N+1) More... | |
container_type | getFieldIndex (const value_type &angle=0) |
Returns the field index (size of container N+1) More... | |
std::pair< value_type, value_type > | getTunes () |
Returns the radial and vertical tunes (in that order) More... | |
container_type | getOrbit (value_type angle=0) |
container_type | getMomentum (value_type angle=0) |
value_type | getAverageRadius () |
Returns the average orbit radius. More... | |
value_type | getFrequencyError () |
Returns the frequency error. More... | |
bool | isConverged () |
Returns true if a closed orbit could be found. More... | |
bool | findOrbit (value_type accuracy, size_type maxit, value_type ekin, value_type dE=1.0, value_type rguess=-1.0, bool isTuneMode=false) |
Computes the closed orbit. More... | |
void | computeOrbitProperties (const value_type &E) |
Fills in the values of h_m, ds_m, fidx_m. More... | |
Private Member Functions | |
value_type | computeTune (const std::array< value_type, 2 > &, value_type, size_type) |
This function is called by the function getTunes(). More... | |
bool | findOrbitOfEnergy_m (const value_type &, container_type &, value_type &, const value_type &, size_type) |
container_type | rotate (value_type angle, container_type &orbitProperty) |
This function computes nzcross_ which is used to compute the tune in z-direction and the frequency error. More... | |
Private Attributes | |
std::array< value_type, 2 > | x_m |
Stores current position in horizontal direction for the solutions of the ODE with different initial values. More... | |
std::array< value_type, 2 > | px_m |
Stores current momenta in horizontal direction for the solutions of the ODE with different initial values. More... | |
std::array< value_type, 2 > | z_m |
Stores current position in vertical direction for the solutions of the ODE with different initial values. More... | |
std::array< value_type, 2 > | pz_m |
Stores current momenta in vertical direction for the solutions of the ODE with different initial values. More... | |
container_type | h_m |
Stores the inverse bending radius. More... | |
container_type | ds_m |
Stores the step length. More... | |
container_type | r_m |
Stores the radial orbit (size: N_m+1) More... | |
container_type | vz_m |
Stores the vertical oribt (size: N_m+1) More... | |
container_type | pr_m |
Stores the radial momentum. More... | |
container_type | vpz_m |
Stores the vertical momentum. More... | |
container_type | fidx_m |
Stores the field index. More... | |
size_type | nxcross_m |
Counts the number of zero-line crossings in horizontal direction (used for computing horizontal tune) More... | |
size_type | nzcross_m |
Counts the number of zero-line crossings in vertical direction (used for computing vertical tune) More... | |
value_type | E0_m |
Is the rest mass [MeV / c**2]. More... | |
value_type | wo_m |
Is the nominal orbital frequency. More... | |
size_type | N_m |
Number of integration steps. More... | |
value_type | dtheta_m |
Is the angle step size. More... | |
value_type | ravg_m |
Is the average radius. More... | |
value_type | phase_m |
Is the phase. More... | |
bool | domain_m |
int | nSectors_m |
Stepper | stepper_m |
Defines the stepper for integration of the ODE's. More... | |
std::function< double(double)> | acon_m = [](double wo) { return Physics::c / wo; } |
std::function< double(double, double)> | bcon_m |
Cyclotron unit \( \left[T\right] \) (Tesla) More... | |
Cyclotron * | cycl_m |
Finds a closed orbit of a cyclotron for a given energy.
Definition at line 42 of file ClosedOrbitFinder.h.
typedef std::vector<value_type> ClosedOrbitFinder< Value_type, Size_type, Stepper >::container_type |
Type of container for storing quantities (path length, orbit, etc.)
Definition at line 50 of file ClosedOrbitFinder.h.
typedef std::function<void(const state_type&, state_type&, const double)> ClosedOrbitFinder< Value_type, Size_type, Stepper >::function_t |
Definition at line 54 of file ClosedOrbitFinder.h.
typedef Size_type ClosedOrbitFinder< Value_type, Size_type, Stepper >::size_type |
Type for specifying sizes.
Definition at line 48 of file ClosedOrbitFinder.h.
typedef std::vector<value_type> ClosedOrbitFinder< Value_type, Size_type, Stepper >::state_type |
Type for holding state of ODE values.
Definition at line 52 of file ClosedOrbitFinder.h.
typedef Value_type ClosedOrbitFinder< Value_type, Size_type, Stepper >::value_type |
Type of variables.
Definition at line 46 of file ClosedOrbitFinder.h.
ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder | ( | value_type | E0, |
size_type | N, | ||
Cyclotron * | cycl, | ||
bool | domain = true , |
||
int | Nsectors = 1 |
||
) |
Sets the initial values for the integration and calls findOrbit().
E0 | is the potential energy (particle energy at rest) [MeV]. |
N | specifies the number of splits (2pi/N), i.e number of integration steps |
cycl | is the cyclotron element |
domain | is a boolean (default: true). If "true" the closed orbit is computed over a single sector, otherwise over 2*pi. |
Nsectors | is an int (default: 1). Number of sectors that the field map is averaged over in order to avoid first harmonic. Only valid if domain is false |
Definition at line 246 of file ClosedOrbitFinder.h.
References ClosedOrbitFinder< Value_type, Size_type, Stepper >::cycl_m, ClosedOrbitFinder< Value_type, Size_type, Stepper >::domain_m, ClosedOrbitFinder< Value_type, Size_type, Stepper >::ds_m, ClosedOrbitFinder< Value_type, Size_type, Stepper >::fidx_m, Cyclotron::getBScale(), Cyclotron::getCyclotronType(), Cyclotron::getFieldFlag(), Cyclotron::getFMHighE(), Cyclotron::getFMLowE(), Cyclotron::getSymmetry(), ClosedOrbitFinder< Value_type, Size_type, Stepper >::h_m, ClosedOrbitFinder< Value_type, Size_type, Stepper >::N_m, ClosedOrbitFinder< Value_type, Size_type, Stepper >::pr_m, ClosedOrbitFinder< Value_type, Size_type, Stepper >::r_m, Cyclotron::read(), ClosedOrbitFinder< Value_type, Size_type, Stepper >::vpz_m, and ClosedOrbitFinder< Value_type, Size_type, Stepper >::vz_m.
void ClosedOrbitFinder< Value_type, Size_type, Stepper >::computeOrbitProperties | ( | const value_type & | E | ) |
Fills in the values of h_m, ds_m, fidx_m.
Definition at line 818 of file ClosedOrbitFinder.h.
References sqrt(), and value_type().
|
private |
This function is called by the function getTunes().
Transfer matrix Y = [y11, y12; y21, y22] (see Gordon paper for more details).
y | are the positions (elements y11 and y12 of Y) |
py2 | is the momentum of the second solution (element y22 of Y) |
ncross | is the number of sign changes (#crossings of zero-line) |
Definition at line 760 of file ClosedOrbitFinder.h.
References acos(), cos(), fabs(), Physics::pi, sin(), Physics::two_pi, and Physics::u_two_pi.
bool ClosedOrbitFinder< Value_type, Size_type, Stepper >::findOrbit | ( | value_type | accuracy, |
size_type | maxit, | ||
value_type | ekin, | ||
value_type | dE = 1.0 , |
||
value_type | rguess = -1.0 , |
||
bool | isTuneMode = false |
||
) |
Computes the closed orbit.
accuracy | specifies the accuracy of the closed orbit |
maxit | is the maximal number of iterations done for finding the closed orbit |
ekin | energy for which to find closed orbit (in tune mode: upper limit of range) |
dE | step increase [MeV] |
rguess | initial radius guess in [mm] |
isTuneMode | comptute tunes of all energies in one sweep |
Definition at line 396 of file ClosedOrbitFinder.h.
References endl(), Hypervolume::fs, OpalData::getInputBasename(), OpalData::getInstance(), max(), EmissionModelT::NONE, and sqrt().
|
private |
Definition at line 573 of file ClosedOrbitFinder.h.
References endl(), sqrt(), Physics::two_pi, Physics::u_two_pi, ClassicException::what(), and ClassicException::where().
|
inline |
Returns the average orbit radius.
Definition at line 377 of file ClosedOrbitFinder.h.
|
inline |
Returns the field index (size of container N+1)
Definition at line 315 of file ClosedOrbitFinder.h.
ClosedOrbitFinder< Value_type, Size_type, Stepper >::value_type ClosedOrbitFinder< Value_type, Size_type, Stepper >::getFrequencyError | ( | ) |
Returns the frequency error.
Definition at line 384 of file ClosedOrbitFinder.h.
|
inline |
Returns the inverse bending radius (size of container N+1)
Definition at line 295 of file ClosedOrbitFinder.h.
|
inline |
Returns the momentum of the orbit (size of container N+1)starting at specific angle (only makes sense when computing the closed orbit for a whole turn) (default value: 0°), \( \left[ p_{r} \right] = \si{m}\). Attention: It computes the starting index of the array. If it's not an integer it just cuts the floating point part, i.e. it takes the next starting index below. There's no interpolation of the momentum.
angle | is the start angle for the output. Has to be within [0°,360°[ (default: 0°). |
Definition at line 345 of file ClosedOrbitFinder.h.
References for_each().
|
inline |
Returns the closed orbit (size of container N+1) starting at specific angle (only makes sense when computing the closed orbit for a whole turn) (default value: 0°). Attention: It computes the starting index of the array. If it's not an integer it just cuts the floating point part, i.e. it takes the next starting index below. There's no interpolation of the radius.
angle | is the start angle for the output. Has to be within [0°,360°[ (default: 0°). |
Definition at line 335 of file ClosedOrbitFinder.h.
|
inline |
Returns the step lengths of the path (size of container N+1)
Definition at line 305 of file ClosedOrbitFinder.h.
std::pair< Value_type, Value_type > ClosedOrbitFinder< Value_type, Size_type, Stepper >::getTunes | ( | ) |
Returns the radial and vertical tunes (in that order)
Definition at line 323 of file ClosedOrbitFinder.h.
bool ClosedOrbitFinder< Value_type, Size_type, Stepper >::isConverged | ( | ) |
Returns true if a closed orbit could be found.
|
inlineprivate |
This function computes nzcross_ which is used to compute the tune in z-direction and the frequency error.
This function rotates the calculated closed orbit finder properties to the initial angle
Definition at line 873 of file ClosedOrbitFinder.h.
|
private |
This quantity is defined in the paper "Transverse-Longitudinal Coupling by Space Charge in Cyclotrons" of Dr. Christian Baumgarten (2012) The lambda function takes the orbital frequency \( \omega_{o} \) (also defined in paper) as input argument.
Definition at line 226 of file ClosedOrbitFinder.h.
|
private |
Cyclotron unit \( \left[T\right] \) (Tesla)
The lambda function takes the orbital frequency \( \omega_{o} \) as input argument.
Definition at line 232 of file ClosedOrbitFinder.h.
|
private |
Definition at line 236 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Stores the last orbit value (since we have to return to the beginning to check the convergence in the findOrbit() function. This last value is then deleted from the array but is stored in lastOrbitVal_m to compute the vertical oscillations) Stores the last momentum value (since we have to return to the beginning to check the convergence in the findOrbit() function. This last value is then deleted from the array but is stored in lastMomentumVal_m to compute the vertical oscillations) Boolean which is true by default. "true": orbit integration over one sector only, "false": integration over 2*pi
Definition at line 211 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Stores the step length.
Definition at line 157 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Is the angle step size.
Definition at line 185 of file ClosedOrbitFinder.h.
|
private |
Is the rest mass [MeV / c**2].
Definition at line 175 of file ClosedOrbitFinder.h.
|
private |
Stores the field index.
Definition at line 167 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Stores the inverse bending radius.
Definition at line 155 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Number of integration steps.
Definition at line 183 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Number of sectors to average the field map over in order to avoid first harmonic. Only valid if domain is false
Definition at line 216 of file ClosedOrbitFinder.h.
|
private |
Counts the number of zero-line crossings in horizontal direction (used for computing horizontal tune)
Definition at line 170 of file ClosedOrbitFinder.h.
|
private |
Counts the number of zero-line crossings in vertical direction (used for computing vertical tune)
Definition at line 172 of file ClosedOrbitFinder.h.
|
private |
Is the phase.
Definition at line 191 of file ClosedOrbitFinder.h.
|
private |
Stores the radial momentum.
Definition at line 163 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Stores current momenta in horizontal direction for the solutions of the ODE with different initial values.
Definition at line 148 of file ClosedOrbitFinder.h.
|
private |
Stores current momenta in vertical direction for the solutions of the ODE with different initial values.
Definition at line 152 of file ClosedOrbitFinder.h.
|
private |
Stores the radial orbit (size: N_m+1)
Definition at line 159 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Is the average radius.
Definition at line 188 of file ClosedOrbitFinder.h.
|
private |
Defines the stepper for integration of the ODE's.
Definition at line 219 of file ClosedOrbitFinder.h.
|
private |
Stores the vertical momentum.
Definition at line 165 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Stores the vertical oribt (size: N_m+1)
Definition at line 161 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder().
|
private |
Is the nominal orbital frequency.
Definition at line 181 of file ClosedOrbitFinder.h.
|
private |
Stores current position in horizontal direction for the solutions of the ODE with different initial values.
Definition at line 146 of file ClosedOrbitFinder.h.
|
private |
Stores current position in vertical direction for the solutions of the ODE with different initial values.
Definition at line 150 of file ClosedOrbitFinder.h.