Dominique Franck Escande
email: dominique.escande@univ-amu.fr

Barbara Momo
email: barbara.momo@igi.cnr.it

Description of magnetic field lines without arcana

Keywords: magnetic field lines, variational principle, Hamiltonian mechanics, magnetic coordinates, magnetic island width

This work is based on the variational principle for magnetic field lines introduced in 1983 by Cary and Littlejohn. The action principles for magnetic field lines and for Hamiltonian mechanics are recalled to be analogous. It is shown that the first one can be rigorously proved from first principles without analytical calculations. Not only the action principles are analogous, but also a change of canonical coordinates is recalled to be equivalent to a change of gauge. Furthermore, using the vector potential makes obvious the freedom in the choice of "time" for describing Hamiltonian dynamics. These features may be used for a new pedagogical and intuitive introduction to Hamiltonian mechanics. In the context of confined magnetic fields, the action principle for magnetic field lines makes practical calculations simpler and safer, with an intuitive background and allowing to keep a high degree of generality, as shown in the practical example of the calculation of the width of a magnetic island, analytically derived without any need of abstract Fourier components and independently of the choice of coordinates. Moreover, a new formula provides explicitly the Boozer and Hamada magnetic coordinates from action-angle coordinates.

Introduction

Magnetized plasmas are ubiquitous in space and astrophysics, and are also artificially produced for the development of thermonuclear fusion by magnetic confinement. If the Larmor radius may be neglected, a low-energy charged particle follows a magnetic field line (B-line) in the absence of other forces. For finite Larmor radius, B-lines still strongly constrain the dynamics, especially if they wrap on nested toroidal magnetic surfaces, as usually wanted in developing fusion devices. This fact has generated a huge literature about these lines to describe both the case where they do lie on such surfaces, providing good confinement, and the case where they do not, bringing magnetic chaos and a related transport. In the fusion context, this topic is in particular of paramount interest for the control of edge localized modes by magnetic chaos in tokamaks [START_REF] Kim | Numerical simulation on edge localized mode control capability of resonant magnetic perturbation in the KSTAR tokamak[END_REF]; [START_REF] Canik | ELM destabilization by externally applied non-axisymmetric magnetic perturbations in NSTX[END_REF]; [START_REF] Kirk | Resonant magnetic perturbation experiments on MAST using external and internal coils for ELM control[END_REF]; [START_REF] Orlov | Numerical analysis of the effects of normalized plasma pressure on RMP ELM suppression in DIII-D[END_REF], a relaxation phenomenon susceptible to harm ITER plasma facing components.

In this frame, this review paper shows how Hamiltonian mechanics tools can be applied to the study of magnetic fields principally in toroidal geometry. This is important, since a natural tendency for people interested in B-lines in a given device, is to describe them by using directly the magnetic field (D'haeseleer et al (2012); [START_REF] Boozer | Physics of magnetically confined plasmas[END_REF]; [START_REF] White | The Theory Of Toroidally Confined Plasmas[END_REF], chapter 3 of [START_REF] Hazeltine | Plasma confinement[END_REF]), instead of the vector potential, that permits to deal with the magnetic field line problem in the frame of Hamiltonian mechanics. Unfortunately, overlooking the genuine Hamiltonian character of these lines, often led to wrong results (8 wrong papers quoted in Park et al (2008) and 6 in [START_REF] Kaleck | On island formation in a locally perturbed tokamak equilibrium[END_REF]).

To the contrary, the review paper shows that working with the vector potential A is very efficient, and, maybe surprisingly, simpler than using the magnetic field, which means also the use of general coordinate systems, and their covariant and contravariant representations of vectors in physical space, as done in D'haeseleer et al (2012); [START_REF] Boozer | Physics of magnetically confined plasmas[END_REF]; [START_REF] White | The Theory Of Toroidally Confined Plasmas[END_REF], /stand in chapter 3 of [START_REF] Hazeltine | Plasma confinement[END_REF], and in section 3.4 of [START_REF] Kikuchi | Frontiers in fusion research[END_REF] (also in an ICTP course [START_REF] Kikuchi | Topology of Lagrange-Hamilton mechanics of magnetic confinement fusion[END_REF] by the same author). This simplicity stems from the fact that the variational principle for B-lines is written with the vector potential (the Aharonov-Bohm effect in quantum mechanics further indicates the importance of A). The review starts with an innovative pedestrian, yet rigorous, derivation of B-line equations from this variational principle. Indeed, the action principle for B-lines can be proved from Stokes theorem applied to the circulation of A. This principle was sketched in equation (1.3) of the chapter by Morozov and L. S. Solov'ev in [START_REF] Sagdeev | Machine modification for active MHD control in RFX[END_REF]. It was introduced four decades ago [START_REF] Cary | Noncanonical Hamiltonian mechanics and its application to magnetic field line flow[END_REF] in the very educated language of noncanonical Hamiltonian mechanics, which probably did not help making it very popular, with the above quoted negative consequences (for a more recent introduction, see chapter 9 of [START_REF] Hazeltine | Plasma confinement[END_REF]) and [START_REF] Viana | Hamiltonian description for magnetic field lines in fusion plasmas: A tutorial[END_REF]). This type of principle had already proved to be useful for the description of magnetohydrodynamics [START_REF] Newcomb | Lagrangian and hamiltonian methods in magnetohydrodynamics[END_REF] Then the paper recalls the analogy of the action principle for B-lines and of that for Hamiltonian mechanics [START_REF] Pina | On hamiltonian formulations of magnetic field line equations[END_REF]. With beautiful formal aspects: not only the action principles are analogous, but also a change of canonical coordinates is shown to be equivalent to a change of gauge [START_REF] Elsasser | Magnetic field line flow as a hamiltonian problem[END_REF]. Furthermore, using the vector potential makes obvious the freedom in the choice of "time" for describing Hamiltonian dynamics. After introducing the above basic concepts, the paper proposes a methodology in order to minimize the work necessary to answer a theoretical or modeling problem about B-lines, analytically or numerically.

The tools introduced in the first part of the review are used in a second one to solve typical problems faced by people in the fusion community, as calculating the width of a magnetic island. The above-mentioned errors on treating resonant magnetic perturbations are explicitly corrected by using an invariant magnetic flux, which is proportional to the magnetic flux through a ribbon whose edges are the B-lines related to the O and X points of the corresponding magnetic island. In turn, the island width can be expressed in terms of the latter flux, which provides the first expression of this width avoiding abstract Fourier components and obviously independent of the choice of coordinates. Simplifications result from substituting heavy approximate analytical calculations by simple numerical estimates provided by any validated computer code computing B-lines; in particular to compute the width of a magnetic island in a simpler way than previous work [START_REF] Cary | Simple method for calculating island widths[END_REF]; [START_REF] Kaleck | On island formation in a locally perturbed tokamak equilibrium[END_REF]; [START_REF] Bécoulet | Numerical study of the resonant magnetic perturbations for Type I edge localized modes control in ITER[END_REF]; [START_REF] Cahyna | The optimization of resonant magnetic perturbation spectra for the COMPASS tokamak[END_REF]. Moreover, the action-angle formalism enables the derivation of a new simple formula providing explicitly the Boozer and Hamada coordinates, well-known in the fusion community.

While relying upon conceptual tools of modern theoretical physics, the review paper uses elementary mathematics, so as to be accessible to non-specialists and to experimentalists wanting to model their results; in particular, the symplectic structure underlying Hamiltonian mechanics [START_REF] Arnol | Mathematical methods of classical mechanics[END_REF] is only alluded to. Furthermore, most calculations are set in a series of appendices, so as to make the body of the review short and easily readable.

In contrast with other action principles, that for B-lines can be proved without any calculation. This suggests a natural spinoff. Thanks to the above-mentioned beautiful formal aspects and a generalization of the above method, the review paper proposes an alternative, intuitive, way to introduce Hamiltonian mechanics from B-lines "mechanics". In particular, using the vector potential makes obvious the freedom in the choice of "time" and "energy" in the Hamiltonian description of mechanics.

In conclusion, this review paper promotes overlooked treasures about B-lines (essentially references [START_REF] Cary | Noncanonical Hamiltonian mechanics and its application to magnetic field line flow[END_REF]; [START_REF] Pina | On hamiltonian formulations of magnetic field line equations[END_REF]; [START_REF] Elsasser | Magnetic field line flow as a hamiltonian problem[END_REF]) in order to enable simple and safe practical calculations. There is some beauty in the approach, which may provide a new pedagogical and intuitive introduction to Hamiltonian mechanics. This review paper is organized as follows. Section 2 recalls the variational principle for magnetic field lines, and introduces a new derivation of it from first principles. Section 3 provides a translation of the principle into a Hamiltonian description by recalling that the action principles for magnetic field lines and for Hamiltonian mechanics are analogous. It also suggests a new pedagogical and intuitive introduction to this mechanics based on magnetic lines "mechanics". Section 4 introduces action-angle coordinates for magnetic systems, which correspond to the classical magnetic coordinates. It derives a new explicit formula for those of Boozer and Hamada. Section 5 shows that the variational principle makes practical calculations about magnetic field lines simpler and safer, with an intuitive background. In particular, with a new analytical result: the width of a magnetic island is proportional to the square root of an invariant flux related to this island, the magnetic flux through a ribbon whose edges are the field lines related to the O and X points of the island. The same analytical calculation provides a simple way to compute numerically the width of a magnetic island. Also to apply Chirikov resonance overlap criterion. Section 6 provides the conclusion.

2 Variational principle for magnetic field lines Magnetic field lines are usually viewed as a whole, possibly parametrized by a curvilinear abscissa. However, when computing one, it is convenient to consider this abscissa as a time, and the line as the orbit of a flow. A corresponding variational principle was introduced [START_REF] Cary | Noncanonical Hamiltonian mechanics and its application to magnetic field line flow[END_REF], which uses the action

S(x; x 0 , x 1 ) = x1 x0 A(x) • dx, (1)
= λ1 λ0 A[x(λ)] • dx dλ dλ, (2)
where the integral runs between points x 0 and x 1 of a magnetic field line; equation (2) uses a curvilinear abscissa λ and λ 0 and λ 1 are the abscissas of the end points x 0 and x 1 .

In previous papers [START_REF] Cary | Noncanonical Hamiltonian mechanics and its application to magnetic field line flow[END_REF]; [START_REF] Elsasser | Magnetic field line flow as a hamiltonian problem[END_REF], the variational principle for magnetic field lines was first postulated, and then proved to be right by showing one can derive from it the usual equations defining these lines; this is recalled in Section 2.2. However, Section 2.1 first provides a new intuitive, yet rigorous, proof of the principle using Stokes theorem, which avoids any calculation.

New intuitive physical approach using Stokes theorem

Figure 1 (a) displays a blue segment L of magnetic field line bounded by points r 1 and r 2 . It is weakly distorted into the green segment L . The difference δS between the actions computed for L and L corresponds to the circulation of the potential vector along the oriented circuit C indicated by red arrows. Stokes theorem implies that δS is the magnetic flux across this circuit.

Figure 1 (a) also displays a flux tube T with a small radius about L enclosing the weakly distorted segment L . We assume this segment to make at most N turns about L. Since L is confined into T , the magnetic flux δS across circuit C is smaller than N times the flux across T . The latter is of order 2 . So is δS. Since L corresponds to a variation of L of order , δS is second order in this variation. Therefore, S is stationary along any magnetic field line.

Figure 1 (b) displays a blue segment L, which is not a magnetic field line. It intersects a magnetic field line at a point here named P. The segment [r 3 , r 4 ] of L includes P. Q is a point of the straight line passing per P and perpendicular to the plane defined by L and the tangent at P of the magnetic field line. The length of Fig. 1 A physical intuitive approach to the variational principle for magnetic field lines.

segment PQ (perpendicular to both L and the B-line) is assumed to be of order . We define the green path made of the straight segment going from r 3 to Q and of the straight segment going from Q to r 4 . The difference δS between the actions computed for L and for its small perturbation going along the green path is again the circulation of the potential vector along the oriented circuit C indicated by red arrows. Stokes theorem implies that δS is the magnetic flux across this circuit. Since L is not tangent to the field line at P, this flux is of order , i. e. of the same order as the variation of L. Therefore, the action S is not stationary along any curve that does not coincide with a magnetic field line.

As a result of these discussions, action S is stationary on a path, if and only if it is a segment of magnetic field line. This defines the stationary-action principle for magnetic field lines. We stress that the above discussions of figures 1 (a) and (b) were performed with the usual assumption that the variation of the integration path vanishes at end points.

The first part of the proof is performed with a typical deformation L . Some exceptional ones come with a vanishing δS that does not give any information on the field line trajectory and are therefore not interesting for the proof of the variational principle. As an example, this is the case for a purely toroidal magnetic field and an L inside a surface made up of neighboring field lines. Such a vanishing δS can also occur in the usual derivation of Euler-Lagrange equations by specific choices of displacements. Indeed, one can write

δS = t1 t0 δL( q, q, t) dt (3) = t1 t0 ∂L ∂q • δq + ∂L ∂ q • δ q dt (4) = t1 t0 ∂L ∂q • δq + d dt ∂L ∂ q • δq - d dt ∂L ∂ q • δq dt (5) = ∂L ∂ q • δq t1 t0 + t1 t0 ∂L ∂q - d dt ∂L ∂ q • δq dt (6) = t1 t0 ∂L ∂q - d dt ∂L ∂ q • δq dt, (7)
where the fully integrated term in the penultimate equation vanishes because the displacements vanish at t 0 and t 1 . The last equation shows that an appropriate choice of δq can make the integral vanish even if the bracket is non zero. However, the bracket must vanish if the integral is zero for any δq. This leads to Euler-Lagrange equations.

