Relative magnetic field line helicity

Context. Magnetic helicity is an important quantity in studies of magnetized plasmas as it provides a measure of the geometrical complexity of the magnetic field in a given volume. A more detailed description of the spatial distribution of magnetic helicity is given by the field line helicity that expresses the amount of helicity associated to individual field lines, rather than in the full analysed volume. Aims. Magnetic helicity is not a gauge-invariant quantity in general, unless it is computed with respect to a reference field, yielding the so called relative magnetic helicity. The field line helicity corresponding to the relative magnetic helicity has only been examined under specific conditions so far. This work aims to define the field line helicity corresponding to relative magnetic helicity in the most general way. In addition to its general form, we provide the expression for the relative magnetic field line helicity in a few commonly used gauges, and reproduce known results as a limit of our general formulation. Methods. By starting from the definition of relative magnetic helicity, we derive the corresponding field line helicity, and we note the assumptions it is based on. Results. We check that the developed quantity reproduces relative magnetic helicity by using three different numerical simulations. For these cases we also show the morphology of field line helicity in the volume, and on the photospheric plane. As an application to solar situations, we compare the morphology of field line helicity on the photosphere with that of the connectivity-based helicity flux density in two reconstructions of an active region's magnetic field. We discuss how the derived relative magnetic field line helicity has a wide range of applications, notably in solar physics and magnetic reconnection studies.


Introduction
Magnetic helicity is an important quantity in studies of the Sun, as well as, in any other environment where magnetohydrodynamics (MHD) is the appropriate description. This is because magnetic helicity is a conserved quantity in ideal MHD (Woltjer 1958), and is approximately conserved even in non-ideal conditions, i.e., in the presence of reconnection (Taylor 1974, and more recently, Pariat et al. 2015).
Magnetic helicity quantifies the complexity of a magnetic field, and relates to the twist and braiding of the magnetic field lines. It is clasically defined as H m = V A · B dV, where B is the magnetic field in the volume V, and A the corresponding vector potential. It therefore depends on the gauge of A unless it is computed in a volume bounded by a magnetic flux surface. This condition can be too restrictive in many cases, especially when the considered volume is constrained by observational limitations as in solar observations. In order to remove this limitation, the helicity can be defined with respect to a reference magnetic field. The first such relative magnetic helicity was introduced by Berger & Field (1984), and a gauge-independent version of it was later defined by Finn & Antonsen (1985). In this definition of relative magnetic helicity, the obtained helicity values do not depend on the gauges of the vector potentials of the original and reference fields as long as the normal components of the two fields coincide on the boundary of the volume.
The importance of relative magnetic helicity (RMH) has lead to the development of many computational methods in the recent years. These include finite-volume methods in Cartesian coordinates (Thalmann et al. 2011;Valori et al. 2012;Yang et al. 2013;Moraitis et al. 2014), finite-volume methods in spherical coordinates , and methods relying on other definitions of helicity (Pariat et al. 2005;Georgoulis et al. 2012). A complete description and intercomparison of the Cartesian methods can be found in Valori et al. (2016).
Relative magnetic helicity is a global quantity that characterizes the magnetic field. There are cases however where it is desirable to be able to describe helicity more locally. This can be done with field line helicity that was introduced by Antiochos (1987), and Berger (1988). Field line helicity (FLH) of a magnetic field is simply the line integral of the vector potential (that produces the magnetic field) along a field line. The usefulness of FLH stems from the fact that its flux-weighted integral along the boundary is equal to the relative magnetic helicity. FLH can be considered as a function of the field lines, and, due to the arbitrariness of the gauge choice, has no physical meaning unless the field line is closed, in which case it expresses the flux of the magnetic field through the surface bounded by the closed field line. Alternatively, FLH can attain physical meaning under specific gauges for the vector potentials.
Field line helicity has been employed in various solar applications. As an example, Russell et al. (2015) used FLH to trace the connectivity changes caused by reconnection in a magnetic Article number, page 1 of 12 arXiv:1902.10410v1 [astro-ph.SR] 27 Feb 2019 A&A proofs: manuscript no. flh-text field confined between two planes, simulating coronal loops. In another example, Yeates & Hornig (2016) have applied FLH to the global magnetic field of the Sun in order to study the distribution of helicity in the solar corona. A more theoretical study of the properties of FLH can be found in Aly (2018). In most of these applications a special gauge for the vector potentials was used to simplify calculations, which lead to inaccurate helicity budgets when the flux-weighted integral of FLH along the boundary was taken. This has very recently been fixed by Yeates & Page (2018), where a relative FLH was introduced that reproduced relative magnetic helicity to a high degree when integrated over the boundary. Still, this relative FLH is in the same constrained gauge used previously. One of the purposes of this paper is to find an expression for field line helicity that accurately reproduces relative magnetic helicity, and that, at the same time, makes no assumption about the adopted gauge.
Apart from field line helicity there are other methods that employ the magnetic connectivity to compute quantities related to magnetic helicity. An example is the twist number method (Guo et al. 2017), where the twist component of helicity is computed in configurations consisting of twisted magnetic flux ropes. In an alternative method that approximates helicity through its twist, Malanushenko et al. (2011) compute RMH by matching the shapes of coronal loops with field lines of a linear force-free field.
Another method that uses the magnetic connectivity to infer a helicity-related quantity is the connectivity-based helicity flux density method (Pariat et al. 2005;Dalmasse et al. 2014). In this, the rate of helicity change in the volume (dH m /dt) is deduced from the flux-weighted integral of a quantity dh Φ /dt along the boundary of the volume, which can therefore be considered as the helicity flux density per unit of magnetic flux. Moreover, this flux density is inferred from the connectivity of the magnetic field in a similar manner as FLH.
In this paper we define a relative magnetic field line helicity (RMFLH) whose gauge is unrestricted, and investigate its relation with the connectivity-based helicity flux density. In Sect. 2 we define RMFLH, and also express it in various simplifying gauges. In Sect. 3 we describe the magnetic field data that we use for testing our derivation. In Sect. 4 we first validate the derived field line helicity method, and then we apply and compare it to a similar method that uses the helicity flux density. Finally, in Sect. 5 we summarize and discuss the results of the paper.

