{'fraction_non_alphanumeric': 0.03652658940755984, 'fraction_numerical': 0.01581284522906964, 'mean_word_length': 4.148891677122543, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Field line winding of braided vector fields in tubular subdomains

Braided vector fields on spatial subdomains homeomorphic to the cylinder play a crucial role in applications such as solar and plasma physics, relativistic astrophysics, fluid and vortex dynamics, elasticity, and bio-elasticity. Often the vector field's topology -- the entanglement of its field lines -- is non-trivial, and can play a significant role in the vector field's evolution. We present a complete topological characterisation of such vector fields (up to isotopy) using a quantity called field line winding. This measures the entanglement of each field line with all other field lines of the vector field, and may be defined for an arbitrary tubular subdomain by prescribing a minimally distorted coordinate system. We propose how to define such coordinates, and prove that the resulting field line winding distribution uniquely classifies the topology of a braided vector field. The field line winding is similar to the field line helicity considered previously for magnetic (solenoidal) fields, but is a more fundamental measure of the field line topology because it does not conflate linking information with field strength.


Introduction
The entanglement of vector field integral curves (field lines) in tubular subdomains homeomorphic to the cylinder has long been of wide interest. For example, in stellar interiors, twisted bundles of magnetic field lines -known as magnetic flux ropesare potentially important for the generation of large scale magnetic fields (Childress & Gilbert 1995, Moffatt & Proctor 1985, Nordlund et al. 1992, Bao & Yang 2010. In stellar atmospheres such as the Sun's corona, twisted and braided magnetic fields play a crucial role in dynamic phenomena such as coronal heating, jet formation, and coronal mass ejections (Rust & Kumar 1996, Török & Kliem 2005, Wilmot-Smith 2015, Prior & MacTaggart 2016, Yeates & Hornig 2016. Another area where the dynamic entanglement of magnetic field is crucial is the formation of relativistic jets from black holes and neutron stars (Komissarov 1999, Heinz & Begelman 2000, Contopoulos et al. 2009, Prior & Gourgouliatos 2019. In thin body elasticity, structures such as ropes, cables, and biopolymers are treated as thin elastic tubes which can be internally twisted and which often react to this twisting by forming looped and knotted structures (Goriely & Tabor 1998, Thompson et al. 2002, Grason 2009, Starostin & Van der Heijden 2014, Prior & Neukirch 2016. A particularly well known example is plectoneme formation, whereby an elastic tube submitted to increasing twisting becomes unstable and loops at its centre, forming a self-contacting loop. As the twist is further increased the number of loops increase and the tube becomes supercoiled. DNA is an example of a biopolymer which exhibits this supercoiling (and where twisting can be applied by optical tweezer experiments, e.g., Forth et al. 2008). Supercoiling acts as a mechanism for large DNA molecules to compactify in order to fit into their local environment (Mullinger & Johnson 1980). In all of these varied systems, a crucial aspect is their inability to disentangle, at least completely. This often informs their physical behaviour, and means that quantifying entanglement is important for understanding the systems themselves.
Motivation for our work comes from the particular context of magnetised plasmas, where the standard tool for quantifying entanglement is a volume integral called magnetic helicity, H (Woltjer 1958, Berger & Field 1984, analogous to a similar quantity in fluid dynamics (Moreau 1961, Moffatt 1969, Arnold & Khesin 1992. For a "closed" magnetic field whose field line curves are tangent to the boundary, the value of this integral is invariant under an ideal evolution because field lines cannot reconnect and change their topology. As a result, having non-zero H constrains the amount of magnetic energy that can be released (Arnold & Khesin 1992). In such a magnetically-closed volume, it has long been known that H may be written as an average of the Gauss linking integral between all pairs of magnetic field line curves (Pohl 1968, Moffatt 1969, Cantarella & Parsley 2010. Recently, Prior & Yeates (2014) showed that the H admits an analogous interpretation for so-called "braided" magnetic fields, where magnetic field lines connect between two planar boundaries rather than being tangent. In this case, H is gauge dependent, but the authors showed that there is a particular gauge, the "winding gauge", in which H is the equal to the average winding number between all pairs of field line curves. This extends the topological interpretation of helicity beyond the restricted case of tangent fields, which are not directly relevant for applications such as stellar atmospheres.
The main limitation of the winding-gauge helicity of Prior & Yeates (2014) is that it is defined only for domains foliated by planes, for which the standard definition of winding number can be used. However, in many contexts it would be useful to consider tubular domains of more general shape. One example would be the concentrated magnetic flux ropes that form during flux emergence into the solar atmosphere. Such flux ropes typically occupy curved and distorted domains that cannot be represented as foliations of parallel planes (Longcope & Malanushenko 2008). Yet to characterise the internal entanglement of such structures it is necessary to isolate them from the surrounding magnetic field. Recent work has suggested that these structures may be more stable if they have a complex, "braided" internal field-line topology, rather than a uniformly twisted structure (Prior & Yeates 2016). Even in stable loops, Wilmot-Smith et al. (2011) showed that different internal braiding patterns can lead to significantly different internal heating. It is important to note that the Prior & Yeates (2014) definition of winding-gauge helicity will fail not only if the tubular domain as a whole has a curved shape, but also if its end "caps" are not flat. Recently, Prior & MacTaggart (2019) have shown that accounting for such wrinkling of the Sun's surface can significantly affect the measured input of magnetic helicity into the solar atmosphere. Observational studies of such helicity injection are important because they can potentially be used try to predict the ensuing behaviour of the atmospheric magnetic field (Romano et al. 2011, Dalmasse et al. 2014, Gopalswamy et al. 2017, as well as providing insight into the unobservable magnetic structure in the solar interior. Thus there is a need to consider winding numbers on more general domains, so as to quantify the entanglement of vector fields on those domains. This is the main aim of this paper. To fully quantify the entanglement of a braided vector field, it is not sufficient to consider only a single, global integral like magnetic helicity, H. To give an extreme example, since H is a signed quantity, one can have a topologically non-trivial vector field with zero total H, such as the Borromean rings (Del Sordo et al. 2010) or the equivalent magnetic braid (Wilmot-Smith 2015). Moreover, in real systems that are not perfectly ideal, it is often the case that there are substantial local changes in entanglement, even when the total H (the average entanglement) is conserved to a good approximation (Taylor 1974, Russell et al. 2015. A full understanding of the field line topology therefore requires the study of finer-grained invariants. As such, our main quantity of interest in this paper is not the analogue of H (which would be the average winding among all pairs of field lines), but rather the analogue of field line helicity (Berger 1988, Yeates & Hornig 2013, Aly 2018, Yeates & Page 2018, Moraitis et al. 2019). This we call the field line winding, as it is defined for each field line and measures the average winding of this field line with all others.
Our new measure of field line winding allows not only for more general shapes of domain but also for more general classes of vector field. We still assume that the vector field is "braided" (defined precisely in Section 2), but unlike Prior & Yeates (2014) we do not require it to be solenoidal (divergence free). As will be discussed in Section 6, this amounts to removing the field-strength information from the winding measure. Magnetic helicity, for example, has units of magnetic flux squared, and is effectively a confluence of both topological and strength information. As shown by Prior & Yeates (2014), a given set of field line curves can have different helicity depending on the field strength. In this paper, we focus purely on how to uniquely describe the field line topology, without regard to the strength. This unweighted, purely topological measure applies equally to non-solenoidal fields, whereas the magnetic helicity, for example, is an ideal invariant only thanks to the solenoidal nature of the magnetic field.
The paper is organised as follows. After stating our assumptions on the vector field and domain in Section 2, we give the general definition of winding numbers and field Figure 1: A tubular subdomain M is an embedding of the unit cylinder in R 3 given by a homeomorphism F : C → R 3 . The discs D z of constant z in the cylinder C map to distorted surfaces S z that foliate M. Shown in green are a field line F (γ) ∈ M and its preimage curve γ ∈ C. A crucial part of this study will be to determine a minimally-distorted choice for the map F , within a given subdomain M.
line winding in Section 3. These definitions rely on establishing a least distorted vector field on the domain, whose field lines have no mutual winding. This is addressed in Section 4. In Section 5, we prove that the field line topology is completely determined by the distribution of field line winding. This is an extension of an earlier completeness result that applied only to a more restricted class of solenoidal vector fields (Yeates & Hornig 2013, Yeates & Hornig 2014, Prior & Yeates 2018. As well as extending the class of domains and vector fields considered, we prove that the field line winding measure uniquely determines not only the field line mapping (as in the earlier papers) but also whether or not the two vector fields can be linked by an ideal evolution (an endvanishing isotopy). Thus we also strengthen the earlier result for magnetic fields. The relation of our field line winding invariant to magnetic helicity is discussed in Section 6, before concluding in Section 7.

Assumptions and notation
In this paper, we consider vector fields v defined on subdomains M ⊂ R 3 . Both are restricted, in the following ways. The subdomain M is "tubular", meaning that it may be thought of as an embedding of the solid unit cylinder C in R 3 , determined by some homeomorphism F : C → R 3 , as in Figure 1. This homeomorphism F is by no means unique, and an important part of this paper will be to choose a suitable F . Note that the boundary ∂M = S 0 ∪S 1 ∪S s is the union of two end caps S 0 , S 1 and a side boundary S s , and this composite boundary is assumed Lipschitz continuous. This means that M can be foliated by a set of surfaces S z , z ∈ [0, 1]. We will choose F so that these surfaces are the images of the discs D z of constant z in C, where we define Cartesian coordinates on C as (x 1 , x 2 , z). This notation recognizes the special role of the third coordinate in Figure 2: Three curves that could be field lines of a braided vector field as defined in Section 2. The green curve would not be monotone in z but is still valid provided that the corresponding v can be deformed by isotopy to a field with field lines that are monotone in z.
defining the foliation. In effect, z becomes an axial coordinate for M. Throughout this paper we will denote points in C by x and points in M by y.
The vector field v is "braided", meaning that it is Lipschitz continuous, non-zero everywhere in M ∪ ∂M, and satisfies the boundary conditionŝ whereẑ is a unit vector normal to S z pointing in the direction of increasing z andn is the unit normal to S s . Thus the integral curves/field lines of v are all rectifiable curves that connect from S 0 to S 1 , as shown for the three example field lines in Figure  2. The final assumption on v is that its field lines can be deformed by isotopy to a vector field satisfyingẑ · v > 0 on every S z . By an isotopy we mean a continuous set of homeomorphisms of the curves (which are automorphisms of the domain M). For such fields, we can define a mapping from S 0 to S z , or equivalently from D 0 to D z by following the field lines. These mappings are diffeomorphisms thanks to the Picard-Lindelöf theorem (see, e.g, Arnold 2012). In particular, we define a diffeomorphism f (1) from D 0 to D 1 that will be used in Section 5.

Field line winding
Our goal in this paper is to describe the field-line topology of a braided vector field v in M. In other words, properties of the field lines that remain unchanged under a continuous isotopy/deformation of v. Since the field lines exit M through S 0 and S 1 , we must qualify this statement: we consider properties that remain invariant under isotopies of v that vanish on S 0 and S 1 . These we call end-vanishing isotopies.
Our topological invariants are based on winding numbers between field lines. In this paper, we take advantage of the embedding of M and define the winding number between any two curves in M by calculating the winding number between their two preimage curves in C. An alternative approach would be to work in M directly by choosing a metric structure. The advantage of our approach is that it allows us to define the angle in a simple and clear manner (i.e., on the cylinder), as well as simplifying the proof in Section 5. Figure 3(a) shows field lines of an example vector field on a tubular domain M, and Figure 3(b) shows the preimages of these curves in C for a particular choice of the embedding map F . How best to choose F will be addressed in Section 4.

Pairwise winding number
Given two preimage curves γ, γ in C, the most basic topological invariant is their pairwise winding number. In any plane D z , we can use the Cartesian components of the two curves γ and γ to define the "angle" between them, as shown in Figure 4. The net change in this angle as we follow the curves from z = 0 to z = 1 is the pairwise winding number Figure 4: Definition of the angle Θ between two curves γ, γ on C.
where primes denote differentiation by z. Alternatively, we may write where N (γ, γ) counts the (signed) number of branch cut crossings as we follow the curves in z. This makes clear that L(γ, γ) is invariant under any isotopy of the curves that does not move their end-points. In other words, it is a topological invariant. Berger & Prior (2006) showed that the definition of L(γ, γ) may be generalised to allow for non-monotonic curves like the green curve in Figure 2. Such a curve γ is split into n + 1 sections γ (0) , . . . , γ (n) using the n turning points where dγ z /dz = 0. For each section, we define the indicator function We split γ and define σ (j) in a similar way. Then the pairwise winding number is the sum where [z min ij , z max ij ] is the mutual range of z values (if any) shared by the curve sections γ (i) and γ (j) . Once again, L(γ, γ) is invariant to any isotopy of the curves that fixes their endpoints. It reduces to (3) if both curves have only a single section stretching from z = 0 to z = 1. (Although not needed here, Berger & Prior (2006) also showed that when the curves are closed, L(γ, γ) is equal to their Gauss linking integral, hence the notation "L".) It is important to realize that the value of L(γ, γ) depends on the choice of embedding map F . This is illustrated by Figure 5. Nevertheless, L(γ, γ) is a topological invariant for any (fixed) choice of F , under deformations that vanish on S 0 and S 1 . Here the red and green curves show F (γ) and F ( γ), while yellow lines indicate the surface that F (γ) should belong to in each coordinate system to give constant Θ(γ, γ, z). In (a) F (γ) lies in this surface, so L(γ, γ) = 0, but in (b) it does not and L(γ, γ) = 0.

Field line winding of a vector field
In principle, we could characterise the field line topology of v by the set of all pairwise winding numbers L(γ, γ) between all pairs of preimage field lines. However, we will show in Section 5 that this would entail significant redundancy. A more succinct description of the field line topology is given by a quantity we call the field line winding. This is defined for each field line γ, and is simply the average winding number of γ with all other field lines in C, i.e., Here γ(x) denotes the field line starting from a point x ∈ D 0 . Since every field line γ passes through D 0 , L v defines a scalar distribution on D 0 . An example of such a distribution is shown in Figure 3(c). By virtue of its definition, L v is invariant under end vanishing isotopies of v that vanish on S 0 , S 1 . Like L(γ, γ), the field line winding L v (γ) is dependent on the choice of mapping from C to M; we will shortly fix this choice and hence the definition of L.
An alternative way to write (8) is to use Cartesian coordinates (x 1 , x 2 , z) on C, then (4) gives where γ(x) is the curve passing through the point x = (x 1 , x 2 , z) ∈ D z .

Choice of embedding map
For measuring field line winding on a fixed subdomain M, any choice of embedding map F : C → M will generate a topological measure L v that is invariant under endvanishing isotopies. However, as we saw in Figure 5, the actual value of L v for each field line depends on the chosen mapping. In order to allow for comparison between vector fields on different M, it is useful to define F uniquely and fix an absolute L v . In this section, we propose to do this by identifying the "least distorted" vector field on M, that follows the shape of the tube as simply as possible. We then define F so that the field lines of this least distorted field are the images of vertical lines on C. This way, they will all have L v ≡ 0. Vector fields with non-trivial field line topology will then have L v = 0, at least for a subset of their field lines.

The least distorted field
A natural candidate for least-distorted braided vector field on M is a harmonic vector field u = ∇φ that satisfies z × ∇φ = 0 on S 0 , S 1 , n · ∇φ = 0 on S s .
Here we reiterate thatẑ is the unit normal to the cross-sectional surfaces S z , andn is the unit normal to the side boundary S s . Conditions (10)-(12) define u uniquely up to magnitude, disregarding the trivial case of constant φ. Condition (11) implies that φ is constant on each of the end caps, so that the integral curves are normal to these end caps. The actual values of these two constants control the magnitude and sign of u, but not the shape of its integral curves. That this field can be assumed to exist on M is a result of Theorem 1.1 of Goldshtein et al. (2011), which provides a mixed boundary condition Hodge decomposition on Lipschitz domains. In particular the dimension of the harmonic field space, given by (1.6) in that paper, is 1 for a cylinder; this dimension corresponds to the magnitude of the field u.
To motivate the choice of condition (11), consider any other harmonic field ∇φ = ∇(φ + ψ) in M that satisfies (12) and has the same flux as ∇φ through S 0 and S 1 , meaning that Therefore ∇φ is the harmonic field in M that minimizes this energy for a given axial flux. In this sense, it has the least distorted integral curves. This is related to the notion of harmonic coordinates in Riemannian geometry (DeTurck & Kazdan 1981), which may be thought of as minimizing the Dirichlet energy of a coordinate map from M to R 3 . Examples of this field u are shown in Figure 6 for various domains, computed using the finite-element code IFEM2 in MATLAB (Chen 2009). Note that the curves of this least distorted field flow through the domain, contouring to its shape and expanding (contracting) when the tube does. They are the natural analogue of straight lines in a Cartesian domain.

Definition of the embedding map
It is most convenient to specify F −1 rather than F itself directly. Our fundamental idea is that field lines of u should map to vertical lines in C, but this leaves considerable freedom in the choice of F −1 , both in the z coordinate (effectively distance along the field lines) and in which field line of u maps to which vertical line in C. To set the z coordinate, note that u = ∇φ naturally defines a foliation {S z } of M by taking each S φ to be the surface φ = constant. Given the freedom in scaling the magnitude of u, we may always arrange that φ = 0 on S 0 and φ = 1 on S 1 . The fact that φ gives a valid foliation relies on the fact that u is non-zero everywhere on the interior of M (see Appendix A).
Choosing which field line of u maps to which vertical line is equivalent to choosing F −1 on one of the end caps, say S 0 . Equivalently, we must choose functions (x 1 (y), x 2 (y)) for y ∈ S 0 . To avoid measuring any spurious pairwise winding (cf. Figure 5), we require each of the functions x 1 and x 2 to be harmonic in the two-dimensional surface S 0 , that is where ∇ 2 S 0 indicates the Laplacian operator in the surface S 0 . To specify a unique solution we also need to impose boundary conditions on ∂S 0 . In order to ensure that F −1 (and hence F ) is one-to-one, these boundary conditions must take the form x 1 = cos(θ(s)), x 2 = sin(θ(s)), where θ(s) is an angle function of arclength s along ∂S 0 . An example is shown in Figure 7, where we make the simple choice θ(s) = 2πs/L for some arbitrary point s = 0, where L is the perimeter length of S 0 .

Topological classification
In this section, we will show that the field-line winding L v distribution for a braided vector field v completely determines the topology of its field lines, in the following sense. Notice that this is purely a result about the field line curves: the magnitudes of v and v do not matter, because L v and L v depend only on the geometry of the curves. The boundary requirement on S s relates to a fundamental fact regarding the classification group of parametrized diffeomorphisms of the unit disc (Aref 1984, Birman 2016. Essentially, if the corresponding field line mappings f (1), f (1) differ on the side boundary, then this difference could be compensated by an opposite rotation on the interior, leading to both fields having the same L v .
Proof of Theorem 1. One direction is immediate: we know that L v is invariant under any isotopy of v that vanishes on S 0 and S 1 . The other direction is a deeper result. Our strategy will be to first show that equality of L v and L v implies equality of the corresponding field line mappings f (1), f (1) from D 0 to D 1 . Then, we will show that this implies the existence of an end vanishing isotopy between the field lines of v and those of v .
To show equality of the field line mappings f (1) and f (1), consider the gradient of L v (γ) with respect to the field line startpoint (r, θ) ∈ D 0 . This is most succinctly expressed in the language of differential forms as d ⊥ L v , and we claim that where α(r, θ, z) = r 2 2 dθ.
To see this, note that we can write L v in terms of the field line mapping f as where Θ(γ, γ(x), z) is the angle made in the surface D z by the curve γ and another curve γ rooted at a point x ∈ D 0 . Treating this as a function of the γ-startpoint (r, θ) ∈ D 0 , we differentiate to find One may show by explicit calculation (see Appendix B) that from which (16) follows. Now consider the composite map g : D 0 → D 0 , defined by g = f (1) −1 • f (1). Under our assumption L v = L v , it follows from equation (16) that g * α = α (Yeates & Hornig 2013). Equivalently, in components, The first equation shows that g θ (r, θ) = G(θ), but the fact that f (1) = f (1) on the side boundary (by our assumption on S s ) means that g θ (r, θ) = θ. The second equation then shows that g r (r, θ) = r, so g is the identity and hence f (1) = f (1). This leaves us to show that there exists an isotopy between any two braided vector fields with the same field line mapping f (1). For this we utilise some established results.
The field lines f (z) are parametrised curves in the group of diffeomorphisms of the unit disc, Diffeo(D 2 ). Since f (0) = f (0) = id and f (1) = f (1), the composite map forms a closed curve in this group which is anchored at the identity. If this curve can be shrunk to the identity within the group by a homotopy then the field lines can be linked by an isotopy. Thus we are interested in the homotopy group π 1 (Diffeo(D 2 )) of curves in Diffeo(D 2 ) (anchored at the identity). A number of established facts related to this group allow us to answer the question. Firstly, there is a restriction map obtained by restricting each diffeomorphism in D 2 to the boundary ∂D 2 = S 1 . This is a fibration with fiber Diffeo ∂D 2 (D 2 ), namely diffeomorphisms of the disc that fix the boundary. This implies that the map π 1 (Diffeo((D 2 )) → π 1 (Diffeo(S 1 )) is an isomorphism -see Mann (2013) in conjunction with Theorem 4.41 in Hatcher (2002). Finally there is a homotopy equivalence between Diffeo(S 1 ) and the group O 2 of rotations (see Smale 1959). Putting this information together implies that the set of closed curves in the space Diffeo(D 2 ), from which our map f c is drawn, can be categorised up to homotopy by their behaviour when restricted to the boundary of the cylinder. Then the fact that the homotopy group has the structure of O 2 implies that closed curves in Diffeo(D 2 ) are homotopic to the identity if and only if they describe no net integer rotation on the boundary. The boundary assumption in the theorem ensures this for f c .

Relation to helicity
Since each pairwise winding number L(γ, γ) is itself invariant under end-vanishing isotopies of v, it is clear that any functional will be similarly invariant. The field line winding L v (γ), with w ≡ 1 is the simplest such invariant, and is already sufficient to completely determine the field line topology of v. Nevertheless, there may be situations in which other weightings are of physical interest. The most notable example is field line helicity, which is defined for the subset of divergence-free braided vector fields. Typical examples are magnetic fields (in magnetohydrodynamics) or vorticity fields. In this section, we shall denote such fields as b rather than v. The field line helicity is the particular W v invariant given by where J 0 is the Jacobian of the map F −1 : S 0 → D 0 , and b z is the normal component of b on S 0 . When M = C, we have J 0 ≡ 1 so For this case, Prior & Yeates (2014) showed that (25) is equivalent to the original definition of field line helicity, A b (γ) = γ a · dl (where b = ∇ × a) provided that the vector potential a is in the so-called winding gauge Indeed, they used the geometrical interpretation in terms of winding numbers to motivate this particular choice of gauge. For more general M, we can similarly relate (24) to a particular choice of vector potential. It is convenient to think of b as a differential 2-form β = i b vol 3 on M, where i is the interior product and vol 3 the volume form (Frankel 2011). Then pushing forward the integral from D 0 to S 0 , and using equation (3.13) of Frankel (2011), we have Now, the divergence free property of b means that the form β z dy 1 ∧ dy 2 is conserved along field lines, so we can write Using (4) and the fact that dγ i /dz = β i /β z , we find that where the one-form α = α 1 dy 1 + α 2 dy 2 + α z dz has components α 1 (y) = − β z (ỹ)(y 2 −ỹ 2 ) (y 1 −ỹ 1 ) 2 + (y 2 −ỹ 2 ) 2 dỹ 1 ∧ dỹ 2 , This one-form corresponds to a vector potential a on M which is the generalisation of the winding-gauge vector potential (26). Notice that A b contains no additional topological information compared to L b ; the difference is that it weights each field line differently according to b z . This weighting has physical meaning because β z dy 1 ∧ dy 2 is preserved along field lines -thus the weighting is a property of the field line as a whole, not just an arbitrary function of the endpoints on S 0 . An interesting consequence of the additional weighting is that, although A b is invariant under end-vanishing isotopies of b like L b , it may behave differently from L b if the domain M changes shape. This remains to be investigated further.

Conclusions and comparison to other work
The primary development in this work (Theorem 1) is the proof of a topological classification theorem for braided vector fields on tubular subdomains, which are homeomorphic to the cylinder as defined in Section 4. Specifically, the field lines of a given braided field may be continuously deformed into those of another other fieldwithout moving their end-points -if and only if the two fields have the same distribution of field line winding, L v . There is a small caveat: this invariant cannot distinguish overall full (integer) rotations. These could be detected solely from the field line mappings on the side boundary, and are unlikely to be problematic in practical applications. Our result strengthens an earlier theorem of Yeates & Hornig (2014) and extends it to a broader class of vector fields; specifically to include those which have divergence. The measure L v has recently been applied to study reconnection in a laboratory plasma experiment (Prior & Yeates 2018); here we have formalised the underpinning result and extended it to tubular sub-domains that cannot be foliated by parallel planes, including tubular domains foliated by non-Euclidean surfaces.
The unique definition of L v relies on the identification of a least distorted vector field u, defined in Section 4.1, whose integral curves are mapped to straight lines on the cylinder (on which the field line winding is defined). Our choice of u and its mapping to the cylinder have three critical properties: (i) The vector field u minimises the Dirichlet (distortion) energy amongst all braided vector fields on a given tubular domain M with a specified flux, i.e. it minimises The latter constraint relates to the fact the energy varies with flux for a fixed topology, whereas we are interested purely in finding the vector field of least entangled topology.
(ii) In this mapping, all field lines of u have zero pairwise winding number, so the winding measure L v is everywhere zero for u itself.
(iii) To determine which field line of u maps to which vertical line on C, we use harmonic coordinates so as to avoid the erroneous measurement of entanglement such as in Figure 5.
The combination of these three properties means that a non-trivial distribution L v necessarily indicates non-trivial internal entanglement of the original vector field v. This entanglement may be seen as increasing the energy above the minimum level enforced by the distorted global shape of the domain M itself. The only comparable construction to this of which we are aware is the so-called Mermin-Ho basis, which is defined on a pre-determined Riemannian manifold. Using the notion of parallel transport with respect to a preferred vector field (not specifically assigned in the theory) one can define a local basis on the manifold from which any local deviations of an arbitrary vector from this field are quantified (Mermin & Ho 1976, Kamien 2002. Our work differs in that we define and justify the choice of a preferred vector field. Moreover, this justification is based on a globally defined notion (the winding rate dΘ(γ, γ, z)/dz), rather than a local notion (parallel transport). The Godbillion-Vey invariant see e.g. (Arnold & Khesin 1992), can be related to the helicity of the integral curves of the foliation of a closed domain so is not directly comparable here (see (Webb et al. 2014) for a discussion of its applicability in MHD contexts). The invariant L v used in our classification theorem provides a fundamental description of the field line topology, in the sense that it depends only on the integral curves of the vector field and not on its magnitude or flux. This is in contrast to the widely used (field line) helicity invariants for divergence-free fields (Webb et al. 2014, Russell et al. 2015, Cantarella & Parsley 2010, Yeates & Page 2018, Moraitis et al. 2019, which do depend on the flux. Indeed, we showed in Section 6 that the field line helicity -effectively, the helicity of an infinitesimal flux tube surrounding a single field line -takes a similar integral form to L v but with an additional weighting of flux. As such, it mixes a purely topological quantity (the pairwise winding) with a physical quantity (the flux). This indicated the invariance of helicity under Euler flows (ideal motions) which vanish at the domain boundaries requires not only the invariance of L(γ, γ) but also the divergence-free condition, which ensures preservation of flux. Since the flux can change without altering the field line topology, L v is revealed as a more fundamental quantity than the (field line) helicity.

Appendix A. Validity of the foliation defined by u
In this appendix we show that the least-distorted harmonic field u defines a valid foliation of the domain M. In particular, we will show that u = 0 everywhere on the interior of M, so that there is a unique surface S z through all interior points and the winding integrals are well defined. It is possible to have points with u = 0 on the boundary ∂M , but these do not prevent the existence of the foliation.
To rule out null points of our harmonic field u = ∇φ, the idea is to consider the possible structures of constant-φ surfaces that could result from such points, and show that such surfaces cannot exist. If p is a hypothetical point where u(p) = 0, then the local linearisation of u around p is constrained by the fact that u is harmonic. Firstly, the tensor u is symmetric due to ∇ × u = 0, meaning that it has real eigenvalues λ 1 , λ 2 , λ 3 . Secondly, it is traceless due to ∇ · u = 0, so that λ 1 + λ 2 + λ 3 = 0. There are two possible structures around p, shown in Figure A1. If all three eigenvalues are non-zero, then in suitable local coordinates we may write Then the surface φ = 0 has the topology of two cones whose tips meet at p ( Figure  A1a), separating two-sheet hyperboloids with φ > 0 and one-sheet hyperboloids with φ < 0. Alternatively, if one eigenvalue is 0 then p is part of a null line ( Figure A1b) and, again in suitable local coordinates, we may write The φ = 0 surface is then a pair of intersecting planes. The null line could either be a closed loop or could intersect the boundary ∂M. It is not possible to have a null surface, nor for all three eigenvalues to vanish at p (unless u = 0 on the whole domain).
To rule out null points and lines, we must consider how the φ surfaces extend outside the neighbourhoods of these structures. To do so, we use the fact that φ defines a continuous foliation of M everywhere outside the null set N = {p ∈ M | u(p) = 0}. This follows from the Frobenius theorem. So the φ = 0 surfaces from null points or lines extend smoothly away from these locations and can end only on N or on the boundary ∂M. In fact, they can only intersect (transversely) the side boundary S s , owing to the boundary conditions of constant φ on S 0 and S 1 . Consider first a single null point in the interior, as in Figure A2(a). Each of the two φ = 0 surfaces must either be closed or end on S s (as shown in Figure A2a). To show that neither is possible, letn be the outward normal from the indicated volume V. Then observe thatn · u is non-zero with the same sign everywhere on these two surfaces where they bound V, because φ < 0 on one side and φ > 0 on the other. Since the two surfaces intersect S s , and sincen · u = 0 on S s , there must be a net flux in/out of V, contradicting ∇ · u = 0. If the surface were closed instead of intersecting S s , we would similarly obtain a contradiction. So a single null point in the interior cannot exist.
This argument extends to rule out multiple null points or lines in the interior (of which there can only be a countable number). Tracing the φ = 0 surfaces from some null point or line, we can extend these surfaces, possibly incorporating further points in N -as depicted in Figure A2(b) or (c) -until the composite surfaces either close on themselves or intersect S s . Either way we can find a finite volume enclosed with a non-zero flux of u through its boundary, which contradicts ∇ · u = 0.
Finally we point out that since the boundary is Lipschitz continuous it is possible to embed the conic structure of a null surface φ = 0 in the boundary. As an example this would be necessary on the bounding curves ∂S 0/1 for an hourglass domain morphology, owing to the boundary conditions on u.