Previous derivations

The variational principle for magnetic field lines was first intuitively introduced without a proof in a 1966 paper by Morozov and L. S. Solovèv (equation (1.3) of [START_REF] Sagdeev | Machine modification for active MHD control in RFX[END_REF]). The rationale was that a mass-less particle in a vanishing electric field follows magnetic field lines. Now, the action for this motion is the integral over time of A.v, where v is the particle velocity. Setting dx = vdt yields the action integral (1). Therefore, the principle can be intuitively deducted, while this is not generally the case for other variational principles. Subsequent derivations introduce a curvilinear abscissa λ and write the action as in equation (2),

S(x; x 0 , x 1 ) = λ1 λ0 A[x(λ)] • dx dλ dλ, (8)
where λ 0 and λ 1 are the abscissas of the end points of the first integral.

The stationary action principle for the field line flow can then be written as

δS = δ x1 x0 A(x) • dx = 0 (9) = δ λ1 λ0 A(x(λ)) • dx dλ dλ = 0 (10)
with the usual requirement that the arbitrary variation δx(λ) of the trajectory vanishes at the end points x 0 = x(λ 0 ) and x 1 = x(λ 1 ). If the stationary action principle holds, then magnetic field line equations must be derived from equation (10).

In 1983, [START_REF] Cary | Noncanonical Hamiltonian mechanics and its application to magnetic field line flow[END_REF] focused on the important practical case where λ is one of the coordinates. Using general coordinates x i = (x 1 , x 2 , x 3 ), say λ = x 3 (for instance the toroidal angle in a tokamak). Then, (10) becomes 0 = δ

x 3 1 x 3 0 dx 3 L(x, dx dx 3 , x 3 ) (11) L(x, dx dx 3 , x 3 ) = A 1 (x) dx 1 dx 3 + A 2 (x) dx 2 dx 3 + A 3 (x) = A i (x) dx i dλ , (12)
where the form of the Lagrangian of the magnetic system is emphasized. The last expression of equation ( 12) writes the Lagrangian in a more compact form using the covariant components A i = A • e i of the vector potential and Einstein's convention of summation over repeated indices. The corresponding Euler-Lagrange equations, solution of the stationary principle δS = 0, are

∂L ∂x j - d dx 3 ∂L ∂(dx j /dx 3 ) = 0, j = 1, 2. ( 13
)
If the x i 's are Cartesian coordinates, these equations yield

dx 1 B 1 = dx 2 B 2 = dx 3 B 3 , (14)
which are the equations defining the magnetic field lines from the contravariant components of the magnetic field, defined as B i = B • ∇x i , since equations ( 14) are equivalent to the condition of collinearity between the velocity vector dx/dλ and B. This proves that magnetic field line equations can indeed be derived from principle (9) or (10). Equations ( 14) are valid in any coordinate system, not only in Cartesian coordinates. In deriving them from equations ( 12) and ( 13), the general relation that links the covariant components A i of the vector potential and the contravariant ones of the magnetic field in any coordinate system must be used. Extended calculations can be found in appendix [START_REF] Elsasser | Magnetic field line flow as a hamiltonian problem[END_REF], Elsässer Elsasser (1986) proved again the validity of the variational principle for magnetic field lines showing in an algebrical way that equation ( 10) is true if and only if

∇ × A × dx(λ) dλ = 0 (15)
which means that ẋ ≡ dx/dλ is parallel to B = ∇ × A, as required for magnetic field lines. Following his proof, and considering the fields always taken at x = x(λ) even when this is not explicitly stated,

0 = δ λ1 λ0 dλ A(x(λ)) • ẋ(λ) (16) = λ1 λ0 dλ δx • ∇ A • ẋ + A • δ ẋ x=x(λ) (17) = λ1 λ0 dλ ∇(A • ẋ) -( ẋ • ∇)A x=x(λ) • δx(λ) (18)
Therefore, for arbitrary variations δx(λ),

0 = ∇(A • ẋ) -( ẋ • ∇)A x=x(λ) (19) = ẋ × ∇ × A x=x(λ) (20)
This shows that the variational principle stated in equation ( 10) leads to equation (15) as Euler equation, ending the proof. The function A(x) is considered fixed, but the argument x must be varied independently of λ with vanishing variations δx(λ) at the end points λ = λ 1 , λ 2 . A partial integration brings from equation ( 17) to ( 18), considering also interchanging δ and the derivative with respect to λ.

Translation into a Hamiltonian description

In section 2 the existence of a variational principle for magnetic field lines was proved.

Here, Section 3.1 recalls the equivalence between the variational principle for magnetic field lines and that for their Hamiltonian mechanics showing that magnetic field lines in physical space are analogous to the flow of a dynamical system with one degree of freedom in phase space. The identification between canonical variables (p, q, t) and magnetic ones follows, intending for magnetic variables the space coordinates x and the covariant components of the vector potential A. Section 3.2 recalls then the equivalence between canonical and gauge transformations. To conclude, going beyond the physical meaning of magnetic fluxes and field lines, Section 3.3 proposes a way of teaching Hamiltonian mechanics from magnetic lines "mechanics".

Equivalence between the variational principles for magnetic field lines and for their Hamiltonian mechanics

The possibility of a Hamiltonian description of magnetic field line is intuitively natural, since the conservation of magnetic flux is analogous to that of phase space volume (Liouville theorem). It was introduced more than seventy years ago [START_REF] Kruskal | Some properties of rotational transform[END_REF]; [START_REF] Kerst | The influence of errors on plasma-confining magnetic fields[END_REF]; Gelfand et al (1962); [START_REF] Whiteman | Invariants and stability in classical mechanics[END_REF]; [START_REF] Boozer | Evaluation of the structure of ergodic fields[END_REF]; [START_REF] Cary | Noncanonical Hamiltonian mechanics and its application to magnetic field line flow[END_REF]. It is at the root of a large contribution of plasma physics to Hamiltonian mechanics [START_REF] Escande | From thermonuclear fusion to Hamiltonian chaos[END_REF]. This section shows the equivalence between the variational principle for magnetic field lines in physical space expressed in equation ( 9) and that for their Hamiltonian dynamics in phase space, obtaining the identification between canonical and magnetic variable as proved by Piña and Ortiz in 1988 [START_REF] Pina | On hamiltonian formulations of magnetic field line equations[END_REF].

The canonical equations of a N degree of freedom mechanical system can be derived from the variational principle, where q = dq/dt, 0 = δ t1 t0 L( q, q, t)dt = δ (dS) ( 21)

L( q, q, t) = p • q -H(p, q, t) (22)
Or, equivalently,

0 = δ t1 t0 p • dq -H(p, q, t)dt (23)
where (p, q) are the canonical variables (N -vectors), L( q, q, t) the Lagrangian and H(p, q, t) the Hamiltonian of the system. The differential of the action, dS = [p • dq -H(p, q, t)dt] is called Poincaré-Cartan integral invariant [START_REF] Arnol | Mathematical methods of classical mechanics[END_REF]). Indeed, the corresponding Euler-Lagrange equation, solution of ( 21) or ( 23),

∂L ∂q - d dt ∂L ∂ q = 0 (24)
yields the canonical equations of motion in phase space:

dq dt = ∂H ∂p (25) dp dt = - ∂H ∂q . (26)
In the same way, as proved in Section 2, magnetic field line equations can be derived from the variational principle (9), that we now write in an arbitrary coordinate system x = (x 1 , x 2 , x 3 ) as

0 = δ A i dx i . ( 27
)
This expression uses the classical covariant expression of the dot product and Einstein convention of summation over repeated indexes (i = 1, 2, 3). The vector potential is always defined up to a gauge transformation defined by

A i → A i = A i + ∂ i G (or A → A = A + ∇G)
where G is an arbitrary scalar function of the spatial coordinates, being B = ∇ × A = ∇ × A . Since an axial gauge, for which A i = 0 for one of the indexes, can be always chosen, one term in the sum of equation ( 27) can be killed.

Here we take A 1 = 0. Then, principle (27) becomes

dS = A 2 dx 2 + A 3 dx 3 , ( 28
) 0 = δ (dS) . ( 29
)
With the choice of an axial gauge, principle (27) for magnetic field lines has the same structure as principle (23) for N = 1 degree of freedom mechanical system. Therefore, one can identify canonical and magnetic variables. Going back to the particular choice A 1 = 0, from pdq -Hdt = α(A 2 dx 2 + A 3 dx 3 ) the identifications result:

p = α A 2 (x 1 , x 2 , x 3 ) (30) q = x 2 (31) H(p, q, t) = -α A 3 (x 1 , x 2 , x 3 ) (32) t = x 3 ( 33
)
where α is an arbitrary constant. The relation p = α A 2 (x 1 , x 2 , t) must be inverted (possibly only locally) in order to write x 1 = x 1 (x 2 , p, t), and therefore the Hamiltonian as a function of the canonical variables, H = H(p, q, t).

A mere change of the indices of the coordinates enables to deal with gauge A 2 = 0 or A 3 = 0. Therefore, we anticipate the important result discussed in the next section, that different choices of gauge correspond to different sets of canonical variables. Moreover, the freedom in the definition of a Hamiltonian for magnetic field lines is even larger, since coordinates 2 and 3 can be exchanged in equation ( 28) defining a dynamics where the new Hamiltonian corresponds to the previous -p, the new p is the previous -H, the new time is q, and the new q is t. This highlights an aspect of the freedom in the definition of a Hamiltonian for magnetic field lines: the canonical momentum p and the Hamiltonian can exchange their role, which corresponds to inverting the roles of p q and -H in equation ( 22) or of p dq and H dt in equation ( 23). With a caveat, yet: an arbitrary choice of time does not guarantee magnetic field lines to be fully parametrized by such a time. A full parametrization requires a "reasonable" choice of coordinates, for instance some kind of toroidal angle in a tokamak or a stellarator, and of poloidal angle in a reversed field pinch must be used as a time. This limits the freedom in the choice of the Hamiltonian and therefore in the identifications between canonical and magnetic coordinates.

This derivation of a Hamiltonian for B-lines is shorter and simpler than the standard one in [START_REF] Boozer | Physics of magnetically confined plasmas[END_REF]. Indeed, the latter requires to compute with coordinates, to introduce a symplectic form of the magnetic field for specific ones, and to prove orthogonality properties of the covariant and contravariant basis vectors. Finally, the present derivation uses a variational principle with an intuitive physical basis, while providing a way of generating a Hamiltonian for field lines in very general coordinates.

Equivalence between change of gauge and of canonical transformation

The previous section shows that different choices of gauge correspond to different sets of canonical variables. In reality, the link between gauge and canonical variables is stronger. This section shows that gauge transformations are nothing but canonical transformations, as proved by Elsässer in 1986 [START_REF] Elsasser | Magnetic field line flow as a hamiltonian problem[END_REF].

First of all we show that Hamiltonian flows are independent not just of canonical transformation of coordinates, but also of gauge transformation. Identification (30)-(33) implies a new way to write the Lagrangian in (22):

α(A 2 ẋ2 + A 3 ẋ3 ) = p q -H(p, q, t). ( 34
)
where ẋi = dx i /dt with the identification t = x 3 . We remind that identifications (30)-(33) assume the gauge A 1 = 0, so in the left hand side of last equation A 1 is absent because of the chosen axial gauge. Note moreover that ẋ3 = dt/dt = 1. Under a gauge transformation, the vector potential transforms as

A → A + ∇G (35)
A i → A i + ∂G ∂x i (36)
where function G(x) is a scalar, and ∇G is its gradient. Then, if a change of gauge is applied, the Lagrangian in equation (34) becomes

α(A 2 ẋ2 + A 3 ẋ3 + ∂G ∂x i ẋi ) = p q -H(p, q, t) + α dG dt , (37)
where the summation over partial derivatives of G of the left hand side is written in a more compact form in the right hand side. So a gauge transformation adds to the Lagrangian the total derivative of a scalar function G, and to the Poincaré-Cartan form the total differential dG of the same function. Both variational principles ( 23) and ( 27) are therefore not affected by gauge transformations (due to the vanishing variation of the position at the boundaries, δG = 0), and so are not canonical equations of motion and magnetic field line equations.

To show the equivalence between gauge and canonical transformations, we now apply the same gauge transformation, defined by function G(x), before and after the canonical transformation (p, q, t) → (P, Q, t) defined by

p = ∂F ∂q , P = ∂F ∂Q , H = H + ∂F ∂t , ( 38
)
where F is an arbitrary function of (q, Q, t) (see appendix B for the definition of a canonical transformation). This means performing the gauge transformation in the (p, q) coordinates with G(p, q, t) and the gauge transformation in the (P, Q) coordinates with G(P, Q, t):

p q -H(p, q, t) + α dG(p, q, t) dt = P Q -H (P, Q, t) + dF (q, Q, t) dt + α dG(P, Q, t) dt .( 39
)
We now link the canonical transformation and the subsequent gauge transformation by

F (q, Q, t) + αG[P (q, Q, t), Q, t] = 0 ( 40
)
where P (q, Q, t) is defined by equation ( 38). Equation ( 39) becomes p q -H(p, q, t) + dG(p, q, t)

dt = P Q -H (P, Q, t). (41)
This means that G[P (q, Q, t), Q, t] is the generating function of the reciprocal canonical transformation

(P, Q) → (p, q) (42) H → H. (43)
Therefore, equation ( 40) enables the two-way translation of any gauge transformation into a canonical one.

Teaching Hamiltonian mechanics from magnetic lines "mechanics"

A typical textbook of classical mechanics, starts with Newton's laws, introduces the energy as the sum of a kinetic and a potential part, and then the variational principle with a Lagrangian, which is the difference of these two parts. Then the Hamiltonian is introduced as energy, the sum of these two parts, and the canonical equations of motions are derived from the corresponding expression of the Lagrangian (equations ( 21) and ( 22)). This sets in the mind of students that, in Hamiltonian mechanics, the Hamiltonian is the energy, and p is a momentum. In reality, the version of the variational principle provided by equation ( 23) uses the Poincaré-Cartan integral invariant

p • dq -H(p, q, t)dt, (44)
whose scalar components may be swapped [START_REF] Arnol | Mathematical methods of classical mechanics[END_REF]. Therefore, any p i may be taken as the Hamiltonian and q i as the time. Furthermore, another invariant can be obtained by subtracting d(p • q) to the first one, -d(p • q) -Hdt, which enables any q i to be taken as the Hamiltonian and p i as the time. This flexibility is very useful. For instance for the description of the motion of electrons in a traveling wave tube, where it is convenient to use the position along the tube as time [START_REF] Ruzzon | A symplectic, symmetric algorithm for spatial evolution of particles in a time-dependent field[END_REF]. It was essential to the development of neo-adiabatic theory, which deals with the jumps of an adiabatic invariant at slow separatrix crossings (see section 8.1 of [START_REF] Escande | From thermonuclear fusion to Hamiltonian chaos[END_REF] and references therein).

If, in contrast with what is done in section 3.1, the variational principles for magnetic field lines is introduced first, and then that for their Hamiltonian mechanics, the above flexibility for the choice of Hamiltonian is obvious, since it stems from the arbitrariness in the choice of coordinates for describing the vector potential. Furthermore, the action principle for magnetic field lines can be introduced in the pedestrian way of section 2.1 without calculations, while that for Hamiltonian mechanics is more abstract and requires analytical calculations. Finally, the somewhat abstract change of canonical coordinates can be made more concrete by showing it is nothing but a change of gauge (section 3.2).

This suggests teaching Hamiltonian mechanics from magnetic lines "mechanics". The Poincaré-Cartan integral invariant would be first introduced for a one-degree-offreedom time-dependent Hamiltonian and then generalized to higher dimensions.

Action-Angle coordinates for magnetic systems

This section focuses on toroidal magnetic configurations for magnetic confinement like the tokamak, the stellarator and the reversed field pinch. We first introduce a general expression of the potential vector using the toroidal and poloidal fluxes, whose complete derivation can be found in appendix D. Then, we specify to the case where the magnetic field is regular, i.e. where there are conserved magnetic flux surfaces on which magnetic field lines flow. This corresponds to the case of a time independent Hamiltonian and bounded energy surfaces. We introduce corresponding action-angle variables, called magnetic coordinates in the fusion context. For the sake of completeness, a general derivation of action-angle variables for any one-degree-of-freedom Hamiltonian system is provided in appendix C. We then show that the Boozer and Hamada magnetic coordinates used to describe MHD equilibria can be explicitly computed using the action-angle formalism.

Explicit magnetic fluxes

For the tokamak, the stellarator and the reversed field pinch, one can use the natural cylindrical coordinates (r, θ, ϕ), but other poloidal and toroidal angles may be more convenient to emphasize the symmetries of the system. For instance, if there is a helical symmetry or quasi-symmetry with poloidal and toroidal periodicity (m 0 , n 0 ), the helical angle u = m 0 θ -n 0 ϕ may be used instead of θ. In the general x = (r, θ, ϕ) coordinates, the potential vector can be written as

A = ψ t ∇θ/2π -ψ p ∇ϕ/2π. ( 45
)
and the corresponding magnetic field, B = ∇ × A, as

B = ∇ψ t × ∇θ/2π -∇ψ p × ∇ϕ/2π, (46)
which is a formulation, called canonical form, valid for any divergence free field on a torus. Here ψ t is a toroidal magnetic flux, i. e. the magnetic field integrated over the cross section of a constant-ψ t torus; ψ p is a poloidal magnetic flux, i. e. the poloidal flux that goes through the hole in a constant-ψ p torus. These two types of tori do not need to be identical and in general ψ t = ψ t (x) and ψ p = ψ p (x) can define different surfaces for a constant ψ t and a constant ψ p . These fluxes define the same flux surfaces if the magnetic field is regular (i.e. if there are magnetic flux surfaces), and magnetic field lines wrap on sets of nested tori. In this case ψ t = ψ t (ψ p ) and each of the two magnetic fluxes can be used as the radial variable which identifies magnetic flux surfaces, instead of the generic cylindrical coordinate r. The definition of the coordinate system in which ψ t = ψ t (ψ p ) (named action-angle system) is given in the next section and more discussion on the physical meaning of magnetic fluxes can be found in appendix D, as well as the way to go from a classical formula for tokamak magnetic field to our equation ( 45). From here on, the case of a one to one relation between fluxes will be emphasized by the use of capital letters in indices, ψ T and ψ P .

In the following, we take the toroidal flux as the radial coordinate, playing the role of the canonical momentum, as generally done for the tokamak and the stellarator. Then the poloidal flux is intended as a function of (ψ t , θ, ϕ) (or ψ T in the case of a regular magnetic field configuration), implying a change of coordinates from (r, θ, ϕ). θ and ϕ are arbitrary poloidal and toroidal angles, except for the requirement B•∇ϕ = 0, in order to be able to use ϕ to follow a given magnetic field line. Note that this condition is also required to define a good change of coordinates, with a non-zero Jacobian, from the (r, θ, ϕ) to (ψ t , θ, ϕ) coordinates. Indeed, from equation ( 46), 2πB.∇ϕ = ∇ψ t .(∇θ × ∇ϕ), and the latter quantity is the inverse of the Jacobian of the change of coordinates from Cartesian ones to (ψ t , θ, ϕ), as can be shown for instance by using successively equations (A4), (A7), and (A2) of [START_REF] Boozer | Physics of magnetically confined plasmas[END_REF].

We note that, because of toroidal field reversal, the choice of the toroidal flux as a radial coordinate is not a good choice for the magnetic field of a reversed field pinch: the opposite choice must be done, choosing the poloidal coordinate as the radial coordinate, but all the following calculations can be trivially rephrased.

Magnetic or action-angle coordinates

Conserved flux surfaces have their equivalent in the bounded constant energy surfaces of a time independent Hamiltonian. In the case of a regular magnetic field, therefore, new angle variables can be defined exploiting the symmetries of the system, having their equivalent in the action-angle coordinates of a Hamiltonian system. We remind here that in the following we use the toroidal flux as radial coordinate, and the general poloidal and toroidal (θ, ϕ) angle coordinates to start with.

We use equivalence ( 30)-( 33), coming from the choice of the axial gauge A 1 = 0, between canonical and magnetic coordinates, and here reported using also the magnetic fluxes according to expression (45),

p = αA 2 = ψ t (47) q = x 2 = θ (48) H = -αA 3 = ψ p (ψ t , θ, ϕ) (49) t = x 3 = ϕ (50)
where we assume α = 2π. We now assume that the A i 's (i.e. the fluxes) do not depend on x 3 = ϕ, which makes the Hamiltonian time-independent. In agreement with equations ( 47)-( 50), we take x 2 = θ, and H(ψ t , θ) = ψ p (ψ t , θ). Then, this enables to define ψ t (E, θ) by inverting E = H(ψ t , θ).

Then, we define action-angle variables (ψ T , ζ) for the magnetic system, using their definition given by equations (C19) and (C27), which yields

ψ T (E) = 1 2π ψ t (E, θ) dθ (51) G(θ, ψ T ) = θ θ0 ψ t [E(ψ T ), θ ] dθ (52) ζ(θ, ψ T ) = ∂G ∂ψ T = θ θ0 ∂ψ t [E(ψ T ), θ ] ∂ψ T dθ . (53)
Identifications ( 47)-( 50), valid for the general (p, q, t) = (ψ t , θ, ϕ) toroidal coordinates, can now be written for action-angle variables (P, Q, t) = (ψ T , ζ, ϕ):

P = αA ζ = ψ T (54) Q = x 2 = ζ (55) H = -αA ϕ = ψ P (ψ T ) = E(ψ T ) (56) t = x 3 = ϕ (57)
again assuming α = 2π. Equation of motion (C28) defines the constancy of ψ T on each flux surface, whereas equation (C29) provides the equation defining the magnetic field lines:

dψ T dϕ = 0 (58) dζ dϕ = ι(ψ T ) = dψ P dψ T . (59)
This implies that, when using action-angle coordinates, both magnetic fluxes (the action and the Hamiltonian of the system) are constant of the motion, i.e. are constant on magnetic flux surfaces. Moreover, magnetic field lines written in action-angle coordinates are straight lines in the (ζ, ϕ) plane. Therefore, action-angle coordinates are the well-known magnetic coordinates, named also flux or straight-field-line coordinates in the fusion community. The frequency ι is called the rotational transform. Its inverse is called safety factor, usually indicated with the symbol q (we avoid using it to avoid any confusion with a canonical variable). Both ι and its inverse, as well as the magnetic fluxes, can be used to label magnetic flux surfaces.

According to identifications (54)-( 57), the vector potential can be written in a way similar to (45), but for magnetic coordinates x = (ψ T , ζ, ϕ)

2π A = ψ T ∇ζ -ψ P ∇ϕ (60)
where ψ P = ψ P (ψ T ). With respect to equation ( 45), constant fluxes on magnetic flux surfaces are used, the toroidal angle ϕ is kept fixed, but the poloidal angle θ is substituted for the "straight" poloidal angle ζ.

We are now interested in a change of magnetic coordinates from (ψ T , ζ, ϕ) to (ψ T , ζ N , ϕ N ). For convenience for the following calculations, we define it implicitly by

ζ = ζ N + f (ψ T , ζ N , ϕ N ), (61)
ϕ = ϕ N + g(ψ T , ζ N , ϕ N ), (62)
where both poloidal and toroidal angle are transformed and f and g are arbitrary functions on each flux surface. The toroidal flux coordinate is therefore kept constant in this change. Setting these expressions for ζ and ϕ into equation ( 60), we find the relations between the functions f and g so that (ζ N , ϕ N ) are magnetic coordinates, which means A can be written as in (60) also in the new coordinates. It results in

2πA = ψ T ∇ζ N -ψ P ∇ϕ N + F, (63)
F = ∇(f ψ T -gψ P ) + (ιg -f )∇ψ T . ( 64
)
Of course A is defined up to a gauge, defined in equation ( 35). In order for F to be a gradient, ιg -f must be a function of ψ T . We call it h(ψ T ). If F is a gradient, a change of gauge can be performed by adding its opposite in equation ( 63), which yields equation ( 60) written for the (ζ N , ϕ N ) magnetic coordinates. Therefore, equations ( 61)-( 62) define a change of magnetic coordinates if and only if

f = ιg -h(ψ T ), (65)
with h(ψ T ) an arbitrary function. Since there is a lot of freedom in the definitions of g and h, there are infinitely many systems of magnetic coordinates. In appendix E extended calculations proving these results are provided.

It is worth noting that the change of magnetic coordinates ( 61)-( 62) is not a change of canonical coordinates. According to equation ( 63) with F a gradient, the Hamiltonian stays the same in the new coordinates. In particular equation ( 65) shows that equation (59) stays correct in these coordinates.

Among the most common sets of magnetic coordinates used in the fusion community are the [START_REF] Hamada | Hydromagnetic equilibria and their proper coordinates[END_REF], [START_REF] Boozer | Plasma equilibrium with rational magnetic surfaces[END_REF] and PEST Grimm et al (1983) coordinates. PEST coordinates are defined as the straight-B-line coordinates in which the toroidal angle corresponds to the geometrical one. Therefore, straight-B-line coordinates obtained from equations ( 51)-( 53) are the PEST coordinates if the ignorable coordinate ϕ coincides with the geometrical toroidal angle. Any other set of magnetic coordinates needs to change both the angular coordinates, as shown in equations ( 61)-(62). A clear definition of the symmetry angle ϕ in an axisymmetric system can be found for instance in chapter 6 of D'haeseleer et al (2012), where the symmetry flux coordinates in a tokamak are described: the ϕ = constant surfaces are vertical surfaces so that ∇ϕ points in the symmetry direction and the ϕ-coordinate curves (produced when only ϕ is allowed to vary while the other two coordinates are held fixed) are circles whose tangents points in the symmetry direction requires e ϕ ∝ ∇ϕ. Being R the distance from the major symmetric axis to a point on flux surface, |∇ϕ| = 1/R. Hamada and Boozer coordinates are defined in the next section.

For people aware of action-angle variables, the proof of existence of magnetic coordinates as action-angle variables of the Hamiltonian defining magnetic field line is a lot shorter than the specific proof using the Clebsch representation of the magnetic field (see for instance section 4.B.1 of [START_REF] Cary | Hamiltonian theory of guiding-center motion[END_REF]; with the caveat that a minus sign must be added in the right hand side of its equation (4.43)). Using action-angle variables also puts magnetic coordinates in a wider and more fundamental perspective.

Boozer and Hamada coordinates -a new formulation

We now focus on magnetic coordinates used to describe MHD equilibria. Such equilibria are defined by

j × B = ∇p, ( 66
)
where j is the current density, and p in this context indicates the kinetic pressure.

Because of this equation, ∇p is perpendicular to both B and j, so the pressure p is constant along both B and j-lines. Magnetic field lines, where the rotational transform ι is irrational, wrap densely on the corresponding magnetic surfaces. Therefore, p is constant over such surfaces. If p is a smooth function, this property carries over to all real numbers. Because p is constant along both B and j-lines, magnetic surfaces coincide with current-density surfaces. Considering force free equilibria, i. e. ∇p = 0, magnetic field lines are parallel to current-density lines; when ∇p = 0 they are not, but still lie on flux surfaces. Two types of magnetic coordinate systems are commonly used to describe MHD equilibria: Hamada coordinates [START_REF] Hamada | Hydromagnetic equilibria and their proper coordinates[END_REF] and Boozer coordinates Boozer (1981). In Hamada coordinates, both the magnetic field lines and current lines corresponding to the considered MHD equilibrium are straight. In Boozer coordinates, both the magnetic field lines corresponding to the MHD equilibrium are straight and the diamagnetic lines, i.e. the integral lines of ∇p × B. The derivation of these two kinds of magnetic coordinates can be found for instance in appendix B of [START_REF] Cary | Hamiltonian theory of guiding-center motion[END_REF], where these coordinates are defined also from the specific form of their Jacobian (J ∝ 1 defines Hamada coordinates, whereas J ∝ B -2 defines Boozer ones). Analytical calculations involving these coordinates are simplified by the technique introduced in Pustovitov (1998b[START_REF] Pustovitov | Magnetic coordinates with double straightening[END_REF].

We now show that the action-angle approach enables a simple explicit definition of these specific coordinates from equation (65), that does not use at all the magnetic field or magnetic differential equations.

Hamada coordinates

Equation ( 46), written for the magnetic field, is said canonical form and can be generalized to any divergence free field on a torus. In MHD, the divergence of j vanishes, as does that of the magnetic field. This makes natural the application of the above formalism to j. Because j ∼ ∇ × B, now B plays the previous role of A. Naturally, there is no gauge invariance for B, but if we are interested in the current lines only, we do not care about the exact magnetic field producing j, and we may again use the freedom of adding a gradient, now to B, which makes j invariant. It is worth noting that this fact is implicit in the Clebsch representation of the current in equation (B2) of [START_REF] Cary | Hamiltonian theory of guiding-center motion[END_REF]. Moreover, to define action-angle coordinates, the Hamiltonian of the magnetic system (the component B 3 of the magnetic field when studying j-lines) needs to be time independent, which is true in toroidal systems when the canonical time is associated to the toroidal angle ϕ. The gauge transformation to define the axial gauge B 1 = 0 is "time" independent, so that action-angle formalism can indeed be applied to look for straight j-lines. Hamada coordinates can be defined following a list of steps.

• On magnetic flux surfaces, straight magnetic field lines coordinates (ψ T , ζ, ϕ) are defined in equations ( 51)-( 53) from the action-angle formalism. Hamada coordinates can then be defined from general magnetic coordinates (ψ T , ζ, ϕ) using equations ( 61)-( 62) and ( 65):

ζ H (ψ T , θ) = ζ(θ, ψ T ) + ι(ψ T ) g(ψ T , ζ(θ, ψ T ), ϕ) -h(ψ T ), (67)
ϕ H (θ, ϕ, ψ T ) = ϕ + g(ψ T , ζ(θ, ψ T ), ϕ). (68)
• Exploiting the canonical form for j, the equivalent of equations ( 51)-( 53) can be used to define action-angle variables for the current line "dynamics" on magnetic flux surfaces (when magnetic flux surfaces exist, we remind the equivalence of magnetic and current density flux surfaces due to equation ( 66)). Adding a prime to all quantities related to the current dynamics, and noting that B plays the previous role of A, the canonical form for j = ∇ × B/µ 0 can be written as

(2π/µ 0 ) B = ψ t ∇θ -ψ p ∇ϕ (69) 2π j = ∇ψ t × ∇θ -∇ψ p × ∇ϕ (70)
where quantities ψ t and ψ p define the "current density fluxes" in the general toroidal coordinates x = (ψ t , θ, ϕ):

ψ i = j • dΣ = 1 µ 0 Σ(l) (∇ × B) • dΣ = 1 µ 0 l B • dj = 2π µ0 B θ (i = t) 2π µ0 B ϕ (i = p) (71)
where the definition of the flux of j through a surface Σ, Ampère's law and Stokes theorem have been used in equation ( 71). Last equality uses B 1 = 0 and the definition of poloidal or toroidal surface, as done for the derivation of the magnetic fluxes in appendix D.1. We now use the equivalence of magnetic and current density flux surfaces and we keep in mind that we use the same x spatial coordinates for magnetic and current lines; in particular x 3 = ϕ. The definition of straight current density lines on magnetic flux surfaces and their rotational transform follow from equations ( 51)-( 53) and ( 58)-( 59) :

ψ T (E) = 1 2π ψ t (E, θ) dθ (72) ζ (θ, ψ T ) = θ θ0 ∂ψ t [θ, x 2 (θ, ψ T )] ∂ψ T dθ (73) ι (ψ T ) = dζ dϕ = dψ P dψ T (74)
The fluxes ψ T (ψ P ) define the "current surfaces". • Because Hamada coordinates define both straight B and j-lines, equations similar to ( 67)-( 68) can be written to define the same Hamada coordinates from straight current lines coordinates (ζ , ϕ). We distinguish the new definition of Hamada coordinates from the previous one by adding a prime to ψ T , ζ, ι, g, and h. • Equating the two formulations of Hamada coordinates yields an expression of these coordinates as a function of general straight magnetic field and straight current density lines, here indicated by the symbols (ψ T , ζ, ϕ) and (ψ T , ζ , ϕ) respectively.

Equating the right hand sides of the two sets of equations for Hamada coordinates, and remembering that

ζ = ζ(ψ T , θ), ι = ι(ψ T ), g = g(ψ T , ζ(θ, ψ T ), ϕ), h = h(ψ T ),
and the same for prime quantities, yields

ζ + ι g -h = ζ + ι g -h (75) g = g ( 76
)
where we used that the initial toroidal angle is the same in both cases. The second equation enables substituting g for g in the first one, which yields

(ι -ι) g = ζ -ζ + h -h . (77)
This enables the calculation of g which is found independent of the toroidal angle,

g(ψ T , ζ(θ, ψ T )) = ζ -ζ + h -h (ι -ι) . (78)
Setting g in equations ( 67) and ( 68), gives a simple explicit expression for Hamada coordinates (ψ T , ζ H , ϕ H ) as a linear combination of action-angle coordinates for B and j:

ζ H (θ, ψ T ) = ι (ζ -h) -ι(ζ -h ) ι -ι , (79)
ϕ H (θ, ϕ, ψ T ) = ϕ + ζ -ζ -h + h ι -ι . ( 80
)
These coordinates have some freedom due to the arbitrary functions h(ψ T ) and h (ψ T ). This freedom corresponds to the integration constants present when using magnetic differential equations to define Hamada coordinates.

Boozer coordinates

Boozer coordinates can be computed in the same way. Indeed, diamagnetic lines are the integral lines of ∇ψ T × B, which is colinear to q = ∇p × B, since the gradient of the scalar pressure p is colinear with that of ψ T (∇p ∇ψ T ). Now, q is a divergence free vector like B Pustovitov (1999). Indeed, ∇.(∇p × B) = B .∇ × ∇p -µ 0 ∇p . j = 0, since ∇p = j × B and j = ∇ × B/µ 0 . Furthermore, q × B = -B 2 ∇p which is similar to equation ( 66), which implies that p is constant along q lines. Therefore, q can be dealt with like we did previously with B and j. Naturally, to fit with diamagnetic "dynamics", in this calculation all primes become double primes, and index H becomes index B for "Boozer". In this way ψ" T and ψ" P are the fluxes defining the surfaces where diamagnetic q-lines lays. Again, a one to one correspondence between ψ" T and ψ T is expected, so Boozer coordinates define a frame of reference in which both B and q lines are straight.

5 Calculations made easier with the action principle: the perturbative approach and a new derivation of the magnetic island width

This section deals with the effect of a small resonant perturbation to a regular magnetic field. Subsection 5.1 defines the corresponding perturbed Hamiltonian. Subsection 5.2 introduces an invariant flux related to a magnetic island, useful to express its width as shown in Subsection 5.3. Subsection 5.4 shows how to compute numerically a magnetic island width from experimental data, and subsection 5.5 how to derive from this Chirikov overlap parameter when several resonant perturbations are present.

Small resonant perturbation of a regular magnetic field

We now consider the effect of a small resonant perturbation of a regular magnetic field, associated to a "time" independent Hamiltonian H 0 . Such a field is defined by the existence of magnetic flux surfaces and by a one to one relation between ψ T and ψ P when using action-angle coordinates. Using ψ T as the radial coordinate identifying magnetic flux surfaces, we take ψ P = ψ P (ψ T ), or H 0 = H 0 (p). In the following we use the notation x = (ψ T , θ, ϕ) = (p, q, t) for the action-angle coordinates defined on H 0 flux surfaces. It is worth noting that these are not magnetic coordinates for the perturbed Hamiltonian.

The perturbation δB(ψ T , θ, ϕ) of the regular magnetic field is provided by a perturbation δA(ψ T , θ, ϕ) of both components of the potential vector. However, in appendix F, it is shown that, whatever be the perturbation of the toroidal flux, an appropriate redefinition of this variable enables considering the magnetic perturbation to bear only on the poloidal flux. Then, using equation ( 45), the perturbation to the vector potential is defined by

δA = -δψ P ∇ϕ/2π, (81)
where δψ P is a function of (ψ T , θ, ϕ), or, equivalently, of the canonical variables (p, q, t). This perturbation to the vector potential turns out to be a perturbation to the Hamiltonian (49), which is defined by

H = H 0 + H 1 (82) H 0 = ψ P (ψ T ) (83) H 1 = δψ P (ψ T , θ, ϕ). (84)
In the following we consider the case where H 1 consists in a single helical Fourier component, δψ P = H 1,m0,n0 (p) cos(m 0 θ -n 0 ϕ), which is resonant at a value of p = ψ T defined by ι(p 0 ) = n 0 /m 0 . The classical local reduction of the Hamiltonian to a pendulum Hamiltonian close to p 0 is performed in appendix G. It proves the existence of a magnetic island that develops around the unperturbed resonant flux surface defined by ι(p 0 ). Defining the helical angle u = m 0 θ -n 0 ϕ, its X-point corresponds to u X = 0 and its O-point to u O = π if dι(p0) dp H 1,m0,n0 (p 0 ) > 0, and the opposite otherwise. In the following, results from appendix G will be used also to compute the magnetic island width.

The following calculations are rephrased in appendix H in the case of a perturbation bearing on both magnetic fluxes.

Invariant flux related to a magnetic island

Physical quantities, like the width of a magnetic island, cannot depend on the choice of the coordinates. They must therefore be related to invariants under change of coordinates or gauge transformations. In this section we use the definition of the action for magnetic field lines and Stokes theorem, that implies the equivalence between the action along a closed circuit (circulation of A) and the magnetic flux through any surface having the oriented circuit as a boundary. This mathematics will be used to prove the existence of a magnetic flux, defined for each magnetic island through the ribbon defined by the O and X points, which is invariant under change of coordinates and named Φ OX in the following. This flux is the analogous of the flux Φ defined in Park et al (2008), or, better, to its resonant Fourier components that are proved to be the same in each set of magnetic coordinates, and the island width results ∼ (|Φ mn |). The explicit definition of Φ is given in appendix H.1.

We compute the action along the closed orbit O, corresponding to the center of the magnetic island. According to equations ( 28) and ( 47)-( 50), it is

S O = 1 2π O [pdθ -H(p, q, ϕ)dϕ]. (85)
Since the perturbation is small, along O and X it is true to lowest order that p = p 0 , dθ/dϕ = ι(p 0 ) = m 0 /n 0 , and u 0 = m 0 θ -n 0 ϕ = ±π (see appendix G). Assuming that m 0 and n 0 are mutually relatively prime, ϕ varies by 2m 0 π along O and θ varies by 2n 0 π. Assuming ( 82)-( 84), this yields Its geometrical meaning is explained in appendix H to be the helical flux through the surface defined by the O-point. Similarly, the action S X along the closed orbit corresponding to the X-point of the magnetic island is given by equation ( 86) where cos(u O ) becomes cos(u X ) = -cos(u O ). Consequently,

S O = m 0 [p 0 ι(p 0 ) -H 0 (p 0 ) -H 1,m0,n0 (p 0 ) cos(u O )]. ( 86
)
S O -S X = -2 cos(u O )m 0 H 1,m0,n0 (p 0 ) = 2m 0 sgn[ dι(p 0 ) dp ]|H 1,m0,n0 (p 0 )|, (87)
where the last expression results from equation (G69). The geometrical meaning of the S O -S X flux can be understood from Figure 2, which displays the closed orbits O, in red, and X, in blue, for a (m 0 = 1, n 0 = 1) magnetic island whose separatrix is indicated in green. It displays their intersections o and x in a poloidal section. We now compute the action corresponding to the closed path starting at o, following O with a growing ϕ up to reaching back o, then going from o to x in the poloidal section along the red segment ox, then following X with a decreasing ϕ up to reaching back x, then finishing by going from x to o in the poloidal section along blue segment ox. Stokes theorem implies that this action is nothing but the magnetic flux Φ OX through any oriented ribbon whose edges are the oriented closed orbits corresponding to the O and X-point. Since the two contributions to this action corresponding to ox cancel because they are opposite, this magnetic flux is

Φ OX = S O -S X . (88)
As a consequence, as expected, the width of the magnetic island is not related to the specific choice of toroidal coordinates, but is defined by a coordinate-independent magnetic flux with a simple geometrical definition. In particular, it does not depend on the choice of the radial coordinate. The single helical Fourier component introduced above verifies

|H 1,m0,n0 (p 0 )| = |Φ OX |/2m 0 .
By inverting the roles of ψ T and ψ P , equation (87) becomes

S O -S X = -2 cos(u O )n 0 H 1,m0,n0 (ψ P 0 ) = 2n 0 sgn[ dq s (ψ P0 ) dψ P ]|H 1,m0,n0 (ψ P0 )|, (89)
where ψ P 0 is the resonant value of ψ P defined by q s (ψ P 0 ) = m 0 /n 0 with q s = 1/ι the safety factor, and H 1,m0,n0 (ψ P ) is the resonant contribution in the Hamiltonian with the inverted roles of ψ T and ψ P . This shows that m 0 H 1,m0,n0 (p 0 ) = n 0 H 1,m0,n0 (ψ P 0 ). The existence of a coordinate-independent magnetic flux related to a magnetic island that correctly estimates its width was already proved in Park et al ( 2008) by using a magnetic differential equation and by performing explicit changes of magnetic coordinates with the corresponding Jacobians. The above path, based on the action for magnetic field lines, avoids using coordinates and Jacobians, and leads to an expression for the invariant flux in terms of a magnetic flux through an explicit surface: the ribbon defined by the periodic orbits related to the O and X points. Appendix H discusses previously introduced coordinate-independent fluxes and shows their interpretation as helical fluxes.

Reference Park et al ( 2008) quotes eight papers (its references 11-13 and 15-19) where the resonant Fourier components of the magnetic field were mistakenly considered as almost invariant when going to magnetic coordinates. Its abstract states: when replacing the Fourier components of the perturbation vector potential by those of the magnetic field finite aspect ratio effects have been neglected so far. For present tokamaks with B = r/R ∼ 0.3 this can lead to an error in the field line diffusion of one to two orders of magnitude. Reference [START_REF] Kaleck | On island formation in a locally perturbed tokamak equilibrium[END_REF] quotes six papers (its references 5, 7-9, 12, 13) where the same mistake was made. Above its equation ( 15), it states that a number of papers have discussed the resonant Fourier harmonics of magnetic field [...] instead of the [Fourier harmonics of the flux], assuming the Fourier spectrum is little changed by going to magnetic coordinates. But this assumption can be very inaccurate in toroidal plasmas. Figure 4 of [START_REF] Jk | Spectral asymmetry due to magnetic coordinates[END_REF] shows this can be wrong by a factor 3, leading to a factor 9 for a quasilinear estimate of a corresponding diffusion coefficient. This shows how useful is the use of the potential vector and of the corresponding Hamiltonian description of magnetic field lines to find out the right invariants.

If on top of the single helical component considered at the end of section 5.1 there is another non-resonant one, say H 1,m,n (p) cos(mθ-nϕ), when performing the integral of equation ( 85), this component adds a non-vanishing contribution to S O . In this case, therefore, S O cannot be estimated by an integration over a single period of O, as done in equation ( 85). When performing the integration over N periods of O, we get N S O , plus an oscillating term, that stays bounded when N grows. Dividing by N the integral over N periods of O, we get S O , plus a contribution vanishing for N large. Therefore, in an experimental case where there is more than one component in the Fourier series of H 1 in θ and ϕ, S O can be estimated by this method.

Width of a magnetic island

We refer to appendix G for the calculation of the island width in terms of the Hamiltonian perturbation, and to the results of the previous section to express it in terms of the invariant island flux defined by equations ( 87) and (88).

Equation (G68) of appendix G shows that the magnetic island half -width in units of p 0 (i.e. of a flux) is

∆p = ∆ψ T = 2 H 1,m0,n0 (p 0 ) dι(p0) dp = 2 Φ OX 2m 0 dι(p0) dp , (90)
where the last expression is obtained through Eqs. ( 87) and ( 88). It is worth noting that this width is defined even if the island is washed out by chaos.

The equivalent expression in units of ψ P 0 (i.e. of the poloidal flux), valid when the poloidal flux ψ P is taken as radial coordinate and obtained by inverting the roles of ψ T and ψ P in equation ( 45) and by replacing factor 1/2π in the latter expression, yields

∆ψ P = 2 H 1,m0,n0 (ψ P 0 ) dqs(ψ P 0 ) dψ P = 2 Φ OX 2n 0 dqs(ψ P 0 ) dψ P , ( 91
)
where the last expression is obtained through equation ( 89). For instance, equation ( 91) must be used for the reversed field pinch in the domain where the toroidal field reverses, since ψ T does not evolve monotonically radially there, which invalidates the derivation leading to equation ( 90).

It is worth noting that the above second expressions of island widths involve an explicit magnetic flux instead of an abstract Hamiltonian perturbation.

The calculations of appendix G assume the magnetic shears dι(p0) dp and dqs(ψ P 0 )

dψ P = -1 ι(p0) 2 dι(p0)
dp do not vanish. When these quantities diminish, the island width increase. The above calculations make sense only when the island domain does not overlap a flux surface with a vanishing shear. It is worth mentioning that magnetic shear vanishes at q-minimum radius of reversed shear plasma of tokamaks.

Finally, the island width computed in terms of flux can be translated into the geometric width of a pendulum-like eye-of-cat through the equations defining magnetic surfaces. Formula (90) agrees with equation (1.44) of [START_REF] White | The Theory Of Toroidally Confined Plasmas[END_REF] and with equation (7.2.8) of [START_REF] Wesson | Tokamaks[END_REF]; equation (20) of chapter 9 of [START_REF] Hazeltine | Plasma confinement[END_REF] yields a result √ 2 larger.

Numerical calculation of a magnetic island width from experimental data

The calculation of a magnetic island width from experimental data can be done by using equation ( 90) or ( 91), where the actions along the closed orbit O and X are computed by performing the integration over several periods of these orbits, as indicated in the last paragraph of section 5.2. Furthermore, the Φ OX flux can also be computed directly from formulas (87) or ( 89) when the resonant components of the perturbation are known. An example is given in appendix H.2 using data from the RFX-mod Reversed Field Pinch experiment Sonato et al (2003).

Previously, the calculation of this width from experimental data was performed in at least two ways. A first one starts with the calculation of A by a Biot-Savart calculation in cylindrical coordinates (R, Z, ϕ) [START_REF] Kaleck | On island formation in a locally perturbed tokamak equilibrium[END_REF]; [START_REF] Bécoulet | Numerical study of the resonant magnetic perturbations for Type I edge localized modes control in ITER[END_REF]; [START_REF] Cahyna | The optimization of resonant magnetic perturbation spectra for the COMPASS tokamak[END_REF]. Then, the toroidal spectra of the three cylindrical components of A is calculated, and from them are computed the corresponding components of the magnetic field perturbation so as to satisfy numerically the condition ∇ • B = 0. Then, the radial component of B, and its poloidal and toroidal Fourier spectra are computed, before making calculations involving metric coefficients, which provide finally the island width.

A second type of calculation of magnetic island width is performed by computing numerically magnetic field lines from the knowledge of the magnetic field [START_REF] Cary | Simple method for calculating island widths[END_REF]. First the O-point of the island of interest is identified. The full-orbit tangent map related to the O-point of the island of interest is then computed by integrating the differential equations for the derivative of the "equations of motion" of the field line. Two eigenvectors are then computed by diagonalizing matrices obtained from this map. This yields the rotation frequency in the center of the island, and then the shear of magnetic field lines. This is finally set into a formula providing the island width.

In view of the many steps of these techniques, it might be worthwhile checking the accuracy of the simple estimate in terms of action integrals indicated above. This could be done by dealing with synthetic magnetic data produced from a Hamiltonian enabling an analytical calculation of island widths from equation ( 90) or (91).

Resonance overlap

If several resonant perturbations are present in an experiment, Chirikov resonance overlap criterion [START_REF] Chirikov | A universal instability of many-dimensional oscillator systems[END_REF] can be applied from the experimental data about the magnetic field. One can use engineer coordinates like (z, R, φ) or (r, θ, φ), and choose φ as time when dealing with the tokamak. Then, magnetic field lines can be numerically computed by using a symplectic code and the Hamiltonian description of field lines provided by equations ( 30)-( 33).

If possible, first plot the Poincaré map without perturbation to make sure there is no spurious chaos due to the algorithm (in particular due to time discretization). Then, plot the Poincaré maps including the successive resonant perturbation you want to analyze. Measure the normalized width of the resonances. Then Chirikov overlap parameter can be computed for any couple of resonance amplitudes. There is no need of a high precision, since the criterion is approximate, and only gives an order of magnitude estimate.

Chirikov criterion can be applied in the following way: plot the Poincaré map corresponding to the experimentally measured magnetic field, and identify the location of the periodic orbits corresponding to the resonances whose overlap is to be checked. Then, compute the width of the resonances from the technique of the preceding subsection. Then Chirikov overlap parameter can be computed for any couple of resonances.

Chirikov criterion is a very useful rule of thumb. In reality the threshold for large scale chaos (or "stochasticity") depends on two features of the overlapping resonances; the ratio of their amplitudes and that of the number of island chains. This was shown in figure 2.19 of [START_REF] Escande | Stochasticity in classical Hamiltonian systems: universal aspects[END_REF]. We use the notations of this reference where k is the ratio of the number of island chains, M and P are the normalized amplitudes of the resonances, such that Chirikov overlap parameter is s = 2 (M ) + 2 (P The smallest threshold corresponds to s = 0.7 for k = 1 and ρ = 1 with ρ = (M/P ). The threshold corresponds to s = 1 for k = 1 and ρ 3, and for ρ = 1 and k 4. The increase of the threshold when ρ becomes large or small is natural. Indeed, if one of the resonances has a vanishing amplitude, no chaos will occur whatever big is s. The increase of the threshold when k becomes large or small is natural too. Indeed, if a resonance has many islands along a single one of the other resonance, the effect of the former on the dynamics of the latter is a fast perturbation, which can be averaged out.

Chirikov criterion can be interpreted as a criterion of heteroclinic intersection, i. e. of intersection of the stable manifold of an X-point of the first resonance with the unstable manifold of an X-point of the second resonance, and vice-versa (see section 7 of Escande ( 2018)). Indeed, the part of these manifolds close to the corresponding X-point can be approximated by the separatrix corresponding to the resonance alone. Therefore resonance overlap is an approximation of heteroclinic intersection.

Section III of reference [START_REF] Elsasser | Magnetic field line flow as a hamiltonian problem[END_REF] points out the difficulty of choosing relevant resonances to use Chirikov criterion when many resonances with close values of m/n are present. Empirically, one can apply it to the largest islands in Poincaré maps. This choice can be often justified by the Hamiltonian version of renormalization theory for Kolmogorov-Arnold-Moser tori [START_REF] Escande | Stochasticity in classical Hamiltonian systems: universal aspects[END_REF]. Indeed, the largest islands often correspond to the dominant current perturbations. Then islands with higher values of m or n turn out to be the "daughters" of the large ones, and belong in the large islands of the smaller scales of phase space exhibited by the renormalization "microscope". A pedagogical introduction to these concepts can be found in section 5 of [START_REF] Escande | From thermonuclear fusion to Hamiltonian chaos[END_REF]. Finally, it is worth noting, that when the amplitude of a magnetic perturbation increases, there may be a collision of the O and X-points of the corresponding magnetic island (inverse saddle-node bifurcation) canceling the separatrix and leading to a strong resilience to chaos [START_REF] Escande | Chaos healing by separatrix disappearance and quasisingle helicity states of the reversed field pinch[END_REF].

Finally, it is worth noticing that numerical calculations are so handy, that it may be more reliable to compute a threshold of chaos this way than to compute it by applying Chirikov criterion numerically, or analytically after painstaking uncontrolled approximations.

Conclusion

This review paper proceeded as follows. It recalled the variational principle for magnetic field lines and showed it can be intuitively deducted. It introduced a new derivation of it from first principles, using Stokes theorem and avoiding analytical calculations, and recalled previous ones using such calculations. It was recalled that the action principles for magnetic field lines and for Hamiltonian mechanics are analogous. Also that a change of gauge is equivalent to a canonical transformation. Action-angle coordinates were introduced for magnetic systems, which correspond to the so-called magnetic coordinates. A new formula was derived providing explicitly the Boozer and Hamada magnetic coordinates from action-angle coordinates. Then practical calculations about magnetic field lines were shown to be simpler and safer, with an intuitive background. In particular, with a new analytical result: the width of a magnetic island is proportional to the square root of an invariant flux related to this island, the magnetic flux through a ribbon whose edges are the field lines related to the O and X points of the island. This is the first expression of this width avoiding abstract Fourier components and obviously independent of the choice of coordinates. The same analytical calculation provides a simple way to compute numerically the width of a magnetic island. Also to apply Chirikov resonance overlap criterion.

It was also shown that the pedestrian derivation of the action principle for magnetic field lines suggests a new pedagogical and intuitive introduction to Hamiltonian mechanics: teaching it from magnetic lines "mechanics". There would be some beauty in the approach, in particular because of the equivalence of change of gauge and of canonical transformation. Also because it provides a natural unification of the many Hamiltonians describing the same dynamics, which broadens the freedom for practical applications. As a result, this review brings a further element of the contribution of plasma physics to nonlinear dynamics and chaos [START_REF] Escande | Contributions of plasma physics to chaos and nonlinear dynamics[END_REF][START_REF] Escande | From thermonuclear fusion to Hamiltonian chaos[END_REF]. Also, more generally to mechanics, when including the capability of the N-body description of the plasma to enable a reductionist approach to kinetic problems, in contrast to most of the rest of physics [START_REF] Escande | Basic microscopic plasma physics from N-body mechanics: A tribute to Pierre-Simon de Laplace[END_REF].

The review shows that important simplifications are brought by working with the vector potential, i.e. in a geometrical way avoiding the use of specific coordinates, and respecting the symplectic background of the dynamics. This philosophy is also present in the description of particle dynamics with the Lagrangian derivation of a guiding center equation of motion [START_REF] Littlejohn | Variational principles of guiding centre motion[END_REF], which involves the use of the Lie transform technique [START_REF] Littlejohn | Hamiltonian perturbation theory in noncanonical coordinates[END_REF], which is also at the basis of the modern derivation of gyrokinetic theory [START_REF] Hahm | Nonlinear gyrokinetic equations for tokamak microturbulence[END_REF]; [START_REF] Hahm | Nonlinear gyrokinetic theory for finite-beta plasmas[END_REF]; [START_REF] Brizard | Foundations of nonlinear gyrokinetic theory[END_REF], and of the development of various gyrokinetic simulation codes [START_REF] Garbet | Gyrokinetic simulations of turbulent transport[END_REF]. Further developments along these lines are noncanonical guiding-center theory [START_REF] Cary | Hamiltonian theory of guiding-center motion[END_REF], Hamiltonian formulations of quasilinear theory for magnetized plasmas [START_REF] Brizard | Hamiltonian formulations of quasilinear theory for magnetized plasmas[END_REF], with an extension for inhomogeneous plasmas [START_REF] Dodin | Quasilinear theory for inhomogeneous plasma[END_REF]. Also a gauge-free electromagnetic gyrokinetic theory where the gyrocenter phase-space transformation are expressed in terms of the perturbed electromagnetic fields, instead of the usual perturbed potentials [START_REF] Burby | Gauge-free electromagnetic gyrokinetic theory[END_REF]. Finally, [START_REF] Tronko | Second-order nonlinear gyrokinetic theory: from the particle to the gyrocentre[END_REF] shows how to account for various orderings of the small parameter associated with spatial inhomogeneities of the background magnetic field and that characterizing the small amplitude of the fluctuating fields. This review paper and the above references contribute to making plasma physics a fundamental science. so the Euler-Lagrange equations (A2) assume the form

∂A i ∂x j dx i dx 3 - ∂A j ∂x k dx k dx 3 = 0, j = 1, 2. (A6)
Expanding the summations over repeated indexes, equations (A6) yield

0 = ∂A 1 ∂x j dx 1 dx 3 + ∂A 2 ∂x j dx 2 dx 3 + ∂A 3 ∂x j - ∂A j ∂x 1 dx 1 dx 3 + ∂A j ∂x 2 dx 2 dx 3 + ∂A j ∂x 3 , j = 1, 2. (A7)
To recognize the magnetic field line equations in equations (A7), one needs the general relations linking the covariant components A i of the vector potential and the contravariant ones of the magnetic field from the definition of the curl in generic curvilinear coordinates:

B i = 1 √ g ijk ∂A k ∂x j (A8)
where ijk = ±1, depending on the order of the indexes, and 1/ √ g is the Jacobian of the coordinate system. Using definitions (A8) we can explicitly write the contravariant components of the magnetic field, as

√ gB 1 = ∂A 3 ∂x 2 - ∂A 2 ∂x 3 , √ gB 2 = ∂A 1 ∂x 3 - ∂A 3 ∂x 1 , √ gB 3 = ∂A 2 ∂x 1 - ∂A 1 ∂x 2 (A9)
Using equations (A9) in equations (A7) yield

dx 1 B 1 = dx 3 B 3 for j = 1 (A10) dx 2 B 2 = dx 3 B 3 for j = 2 (A11)
which are equations ( 14) defining the magnetic field lines. Note that these relations are valid in any coordinate system, and that one does not really need to compute the related Jacobian. This finally proves that magnetic field line equations can indeed be derived from a stationary action principle.

where q = dq/dt. For the same lines and another set (P, Q) of canonical coordinates, this equation becomes

0 = δ t1 t0 [P Q -H (P, Q, t)]dt, ( B13
)
where H is the corresponding Hamiltonian and Q = dQ/dt. One way for both variational principles to be satisfied is to have

p q -H(p, q, t) = P Q -H (P, Q, t) + dF dt , ( B14
)
where F is an arbitrary function of the coordinates, called generating function of the canonical transformation. We now specify it by considering F as a function of (q, Q, t).

Then, equation (B14) becomes

p q -H(p, q, t) = P Q -H (P, Q, t) + ∂F ∂q q + ∂F ∂Q Q + ∂F ∂t (B15) so p - ∂F ∂q q -P + ∂F ∂Q Q + H -H - ∂F ∂t = 0, (B16) which implies p = ∂F ∂q , P = - ∂F ∂Q , H = H + ∂F ∂t . (B17)
By subtracting d(pq) dt in the left hand side of equation (B14), and/or d(P Q) dt in the right hand side of the same equation, one can define three other generating functions with arguments (p, Q, t), (P, q, t), or (p, P, t). The above canonical transformations extend naturally to Hamiltonians with more degrees of freedom.

It is worth noting that Hamiltonian motion may be considered as a canonical transformation. Indeed, consider the transformation from [p(t), q(t)], to [p(t+T ), q(t+ T )] where T is an arbitrary time. It is canonical, since there is a Hamiltonian describing the dynamics of [p(t + T ), q(t + T )]: the same as that for [p(t), q(t)]. This is the basis of Lie perturbation theory where T is considered as infinitesimal [START_REF] Cary | Lie transform perturbation theory for Hamiltonian systems[END_REF].

possible defining new canonical coordinates (P, Q) such that the new momentum is some function of E, P = f (E), and a constant of the motion too. In such a case, H = H (P ): the evolution of P is ruled by

dP dt = df dE dE dt = - ∂H ∂Q , (C18)
where the last expression results from the canonical equation of motion for P . Since E is a constant, the second expression vanishes, which implies H does not depend on Q. This means that H = H (P ), ending the proof.

If energy surfaces H(p, q) = E are bounded in phase space, so is the range of variation of q on any of them, defining a periodic motion. In this case the new (P, Q) = (I, ζ) canonical variables defined by H = H (P ) are called action-angle variables. For a given value of E, we define the corresponding action as

I(E) = 1 2π p(q, E) dq, ( C19
)
where the integration runs over the related whole range of variation of q. Because of the conservations of area in canonical transformations, this definition of I is independent from the choice of canonical coordinates. The conjugate variable, ζ, can be defined from the relation between canonical variables using equation (B14), by setting Q = ζ, P = I, and F = -ζI + G(q, I), where G is the generating function of the canonical transformation. Then, equation (B14) becomes A word of caution is of order for systems with a separatrix. Indeed the partial derivative with respect to I is not defined at an X-point. So does ζ. In reality, a separatrix separates orbits with different topologies, which implies a discontinuity of the definition of the action when crossing it. Away from a separatrix, the integral in equation (C19) turns out to be a curvilinear integral on a closed orbit.

p q -H(p, q) = -ζ İ -H (I, ζ) + ∂G ∂q q + ∂G ∂I İ, (C20) so p
- ∂G ∂q q + ζ - ∂G ∂I İ + H -H = 0, (C21) Which implies p = ∂G ∂q , (C22) ζ = ∂G ∂I , (C23)
H = H . (C24) Equation (C22) implies G(q, I) = q q0 p(q , I) dq , (
We conclude mentioning that the action defined in equation ( 21) and the one in equation (C19) defining the canonical momentum in action-angle coordinates are not physically related, except for their dimensions.

where x = (ψ t , θ, ϕ) are general toroidal coordinates. A similar form can be used for the vector potential A, A = ψ t ∇θ/2π -ψ p ∇ϕ/2π + ∇G , (D32) that can be always defined up to a gauge, which means up to the gradient of a scalar function here named G, irrelevant for the corresponding magnetic field, B = ∇ × A.

Here we show the equivalence between the covariant components of the vector potential and the magnetic fluxes. We first remind the definition of covariant components of a vector, defined by A = A i ∇x i , where the ∇x i are the gradients of the spatial coordinates. We use an intuitive physical approach, and in particular Stokes theorem that states the equivalence between a circulation and a flux:

l A • dl = Σ (∇ × A) • dΣ (D33)
being Σ any surface having the oriented circuit l as a boundary. If A is the vector potential, the circulation of A along l immediately implies the flux of the magnetic field B = ∇ × A through Σ.

In different frame of references, fluxes assume different physical meaning depending on the definition of the surface Σ through which they are computed, see for example [START_REF] Predebon | MHD spectra and coordinate transformation in toroidal systems[END_REF]. In the more general definition, poloidal and toroidal fluxes are the fluxes across some surface Σ defined by fixed values of the chosen angle θ or ϕ. We anticipate that only in magnetic (or action-angle) coordinates Σ represents the magnetic flux surfaces.

In section D.1 we prove that function A i (x) is a measure of the poloidal/toroidal flux across the surface defined by Σ = A i (x) = constant, which in general does not correspond to a magnetic flux surface, and without a clear geometric interpretation. In particular, in general toroidal coordinates (x 1 , x 2 , x 3 ) = (r, θ, ϕ) and choosing the axial gauge A 1 = 0, it is true that:

• A 2 = ψ t /2π: the A 2 = A θ component is a measure (up to 2π) of the toroidal flux ψ t across the surface defined by Σ = A θ (r, θ, ϕ) = constant at ϕ = constant. • A 3 = -ψ p /2π: the A 3 = A ϕ component is a measure (up to -2π) of the poloidal flux ψ p across the ribbon bounded by the magnetic axis and the surface defined by Σ = A ϕ (r, θ, ϕ) = constant at θ = constant. Equivalently, the A 3 component can be defined as a measure (up to 2π) of the poloidal flux across the disk outside surface Σ at θ = constant.

When magnetic flux surfaces exist, they are defined by function Σ = H(p, q) = ψ p (r, θ) = constant, but not by Σ = ψ t (r, θ), as shown in section D.1. Only choosing magnetic (or action-angle) coordinates, defined in section 4.2, magnetic flux surfaces are well defined by both magnetic fluxes, Σ = H(I) = ψ P (ψ T ), that can be used as flux-surface labels. Following the method described in section D.1, and choosing the axial gauge A 1 = 0 and magnetic coordinates x = (ψ T , ζ, ϕ), one can prove that:

• A 2 = ψ T /2π: I(ψ T ) = A ζ (ψ T ) is a measure (up to 2π for the A ζ component of A)
of the toroidal flux ψ T across magnetic flux surfaces at ϕ = constant. • A 3 = -ψ P /2π: H(I) = A ϕ (ψ T ) is a measure (up to -2π for A ϕ ) of the poloidal flux ψ P across the ribbon bounded by the magnetic axis and the magnetic flux surfaces at ζ = constant.

Magnetic coordinates therefore define the only coordinate systems in which the magnetic fluxes assume the usual meaning of fluxes through magnetic flux surfaces. In addition to the results reported in this review, knowing the relationship between magnetic fluxes and the A i components allows to tackle the study of physical problems in a geometrical way. The transformation rules of the covariant components of a vector have been used for example to study the relationship between the Fourier spectra of the magnetic fluxes in different frame of reference defined by magnetic coordinates [START_REF] Predebon | MHD spectra and coordinate transformation in toroidal systems[END_REF].

D.1 Magnetic fluxes in general toroidal coordinates

Let us compute the toroidal flux ψ t (r, θ) using its general definition for a timeindependent Hamiltonian system, for which the A i 's components do not depend on time (here identified by the toroidal angle ϕ):

ψ t = Σ(ϕ) B • dΣ(ϕ) = Σ(ϕ) (∇ × A) • dΣ = ∂Σ(ϕ) A • dl (D34) = 2π 0 A θ (r, θ) dθ (D35) = 2π A θ (r, θ) = ψ t (r, θ) (D36)
The definition of the toroidal flux and Stokes theorem have been used in the first line.

The symbol Σ(ϕ) define the surfaces at ϕ = constant, and the elementary surface element is dΣ(ϕ) = √ g ∇ϕ dr dθ, where √ g is the inverse of the Jacobian of the coordinate system. The line element is defined by dl = dx i e i , where the e i 's are the tangent basis vectors. Because of the constancy of the toroidal angle ϕ and of the choice A 1 = A r = 0 for the axial gauge, we obtain equation (D35). Equation (D36) can be true if and only if we consider the flux through surface Σ = A θ (r, θ) = constant. This ends the explanation of the physical meaning of A θ .

The poloidal flux can be written in the same way:

ψ d p = Σ(θ) B • dΣ(θ) = Σ(θ) (∇ × A) • dΣ = ∂Σ(θ) A • dl (D37) = 2π 0 A ϕ (r, θ) dϕ (D38) = 2πA ϕ (r, θ) = -H(p, q) (D39)
where symbol ψ d P has been introduced for the poloidal flux through a disk defined outside surface Σ(θ) (w.r.t the magnetic axis). Symbol Σ(θ) defines the surfaces at θ = constant, and dΣ(θ) = √ g ∇θ dr dϕ. Equivalences in equation (D39) are written reminding identification (32), and are true if and only if in equation (D38) we consider the flux through surface Σ = A ϕ (r, θ) = constant = -H(p, q), defining magnetic flux surfaces.

It is worth noting that the circulation in dϕ, at the θ = constant angle, defines the ribbon outside the Σ(θ) surface, and that is why symbol ψ d p has been introduced. The relation with the poloidal flux ψ p inside the flux surface can be found in chapter 4 of D'haeseleer et al (2012), which states the complementarity of the two poloidal fluxes with respect to the total one. In the case where magnetic coordinates are used, each of the two fluxes can be chosen to label magnetic flux surfaces, but ψ d p has the disadvantage of decreasing radially outward. Therefore, calling ρ any label of magnetic flux surfaces, it is natural to choose ρ = ψ P or ρ = -ψ d P .

D.2 Using a classical tokamak formula for the magnetic field

A classical formula for tokamak magnetic fields is

B = ∇ϕ × ∇ψ + I(ψ)∇ϕ (D40)
where ψ = ψ p /2π is the radial variable proportional to the poloidal flux, I(ψ) is a flux function that will be better defined in the following, and ϕ is the symmetry angle.

The axisymmetry of the system is used in the choice of poloidal and toroidal angles satisfying the orthogonal relations ∇ψ • ∇ϕ = 0 and ∇ϕ • ∇θ = 0, as shown in section 6.2 of D'haeseleer et al (2012).

When magnetic coordinates are used, by taking into account that for magnetic flux surfaces, ψ P = ψ P (ψ T ) and ∇ψ T = (dψ T /dψ P )∇ψ P , it is easy to see that equation (46) for the magnetic field is equivalent to the Clebsch relation

B = ∇ψ × ∇(qθ -ϕ) (D41)
where q = 1/ι = dψ T /dψ P = dϕ/dθ, as defined in (59). Section 6.2 of D'haeseleer et al ( 2012) shows (D40) and (D41) are equivalent when the orthogonal coordinates are magnetic coordinates too. Therefore (D40) preserves the Hamiltonian structure defined by equations ( 45)-( 46). Section 6.3 of D'haeseleer et al (2012) shows that equation (D40) can be recovered even in non-magnetic coordinates. In this case, however, Clebsch relation (D41) can be recovered only for a particular choice of the poloidal angle such that the Jacobian of the coordinate system √ g ∝ R 2 , where R is the radial coordinate in a cylindrical coordinate system (R, ϕ, Z). This yields

I(R, Z) = qR 2 √ g , (D42)
which is valid in magnetic coordinates too. I(R, Z) can be written as I = RB T in cylindrical coordinates. Sections 6.2 and 6.3 of D'haeseleer et al (2012) show that I is a flux function for an isotropic pressure plasma equilibrium, and it is physically related to the poloidal flux external to the ψ-constant flux surfaces (including plasma and coils currents). When equation (D42) holds, for a given I(R, Z), one can derive q(R, Z). Because of the symmetry in ϕ, ψ p = ψ p (R, Z). To (R, Z = 0) corresponds q(R, 0) and ψ p = ψ p (R, 0). The latter expression can be inverted to yield R(ψ p ) on the flux surface ψ p = constant that contains point (R, 0). Because of the existence of magnetic surfaces, this expression can be set into q(R, 0), which yields q(ψ p ). Then, ψ T can be computed from equation ( 59) with ι = 1/q. Therefore, the vector potential can be computed from equation (45), and (D40) preserves again the Hamiltonian structure defined by equations ( 45)-( 46).

In the case of general orthogonal (with respect to the toroidal angle) coordinate systems, expression (D40) preserves the very general Hamiltonian structure given by equation ( 46), for which only the divergence null of the magnetic field on the torus is required. However, there is no simple way to compute ψ T . must be valid: the following equations are derived simply using equation (D32) in the magnetic coordinates (ψ T , ζ, ϕ), their relation with the (ψ T , ζ N , ϕ N ) coordinates, and the definition of the gradient of a function:

2πA = ψ T ∇ζ -ψ P ∇ϕ = (E47) = ψ T ∇ζ N + ∇f -ψ P ∇ϕ N + ∇g = (E48) = ψ T ∇ζ N + ∂f ∂ψ T ∇ψ T + ∂f ∂ζ N ∇ζ N + ∂f ∂ϕ N ∇ϕ N + (E49) -ψ P ∇ϕ N + ∂g ∂ψ T ∇ψ T + ∂g ∂ζ N ∇ζ N + ∂g ∂ϕ N ∇ϕ N = (E50) = ψ T ∇ζ N -ψ P ∇ϕ N + F (E51)
where

F = ψ T ∂f ∂ψ T -ψ P ∂g ∂ψ T ∇ψ T + ψ T ∂f ∂ζ N -ψ P ∂g ∂ζ N ∇ζ N + ψ T ∂f ∂ϕ N -ψ P ∂g ∂ϕ N ∇ϕ N (
∂G ∂ψ T = ∂ ∂ψ T ψ T f -ψ P g) -f + ιg (E53) ∂G ∂ζ N = ∂ ∂ζ N ψ T f -ψ P g) (E54) ∂G ∂ϕ N = ∂ ∂ϕ N ψ T f -ψ P g) (E55)
where ι = dψ P /dψ T is the rotational transform of the configuration and the fluxes depend on the radial variable only. For equations (E53)-(E55) to be compatible, (ιg-f ) in equation (E53) must be a function of ψ T only: ιg -f = h(ψ T ), which ends the first part of the proof.

Vice versa (only if ), one can prove that if equation (E46) holds, then A can be written in its canonical form. Applying equations (E44)-(E45) together with equation (E46) in equation (E47), one obtains the canonical form for A in (ψ

T , ζ N , ϕ N ) coordinates with G = ιψ T -ψ P g -ψ T ∂h ∂ψ T dψ T (E56)
This is in agreement with what already found in equation (E53) and ends the proof.

G.1 Pedestrian calculation

In this subsection the pendulum Hamiltonian is derived from the canonical equations of motion. Let p be the value of the toroidal flux (canonical momentum) of a magnetic flux surface very near to the resonant one defined by p 0 . Let δp = p -p 0 , and expand Hamiltonian (82) in δp next to p 0 . Since the width of the magnetic island in δp will turn out to scale like H 1,m0,n0 (p 0 ), considered as small, this expansion must be done up to order 2 in δp. This yields the reduced Hamiltonian

H r (δp, θ, ϕ) = H 0 (p 0 ) + ι(p 0 )δp + 1 2 dι(p 0 ) dp δp 2 + H 1,m0,n0 (p 0 ) cos(m 0 θ -n 0 ϕ), (G60)
from which we deduce the canonical equation of motion by using identities (25,26)

θ = dθ dt = ∂H r ∂p = ι(p 0 ) + dι(p 0 ) dp δp (G61) ṗ = dp dt = - ∂H r ∂q = m 0 H 1,m0,n0 (p 0 ) sin(m 0 θ -n 0 ϕ) (G62) θ = m 0 dι(p 0 ) dp H 1,m0,n0 (p 0 ) sin(u), (G63)
H r does not depend separately on θ and ϕ, but only on their helical composition.

In order to recognize the Hamiltonian H p of the pendulum, the helical angle u = m 0 θ -n 0 ϕ must be introduced. This yields ü = m 0 q = m 2 0 dι(p0)

dp H 1,m0,n0 (p 0 ) sin(u), which results from the combination of the canonical equations ) of the pendulum Hamiltonian

