Dipole

class zgoubidoo.commands.magnetique.Dipole(label1: str = '', label2: str = '', *params, **kwargs)[source]

Bases: zgoubidoo.commands.magnetique.PolarMagnet

Dipole magnet, polar frame.

Zgoubi manual description

DIPOLE provides a model of a dipole field, possibly with transverse field indices. The field along a particle trajectory is computed as the particle motion proceeds, straightforwardly from the dipole geometrical boundaries. Field simulation in DIPOLE is the same as used in DIPOLE-M and AIMANT for computing a field map; the essential difference in DIPOLE is in its skipping that intermediate stage of field map generation found in DIPOLE-M and AIMANT.

DIPOLE has a version, DIPOLES, that allows overlapping of fringe fields in a configuration of neighboring magnets.

The dimensioning of the magnet is defined by (Fig. 11, p. 82):

  • AT : total angular aperture

  • RM : mean radius used for the positioning of field boundaries

The 2 or 3 effective field boundaries (EFB), from which the dipole field is drawn, are defined from geometric boundaries, the shape and position of which are determined by the following parameters:

  • ACENT: arbitrary inner angle, used for EFB’s positioning;

  • ω: azimuth of an EFB with respect to ACENT;

  • θ: angle of an EFB with respect to its azimuth (wedge angle) : radius of curvature of an EFB;

  • R1, R2 U1, U2: extent of the linear part of an EFB.

The magnetic field is calculated in polar coordinates. At any position (R, θ) along the particle trajectory the value of the vertical component of the mid-plane field is calculated using

R−RM􏰖 􏰕R−RM􏰖2 􏰕R−RM􏰖3􏰛 BZ(R,θ)=F(R,θ)∗B0∗ 1+N∗ RM +B∗ RM +G∗ RM (4.4.8)

where N, B and G are respectively the first, second and third order field indices and F(R,θ) is the fringe field coefficient (it determines the “flutter” in periodic structures).

Calculation of the Fringe Field Coefficient

With each EFB a realistic extent of the fringe field, λ (normally equal to the gap size), is associated and a fringe field coefficient F is calculated. In the following λ stands for either λE (Entrance), λS (Exit) or λL (Lateral EFB).

F is an exponential type fringe field (Fig. 12, p. 84) given by [34] F=1 1+expP(s) wherein s is the distance to the EFB and depends on (R, θ), and P(s)=C0 +C1􏰓s􏰔+C2􏰓s􏰔2 +C3􏰓s􏰔3 +C4􏰓s􏰔4 +C5􏰓s􏰔5 λλλλλ It is also possible to simulate a shift of the EFB, by giving a non zero value to the parameter shift. s is then changed to s−shift in the previous equation. This allows small variations of the magnetic length. Let FE (respectively FS , FL) be the fringe field coefficient attached to the entrance (respectively exit, lateral) EFB. At any position on a trajectory the resulting value of the fringe field coefficient (eq. 4.4.8) is

102 4 DESCRIPTION OF THE AVAILABLE PROCEDURES F(R,θ)=FE ∗FS ∗FL In particular, FL ≡ 1 if no lateral EFB is requested. Calculation of the Mid-plane Field and Derivatives BZ (R, θ) in Eq. 4.4.8 is computed at the n × n nodes (n = 3 or 5 in practice) of a “flying” interpolation grid in the median plane centered on the projection m0 of the actual particle position M0 as schemed in Fig. 20. A polynomial interpolation is involved, of the form BZ(R,θ)=A00 +A10θ+A01R+A20θ2 +A11θR+A02R2 that yields the requested derivatives, using Akl = 1 ∂k+lBZ k!l! ∂θk∂rl Note that, the source code contains the explicit analytical expressions of the coefficients Akl solutions of the normal equations, so that the operation is not CPU time consuming. B2 interpolation grid δ s particle trajectory B1mm1 B3 0 Figure 20: Interpolation method. m0 and m1 are the projections in the median plane of particle positions M0 and M1 and separated by δs, projection of the integration step. Extrapolation Off Median Plane From the vertical field B⃗ and derivatives in the median plane, first a transformation from polar to Cartesian coordinates is performed, following eqs (1.4.9 or 1.4.10), then, extrapolation off median plane is performed by means of Taylor expansions, following the procedure described in section 1.3.3.

Zgoubidoo usage and example

>>> m = Dipole()
>>> m.fit()

Command attributes

LABEL1=''

Primary label for the Zgoubi command (default: auto-generated hash).

Type