Definition
Relative magnetic helicity of a three-dimensional (3D) magnetic field B in a simply-connected, finite volume V ⊂ R 3 with boundary ∂V, is given by the Finn & Antonsen (1985) formula Here, B p is a potential magnetic field that is used as reference, and A, A p are the vector potentials of the fields B, B p , respectively. Relative magnetic helicity does not depend on the gauges of A and A p as long as the condition holds (see, e.g., Valori et al. 2012), wheren denotes the outwardpointing unit normal of ∂V. The relative magnetic helicity defined in Eq. (1) can be decomposed into the sum of two gaugeindependent helicities, one involving only the current-carrying part of the magnetic field, B j = B − B p , namely and one also involving the potential magnetic field These components are referred to as the non-potential and volume-threading helicities in Linan et al. (2018), respectively. In order to derive a general expression for the field line helicity we start from relative magnetic helicity of Eq. (1), and decompose it as where the individual terms on the right-hand side are now gaugedependent. The volume integrations can be performed along the field lines of the respective magnetic field if we split the volume elements according to dV = dS dl = dS · dl (with both dS, dl pointing along the field lines) in the first integral, and dV = dS dl p = dS · dl p in the second, and rearrange the dot products inside the integrals. Equation (5) then reads where ∂V + (∂V − ) denotes the part of the boundary where magnetic flux enters into (leaves) the volume, defined through ∂V ± = {x ∈ ∂V :n · B(x) ≶ 0}. The footpoints of the field lines of B (B p ) are denoted as α + ∈ ∂V + , α − ∈ ∂V − (α p+ ∈ ∂V + , α p− ∈ ∂V − ). The only assumption made in going from Eq. (5) to (6) is that each field line can be labelled with its infinitesimal flux, or in other words, that an infinitesimal flux tube can surround each field line. This assumption can always be fulfilled in regions of sufficiently smooth magnetic field. The integrations in Eq. (6) are taken along ∂V + so that each field line is counted only once, but equivalently, they can be performed along ∂V − , or even along the whole boundary, ∂V, but in that case the resulting helicity should be halved. Since by construction the potential field has the same normal components along the boundaries with the given magnetic field, we can choose to start from the same footpoint in the two integrals, α p+ = α + , so that |n · B| = n · B p , yielding By defining the relative magnetic field line helicity as it follows that H r = ∂V + A + r dΦ with dΦ = |n · B| dS the elementary magnetic flux on the boundary. A similar expression results when we consider as starting points the field lines of ∂V − where the common footpoint is now α p− = α − . When the whole boundary is considered, the respective RMFLH is given by the average of the latter two expressions, namely In all cases the RMFLH is expressed relative to the same quantity integrated along the field lines of the potential magnetic field, hence the name relative magnetic field line helicity seems appropriate. It also follows that for a potential magnetic field all RM-FLH expressions, Eqs. (8), (9), and (10), vanish by definition. Inevitably, the RMFLH is a function of not only the footpoints of B, but also of B p . Expressed differently, RMFLH depends on the way that both fields connect positive to negative footpoints. The relative magnetic helicity can be interpreted as the helicity budget of the composing field line helicities in the whole volume, and can be expressed in all cases as where s stands for the characters, '+', '-', or '0', and we defined for reasons of uniformity, ∂V 0 = ∂V. This relation shows that the RMFLH can be considered as the RMH density per unit magnetic flux. Note also that, differently from the direct computation of RMH as a volume integral, its computation as a budget of RMFLH does not include the contribution from field lines that do not connect with the boundary (if any) but rather close within the volume. The RMFLH can always be computed from one of the Eqs. (8)-(10), but its flux-weighted integral given by Eq. (11) will be equal to the RMH only if all field lines are connected to the boundary at both ends, i.e., when no closed and/or ergodic field lines are present in the volume. We adopt this assumption henceforth.
In a similar manner one can also define the relative magnetic field line helicity of the components H j and H p j of helicity by replacing A + A p in Eqs. (8)-(10) with A − A p , and 2A p , respectively. As an example, the relative magnetic field line helicity of the non-potential component of helicity with field lines starting from the positive polarity is Of course, all these RMFLHs are gauge-dependent, but their flux-weighted integrals along the (whole) boundary recover the respective gauge-independent helicity component, i.e., for Eq. (12) the budget H j = ∂V + A + j dΦ is indeed gauge-invariant.

Specific gauge choices
As with any FLH defined on open field lines, all RMFLH expressions depend on the gauges of the vector potentials. The only gauge independent FLH is when field lines are closed, in which case the FLH is the magnetic flux through the surface defined by the closed field line. For the RMFLH, by setting A = A + ∇ψ 1 and A p = A p + ∇ψ 2 in Eq. (8) for example, it can easily be seen It would be thus useful to exploit this gauge freedom in order to derive expressions for the RMFLH that are a function of the footpoints of only one magnetic field (and preferably of B) instead of two, and, if possible, without restricting the gauge of A in doing so. Here we give a non-exhaustive list of choices for the gauges that simplify the resulting RMFLH.

Potential-free gauge
An obvious way to have a RMFLH that depends only on the footpoints of B is by making the second term in Eqs. (8), (9) to vanish. By going back in the derivation to Eq. (5), and replacing in the second term the potential field with the identity B p = ∇Ψ, we have The last two terms can be eliminated with the gauge combination The respective field line helicity is then It depends only on the footpoints of B, and can be obtained with an arbitrary gauge for A, only the gauge of A p is restricted.

Berger & Field gauge
Another possibility for the gauge is given by the relation which involves the tangential components of the two vector potentials on the boundary, as can be seen from the sufficient condition for its validitŷ This gauge can be fulfilled with the tangential components of A p being determined from those of A, while the gauge of the latter is unrestricted. The gauge condition given by Eq. (16) was used in the original definition of relative magnetic helicity by Berger & Field (1984), where Eq. (2) then reads This gauge is thoroughly examined in Yeates & Page (2018) where it is used to define the following relative field line helicity written here in our notation and for the positive polarity boundary. This relative FLH is constructed similarly to the RMFLH of this paper since both quantities are differences of FLHs along the field lines of B and B p . Unlike the RMFLH given by Eq. (8) however, it employs a specific gauge condition, although Yeates & Page (2018) provide a recipe to impose this gauge starting from a general one. An alternative form for the relative FLH of Yeates & Page (2018) can be obtained when helicity is written as H r = V (A − A p ) · (B + B p ) dV in the same gauge (Berger & Field 1984). By splitting the volume element along and across the field lines of the magnetic field B q = B + B p according to dV = dS · dl q , we can define the respective field line helicity Article number, page 3 of 12 A&A proofs: manuscript no. flh-text With respect to Yeates & Page (2018), this RMFLH depends on the footpoints (α q+ , α q− ) of the single magnetic field B q , and therefore requires to trace field lines for this magnetic field only. The factor of 2 comes from the flux of the respective flux tubes, dΦ q = 2dΦ, on the boundary.

Original Berger gauge
An even more restricting gauge combination is the one originally used in Berger (1988), and more recently in Yeates & Hornig (2016). This consists of the relations and it also involves the gauge of A, not just A p 's. Relative magnetic helicity from Eq.
(2) simplifies then to H r = V A·B dV (see also Valori et al. 2012). By splitting the volume element along and across the field lines of B, we derive the respective field line helicity This RMFLH involves only the footpoints of B. Although the form of RMFLH in this gauge is very simple, it is difficult to use in practical implementations because of all the restrictions of Eq. (19).

Magnetic-field data
To check that the definition of relative magnetic field line helicity, given in Sect. 2, is consistent, and that it is implemented correctly, we need to compare the values of helicity obtained with the RMFLH method with those of a standard volume method. We use three MHD simulations for this comparison, so that to be able to also follow the evolution of the RMH. Additionally, we want to examine the relation between the helicity flux density method of Dalmasse et al. (2014) with the RMFLH one. For this we use two extrapolations of the 3D magnetic field of an observed active region (AR). All magnetic field data, from simulations or from extrapolations, are described below.

MHD data
The first two MHD datasets that we use are from the noneruptive (Leake et al. 2013), and eruptive (Leake et al. 2014) flux-emergence simulations that were used and described in Valori et al. (2016), and also in Pariat et al. (2017) and in Linan et al. (2018). The two simulations involve the emergence of the same twisted magnetic flux rope in the same stratified solar atmosphere, and differ only in the strength and orientation of the initial, background, coronal magnetic field. In the noneruptive case the initial field is parallel to the emerging flux rope, while in the eruptive case it is anti-parallel (and smaller than the non-eruptive one), thus favoring magnetic reconnection between emerging and background fields.
The magnetic field in both simulations is interpolated from the original stretched grid to a uniform one, that spans the volume [−100, 100] × [−100, 100] × [0. 36,150] in the nondimensional units of the MHD code. The resulting mesh consists of 233×233×174 grid points, with a pixel size of 0.859 in all directions. The simulations last from t = 0 to t = 200. In the eruptive case an eruption occurs around t = 120. The morphology of the magnetic field and the way it changes during the simulation is shown in the top two panels of Fig. 1 for both simulations. There, one can see the emerging flux rope (in orange), and the overlying arcade field (in blue), and the different behavior of their interaction in the two simulations.
The third dataset that we used is based on the simulation of Pariat et al. (2009) for the formation of a coronal jet, and is described in Pariat et al. (2015) and in Linan et al. (2018). In the simulation, there is initially uniform coronal plasma around an axisymmetric null point, that is created by embedding a vertical dipole below the simulation domain, and adding a uniform volume vertical magnetic field of opposite direction in the domain. As a result, the initial field in the volume is split into two connectivity domains, one closed and one open. Photospheric twisting motions eventually destabilize the configuration and magnetic reconnection between closed and open field lines occurs, with the final outcome the generation of a jet.
The magnetic field occupies the volume [−6, 6] × [−6, 6] × [0, 12] (in non-dimensional units), and is discretized with 129×129×129 grid points, and a pixel size of 0.0938 in all directions. The simulation lasts from t = 0 to t = 1600, with an accumulation phase for t ∈ [0, 700], and a dynamical phase for t ∈ [700, 1600] that is sampled more frequently, while the nonideal effects start to appear around t ≈ 920. The evolution of the magnetic field morphology for this simulation is shown in the bottom panel of Fig. 1.

Extrapolation data
To investigate the relation of field line helicity with the connectivity-based helicity flux density, dh Φ /dt, we use the same 3D magnetic-field data as in Dalmasse et al. (2018). These comprise a potential and a non-linear force-free (NLFF) reconstruction of the 3D magnetic field of NOAA AR 11158. Both methods start from the same vector magnetogram, which is the average of the SDO/HMI ones at 06:22 UT and 06:34 UT of 14 February 2011, rebinned by a factor of two, to the resolution 1 per pixel.
The first reconstruction produces a potential magnetic field through the scalar potential of Schmidt (1964). This method uses only the normal component of the photospheric magnetic field. The scalar potential is obtained from the numerical solution of Laplace's equation with the Dirichlet boundary conditions along the six boundaries of the volume that are given by the actual Schmidt solution. The resulting potential field occupies the volume 204 Mm × 200 Mm × 144 Mm, which is discretized by 284 × 277 × 200 grid points.
The second reconstruction is a NLFF one that uses a weighted optimization method (Wiegelmann 2004), after preprocessing the horizontal components of the field on the photosphere so that it becomes more compatible with the forcefree assumption, and additionally smoothing of the original vector magnetogram. The resulting NLFF field occupies the volume 185 Mm × 185 Mm × 144 Mm, which is discretized by 256 × 256 × 200 grid points. The full details on each method can be found in Dalmasse et al. (2018) and references therein. The morphology of the magnetic field for the two extrapolations is shown in Fig. 2.

Applications
In this section we present the results from the application of the field line helicity method of Sect. 2 to the magnetic field data of Fig. 1. Evolution of the magnetic field morphology for the three MHD simulations described in Sect. 3.1. Shown are the B z -distribution at the photospheric-like plane, and selected magnetic field lines of the current-carrying structure (with orange) and of the surrounding field (with blue). Sect. 3. Before that, we describe a few details of the implementation of the method.