u = p (G64) ṗ = m 2 0 dι(p 0 ) dp H 1,m0,n0 (p 0 ) sin(u), ( G65
H p (p , u) = 1 2 p 2 + m 2 0 dι(p 0 ) dp H 1,m0,n0 (p 0 ) cos(u). (G66)
For the general pendulum Hamiltonian H = Gp 2 /2 -F , where G and F characterize the kinetic and potential energy respectively, the half width of the separatrix of the pendulum in phase space is W/2 = 2 F/G. The half width of the separatrix of the pendulum in equation ( G66) is

∆p = 2 m 2 0 dι(p 0 ) dp H 1,m0,n0 (p 0 ) . (G67)
Equations ( G61) and (G66), together with the definition of the helical angle u and of the toroidal angle ϕ as canonical time t, imply p = m 0 q -n 0 = m 0 (ι(p 0 ) + dι(p0) dp δp)n 0 . Therefore the width in p translates in an island width in units of p, which is m 0 dι(p0) dp smaller, and given by equation ( 90) here recalled

∆p = ∆ψ T = 2 H 1,m0,n0 (p 0 ) dι(p0) dp . (G68)
Note that this is the formula for the half width of a magnetic island. Note moreover that the island width is proportional to the square root of the perturbation of the Hamiltonian, and therefore of the perturbation of a magnetic flux, and not to a perturbation of a component of the magnetic field. The X and O points correspond to the extrema of the perturbation of the Hamiltonian respectively. The X-point corresponds to u X = 0 and the O-point to u O = π if dι(p0) dp H 1,m0,n0 (p 0 ) > 0 and the opposite otherwise. This implies

cos(u O )H 1,m0,n0 (p 0 ) = -sgn[ dι(p 0 ) dp ]|H 1,m0,n0 (p 0 )|. (G69)

G.2 Calculation with a canonical change of variables

In this subsection the Hamiltonian of the pendulum is obtained through a canonical change of coordinates, that highlights the helical symmetry of the system. We transform Hamiltonian (82) by a canonical change of variables from (p, θ) to (P, u) defined by the generating function G(P, θ, ϕ) = P (m 0 θ -n 0 ϕ) + p 0 θ. This yields

u = ∂G ∂P = m 0 θ -n 0 ϕ (G70) p = ∂G ∂θ = m 0 P + p 0 , (G71)
which implies P = (p -p 0 )/m 0 and the new Hamiltonian

H (P, u, ϕ) = H + ∂G ∂ϕ = H 0 (p 0 ) + m 2 0 2 dι(p 0 ) dp P 2 + H 1,m0,n0 (p 0 ) cos(u), (G72)
which is again a pendulum Hamiltonian with other units for P , except for the dynamically irrelevant H 0 (p 0 ) term. This yields again the magnetic island width equation ( 90) with the same values of u as above for the O-point and X-point respectively.

by choosing an axial gauge). Section 5.1 considers the case where an appropriate redefinition of the toroidal flux enables considering the magnetic perturbation to bear only on the poloidal one, as shown in appendix F. Here we obtain the same results as section 5.2, but considering the perturbation on both fluxes. Covariant components of A and magnetic fluxes are identified remembering the results of appendix D, ψ t = 2πA θ and ψ p = -2πA ϕ .

A general perturbation can be decomposed in a whole spectrum of Fourier components. We consider the case of a single Fourier component perturbation to the equilibrium magnetic field whose magnetic flux surfaces are defined by the equilibrium fluxes ψ P (ψ T ). We consider that x = (ψ T , θ, ϕ) are magnetic coordinates for the equilibrium field, so the perturbed fluxes can be written as where m 0 and n 0 define, respectively, the poloidal and toroidal periodicity of the single perturbation and u = m 0 θ -n 0 ϕ defines the helical angle. Being Fourier components, ψ m0,n0 t (ψ T ) and ψ m0,n0 p (ψ T ) are complex functions and c.c. means the complex conjugate. Note moreover that capital letter T is used to indicate the equilibrium toroidal flux, used as radial coordinate, whereas the lowercase letters t and p are used for the perturbed fluxes. Clearly, equation (H74) correspond to equation ( 82).

Using both equations (H73)-(H74), we compute the S O flux introduced in section 5.2, as

S O = 1 2π O [pdθ -H(p, q, ϕ)dϕ] = O [A θ dθ + A ϕ dϕ] (H75)
which is a line integral along the line defined by the O-point of the (m 0 , n 0 ) island developed around the resonant surface defined by ι(ψ T ) = dψ P /dψ T = n 0 /m 0 . The S X flux is defined in an analogous way along the line defined by the X-point. We show that they are the helical fluxes through the flux surface defined by the O and X-point respectively. Their difference, the Φ OX flux, can be written in terms of the perturbation to the helical flux at the resonant surface, and is defined as the flux through the ribbon defined by the extremal points of the island.

In computing S O , we assume that m 0 and n 0 are mutually relatively prime, ϕ varies by 2πm 0 along O and θ varies by 2πn 0 , while u O = constant. This yields h | e i φ m 0 ,n 0 h , as a function of the poloidal and toroidal ones, formulas for the sum of complex numbers must be used.

The computation of the S X flux follows the same steps, with u O being substituted by u X and remembering that u X is shifted by π with respect to u O : u O +φ m0,n0 h = 0, π and u X + φ m0,n0 h = π, 0 depending on the sign of the magnetic shear (see appendix G). Here φ m0,n0 where, again, all radial functions must be evaluated on the resonant surface.

Let us now compare equations ( 87) and (H80) for Φ OX = S O -S X , the first obtained considering the perturbation to the vector potential to bear on the poloidal flux only as defined by equation ( 81), the latter considering perturbations (H73)-(H74) to both the fluxes. One can immediately note a simple change in the notation between the two equations, where p = ψ T and p 0 is the equilibrium toroidal flux on the resonant surface. Moreover, to derive equation ( 87) the phase of the single Fourier components of the perturbation has been neglected. This cannot be done in the case where both fluxes are perturbed.

More interesting is to note that both equations express the Φ OX flux in terms of the perturbation to a helical flux evaluated at the resonant surface: In RFX-mod, many Fourier components of a perturbation can be reconstructed for both the poloidal and toroidal magnetic fluxes from the solutions of Newcomb-like equations in toroidal geometry [START_REF] Zanca | Reconstruction of themagnetic perturbation in a toroidal reversed field pinch[END_REF]. Considering just the single helical deformation related to the island periodicity, perturbed magnetic fluxes can be written as in equations ( H73)-(H74), with p = ψ t and H = ψ p . The Φ OX = S O -S X flux in equation ( 90) is here calculated using equation (H80), derived in appendix H considering the perturbation to both the fluxes, and not just on the Hamiltonian as done in deriving the analogous equation ( 87). The equilibrium fluxes, p 0 = ψ T (r) and H 0 = ψ P (r), are known as a function of the radius r of the unperturbed circular magnetic flux surfaces and this is used to get the final island width in units of lengths: ∆r = dψ T dr -1 ∆p (H89)