str

LABEL2=''

Secondary label for the Zgoubi command.

Type

str

HEIGHT='20 centimeter'

Height of the magnet (distance between poles), used by plotting functions.

Type

Quantity

POLE_WIDTH='150 centimeter'

Pole width (used for plotting only).

Type

Quantity

PIPE_THICKNESS='2 centimeter'

Thickness of the pipe, used by plotting functions.

Type

Quantity

PIPE_COLOR='grey'

Color of the pipe, used by plotting functions.

Type

str

REFERENCE_FIELD_COMPONENT='BZ'

Orientation of the reference field (used by field maps)

Type

str

KINEMATICS='None'

A kinematics object.

Type

NoneType

APERTURE_LEFT='10 centimeter'

Aperture size of the magnet, left side (used for plotting only).

Type

Quantity

APERTURE_RIGHT='10 centimeter'

Aperture size of the magnet, right side (used for plotting only).

Type

Quantity

APERTURE_TOP='10 centimeter'

Aperture size of the magnet, top side (used for plotting only).

Type

Quantity

APERTURE_BOTTOM='10 centimeter'

Aperture size of the magnet, bottom side (used for plotting only).

Type

Quantity

IL='0'

Print field and coordinates along trajectories

Type

int

AT='0 degree'

Total angular extent of the dipole (positive value in all cases)

Type

Quantity

RM='0 centimeter'

Reference radius

Type

Quantity

ACENT='0 degree'

Azimuth for positioning of EFBs

Type

Quantity

B0='0 kilogauss'

Reference field

Type

Quantity

N='0'

Field index (radial quadrupolar)

Type

int

B='0'

Field index (radial sextupolar)

Type

int

G='0'

Field index (radial octupolar)

Type

int

LAM_E='0 centimeter'

Entrance fringe field extent (normally ≃ gap size)

Type

Quantity

C0_E='0'

Fringe field coefficient C0

Type

int

C1_E='1'

Fringe field coefficient C1

Type

int

C2_E='0'

Fringe field coefficient C2

Type

int

C3_E='0'

Fringe field coefficient C3

Type

int

C4_E='0'

Fringe field coefficient C4

Type

int

C5_E='0'

Fringe field coefficient C5

Type

int

SHIFT_E='0 centimeter'

Shift of the EFB

Type

Quantity

OMEGA_E='0 degree'
Type

Quantity

THETA_E='0 degree'

Entrance face wedge angle

Type

Quantity

R1_E='1000000000.0 centimeter'

Entrance EFB radius

Type

Quantity

U1_E='1000000000.0 centimeter'

Entrance EFB linear extent

Type

Quantity

U2_E='1000000000.0 centimeter'

Entrance EFB linear extent

Type

Quantity

R2_E='1000000000.0 centimeter'

Entrance EFB radius

Type

Quantity

LAM_S='0 centimeter'

Exit fringe field extent (normally ≃ gap size)

Type

Quantity

C0_S='0'

Fringe field coefficient C0

Type

int

C1_S='1'

Fringe field coefficient C1

Type

int

C2_S='0'

Fringe field coefficient C2

Type

int

C3_S='0'

Fringe field coefficient C3

Type

int

C4_S='0'

Fringe field coefficient C4

Type

int

C5_S='0'

Fringe field coefficient C5

Type

int

SHIFT_S='0 centimeter'

Shift of the EFB

Type

Quantity

OMEGA_S='0 degree'
Type

Quantity

THETA_S='0 degree'

Exit face wedge angle

Type

Quantity

R1_S='1000000000.0 centimeter'

Exit EFB radius

Type

Quantity

U1_S='1000000000.0 centimeter'

Exit EFB linear extent

Type

Quantity

U2_S='1000000000.0 centimeter'

Exit EFB linear extent

Type

Quantity

R2_S='1000000000.0 centimeter'

Exit EFB radius

Type

Quantity

LAM_L='0.0 centimeter'

Lateral fringe field extent (normally ≃ gap size)

Type

Quantity

XI_L='0'

Flag to activate/deactivate the lateral EFB (0 to deactivate)

Type

int

C0_L='0'

Fringe field coefficient C0

Type

int

C1_L='1'

Fringe field coefficient C1

Type

int

C2_L='0'

Fringe field coefficient C2

Type

int

C3_L='0'

Fringe field coefficient C3

Type

int

C4_L='0'

Fringe field coefficient C4

Type

int

C5_L='0'

Fringe field coefficient C5

Type

int