Implementation details of the RMFLH method
The calculation of relative magnetic helicity with the help of relative magnetic field line helicity is an instantaneous integration method that needs as input the 3D magnetic field in the volume under study. It can thus be considered as a finite-volume method according to the classification of Valori et al. (2016), and consequently it can be computed simultaneously with any method that employs the definition of Eq. (1), although RMFLH needs additionally the computation of the field lines.
Since all the test data of Sect. 3 are in the Cartesian domain, we follow for each snapshot of the given 3D magnetic field the volume method described in Moraitis et al. (2014). We first compute numerically the potential field that satisfies the condition of Eq. (2) as a solution of Laplace's equation. From the two magnetic fields, B and B p , we then compute their corresponding vector potentials by adopting the DeVore gauge, for which the vertical component is assumed to be null, A z = 0. This gauge was originally introduced by DeVore (2000) and was then modified by Valori et al. (2012) for use in finite volumes, and it has the advantage of being very accurate and fast to compute. Our computation of RMFLH is thus performed in the most efficient way and it does not assume any of the specific gauge choices presented in Sect. 2.2. The quantity (A + A p ) is then input to the field line integration part, along with the two magnetic fields.
The relative magnetic field line helicities A + r and A − r are computed from Eqs. (8) and (9) by calculating the two terms separately and then taking their difference. Each of the terms in these relations is obtained by an integration along the respective field lines, and so this method involves two different field line integrations, one for B, and one for B p . For these integrations we use as a starting point the code QSL Squasher (Tassev & Savcheva 2017) which is very fast and robust, and we modify it in three ways. First, we keep only the field-line integration part and omit any squashing factor calculations. Second, we modify the starting points of the field lines to be user-supplied instead of automatically determined by space-filling Hilbert curves. Finally, we augment the system of the three equations that are solved by the code with one more, which describes the field line helicity change (dh) along a field line as with s denoting the distance along the given field line.
For the starting points of the field lines (the footpoints) we consider separately the positive-and the negative-polarity boundary. Once the field lines are obtained, we compute either A + r or A − r depending on whether the field lines start from the positive or negative magnetic sign domain, using Eq. (8) or Eq. (9), respectively, while for A 0 r we simply take the average of these expressions as in Eq. (10). All the results presented in the following use the grid points of the given magnetic field as the footpoints for the field lines. An alternative method which gives more weight to locations of higher magnetic field is discussed in the Appendix.

Application to MHD data
The verification of the RMFLH-based helicity calculation method presented in Sect. 2 is done with the help of the three MHD simulations. For each snapshot of each simulation we compute the relative magnetic helicity from its definition, Eq. (1), and also through the field line method, using Eq. (11) and the RMFLH given either by Eqs. (8), (9), or (10). The resulting evolution of the relative magnetic helicity with the two methods for all simulations is shown in Fig. 3.
We notice that the agreement between the two methods is very good for all cases with the curves being practically indistinguishable. To look closer at it, we denote with H 1 the relative magnetic helicity budget calculated from Eq. (1) and H 2 the one from Eq. (11), and we define their relative difference as The evolution of this relative difference for all MHD simulations is also shown in Fig. 3. Except from the snapshots at the start of the simulations and a few more where helicity is very low, all differences are within ±5%. The computation of helicity with the RMFLH method thus gives results very similar with the volume method in all cases. Additionally, this is true irrespective of whether the starting footpoints belong to the positive or the negative polarity. These observations indicate that the equations derived in Sect. 2 are indeed correct, and also that they are properly implemented. The main advantage of using RMFLH is that in addition to the value of helicity we can also infer its spatial distribution. We show that in two ways in Fig. 4 using a snapshot from each MHD simulation. On the left column of Fig. 4, we present the 3D morphology of RMFLH by plotting representative field lines colourcoded according to the value of A 0 r for that field line, while the 2D distribution of A 0 r on the photospheric plane is displayed on the right column.
For the non-eruptive emergence simulation in the top panel of Fig. 4, and the shown snapshot at t = 120, we notice that the emerging flux rope in the center of the image consists of field lines with high positive values of RMFLH. The flux rope is confined by the overlying arcade field which has mixed-signed, but mostly negative RMFLH of quite lower values, as can be seen in the 2D map of RMFLH on the right image.
For the eruptive emergence simulation and the snapshot at t = 110 just before the onset of the eruption in the middle panel of Fig. 4, we notice a much more complex situation. The arcade field consists now mostly from positive RMFLH, again of lower values than the flux rope. Additionally, the flux rope itself has smaller values of RMFLH than in the non-eruptive case, confirming the smaller helicity budget shown in Fig. 3. Pariat et al. (2017) showed that the non-eruptive simulation had a larger positive helicity than the eruptive one. Using a toy model and the concept of "self" and "mutual" helicities, they explain these differences by the fact that the emerging flux rope, while having the same positive helicity in both cases, was globally sharing positive helicity with the surrounding arcade field in the non-eruptive case and negative helicity in the eruptive one. Within that toy model, the eruptive simulation would possess opposite signs of helicity, i.e., positive RMFLH in the field lines of the flux rope and negative RMFLH in the field lines of the surrounding arcade field. On the contrary, the non-eruptive simulation would have a distribution of RMFLH uniform in sign, positive for both the flux rope and the arcade field.
The results obtained here with RMFLH present a different view. Both eruptive and non-eruptive simulations present positive and negative RMFLH in the arcade field surrounding the flux rope. The spatial distribution of negative and positive RM-FLH in that arcade field is more complex for the eruptive simulation than for the non-eruptive one. However, the main difference lies in the intensity of the positive and negative values of RMFLH. The eruptive case has a low total relative helicity mainly because all the domain possesses a weak RMFLH intensity. The non-eruptive case on the contrary, presents a high contrast of positively and negatively signed RMFLH. This further confirms that although "self" and "mutual" helicities are interesting theoretical tools, they are not directly relevant to relative magnetic helicity, and cannot be used to predict the distribution of RMFLH. The representation of a magnetic field as a collection of flux tubes is of course valid theoretically, and the relative magnetic helicity can then be expressed through sums over the self and mutual helicities under the specific gauge conditions described in Demoulin et al. (2006). In the general case however, the approach of RMH with the self and mutual helicities is of limited practical use.
For the jet formation simulation, we show in the bottom panel of Fig. 4 the snapshot at t = 920 when the non-ideal effects take in. The twisting motions on the photosphere lead to the increase of RMFLH, and also of twist, in the central structure that later reconnects with the overlying jet-like feature. The values of RMFLH are predominantly positive in accordance with the results of Pariat et al. (2009) andLinan et al. (2018).
We should mention at this point that all these conclusions depend on the chosen gauges for the vector potentials. If RMFLH was expressed in a different gauge, its magnitude and even its sign distribution could be quite different. A preliminary testing of this possibility showed that this is not the case, and that at least in intense-RMFLH areas, the sign and magnitude of RM-FLH are robust to the choice of the gauge. Some evidence in favour of this result can also be found in Yeates & Page (2018).
We also note that an alternative to removing the gauge dependency of RMFLH is to specify the gauge explicitly, although this would correspond to a redefinition of relative magnetic helicity less general than the one of Finn & Antonsen (1985). Nevertheless, the resulting FLH can then be associated with a physically meaningful quantity. Such an example is given by the so-called winding gauge (Prior & Yeates 2014), which is a modified, planar Coulomb gauge. The respective FLH, that is termed the flux function in Prior & Yeates (2014), expresses the average pairwise winding between the magnetic field lines. Nonetheless, it relies on a specific setup of the magnetic field, where the lateral boundary consists only from flux surfaces, and cannot extend to the more general case considered here, where field lines starting from one side of the boundary can end in any side, lateral or not.

Application to extrapolation data
Here we use the extrapolation data presented in Sect. 3.2 to compare the 2D morphology of RMFLH with that of helicity flux density, dh Φ /dt, (Dalmasse et al. 2018). For the comparison to be meaningful we use the same footpoint locations in both calculations, i.e., only one method for tracing field lines is used, the one described in Sect. 4.1. Finally, only field lines starting and closing on the photosphere are considered, since dh Φ /dt is defined for closed field lines. The quantities A 0 r , as described in Sect. 4.1, and dh Φ /dt, as described in Dalmasse et al. (2014), are then computed for this set of footpoints. The morphology of the two quantities on the photospheric plane for the two considered extrapolations is shown in Fig. 5. The comments in Sect. 4.2 about the gauge dependence of RMFLH also apply here, where, moreover, the two quantities examined are computed under different gauges.
For the extrapolation using the potential field assumption, by definition relative magnetic helicity should be null since the potential field is used as a reference field. We note that indeed RM-FLH is insignificant in that case as shown in the top-left panel of Fig. 5. This is another indication that the RMFLH method is consistent. In practice of course helicity is not null, but very low, because the potential field computed by our method differs slightly from the extrapolated one. The helicity budget we find with the volume method is H 1 = −7.1 10 39 Mx 2 , while with the RMFLH method it is H 2 = −7.5 10 39 Mx 2 , and so the two methods show an agreement of 6%. These values may indicate the noise level that the helicity method can estimate.
Helicity flux density on the other hand is not necessarily negligible even when the magnetic field is potential, with strong helicity fluxes possibly injecting helicity in some regions and removing it in others. The helicity flux density calculations associated with Fig. 5 were checked against those of Dalmasse et al. (2018), and they were found to be consistent, despite the different footpoints and field line integration methods considered in the two cases. This is also evident from the qualitative agreement of the 2D helicity flux density map displayed in the bottom left panel of Fig. 5, with the one presented in the top right Fig. 3 of Dalmasse et al. (2018) for a similar quantity. This further confirms the results of Dalmasse et al. (2018) that the computation of the helicity flux is robust to the selection of the starting fieldline footpoints.
In the case of the NLFF extrapolation there is an intense relative helicity budget in the domain, three orders of magnitude larger than in the case of the potential field for the RM-FLH method. The value obtained by the volume method is H 1 = 9.4 10 41 Mx 2 , while the RMFLH method gives H 2 = 1.3 10 42 Mx 2 . The agreement is lower in this case, with the RMFLH method overestimating helicity by ∼ 30%. This level of agreement can still be considered acceptable given that the NLFF field is of poorer quality in terms of solenoidality as compared to the MHD ones, and solenoidal errors are the most important source of errors in helicity computations (see Sect. 7 in Valori et al. 2016).
Although dh Φ /dt is a flux, and thus a quantity of a different nature than RMFLH, we see in Fig. 5 (right panels) that the overall distributions of the two quantities agree quite well in the case of the NLFF field extrapolation. As an example, in the two central contours RMFLH and dh Φ /dt both exhibit the same sign and both are important, and so the positive helicity is increasing by the injection of more helicity there. There are regions where the two quantities are quite different of course, such as the negative RMFLH area centered at (x, y) = (60, 120) in Fig. 5, where dh Φ /dt is mostly positive and not as strong. Nevertheless, the overall agreement of the two quantities is quite good.
If the helicity flux injection had been found to be strongly different from the volume helicity distribution, it would have implied that either at this particular time the helicity flux injection was very peculiar (something possible of course, e.g., for a twisted magnetic field being untwisted), or that the helicity flux method and the RMFLH were not carrying consistent information. However, these comparative results of the relative helicity distribution and relative helicity injection draws a coherent picture of the helicity properties in AR 11158, with helicity of a given sign being injected in regions having the same sign of helicity. This behaviour reasonably fits with what is expected to occur in solar active regions, helicity flux injection being relatively homogeneous and consistent in time. This is a first demonstration, that the common use of helicity flux and RMFLH can permit to deeper study the dynamics of helicity in solar active regions.

Discussion
In this paper we defined the concept of relative magnetic field line helicity (RMFLH) and we examined some of its properties. We presented the mathematical derivation of RMFLH starting from the definition of RMH, without any assumption on the gauges of the vector potentials. A similar derivation was followed for the two gauge-invariant components of RMH, the non-potential and volume-threading ones. This decomposition of RMH has been shown to provide very interesting physical insights in the stability of magnetic structures (Pariat et al. 2015;Linan et al. 2018). All the derivations were based on the sole assumption that the magnetic field can be represented with flux tubes, a reasonable assumption for relatively smooth magnetic fields, and that these flux tubes start and end on the boundary of the volume, i.e., they do not form closed loops inside the volume.
The developed RMFLH does not pose any restriction on the vector potentials' gauge and so it can use the simplest possible gauge and/or the most economic in computational resources. By exploiting this flexibility in the choice of the gauge, we presented a fast and robust method for calculating RMFLH. We showed that the developed RMFLH can reproduce the system's relative magnetic helicity budget to high accuracy by using three different MHD simulations, and comparing with the results of a finite volume method of known good performance.
A number of possible gauge combinations that simplify the resulting RMFLHs at the cost of more restrictive conditions for the computations of the vector potentials were also given. Within this framework, the recently proposed relative FLH of Yeates & Page (2018) is derived as a particular choice.
Computations of RMFLH are performed for each snapshot separately as in any volume method. The computational cost for RMFLH is larger than a finite-volume method with the same gauge assumptions however, since it involves additionally the tracing of the field lines of two magnetic fields, original and potential. The information gained is also higher though, since RM-FLH indicates the locations where helicity is more important, instead of providing a single value for the entire considered domain.
In the MHD simulations examined in this work for example, RMFLH reaffirmed the difference in the helicity budgets between the non-eruptive and the eruptive case, while in the jet case, more photospheric twisting lead to localized higher positive values for RMFLH in the region of twist injection. These results, and most notably the sign of RMFLH, are a function of the gauge of course, since RMFLH is a gauge-dependent quantity. Preliminary testing with different gauge combinations shows that locations of higher absolute values of RMFLH are unaffected by the gauge choice. This is also supported by the results of Yeates & Page (2018, Figs. 4 and 7). More detailed examination of this dependence goes beyond the aim of this paper which is to introduce the quantity RMFLH. However, a representation and/or visualization of RMFLH that is less-, or non-related from the gauge is something worth exploring in the future.
In a first application of the developed RMFLH method to solar observations, relative magnetic field line helicity was shown to relate to helicity flux density. In a NLFF reconstruction of the magnetic field of a solar active region the two quantities showed similar overall photospheric spatial distribution, although local differences were also observed. The examination of RMFLH in similar future studies may thus provide additional information on the physical conditions of solar active regions.
Consequently, the concept of relative magnetic field line helicity has important potential for use in plasma applications. Field line helicity seems as a promising tool to apply especially to situations such as the flux ropes of coronal mass ejections (Green et al. 2018), where magnetic helicity is known to play an important role. (1), black curve) and by the field line method (with Eq. (11), colored curves), and of their relative difference η, for the non-eruptive emergence (top), the eruptive emergence (middle), and the jet formation simulations (bottom). In all cases it is shown the RMFLH that starts from the positive footpoints (Eq. (8), red curve), from the negative footpoints (Eq. (9), blue curve), and from both (Eq. (10), grey curve). Fig. 4. Field line helicity morphology for the snapshot at t = 120 of the non-eruptive emergence simulation (top), the snapshot at t = 110 of the eruptive emergence simulation (middle), and the snapshot at t = 920 of the jet formation simulation (bottom). The left plots show representative field lines colored by the value of their RMFLH overplotted on the photospheric map of B z . In the top two plots, field lines are drawn from the contours B z = ±0.3 and the lines at x = ±50, while in the bottom plot from the contour B z = 5 and the circle of radius r = 3.4 centered on the image. The right plots show the respective 2D maps of RMFLH on the photospheric plane.

Appendix A: Dependence of RMFLH on the choice of the footpoints
As mentioned in Sect. 4.1 the default method for choosing the footpoint locations is by the grid points (GP) of the given magnetic field. Here we give an alternative method that assigns more footpoints to areas of stronger magnetic field strength. We refer to this method as the flux-based (FL) method. In this, the magnetogram under study is first divided into weak and intense magnetic field areas. Typically, the division corresponds to the absolute value of B z above which 90% of the flux in the magnetogram is taken into account. In the weak-field areas, a footpoint is assigned to each pixel as in the GP method. In the intense-field areas however, the footpoints assigned per pixel are proportional to the flux in that pixel. The lateral and top boundaries where the magnetic field is normally much weaker are treated as weak-field areas. We note also that this procedure results in the footpoints having similar values of magnetic flux, which is determined from the threshold value of B z . As an example, we show in Fig. A.1 the photospheric footpoints obtained with the two methods for the snapshot at t = 120 of the noneruptive emergence simulation, and the positive-polarity boundary. The number of footpoints in the GP case are ∼ 27 000, while in the FL case almost three times that, ∼ 77 000. The resulting helicity budget using these footpoints for the same simulation is shown in Fig. A.2. For simplicity we have only considered the footpoints starting from the photospheric boundary. We notice in the bottom panel of Fig. A.2 that the relative (to the volume method) differences are very small, ≤ 1% for both cases. This means that the GP method that is mainly used in this paper works equally well as the more accurate FL one, and so the choice of the former as more convenient, is justified. Moreover, the differences in the form of the RMFLH A + r computed with the two methods are very small, as is shown in Fig. A.3.

Fig. A.2.
Evolution of relative magnetic helicity as calculated by the volume method (with Eq. (1), black curve) and by the field line method (with Eq. (11)) and footpoints selected by GP (red curve), and FL (blue curve) methods (top), and of their relative difference η (bottom), for the non-eruptive emergence simulation.
To further examine the differences between the GP-and FLbased methods for choosing footpoints, we use the much more complex NLFF field reconstruction of AR 11158. In the top panel of Fig. A.4 we show the form of the RMFLH A 0 r computed with the footpoints given by the FL method for the threshold B z 2 G between weak and intense magnetic field areas. The differences with the top right Fig. 5 where the footpoints are given by the GP method are very small, as the bottom panel of