As a practical example we choose an island whose width can be also measured from the Poincaré plot in figure 6 of [START_REF] Predebon | Reconstruction of flux coordinates from discretized magnetic field maps[END_REF] and here reported in figure H1 on a horizontal plane. Both, the island width computed from equation (H89) and with a ruler from the Poincaré plot, give an island width of about 12 cm, confirming the applicability and the correctness of the method proposed in section 5.3.

Fig. 2

 2 Fig. 2 Helical ribbon defining the Φ OX flux. In red and blue the closed orbits defined by the O and X-point of a (m 0 = 1, n 0 = 1) magnetic island, respectively. Their intersections o and x in a poloidal section are indicated. The magnetic island separatrix is indicated in green.

  implies that the change of canonical variables (p, q) → (I, ζ) is a change of coordinates that does not perturb the constant energy surfaces in phase space.Canonical equations of motion are very simple in action-angle coordinates. Because of equation (C19), the action is constant along any orbit of constant energy E runs over the range of q, and the right hand side results from the definition of I, equation (C19). Because of this range, ζ is called angle. It evolves linearly in time with the frequency ω(I).

  E52)In order to reduce equation (E51) -written in the (ψ t , ζ N , ϕ N ) coordinates -to the general form in equation (D32), function F must be the gradient of some function G: let us say F = ∇G(ψ T , ζ N , ϕ N ), with F given in equation (E52). Therefore it results:

  ψ t (ψ T , θ, ϕ) ψ T + ψ m0,n0 t (ψ T ) e iu + c.c. = 2πA θ (H73) ψ p (ψ T , θ, ϕ) ψ P (ψ T ) + ψ m0,n0 p (ψ T ) e iu + c.c. = -2πA ϕ (H74)

  ψ T -m 0 ψ P + n 0 ψ m0,n0 t -m 0 ψ m0,n0 p e iu O + c.c. (H77)where all radial functions must be evaluated on the rational surface defined by ι = n 0 /m 0 . Introducing the helical fluxψ h (ψ T , u) = m 0 ψ p -n 0 ψ t ,(H78)S O in equation (H77) can be written in terms of this flux through the O-point orbit as-S O = ψ H (ψ T ) + ψ m0,n0 h (ψ T ) e iu O + c.c. = ψ h (ψ T , u) (H79)where ψ H is related to the equilibrium fluxes. To compute correctly the amplitude and phase of the Fourier component of the helical flux, ψ m0,n0 h (ψ T ) = |ψ m0,n0

h

  is the phase of the resonant Fourier component of the helical flux. This yields S O -S X =

Φ

  flux perturbation in terms of the perturbation to the poloidal and toroidal fluxes using definition (H78), it is straightforward to see that equation (is considered to the Hamiltonian ψ p only. This shows that equation (H80) reduces to equation (87) in this case, considering also that |H 1,m0,n0 | = 2 |ψ m0,n0 p | for the chosen definitions of the perturbations, and this ends the proof.H.1 Previously introduced coordinate-independent fluxesEquation (14) of reference[START_REF] Boozer | Physics of magnetically confined plasmas[END_REF] considers the Fourier component √ g δB • ∇ψ = b mn sin(nϕ -mθ), (H85) written in our notations for the magnetic coordinates x = (ψ, θ, ϕ) with Jacobian 1/ √ g. It computes from it the corresponding island half-width (16), which is exactly equation (90), if one identifies |b mn | and 2|Φ OX |. This proves |b mn | to be a coordinateindependent flux (and not a component of the magnetic field, despite the notation). Another example can be found in reference Park et al (2008) which considers under equation (12) the single Fourier component √ g δB • ∇ψ = Φ mn exp (mθ -nϕ) + c.c. (H86) of a flux Φ, written in our notations. It proves the resonant |Φ mn | to be coordinate independent, being the same in each set of magnetic coordinates. It is straightforward to show that |Φ mn | = |b mn |/2π = |Φ OX |/π.The definition of the curl in generic curvilinear coordinates,B i = 1 √ g ijk ∂A k∂x j , permits to express the flux Φ through the covariant components of the potential vector or, equivalently, the magnetic fluxes. Einstein's convention has been used in the expression for the curl of A, where ijk = ±1, depending on the order of the indexes. H73) and (H74) for the fluxes around the resonant surfaces and the definitions ψ h = m 0 ψ p -n 0 ψ t of the helical flux and u = m 0 θ -n 0 ϕ of the helical angle, equation (H87) can be written as Φ Φ m0,n0 (ψ) e i u + c.c. =as the Φ OX flux defined in this review, the flux Φ defined in Park et al (2008) can be defined through the perturbation to the helical flux, i. e. the flux due to the radial perturbation to the magnetic field. The definition of Φ OX through the helical flux perturbation is proved in equation H81. H.2 An example: numerical calculation of a magnetic island width from RFX-mod experimental data

Fig. H1

 H1 Fig. H1 Poincaré plot of a (m 0 , n 0 ) = (1, 7) magnetic island from RFX-mod experimental data.

Perturbation δB(ψ T , θ, ϕ) of a regular magnetic field is provided by a perturbation δA(ψ T , θ, ϕ) of both components of the vector potential (the third one being killed

RFX-mod device Sonato et al (2003) is a large toroidal RFP device with major radius 2 m and minor radius of about 0.5 m operating in Padova, Italy. RFX-mod experimental data have been used here to compute the width of a (m 0 , n 0 ) = (1, 7) core magnetic island applying the formula given by the last equality of equation (90) which involves the computation of the Φ OX flux.

Acknowledgments. We thank G. Spizzo for a useful remark, A. Escarguel for a first publishable version of figure 2, and I. Predebon for a careful reading of the main body of this paper, and for making us very useful remarks. We thank both referees for useful remarks.

Declarations

Dominique Franck Escande is an editorial board member for Reviews of Modern Plasma Physics and was not involved in the editorial review or the decision to publish this article. All other authors declare that there are no competing interests.

Appendices.

Appendix A Euler-Lagrange equations for magnetic field lines

In section 2 it has been shown that the Euler-Lagrange equations yield the equations defining the magnetic field lines when the Lagrangian of the magnetic system is used.

In this appendix we explicitly derive the magnetic field line equations from the Euler-Lagrangian ones, recalling first the Lagragian of the system:

where x = (x 1 , x 2 , x 3 ) are the spatial coordinates, x 3 being the coordinate that parametrizes the magnetic field line, and the A i 's the covariant components of the vector potential. The last expression of equation (A1) writes the Lagrangian in a more compact form using the Einstein's convention of summation over repeated indices and ẋi = dx i /dx 3 . The corresponding Euler-Lagrange equations are

With L given by equation (A1),

where δ i j = 1 when i = j and null otherwise. The second term of the left hand side of equation (A2) can then be written as

Appendix B Canonical transformations

Here we recall a classical way of defining a canonical transformation. The variational principle expressed by equations ( 21) and ( 22) for the one-degree-of-freedom case related to magnetic field lines yield

Appendix C Action-angle variables for one-degree-of-freedom Hamiltonians

Canonical equations of motion, dq/dt = ∂H/∂p and dp/dt = -∂H/∂q, imply that the total time derivative of a one-degree-of-freedom time-independent Hamiltonian H(p, q) vanishes, dH/dt = 0. Therefore, H(p, q) is a constant of the motion and defines constant energy surfaces in phase space: H(p, q) = E. In this case it is always

Appendix D Intuitive physical approach to the vector potential

Any divergence free field (like the magnetic field B) in a torus can be written in its canonical form, as showed in section 4.1,

Appendix E Change of coordinates between magnetic coordinates

We showed in appendix D the equivalence between the covariant components of the vector potential and the magnetic fluxes, as introduced also in section 4. In general, ψ t = ψ t (x) and ψ p = ψ p (x) are poloidal and toroidal fluxes that do not define magnetic flux surfaces. Magnetic flux surfaces exist only in integrable systems, and are defined by H(p, q) = constant. Only when using magnetic (or action-angle) coordinates to describe the system, magnetic flux surfaces are equivalently defined by both magnetic fluxes, for which ψ P = ψ P (ψ T ) holds. Capital letters in indices are used to distinguish them from the more general ψ p (x) and ψ t (x) fluxes with a less geometrical intuitive definition (see appendix D).

Here we prove the relations defining the change of coordinates between magnetic coordinates, considering that the vector potential can be written in the form

where ψ P = ψ P (ψ T ), if and only if a set of magnetic coordinates is chosen.

In particular we prove that equations ( 61)-( 62), here reported

define the change of coordinates between magnetic coordinates, from (ζ, ϕ) to (ζ N , ϕ N ), if and only if functions f and g are linked by equation ( 65):

We prove it showing that if A can be written in its general form (D32) for the fluxes ψ P (ψ T ), both in (ψ T , ζ, ϕ) and (ψ T , ζ N , ϕ N ) coordinates, then equation (E46)

Appendix F Perturbation of the vector potential

A perturbation to a regular magnetic field involves the perturbation of both poloidal and toroidal magnetic fluxes through magnetic flux surfaces. Using expression (45) for A, its perturbation can be written as δA = δψ T ∇θ/2π -δψ P ∇ϕ/2π, (F57)

where we consider both δψ T and δψ P are function of the coordinates x = (ψ T , θ, ϕ).

Here we prove that, whatever the perturbation to the toroidal flux δψ T , there exists an appropriate redefinition of this variable that permits to consider the perturbation to be only on the Hamiltonian of the system (the poloidal flux), as written in equation ( 82).

Let ψ T = ψ T + δψ T and define δψ T (ψ T , θ, ϕ) = ψ T -ψ T , which leads to the redefinition of the radial coordinate ψ T = ψ T + δψ T . The perturbed potential vector A + δA, written as a function of ψ T , is

where ψ P = ψ P (ψ T + δψ T ) + δψ P (ψ T + δψ T , θ, ϕ). We now define ∆ψ P (ψ T , θ, ϕ) = ψ P (ψ T , θ, ϕ) -ψ P (ψ T ), in order to write an expression for A that highlights a perturbation only of the poloidal flux

This shows the perturbed magnetic field can always be defined by a perturbation of the poloidal flux only. The memory of the change in ψ T is lost when going to the Hamiltonian and using canonical coordinates, where it corresponds to a conjugate momentum with the same name p. In the literature, for practical purposes, often people perturb directly the Hamiltonian, which hides the actual change in the potential vector, as done in equation ( 82).

Appendix G Magnetic island width

Small perturbations of an integrable magnetic field open magnetic islands around the magnetic flux surface where the perturbation is resonant. By definition, resonant magnetic flux surfaces are identified by a rational value of the rotational transform, ι(ψ T ) = n 0 /m 0 . Magnetic perturbations resonant on this surface have the form H 1,m0,n0 (p 0 ) cos(m 0 θ -n 0 ϕ). Using identities (47)-( 50) between magnetic fluxes and canonical coordinates, we define p 0 as the value of the canonical momentum (or toroidal flux) on the resonant flux surface defined by ι(p 0 ) = n 0 /m 0 , the canonical variable q as the poloidal angle θ and the canonical time as the toroidal angle ϕ.

We recall here that any small resonant magnetic perturbation can be described by a Hamiltonian formally identical to the Hamiltonian of a simple pendulum. Two equivalent demonstrations of this fact are provided in the next subsections.