SHIFT_L='0 centimeter'

Shift of the EFB

Type

Quantity

OMEGA_L='0 degree'
Type

Quantity

THETA_L='0 degree'

Lateral field boundary wedge angle

Type

Quantity

R1_L='1000000000.0 centimeter'

Lateral EFB radius

Type

Quantity

U1_L='1000000000.0 centimeter'

Lateral EFB linear extent

Type

Quantity

U2_L='1000000000.0 centimeter'

Lateral EFB linear extent

Type

Quantity

R2_L='1000000000.0 centimeter'

Lateral EFB radius

Type

Quantity

RM3='1000000000.0 centimeter'

Reference radius of the lateral EFB

Type

Quantity

IORDRE='2'
Type

int

RESOL='10'
Type

int

XPAS='1 millimeter'

Integration step

Type

Quantity

KPOS='2'
Type

int

RE='0 centimeter'
Type

Quantity

TE='0 radian'
Type

Quantity

RS='0 centimeter'
Type

Quantity

TS='0 radian'
Type

Quantity

DP='0.0'
Type

float

Default initializer for all Commands.

Attributes Summary

KEYWORD

Keyword of the command used for the Zgoubi input data.

PARAMETERS

Parameters of the command, with their default value, their description and optinally an index used by other commands (e.g.

Methods Summary

fit(kinematics[, particle, …])

param kinematics

the reference energy of the magnet

post_init(**kwargs)

param **kwargs

Attributes Documentation

KEYWORD: str = 'DIPOLE'

Keyword of the command used for the Zgoubi input data.

PARAMETERS: dict = {'ACENT': (<Quantity(0, 'degree')>, 'Azimuth for positioning of EFBs', 4), 'APERTURE_BOTTOM': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, bottom side (used for plotting only).'), 'APERTURE_LEFT': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, left side (used for plotting only).'), 'APERTURE_RIGHT': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, right side (used for plotting only).'), 'APERTURE_TOP': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, top side (used for plotting only).'), 'AT': (<Quantity(0, 'degree')>, 'Total angular extent of the dipole (positive value in all cases)', 2), 'B': (0, 'Field index (radial sextupolar)', 7), 'B0': (<Quantity(0, 'kilogauss')>, 'Reference field', 5), 'C0_E': (0, 'Fringe field coefficient C0', 12), 'C0_L': (0, 'Fringe field coefficient C0', 41), 'C0_S': (0, 'Fringe field coefficient C0', 26), 'C1_E': (1, 'Fringe field coefficient C1', 13), 'C1_L': (1, 'Fringe field coefficient C1', 42), 'C1_S': (1, 'Fringe field coefficient C1', 27), 'C2_E': (0, 'Fringe field coefficient C2', 14), 'C2_L': (0, 'Fringe field coefficient C2', 43), 'C2_S': (0, 'Fringe field coefficient C2', 28), 'C3_E': (0, 'Fringe field coefficient C3', 15), 'C3_L': (0, 'Fringe field coefficient C3', 44), 'C3_S': (0, 'Fringe field coefficient C3', 29), 'C4_E': (0, 'Fringe field coefficient C4', 16), 'C4_L': (0, 'Fringe field coefficient C4', 45), 'C4_S': (0, 'Fringe field coefficient C4', 30), 'C5_E': (0, 'Fringe field coefficient C5', 17), 'C5_L': (0, 'Fringe field coefficient C5', 46), 'C5_S': (0, 'Fringe field coefficient C5', 31), 'COLOR': ('#4169E1',), 'DP': (0.0, '', 63), 'G': (0, 'Field index (radial octupolar)', 8), 'HEIGHT': (<Quantity(20, 'centimeter')>, 'Height of the magnet (distance between poles), used by plotting functions.'), 'IL': (0, 'Print field and coordinates along trajectories', 1), 'IORDRE': (2, '', 55), 'KINEMATICS': (None, 'A kinematics object.'), 'KPOS': (2, '', 58), 'LABEL1': ('', 'Primary label for the Zgoubi command (default: auto-generated hash).'), 'LABEL2': ('', 'Secondary label for the Zgoubi command.'), 'LAM_E': (<Quantity(0, 'centimeter')>, 'Entrance fringe field extent (normally ≃ gap size)', 9), 'LAM_L': (<Quantity(0.0, 'centimeter')>, 'Lateral fringe field extent (normally ≃ gap size)', 39), 'LAM_S': (<Quantity(0, 'centimeter')>, 'Exit fringe field extent (normally ≃ gap size)', 25), 'N': (0, 'Field index (radial quadrupolar)', 6), 'OMEGA_E': (<Quantity(0, 'degree')>, '', 19), 'OMEGA_L': (<Quantity(0, 'degree')>, '', 48), 'OMEGA_S': (<Quantity(0, 'degree')>, '', 33), 'PIPE_COLOR': ('grey', 'Color of the pipe, used by plotting functions.'), 'PIPE_THICKNESS': (<Quantity(2, 'centimeter')>, 'Thickness of the pipe, used by plotting functions.'), 'POLE_WIDTH': (<Quantity(150, 'centimeter')>, 'Pole width (used for plotting only).'), 'R1_E': (<Quantity(1e+09, 'centimeter')>, 'Entrance EFB radius', 21), 'R1_L': (<Quantity(1e+09, 'centimeter')>, 'Lateral EFB radius', 50), 'R1_S': (<Quantity(1e+09, 'centimeter')>, 'Exit EFB radius', 35), 'R2_E': (<Quantity(1e+09, 'centimeter')>, 'Entrance EFB radius', 24), 'R2_L': (<Quantity(1e+09, 'centimeter')>, 'Lateral EFB radius', 53), 'R2_S': (<Quantity(1e+09, 'centimeter')>, 'Exit EFB radius', 38), 'RE': (<Quantity(0, 'centimeter')>, '', 64), 'REFERENCE_FIELD_COMPONENT': ('BZ', 'Orientation of the reference field (used by field maps)'), 'RESOL': (10, '', 56), 'RM': (<Quantity(0, 'centimeter')>, 'Reference radius', 3), 'RM3': (<Quantity(1e+09, 'centimeter')>, 'Reference radius of the lateral EFB', 54), 'RS': (<Quantity(0, 'centimeter')>, '', 66), 'SHIFT_E': (<Quantity(0, 'centimeter')>, 'Shift of the EFB', 18), 'SHIFT_L': (<Quantity(0, 'centimeter')>, 'Shift of the EFB', 47), 'SHIFT_S': (<Quantity(0, 'centimeter')>, 'Shift of the EFB', 32), 'TE': (<Quantity(0, 'radian')>, '', 65), 'THETA_E': (<Quantity(0, 'degree')>, 'Entrance face wedge angle', 20), 'THETA_L': (<Quantity(0, 'degree')>, 'Lateral field boundary wedge angle', 49), 'THETA_S': (<Quantity(0, 'degree')>, 'Exit face wedge angle', 34), 'TS': (<Quantity(0, 'radian')>, '', 67), 'U1_E': (<Quantity(1e+09, 'centimeter')>, 'Entrance EFB linear extent', 22), 'U1_L': (<Quantity(1e+09, 'centimeter')>, 'Lateral EFB linear extent', 51), 'U1_S': (<Quantity(1e+09, 'centimeter')>, 'Exit EFB linear extent', 36), 'U2_E': (<Quantity(1e+09, 'centimeter')>, 'Entrance EFB linear extent', 23), 'U2_L': (<Quantity(1e+09, 'centimeter')>, 'Lateral EFB linear extent', 52), 'U2_S': (<Quantity(1e+09, 'centimeter')>, 'Exit EFB linear extent', 37), 'XI_L': (0, 'Flag to activate/deactivate the lateral EFB (0 to deactivate)', 40), 'XPAS': (<Quantity(1, 'millimeter')>, 'Integration step', 57)}

Parameters of the command, with their default value, their description and optinally an index used by other commands (e.g. fit).

Methods Documentation

fit(kinematics: georges_core.kinematics.Kinematics, particle: zgoubidoo.commands.particules.ParticuleType = <class 'zgoubidoo.commands.particules.Proton'>, entry_coordinates: numpy.array = None, exit_coordinate: float = 0.0, method: zgoubidoo.commands.actions.FitType = <class 'zgoubidoo.commands.actions.Fit2'>, zgoubi: Optional[zgoubidoo.zgoubi.Zgoubi] = None, debug=False)[source]
Parameters
  • kinematics – the reference energy of the magnet

  • particle – the particule type

  • entry_coordinates – references 6D coordinates at the magnet entry

  • exit_coordinate – the coordinate at the magnet exit

  • method – the Zgoubi fitting command

  • zgoubi – the Zgoubi instance used to launch the runs

  • debug – verbose parent

Returns

the Dipole itself (allows method chaining).

post_init(**kwargs)[source]
Parameters

**kwargs

Returns: