|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
#include <ClosedOrbitFinder.h>
Public Types | |
| typedef Value_type | value_type |
| Type of variables. | |
| typedef Size_type | size_type |
| Type for specifying sizes. | |
| typedef std::vector< value_type > | container_type |
| Type of container for storing quantities (path length, orbit, etc.). | |
| typedef std::vector< value_type > | state_type |
| Type for holding state of ODE values. | |
| typedef std::function< void(const state_type &, state_type &, const double)> | function_t |
Public Member Functions | |
| ClosedOrbitFinder (value_type E0, value_type q, size_type N, Cyclotron *cycl, bool domain=true, int Nsectors=1) | |
| Sets the initial values for the integration and calls findOrbit(). | |
| container_type | getInverseBendingRadius (const value_type &angle=0) |
| Returns the inverse bending radius (size of container N+1). | |
| container_type | getPathLength (const value_type &angle=0) |
| Returns the step lengths of the path (size of container N+1). | |
| container_type | getFieldIndex (const value_type &angle=0) |
| Returns the field index (size of container N+1). | |
| std::pair< value_type, value_type > | getTunes () |
| Returns the radial and vertical tunes (in that order). | |
| container_type | getOrbit (value_type angle=0) |
| container_type | getMomentum (value_type angle=0) |
| value_type | getAverageRadius () |
| Returns the average orbit radius. | |
| value_type | getFrequencyError () |
| Returns the frequency error. | |
| bool | isConverged () |
| Returns true if a closed orbit could be found. | |
| 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. | |
| void | computeOrbitProperties (const value_type &E) |
| Fills in the values of h_m, ds_m, fidx_m. | |
Private Member Functions | |
| value_type | computeTune (const std::array< value_type, 2 > &, value_type, size_type) |
| This function is called by the function getTunes(). | |
| bool | findOrbitOfEnergy_m (const value_type &, container_type &, value_type &, const value_type &, size_type) |
| container_type | rotate (value_type angle, const container_type &orbitProperty) |
| This function computes nzcross_ which is used to compute the tune in z-direction and the frequency error. | |
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. | |
| std::array< value_type, 2 > | px_m |
| Stores current momenta in horizontal direction for the solutions of the ODE with different initial values. | |
| std::array< value_type, 2 > | z_m |
| Stores current position in vertical direction for the solutions of the ODE with different initial values. | |
| std::array< value_type, 2 > | pz_m |
| Stores current momenta in vertical direction for the solutions of the ODE with different initial values. | |
| container_type | h_m |
| Stores the inverse bending radius. | |
| container_type | ds_m |
| Stores the step length. | |
| container_type | r_m |
| Stores the radial orbit (size: N_m+1). | |
| container_type | vz_m |
| Stores the vertical oribt (size: N_m+1). | |
| container_type | pr_m |
| Stores the radial momentum. | |
| container_type | vpz_m |
| Stores the vertical momentum. | |
| container_type | fidx_m |
| Stores the field index. | |
| size_type | nxcross_m |
| Counts the number of zero-line crossings in horizontal direction (used for computing horizontal tune). | |
| size_type | nzcross_m |
| Counts the number of zero-line crossings in vertical direction (used for computing vertical tune). | |
| value_type | E0_m |
| Is the rest mass [MeV / c**2]. | |
| value_type | q_m |
| value_type | wo_m |
| Is the nominal orbital frequency. | |
| size_type | N_m |
| Number of integration steps. | |
| value_type | dtheta_m |
| Is the angle step size. | |
| value_type | ravg_m |
| Is the average radius. | |
| value_type | phase_m |
| Is the phase. | |
| bool | domain_m |
| int | nSectors_m |
| Stepper | stepper_m |
| Defines the stepper for integration of the ODE's. | |
| 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). | |
| Cyclotron * | cycl_m |
Definition at line 54 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 62 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 66 of file ClosedOrbitFinder.h.
| typedef Size_type ClosedOrbitFinder< Value_type, Size_type, Stepper >::size_type |
Type for specifying sizes.
Definition at line 60 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 64 of file ClosedOrbitFinder.h.
| typedef Value_type ClosedOrbitFinder< Value_type, Size_type, Stepper >::value_type |
Type of variables.
Definition at line 58 of file ClosedOrbitFinder.h.
| ClosedOrbitFinder< Value_type, Size_type, Stepper >::ClosedOrbitFinder | ( | value_type | E0, |
| value_type | q, | ||
| 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]. |
| q | is the particle charge [e] |
| 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 262 of file ClosedOrbitFinder.h.
References ClosedOrbitFinder(), cycl_m, domain_m, ds_m, dtheta_m, E0_m, fidx_m, h_m, N_m, nSectors_m, nxcross_m, nzcross_m, phase_m, pi, pr_m, q_m, r_m, ravg_m, stepper_m, vpz_m, vz_m, and wo_m.
Referenced by ClosedOrbitFinder().
| void ClosedOrbitFinder< Value_type, Size_type, Stepper >::computeOrbitProperties | ( | const value_type & | E | ) |
|
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 793 of file ClosedOrbitFinder.h.
References cos(), cycl_m, domain_m, Physics::pi, Physics::two_pi, and Physics::u_two_pi.
Referenced by getTunes().
| 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 [m] |
| isTuneMode | comptute tunes of all energies in one sweep |
Definition at line 415 of file ClosedOrbitFinder.h.
References acon_m, computeOrbitProperties(), cycl_m, domain_m, E0_m, endl(), findOrbitOfEnergy_m(), OpalData::getAuxiliaryOutputDirectory(), OpalData::getInputBasename(), OpalData::getInstance(), getMomentum(), getOrbit(), getTunes(), gmsg, level3(), N_m, NONE, phase_m, pr_m, r_m, ravg_m, vpz_m, vz_m, and wo_m.
|
private |
Definition at line 605 of file ClosedOrbitFinder.h.
References acon_m, bcon_m, cycl_m, dtheta_m, E0_m, endl(), gmsg, N_m, nSectors_m, nxcross_m, nzcross_m, phase_m, pr_m, px_m, pz_m, r_m, stepper_m, Physics::two_pi, Physics::u_two_pi, vpz_m, vz_m, OpalException::what(), OpalException::where(), wo_m, x_m, and z_m.
Referenced by findOrbit().
|
inline |
Returns the average orbit radius.
Definition at line 398 of file ClosedOrbitFinder.h.
References ravg_m.
|
inline |
Returns the field index (size of container N+1).
Definition at line 334 of file ClosedOrbitFinder.h.
References fidx_m, and rotate().
| ClosedOrbitFinder< Value_type, Size_type, Stepper >::value_type ClosedOrbitFinder< Value_type, Size_type, Stepper >::getFrequencyError | ( | ) |
Returns the frequency error.
Definition at line 405 of file ClosedOrbitFinder.h.
References phase_m.
|
inline |
Returns the inverse bending radius (size of container N+1).
Definition at line 312 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 366 of file ClosedOrbitFinder.h.
References acon_m, pr_m, rotate(), and wo_m.
Referenced by findOrbit().
|
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 355 of file ClosedOrbitFinder.h.
Referenced by findOrbit().
|
inline |
Returns the step lengths of the path (size of container N+1).
Definition at line 323 of file ClosedOrbitFinder.h.
References ds_m, and rotate().
| 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 343 of file ClosedOrbitFinder.h.
References computeTune(), nxcross_m, nzcross_m, px_m, pz_m, x_m, and z_m.
Referenced by findOrbit().
| 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 906 of file ClosedOrbitFinder.h.
References dtheta_m, and Physics::two_pi.
Referenced by getFieldIndex(), getInverseBendingRadius(), getMomentum(), getOrbit(), and getPathLength().
|
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 242 of file ClosedOrbitFinder.h.
Referenced by computeOrbitProperties(), findOrbit(), findOrbitOfEnergy_m(), and getMomentum().
|
private |
Cyclotron unit \( \left[T\right] \) (Tesla).
The lambda function takes the orbital frequency \( \omega_{o} \) as input argument.
Definition at line 248 of file ClosedOrbitFinder.h.
Referenced by computeOrbitProperties(), and findOrbitOfEnergy_m().
|
private |
Definition at line 252 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), computeTune(), findOrbit(), and findOrbitOfEnergy_m().
|
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 227 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeTune(), and findOrbit().
|
private |
Stores the step length.
Definition at line 170 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), and getPathLength().
|
private |
Is the angle step size.
Definition at line 201 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbitOfEnergy_m(), and rotate().
|
private |
Is the rest mass [MeV / c**2].
Definition at line 188 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), and findOrbitOfEnergy_m().
|
private |
Stores the field index.
Definition at line 180 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), and getFieldIndex().
|
private |
Stores the inverse bending radius.
Definition at line 168 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), and getInverseBendingRadius().
|
private |
Number of integration steps.
Definition at line 199 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), and findOrbitOfEnergy_m().
|
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 232 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), and findOrbitOfEnergy_m().
|
private |
Counts the number of zero-line crossings in horizontal direction (used for computing horizontal tune).
Definition at line 183 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), findOrbitOfEnergy_m(), and getTunes().
|
private |
Counts the number of zero-line crossings in vertical direction (used for computing vertical tune).
Definition at line 185 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), findOrbitOfEnergy_m(), and getTunes().
|
private |
Is the phase.
Definition at line 207 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), findOrbit(), findOrbitOfEnergy_m(), and getFrequencyError().
|
private |
Stores the radial momentum.
Definition at line 176 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), findOrbitOfEnergy_m(), and getMomentum().
|
private |
Stores current momenta in horizontal direction for the solutions of the ODE with different initial values.
Definition at line 161 of file ClosedOrbitFinder.h.
Referenced by findOrbitOfEnergy_m(), and getTunes().
|
private |
Stores current momenta in vertical direction for the solutions of the ODE with different initial values.
Definition at line 165 of file ClosedOrbitFinder.h.
Referenced by findOrbitOfEnergy_m(), and getTunes().
|
private |
Definition at line 191 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder().
|
private |
Stores the radial orbit (size: N_m+1).
Definition at line 172 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), findOrbitOfEnergy_m(), and getOrbit().
|
private |
Is the average radius.
Definition at line 204 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), and getAverageRadius().
|
private |
Defines the stepper for integration of the ODE's.
Definition at line 235 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), and findOrbitOfEnergy_m().
|
private |
Stores the vertical momentum.
Definition at line 178 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), findOrbit(), and findOrbitOfEnergy_m().
|
private |
Stores the vertical oribt (size: N_m+1).
Definition at line 174 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), and findOrbitOfEnergy_m().
|
private |
Is the nominal orbital frequency.
Definition at line 197 of file ClosedOrbitFinder.h.
Referenced by ClosedOrbitFinder(), computeOrbitProperties(), findOrbit(), findOrbitOfEnergy_m(), and getMomentum().
|
private |
Stores current position in horizontal direction for the solutions of the ODE with different initial values.
Definition at line 159 of file ClosedOrbitFinder.h.
Referenced by findOrbitOfEnergy_m(), and getTunes().
|
private |
Stores current position in vertical direction for the solutions of the ODE with different initial values.
Definition at line 163 of file ClosedOrbitFinder.h.
Referenced by findOrbitOfEnergy_m(), and getTunes().