1 Introduction
Magnetic helicity,
$h(V)$
, has been known to be an integral invariant of ideal magnetohydrodynamics (MHD) since Woltjer (Reference Woltjer1958), and its elegant physical interpretation as the average pairwise linking of magnetic flux tubes (or magnetic field lines) since Moffatt (Reference Moffatt1969). Its practical importance is largely due to its robustness even in the presence of finite resistivity (see, e.g. Berger Reference Berger1984; Browning Reference Browning1988). However, the linking interpretation requires the field lines to be either closed curves, or to be ergodic within the domain (Arnold Reference Arnold1986). In astrophysical situations, the magnetic field is typically not confined to a finite volume, so that field lines will typically leave through the boundary of any finite computational domain.
The seminal work of Berger & Field (Reference Berger and Field1984) showed how to define a gauge-invariant version of
$h(V)$
even when the domain is not magnetically closed, by subtracting the helicity of an appropriate reference magnetic field. This so-called relative magnetic helicity,
$H_{R}$
, effectively measures the average linking with respect to that of the reference field. Typically one chooses a reference field with as little self-linking as possible, so that the desired information about the structure of the original field itself is revealed. Usually, this is done by fixing the reference field to the unique current-free/potential magnetic field that minimises magnetic energy for the given boundary conditions. Like
$h(V)$
, the relative helicity
$H_{R}$
is invariant under an ideal-MHD evolution that vanishes on the boundary. In practice, we are often interested in the injection of helicity due to ideal (or nearly ideal) motions on the boundary.
The relative helicity,
$H_{R}$
, was motivated by applications in the solar atmosphere. Here, the magnetic field in three-dimensional space cannot generally be measured directly from telescope observations, but it is routinely observed on the Sun’s photosphere (visible surface). Following Berger & Field (Reference Berger and Field1984), these observations have been used to estimate the flux of relative helicity from the Sun’s interior into its atmosphere, both on a global scale (Berger & Ruzmaikin Reference Berger and Ruzmaikin2000; Yang & Zhang Reference Yang and Zhang2012), and in individual solar active regions (see Démoulin & Pariat Reference Démoulin and Pariat2009, for a review). Indeed, the need to shed relative helicity into interplanetary space is understood to be the fundamental driver for coronal mass ejections (Rust Reference Rust, Crooker, Joselyn and Feynman1997). In the case of numerical models and simulations, it is possible to perform the volume integral for
$H_{R}$
directly. Accordingly, its build up in the solar atmosphere has been followed in a wide variety of simulations of solar active regions (e.g. DeVore Reference DeVore2000; Cheung, Schüssler & Moreno-Insertis Reference Cheung, Schüssler, Moreno-Insertis, Innes, Lagg and Solanki2005; Magara Reference Magara2008; Mackay, Green & van Ballegooijen Reference Mackay, Green and van Ballegooijen2011; Yang et al.
Reference Yang, Büchner, Santos and Zhang2013; Moraitis et al.
Reference Moraitis, Tziotziou, Georgoulis and Archontis2014; Pariat et al.
Reference Pariat, Valori, Démoulin and Dalmasse2015; Sturrock et al.
Reference Sturrock, Hood, Archontis and McNeill2015; Pariat et al.
Reference Pariat, Leake, Valori, Linton, Zuccarello and Dalmasse2017; Yardley, Mackay & Green Reference Yardley, Mackay and Green2018). Minimisation of magnetic energy subject to conservation of
$H_{R}$
can also be used for the computation of force-free equilibria (Finn & Antonsen Jr Reference Finn and Antonsen1985; Dixon et al.
Reference Dixon, Berger, Priest and Browning1989).
However,
$H_{R}$
, like
$h(V)$
, is only a single integral over the whole domain, so cannot provide local information about the constraints on a particular magnetic field. For example, observations of the solar atmosphere suggest a highly non-uniform distribution of free energy, with the concentration of helicity in individual magnetic flux ropes believed to play an important role in their eruptivity. Moreover, recent numerical simulations of the resistive relaxation of braided magnetic flux tubes suggest the presence of additional topological constraints, over and above conservation of the global
$H_{R}$
(Del Sordo, Candelaresi & Brandenburg Reference Del Sordo, Candelaresi and Brandenburg2010; Pontin et al.
Reference Pontin, Wilmot-Smith, Hornig and Galsgaard2011).
To overcome this limitation, it is desirable to compute
$H_{R}$
in smaller subvolumes of the overall computational domain. This was addressed by Longcope & Malanushenko (Reference Longcope and Malanushenko2008), who divide the overall computational volume
$V$
into a union of subvolumes
$V=\bigcup _{i}D_{i}$
. The subvolumes
$D_{i}$
must be defined in such a way that the boundaries between them are magnetic surfaces (with vanishing normal magnetic field). In this way, the only uncontained magnetic field is on their intersection with the global boundary
$\unicode[STIX]{x2202}V$
. Longcope & Malanushenko (Reference Longcope and Malanushenko2008) propose to define an ‘additive self-helicity’,
$H_{i}^{(s)}$
, for each
$D_{i}$
that is simply the relative helicity integrated only over
$D_{i}$
, with respect to a reference potential field defined locally within
$D_{i}$
. In this way, we can measure the helicity over-and-above any helicity which is forced to be present simply by the shape of the domain
$D_{i}$
. Malanushenko et al. (Reference Malanushenko, Longcope, Fan and Gibson2009) were able to relate
$H_{i}^{(s)}$
to the kink instability of a particular magnetic flux rope.
However, a limitation with
$H_{i}^{(s)}$
as defined by Longcope & Malanushenko (Reference Longcope and Malanushenko2008) is the need to identify a suitable union of subvolumes
$D_{i}$
. In the absence of any further information, it seems desirable to make the decomposition very fine (i.e. many
$D_{i}$
). The finest possible decomposition is to take each
$D_{i}$
to be an infinitesimal tube around each magnetic field line, but in that limit the local reference potential field would simply become the original magnetic field, so that
$H_{i}^{(s)}$
(when appropriately normalised) would vanish. Therefore, in this paper, we will take a different approach that allows us to define a limiting field-line helicity for each individual magnetic field line. We will call this a relative field-line helicity because it will integrate to give
$H_{R}$
. Note that this property is not shared by the
$H_{i}^{(s)}$
; although they add to give a relative helicity, it is relative to the sum of the local reference fields rather than to the global reference field used in
$H_{R}$
. A further advantage of our proposed relative field-line helicity over
$H_{i}^{(s)}$
will be its ease of computation, since it will not require computation of the potential reference field on an irregularly shaped domain.
The basic form of field-line helicity, which decomposes the original magnetic helicity
$h(V)$
, was given explicitly by Berger (Reference Berger1988) and will be defined in § 2. Like
$h(V)$
, field-line helicity has been shown to be intimately related to the topological structure of a magnetic field (Yeates & Hornig Reference Yeates and Hornig2013, Reference Yeates and Hornig2014; Prior & Yeates Reference Prior and Yeates2014), and is a valuable tool for studying magnetic reconnection (Yeates & Hornig Reference Yeates and Hornig2011; Russell et al.
Reference Russell, Yeates, Hornig and Wilmot-Smith2015). In global models of non-potential magnetic fields in the solar corona, it has recently been used successfully to identify local magnetic flux ropes (Yeates & Hornig Reference Yeates and Hornig2016; Lowder & Yeates Reference Lowder and Yeates2017). The main objective of the present paper is to generalise the definition of field-line helicity to give a relative field-line helicity that integrates to give
$H_{R}$
, rather than
$h(V)$
. Our proposed definition is given in § 3. Numerical methods for computing relative field-line helicity are summarised in § 4, and used to explore and illustrate its behaviour for particular examples in § 5. Although these examples by no means exhaust the possible situations where these ideas can be applied, they do illustrate some of the more typical structures that are found in solar active regions.
2 Preliminaries
Throughout this paper, we will assume our magnetic field
$\boldsymbol{B}$
(with
$\unicode[STIX]{x1D735}\boldsymbol{\cdot }\boldsymbol{B}=0$
) to be defined in a simply connected closed domain
$V$
whose boundary
$\unicode[STIX]{x2202}V$
is a single closed surface. Our examples in § 5 will use a simple Cartesian box, which is the typical
$V$
we have in mind. However, it is only the topology of
$V$
(and
$\unicode[STIX]{x2202}V$
) that matters for the theory in § 3.
2.1 Relative magnetic helicity
Importantly, we do not require
$\unicode[STIX]{x2202}V$
to be a magnetic surface, but permit non-zero
$B_{n}:=\boldsymbol{B}\boldsymbol{\cdot }\hat{\boldsymbol{n}}$
on
$\unicode[STIX]{x2202}V$
. This is the typical situation in astrophysical applications. As is well known, the magnetic helicity,
is not gauge invariant in this situation, since under a gauge transformation from
$\boldsymbol{A}$
to
$\boldsymbol{A}^{\prime }=\boldsymbol{A}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D712}$
, the helicity becomes
so that its value depends on the gauge function
$\unicode[STIX]{x1D712}$
. A gauge-invariant ‘relative helicity’ may be defined as
where
$\boldsymbol{B}_{p}$
is some arbitrary reference field whose normal component
$B_{pn}$
matches
$B_{n}$
on
$\unicode[STIX]{x2202}V$
(Berger & Field Reference Berger and Field1984; Finn & Antonsen Jr Reference Finn and Antonsen1985). Typically
$\boldsymbol{B}_{p}$
is chosen to be the unique such field that is current free (potential) within
$V$
, although this is not essential. In (2.3),
$\boldsymbol{A}$
is an arbitrary vector potential for
$\boldsymbol{B}$
(so that
$\boldsymbol{B}=\unicode[STIX]{x1D735}\times \boldsymbol{A}$
) and
$\boldsymbol{A}_{p}$
is an arbitrary vector potential for
$\boldsymbol{B}_{p}$
(so that
$\boldsymbol{B}_{p}=\unicode[STIX]{x1D735}\times \boldsymbol{A}_{p}$
). It is easy to show from (2.3) that
$H_{R}$
is invariant under gauge transformation of either
$\boldsymbol{A}$
or
$\boldsymbol{A}_{p}$
, for a given
$\boldsymbol{B}_{p}$
.
2.2 Field-line helicity
The concept of field-line helicity arises if we consider the magnetic helicity in a subvolume
$D_{i}\in V$
. This clearly makes sense for any material (comoving) subvolume
$D_{i}$
provided that
$B_{n}=0$
on
$\unicode[STIX]{x2202}D_{i}$
, for then
would be both gauge invariant and conserved under ideal-MHD evolution. One can envisage sub-dividing
$V$
into a finer and finer union of material subvolumes, in order to gain more and more detailed information about the topological structure. As mentioned in § 1, the finest possible decomposition is where each
$D_{i}$
is a thin magnetic flux tube surrounding a single magnetic field line, because magnetic field lines are material lines in an ideal evolution.
In this paper, however, we will consider only field lines that are rooted at both ends in the boundary
$\unicode[STIX]{x2202}V$
, so that their surrounding tubular domains have
$B_{n}\neq 0$
on the ends, violating this boundary condition. Figure 1 shows such a field line,
$L(\boldsymbol{x})$
, along with a surrounding flux tube
$V_{\unicode[STIX]{x1D716}}(\boldsymbol{x})$
of radius
$\unicode[STIX]{x1D700}$
(in some cross-section). We label
$L(\boldsymbol{x})$
by one of its endpoints
$\boldsymbol{x}\in \unicode[STIX]{x2202}V$
. Throughout this paper,
$\boldsymbol{x}$
will exclusively denote a point on the boundary
$\unicode[STIX]{x2202}V$
.
Because
$B_{n}\neq 0$
on
$\unicode[STIX]{x2202}V_{\unicode[STIX]{x1D716}}(\boldsymbol{x})$
, we expect
$h(V_{\unicode[STIX]{x1D700}}(\boldsymbol{x}))$
to change due to either motion of the field line endpoints or gauge transformation of
$\boldsymbol{A}$
. The latter is a more significant problem, and will be addressed in detail in this paper. First, however, we take the limit to an infinitesimally thin tube. Since
$h(V_{\unicode[STIX]{x1D700}}(\boldsymbol{x}))$
is a volume integral, we normalise by the flux
$\unicode[STIX]{x1D6F7}_{\unicode[STIX]{x1D700}}(\boldsymbol{x})$
of the tube and define
In the limit
$\unicode[STIX]{x1D700}\rightarrow 0$
, the tube collapses to the line
$L(\boldsymbol{x})$
, and
${\mathcal{A}}(\boldsymbol{x})$
tends to a well-defined limit – independent of the choice of cross-section – which Berger (Reference Berger1988) calls the field-line helicity. Note that, although
${\mathcal{A}}(\boldsymbol{x})$
is defined by integrating only over the tubular volume
$V_{\unicode[STIX]{x1D700}}(\boldsymbol{x})$
, it nevertheless contains information about how this particular flux tube interacts with the magnetic field outside, due to the fact that
$\boldsymbol{A}$
is defined globally. In this paper, we will assume that
$\boldsymbol{B}$
has no ergodic field lines with infinite length, as we have not shown that a well-defined limit exists in that case.
Definition sketch for (2.5), showing a thin flux tube
$V_{\unicode[STIX]{x1D700}}(\boldsymbol{x})$
of radius
$\unicode[STIX]{x1D700}$
and magnetic flux
$\unicode[STIX]{x1D6F7}_{\unicode[STIX]{x1D700}}(\boldsymbol{x})$
around the field line
$L(\boldsymbol{x})$
that is rooted at
$\boldsymbol{x}\in \unicode[STIX]{x2202}V$
.

The definition (2.5) shows that
${\mathcal{A}}(\boldsymbol{x})$
has the dimensions of a magnetic flux. A more convenient formula may be obtained by writing the volume integral
$h(V_{\unicode[STIX]{x1D700}}(\boldsymbol{x}))$
as an integral along
$L(\boldsymbol{x})$
of cross-sectional surface integrals. In the limit
$V_{\unicode[STIX]{x1D700}}(\boldsymbol{x})\rightarrow L(\boldsymbol{x})$
, the vector potential
$\boldsymbol{A}$
is constant on each cross-section, so that
$$\begin{eqnarray}{\mathcal{A}}(\boldsymbol{x})=\lim _{\unicode[STIX]{x1D700}\rightarrow 0}\frac{\displaystyle \int _{V_{\unicode[STIX]{x1D700}}(\boldsymbol{x})}\unicode[STIX]{x1D6F7}_{\unicode[STIX]{x1D700}}(\boldsymbol{x})\boldsymbol{A}\boldsymbol{\cdot }\text{d}\boldsymbol{l}}{\unicode[STIX]{x1D6F7}_{\unicode[STIX]{x1D700}}(\boldsymbol{x})}=\int _{L(\boldsymbol{x})}\boldsymbol{A}\boldsymbol{\cdot }\text{d}\boldsymbol{l}.\end{eqnarray}$$
This formula shows clearly that, were
$L(\boldsymbol{x})$
to be a contractible closed loop, then
${\mathcal{A}}(\boldsymbol{x})$
would be gauge independent, and by Stokes’ theorem it would simply be the magnetic flux linked through that loop. Clearly
${\mathcal{A}}(\boldsymbol{x})$
would then be an ideal-MHD invariant, representing the magnetic flux linked with
$L(\boldsymbol{x})$
. In our case,
$L(\boldsymbol{x})$
is not a closed loop. Nevertheless,
${\mathcal{A}}(\boldsymbol{x})$
remains an ideal-MHD invariant provided that there are no boundary motions, and also that the gauge of
$\boldsymbol{A}$
on the boundary is fixed. Indeed a gauge transformation from
$\boldsymbol{A}$
to
$\boldsymbol{A}^{\prime }=\boldsymbol{A}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D712}$
will change the value of
${\mathcal{A}}(\boldsymbol{x})$
to
where
$\boldsymbol{x}_{+}$
is the other end of the field line, as in figure 1. This is simply the limiting version of the formula (2.2). In fact, since
$\unicode[STIX]{x2202}V$
is a single closed surface, it follows that
${\mathcal{A}}(\boldsymbol{x})$
, like
$h(V)$
, depends only on
$\hat{\boldsymbol{n}}\times \boldsymbol{A}$
. For if
$\hat{\boldsymbol{n}}\times \boldsymbol{A}^{\prime }=\hat{\boldsymbol{n}}\times \boldsymbol{A}$
on
$\unicode[STIX]{x2202}V$
, then
$\hat{\boldsymbol{n}}\times \unicode[STIX]{x1D735}\unicode[STIX]{x1D712}=0$
on
$\unicode[STIX]{x2202}V$
, so that
$\unicode[STIX]{x1D712}$
is constant over all of
$\unicode[STIX]{x2202}V$
and
${\mathcal{A}}^{\prime }(\boldsymbol{x})={\mathcal{A}}(\boldsymbol{x})$
. This would not be true for a domain where
$\unicode[STIX]{x2202}V$
is not a single connected surface, for example a spherical shell. As we will see in this paper, the art of working with field-line helicity is to choose an informative gauge for
$\hat{\boldsymbol{n}}\times \boldsymbol{A}$
.
Finally, we note the relation between
${\mathcal{A}}(\boldsymbol{x})$
and the overall helicity
$h(V)$
. When the field lines
$L(\boldsymbol{x})$
partition the whole volume (i.e. there are no closed or ergodic field lines), integrating (2.5) over all field lines, weighted by magnetic flux, will give
$h(V)$
(Berger Reference Berger1988). In other words,
where the factor half arises because each field line has two endpoints on
$\unicode[STIX]{x2202}V$
.
3 Definition of relative field-line helicity
The aim of this paper is to generalise the formula (2.8) to the relative helicity
$H_{R}$
. In other words, we would like to define a ‘relative field-line helicity’
${\mathcal{A}}_{R}(\boldsymbol{x})$
for each field line that is invariant under an ideal-MHD evolution and satisfies
for a fixed choice of reference field. We will firstly show that there are many different ways to define such an
${\mathcal{A}}_{R}$
, and will go on to make some specific choices that we believe are physically reasonable.
3.1 Towards a definition
One option is to use
${\mathcal{A}}(\boldsymbol{x})$
directly, but restrict the gauge
$\boldsymbol{A}$
. We know that, whatever the gauge,
${\mathcal{A}}(\boldsymbol{x})$
is invariant under an ideal-MHD evolution for every field line provided that
$\hat{\boldsymbol{n}}\times \boldsymbol{A}$
on
$\unicode[STIX]{x2202}V$
remains fixed in time. But in an arbitrary gauge, condition (3.1) will not be satisfied, since
$h(V)\neq H_{R}$
in general. Nevertheless, there are a restricted family of gauges of
$\boldsymbol{A}$
where
$h(V)=H_{R}$
. To see this, write (2.3) in the form
It is well known that the boundary term vanishes if we restrict
$\hat{\boldsymbol{n}}\times \boldsymbol{A}=\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
(Barnes Reference Barnes1988; Berger Reference Berger1988). This is always possible since
$B_{pn}=B_{n}$
on
$\unicode[STIX]{x2202}V$
(§ 4.3 shows how to construct such an
$\boldsymbol{A}$
, given an arbitrary
$\boldsymbol{A}_{p}$
). We then need only choose
$\boldsymbol{A}_{p}$
such that
$\int _{V}\boldsymbol{A}_{p}\boldsymbol{\cdot }\boldsymbol{B}_{p}\,\text{d}^{3}x=0$
, and we will have
$H_{R}=h(V)$
and hence (3.1). In general, this is not possible, since
$\boldsymbol{B}_{p}$
may have a closed-loop field line
$L$
within
$V$
whose gauge invariant
$\oint _{L}\boldsymbol{A}_{p}\boldsymbol{\cdot }\text{d}\boldsymbol{l}$
does not vanish. However, in the case where
$\boldsymbol{B}_{p}$
is a potential field, it cannot have any closed-loop field lines, and we can always find a gauge for
$\boldsymbol{A}_{p}$
such that
$\int _{V}\boldsymbol{A}_{p}\boldsymbol{\cdot }\boldsymbol{B}_{p}\,\text{d}^{3}x=0$
(e.g. Barnes Reference Barnes1988; Berger Reference Berger1988).
Even when
$\boldsymbol{B}_{p}$
is a potential field, the conditions that
$\int _{V}\boldsymbol{A}_{p}\boldsymbol{\cdot }\boldsymbol{B}_{p}\,\text{d}^{3}x=0$
and
$\hat{\boldsymbol{n}}\times \boldsymbol{A}=\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
do not uniquely define
${\mathcal{A}}(\boldsymbol{x})$
, because there is still freedom in the choice of
$\boldsymbol{A}_{p}$
. For example, if we have such a gauge
$\boldsymbol{A}_{p}$
and change to
$\boldsymbol{A}_{p}^{\prime }=\boldsymbol{A}_{p}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D719}$
, then
Provided
$B_{n}\neq 0$
, this integral may still vanish even if
$\unicode[STIX]{x1D719}\neq 0$
on
$\unicode[STIX]{x2202}V$
.
3.2 General definition
In practice, it may be inconvenient or (when
$\boldsymbol{B}_{p}$
is non-potential) impossible to find a gauge
$\boldsymbol{A}_{p}$
such that
$\int _{V}\boldsymbol{A}_{p}\boldsymbol{\cdot }\boldsymbol{B}_{p}\,\text{d}^{3}x=0$
. Therefore, we propose instead an alternative definition for relative field-line helicity that does not impose this requirement on
$\boldsymbol{A}_{p}$
. Namely,
where
${\mathcal{A}}(\boldsymbol{x})$
is the usual field-line helicity (2.6) and
which is the field-line helicity of the reference field
$\boldsymbol{B}_{p}$
on its own field line rooted at the same point
$\boldsymbol{x}\in \unicode[STIX]{x2202}V$
. Importantly, our definition assumes the gauge condition on
$\boldsymbol{A}$
that
It follows that
${\mathcal{A}}_{R}(\boldsymbol{x})$
will satisfy (3.1), whatever the gauge of
$\boldsymbol{A}_{p}$
. Note that, unlike
${\mathcal{A}}(\boldsymbol{x})$
, this
${\mathcal{A}}_{R}(\boldsymbol{x})$
will not, in general, have the same value at both ends of a given field line
$L(\boldsymbol{x})$
, since the corresponding reference field line
$L_{p}(\boldsymbol{x})$
at each end will be different.
A nice property of
${\mathcal{A}}_{R}(\boldsymbol{x})$
is that
${\mathcal{A}}_{R}(\boldsymbol{x})=0$
whenever
$\boldsymbol{B}_{p}=\boldsymbol{B}$
all along
$L(\boldsymbol{x})$
for some
$\boldsymbol{x}\in \unicode[STIX]{x2202}V$
. For in that case,
$L(\boldsymbol{x})=L_{p}(\boldsymbol{x})$
and we must have
$\boldsymbol{A}=\boldsymbol{A}_{p}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D712}$
along this line. Then
However, since
$\unicode[STIX]{x2202}V$
is a connected surface, and
$\hat{\boldsymbol{n}}\times \unicode[STIX]{x1D735}\unicode[STIX]{x1D712}=0$
on this surface thanks to our gauge restriction, it follows that
$\unicode[STIX]{x1D712}$
is constant on
$\unicode[STIX]{x2202}V$
and hence
${\mathcal{A}}_{R}(\boldsymbol{x})=0$
. This property makes
${\mathcal{A}}_{R}$
useful for identifying non-potential regions within
$\boldsymbol{B}$
, and will not generally be shared by the basic field-line helicity
${\mathcal{A}}$
, even in a gauge where
$\int _{V}\boldsymbol{A}_{p}\boldsymbol{\cdot }\boldsymbol{B}_{p}\,\text{d}^{3}x=0$
overall.
3.3 Gauge dependence and physical meaning
Unfortunately, our definition of
${\mathcal{A}}_{R}$
in (3.4), even with the restriction that
$\hat{\boldsymbol{n}}\times \boldsymbol{A}=\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
, is still not uniquely defined, and depends on the gauge of
$\boldsymbol{A}_{p}$
. To see this, consider a gauge transformation from
$\boldsymbol{A}_{p}$
to
$\boldsymbol{A}_{p}^{\prime }=\boldsymbol{A}_{p}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D719}$
. To preserve the boundary restriction, we must also change the gauge of
$\boldsymbol{A}$
to
$\boldsymbol{A}^{\prime }=\boldsymbol{A}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D712}$
, where
$\hat{\boldsymbol{n}}\times \unicode[STIX]{x1D735}(\unicode[STIX]{x1D719}-\unicode[STIX]{x1D712})=0$
on
$\unicode[STIX]{x2202}V$
. It follows that the two gauge functions can differ on
$\unicode[STIX]{x2202}V$
only by a global constant (since
$\unicode[STIX]{x2202}V$
is connected). Using this fact, we find that
${\mathcal{A}}_{R}(\boldsymbol{x})$
goes to
When
$L(\boldsymbol{x})\neq L_{p}(\boldsymbol{x})$
, the other ends of the field lines (denoted
$\boldsymbol{x}_{+}$
and
$\boldsymbol{x}_{p+}$
) will differ, so the value of
${\mathcal{A}}_{R}(\boldsymbol{x})$
will change.
To see the physical meaning of this gauge dependence, we can interpret
${\mathcal{A}}_{R}(\boldsymbol{x})$
as a magnetic flux (cf. Yeates & Hornig Reference Yeates and Hornig2016). This is illustrated in figure 2, where
$L(\boldsymbol{x})$
is a field line of
$\boldsymbol{B}$
and
$L_{p}(\boldsymbol{x})$
is a field line of
$\boldsymbol{B}_{p}$
rooted at the same point
$\boldsymbol{x}$
. The curve
$\unicode[STIX]{x1D6FE}\subset \unicode[STIX]{x2202}V$
in figure 2(a) closes the loop and defines a surface in
$V$
bounded by
$L(\boldsymbol{x})$
,
$\unicode[STIX]{x1D6FE}$
and
$-L_{p}(\boldsymbol{x})$
. If
$\unicode[STIX]{x1D6FE}$
is chosen so that
$\int _{\unicode[STIX]{x1D6FE}}\boldsymbol{A}_{p}\boldsymbol{\cdot }\text{d}\boldsymbol{l}=0$
, then
${\mathcal{A}}_{R}(\boldsymbol{x})$
will be precisely the magnetic flux through this surface, by Stokes’ theorem. Provided the field-line endpoints and
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
and remain fixed in time, this flux will be an ideal-MHD invariant. In any gauge, it is possible to find such a curve
$\unicode[STIX]{x1D6FE}$
along which the line integral vanishes, as proven by Yeates & Hornig (Reference Yeates and Hornig2016). In fact, there are an infinite number of such curves (whose corresponding surfaces all have the same flux). The possible
$\unicode[STIX]{x1D6FE}$
depend on the gauge of
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
, as sketched in figure 2(b) which shows a different curve
$\unicode[STIX]{x1D6FE}^{\prime }$
arising in a different gauge
$\boldsymbol{A}^{\prime }$
. This loop encloses a different amount of magnetic flux, corresponding to the different value of
${{\mathcal{A}}_{R}}^{\prime }(\boldsymbol{x})$
in this new gauge. In summary, the gauge dependence of
${\mathcal{A}}_{R}$
may be viewed simply as a choice of how to close flux surfaces on the boundary. Whichever choice is made,
${\mathcal{A}}_{R}(\boldsymbol{x})$
is an ideal-MHD invariant.
Interpretation of
${\mathcal{A}}_{R}(\boldsymbol{x})$
as a magnetic flux, for two different gauges in (a) and (b). The field lines
$L(\boldsymbol{x})$
and
$L_{p}(\boldsymbol{x})$
are the same in each case, but the possible curves
$\unicode[STIX]{x1D6FE}$
and
$\unicode[STIX]{x1D6FE}^{\prime }$
that complete the loop by linking
$\boldsymbol{x}_{+}$
and
$\boldsymbol{x}_{p+}$
on
$\unicode[STIX]{x2202}V$
differ between the two gauges, so that
${\mathcal{A}}_{R}(\boldsymbol{x})\neq {{\mathcal{A}}_{R}}^{\prime }(\boldsymbol{x})$
.

At first sight, it may seem from (3.9) that we can choose any distribution of
${\mathcal{A}}_{R}$
that we like on field lines that intersect
$\unicode[STIX]{x2202}V$
, simply by changing the gauge
$\unicode[STIX]{x1D719}$
. Indeed, this is true. However, choosing
$\unicode[STIX]{x1D719}$
in this way requires you to first know
${\mathcal{A}}_{R}$
for
$\boldsymbol{B}$
in some initial gauge. If we choose the gauge a priori, based only on
$\boldsymbol{B}_{p}$
, then the resulting
${\mathcal{A}}_{R}$
can give us meaningful information about
$\boldsymbol{B}$
.
In § 5, we will illustrate the effect on
${\mathcal{A}}_{R}$
of some different choices of
$\boldsymbol{A}_{p}$
in particular examples. However, we will first propose a general candidate for the ‘best’ choice of gauge, that can be used to uniquely define
${\mathcal{A}}_{R}$
.
3.4 Minimal gauge
Since
${\mathcal{A}}_{R}$
depends only on the distribution of
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
, our idea is to choose this gauge by minimising the integral
$\oint _{\unicode[STIX]{x2202}V}|\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}|^{2}\,\text{d}^{2}x$
over the whole boundary. Intuitively, this will give us the smallest overall boundary contribution to
${\mathcal{A}}_{R}$
, for a given reference field
$\boldsymbol{B}_{p}$
(whether potential or not). In appendix A, we prove that this integral is minimised if
where
$\unicode[STIX]{x1D735}_{h}\boldsymbol{\cdot }$
denotes the two-dimensional divergence in the plane of
$\unicode[STIX]{x2202}V$
. This is the so-called ‘universal gauge’ condition of Hornig (Reference Hornig2006). Although this condition does not specify
$\boldsymbol{A}_{p}$
uniquely within
$V$
, it does specify
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
uniquely on
$\unicode[STIX]{x2202}V$
, and hence uniquely specifies
${\mathcal{A}}_{R}$
. To see this, suppose both
$\boldsymbol{A}_{p}$
and
$\boldsymbol{A}_{p}^{\prime }=\boldsymbol{A}_{p}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D719}$
satisfy (3.10). Then we must have
$\unicode[STIX]{x1D6FB}_{h}^{2}\unicode[STIX]{x1D719}=0$
, but since
$\unicode[STIX]{x2202}V$
is a closed surface, this implies that
$\unicode[STIX]{x1D719}$
is constant on
$\unicode[STIX]{x2202}V$
, so that
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}^{\prime }=\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
. Note that
${\mathcal{A}}_{p}$
does not necessarily vanish in this gauge when
$\boldsymbol{B}_{p}$
is a potential field – we will see this in § 5.
In the rest of this paper, we will denote vector potentials satisfying (3.10) by
$\boldsymbol{A}^{\ast }$
or
$\boldsymbol{A}_{p}^{\ast }$
, the corresponding field-line helicities by
${\mathcal{A}}^{\ast }$
and
${\mathcal{A}}_{p}^{\ast }$
and the corresponding relative field-line helicity by
${\mathcal{A}}_{R}^{\ast }$
. In § 5, we will compute
${\mathcal{A}}_{R}^{\ast }$
for some example magnetic fields, and compare it to
${\mathcal{A}}_{R}$
in some other gauges.
3.5 Summary of the proposed definition
To summarise, let
$\boldsymbol{A}_{p}^{\ast }$
be a vector potential for
$\boldsymbol{B}_{p}$
satisfying
and let
$\boldsymbol{A}^{\ast }$
be a vector potential for
$\boldsymbol{B}$
satisfying
Then our proposed definition of relative field-line helicity at
$\boldsymbol{x}\in \unicode[STIX]{x2202}V$
is the difference
where
${\mathcal{A}}^{\ast }$
,
${\mathcal{A}}_{p}^{\ast }$
are the field-line helicities of
$\boldsymbol{B}$
and
$\boldsymbol{B}_{p}$
in these two gauges, defined along their respective magnetic field lines.
4 Numerical methods
The numerical code used for this paper was written in Python, with a supporting Fortran module for fast tracing of the magnetic field lines (taking advantage of OpenMP if available). This code is open source and available at https://github.com/antyeates1983/flhtools. Although the definitions in § 3 apply to more general domains, this code is specific to a Cartesian domain.
For field-line tracing, the code uses the second-order midpoint method with adaptive step size. The computations in this paper used simple linear interpolation of
$\boldsymbol{A}$
and
$\boldsymbol{B}$
to trace field lines and compute
${\mathcal{A}}$
, demonstrating that sophisticated numerical methods are not required to work with field-line helicity. However, to facilitate computation of
$\boldsymbol{B}_{p}$
,
$\boldsymbol{A}$
and
$\boldsymbol{A}_{p}$
, the code uses a staggered mesh where each component of
$\boldsymbol{B}$
(or
$\boldsymbol{B}_{p}$
) is located at the centre of the corresponding cell face and the components of
$\boldsymbol{A}$
(or
$\boldsymbol{A}_{p}$
) are located on the corresponding cell edges (Yee Reference Yee1966).
4.1 Reference potential field
In a Cartesian box, the potential reference field
$\boldsymbol{B}_{p}$
that matches
$B_{n}$
on all six boundary faces is straightforward to compute. We write
$\boldsymbol{B}_{p}=\unicode[STIX]{x1D735}u$
leading to the three-dimensional Laplace equation
$\unicode[STIX]{x1D6FB}^{2}u=0$
. On the staggered mesh, the potential
$u$
is located at the centre of each three-dimensional cell, so that each component of
$\boldsymbol{B}_{p}$
may be computed from
$u$
by a central difference. We approximate the Laplacian operator
$\unicode[STIX]{x1D6FB}^{2}$
with a second-order (7-point) finite-difference stencil, for which the solution is efficiently and simply obtained using a fast-Poisson technique with Neumann boundary conditions (Press et al.
Reference Press, Teukolsky, Vetterling and Flannery1992). With this technique, the current density
$\unicode[STIX]{x1D735}\times \boldsymbol{B}_{p}$
vanishes to machine precision when computed from
$\boldsymbol{B}_{p}$
with central differences.
4.2 Minimal gauge vector potential
To find
$\boldsymbol{A}^{\ast }$
(or
$\boldsymbol{A}_{p}^{\ast }$
), we have developed a numerical routine that starts from
$\boldsymbol{A}$
(or
$\boldsymbol{A}_{p}$
) in an arbitrary gauge, and performs the necessary gauge transformation. In particular, for the case of
$\boldsymbol{A}$
, we seek a scalar function
$\unicode[STIX]{x1D712}(x,y,z)$
on
$V$
such that
$\boldsymbol{A}^{\ast }=\boldsymbol{A}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D712}$
. The condition
$\unicode[STIX]{x1D735}_{h}\boldsymbol{\cdot }\boldsymbol{A}^{\ast }=0$
on
$\unicode[STIX]{x2202}V$
requires that
$\overline{\unicode[STIX]{x1D712}}:=\unicode[STIX]{x1D712}|_{\unicode[STIX]{x2202}V}$
satisfy the two-dimensional Poisson equation
over this whole boundary
$\unicode[STIX]{x2202}V$
. Since
$\unicode[STIX]{x2202}V$
is a closed surface, the right-hand side necessarily satisfies the compatibility condition
$\oint _{\unicode[STIX]{x2202}V}\unicode[STIX]{x1D735}_{h}\boldsymbol{\cdot }\boldsymbol{A}\,\text{d}^{2}x=0$
, so that the solution for
$\overline{\unicode[STIX]{x1D712}}$
exists and is unique up to an additive constant
$\overline{\unicode[STIX]{x1D712}}_{0}$
.
Equation (4.1) is solved numerically by a finite-difference method, approximating the Laplacian operator with the standard 5-point stencil. For our Cartesian domain, care must be taken to couple values of
$\overline{\unicode[STIX]{x1D712}}$
on neighbouring faces so that the normal component of
$\unicode[STIX]{x1D735}_{h}\overline{\unicode[STIX]{x1D712}}$
is continuous. (Strictly speaking, we are approximating a weak solution to (4.1), since the differential operators in (4.1) are not defined on the edges of the cube.) This coupling between faces precludes the use of a fast-Poisson solver, but a direct solution of the resulting (sparse) linear system remains practical for this two-dimensional problem. Although
$\boldsymbol{A}^{\ast }$
does not depend on the additive constant
$\overline{\unicode[STIX]{x1D712}}_{0}$
, we ensure that the linear system is invertible by fixing
$\overline{\unicode[STIX]{x1D712}}=0$
at one vertex of
$\unicode[STIX]{x2202}V$
.
Given the solution for
$\overline{\unicode[STIX]{x1D712}}$
, we can then choose any arbitrary extension of
$\unicode[STIX]{x1D712}$
into the interior of
$V$
, since this choice does not affect
${\mathcal{A}}^{\ast }$
. It is simplest to take
$\unicode[STIX]{x1D6FB}^{2}\unicode[STIX]{x1D712}=0$
in the volume, and solve this three-dimensional Laplace equation with Dirichlet boundary conditions
$\unicode[STIX]{x1D712}=\overline{\unicode[STIX]{x1D712}}$
on
$\unicode[STIX]{x2202}V$
. This can be solved using a standard fast-Poisson method.
4.3 Matching the reference gauge
Although not required for computing
${\mathcal{A}}_{R}^{\ast }$
, we have also implemented a numerical routine for changing the gauge of
$\boldsymbol{A}$
to
$\boldsymbol{A}^{\prime }$
so that
$\hat{\boldsymbol{n}}\times \boldsymbol{A}^{\prime }=\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
, given some
$\boldsymbol{A}_{p}$
. This will be used in § 5 to illustrate the computation of
${\mathcal{A}}_{R}$
in gauges other than the minimal gauge.
Writing
$\boldsymbol{A}^{\prime }=\boldsymbol{A}+\unicode[STIX]{x1D735}\unicode[STIX]{x1D712}$
, we need to compute
$\unicode[STIX]{x1D712}(x,y,z)\in V$
such that
$\hat{\boldsymbol{n}}\times \boldsymbol{A}^{\prime }=\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on
$\unicode[STIX]{x2202}V$
. This may be done by first solving for
$\unicode[STIX]{x1D712}|_{\unicode[STIX]{x2202}V}=\overline{\unicode[STIX]{x1D712}}$
on
$\unicode[STIX]{x2202}V$
, then extending to a solution on the interior of
$V$
. We need
$\overline{\unicode[STIX]{x1D712}}$
to satisfy
$\unicode[STIX]{x1D735}_{h}\overline{\unicode[STIX]{x1D712}}=\boldsymbol{A}_{ph}-\boldsymbol{A}_{h}$
, so take the divergence and solve the resulting two-dimensional Poisson equation
on
$\unicode[STIX]{x2202}V$
. As in § 4.2, a solution exists because the compatibility condition is satisfied. Since the Neumann boundary condition
$\hat{\boldsymbol{n}}\boldsymbol{\cdot }\unicode[STIX]{x1D735}\overline{\unicode[STIX]{x1D712}}=\hat{\boldsymbol{n}}\boldsymbol{\cdot }(\boldsymbol{A}_{p}-\boldsymbol{A})$
is fixed on the edges of each face, it is possible to solve (4.2) separately on each face. This means that a fast-Poisson solver can readily be used, unlike in § 4.2. This gives
$\overline{\unicode[STIX]{x1D712}}$
on each face
$S_{i}$
up to a constant
$\overline{\unicode[STIX]{x1D712}}_{i}$
, for
$i=1,\ldots ,6$
. One of these constants may be chosen arbitrarily, and the other five are then easily determined by imposing continuity of
$\overline{\unicode[STIX]{x1D712}}$
at each edge. (Although there are 12 edges, the corresponding jumps in
$\overline{\unicode[STIX]{x1D712}}$
are not independent, so the problem is well posed.)
Once the continuous solution for
$\overline{\unicode[STIX]{x1D712}}$
is obtained, this may be extended to
$\unicode[STIX]{x1D712}$
in the interior of
$V$
in the same way as § 4.2, namely solving the three-dimensional Laplace equation
$\unicode[STIX]{x1D6FB}^{2}\unicode[STIX]{x1D712}=0$
in
$V$
with Dirichlet boundary conditions
$\unicode[STIX]{x1D712}=\overline{\unicode[STIX]{x1D712}}$
on
$\unicode[STIX]{x2202}V$
. Again, this choice of interior distribution has no effect on the field-line helicity.
5 Examples
To investigate the behaviour of
${\mathcal{A}}_{R}$
, we consider two well-known solar active region models from the literature. These exhibit important magnetic structures found in MHD simulations, namely sheared magnetic arcades and magnetic flux ropes. They are chosen specifically to enable validation against the results of Valori et al. (Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016), who made a careful study of the numerical computation of
$H_{R}$
in these particular examples (among others).
Field-line structure of the Low–Lou example
$\boldsymbol{B}$
(a) and its corresponding potential reference field
$\boldsymbol{B}_{p}$
(b), for the datacube with
$\unicode[STIX]{x0394}x=2/128$
. The field lines are coloured purple–orange according to their integrated parallel current, shown in the
$z=0$
plane in (c,d). On the lower boundary, the normal field
$B_{z}(x,y,0)=B_{pz}(x,y,0)$
is shown by grey scale contours (a,b) or dashed lines (c,d).

5.1 Low–Lou equilibrium
First, we consider one of the class of nonlinear force-free equilibria derived by Low & Lou (Reference Low and Lou1990), which is given analytically except for the solution of a single ordinary differential equation. Our calculations start from a three-dimensional datacube of
$\boldsymbol{B}$
, computed by Valori et al. (Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016) and kindly shared by these authors. This corresponds to the specific solution with parameters
$n=1$
,
$l=0.3$
,
$\unicode[STIX]{x1D719}=\unicode[STIX]{x03C0}/4$
, in a Cartesian box
$V=[-1,1]\times [-1,1]\times [0,2]$
. We used four datacubes with uniform mesh spacing
$\unicode[STIX]{x0394}x=2/32$
,
$2/64$
,
$2/128$
and
$2/256$
. As described in § 4, our numerical code uses a staggered mesh, so we first interpolated the original
$\boldsymbol{B}$
components from cell vertices to the centres of the cell faces, using trilinear interpolation. We also tested tricubic interpolation here but found it unnecessary.
Figure 3 shows the magnetic field lines for this magnetic field
$\boldsymbol{B}$
(a) and for the corresponding reference potential field
$\boldsymbol{B}_{p}$
(b). The latter was computed numerically to match
$B_{n}$
on all six boundaries, using the method described in § 4.1. In figure 3, each field line
$L(\boldsymbol{x})$
is coloured by its integrated parallel current density, defined as
and normalised by
$B_{0}$
, the mean value of
$|B_{z}(x,y,0)|$
. Maps of
$J_{\Vert }/B_{0}$
for all field lines seeded from the
$z=0$
boundary are shown in (c,d). In the Low–Lou equilibrium, the electric currents are smoothly distributed within the arcade of magnetic loops surrounding the central polarity-inversion line. For
$\boldsymbol{B}_{p}$
, we have
$\unicode[STIX]{x1D735}\times \boldsymbol{B}_{p}\equiv \mathbf{0}$
and hence
$J_{\Vert }$
vanishes (to machine precision).
Next, we have computed maps of the field-line helicities
${\mathcal{A}}$
,
${\mathcal{A}}_{p}$
and the relative field-line helicity
${\mathcal{A}}_{R}:={\mathcal{A}}-{\mathcal{A}}_{p}$
using four different gauges. These include the minimal gauge
$\boldsymbol{A}_{p}^{\ast }$
, but also three others, denoted
$\boldsymbol{A}_{p}^{a}$
,
$\boldsymbol{A}_{p}^{b}$
,
$\boldsymbol{A}_{p}^{c}$
and defined as follows. All three satisfy the DeVore (Reference DeVore2000) condition that
$A_{z}=0$
. The first is integrated upward in from the lower
$z$
boundary,
and uses the Coulomb gauge form
$\boldsymbol{A}_{0}^{a}=\unicode[STIX]{x1D735}\times (\unicode[STIX]{x1D6F9}\hat{\boldsymbol{z}})$
for the boundary term, with
$\unicode[STIX]{x1D6F9}$
computed by solving the Poisson equation
$\unicode[STIX]{x1D6FB}_{h}^{2}\unicode[STIX]{x1D6F9}=-B_{z}(x,y,0)$
(we separate the monopole component and solve for the remainder using periodic boundary conditions). The second gauge is similar but integrated down from the upper
$z$
boundary, so that
and
$\boldsymbol{A}_{0}^{b}$
is now computed on
$z=2$
from
$B_{z}(x,y,2)$
. The third is an alternative DeVore gauge that still has the form
but uses the alternative boundary term
There is nothing special about these chosen gauges, other than their simplicity of computation. The latter has led to the use of
$\boldsymbol{A}_{p}^{a}$
and
$\boldsymbol{A}_{p}^{b}$
for computation of
$H_{R}$
(e.g. Valori et al.
Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016), where, of course, the choice of gauge does not affect the result, except for numerical error.
Figure 4 shows maps of
${\mathcal{A}}$
,
${\mathcal{A}}_{p}$
, and
${\mathcal{A}}_{R}$
for each of the four gauges, computed at resolution
$256\times 256$
from the datacube with resolution
$\unicode[STIX]{x0394}x=2/128$
. These maps show only the
$z=0$
boundary. For the first three gauges,
$\hat{\boldsymbol{n}}\times \boldsymbol{A}$
has been matched to
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
using the gauge-matching procedure described in § 4. For
$\boldsymbol{A}_{p}^{\ast }$
, this is not necessary as both
$\boldsymbol{A}$
and
$\boldsymbol{A}_{p}$
are independently matched to the minimal gauge using the procedure in § 4.2.
The first important observation is that all three distributions depend on the gauge choice
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
. In fact, the results from
$\boldsymbol{A}_{p}^{a}$
and especially
$\boldsymbol{A}_{p}^{b}$
are quite close to
$\boldsymbol{A}_{p}^{\ast }$
in this case. This is because, for this specific
$\boldsymbol{B}$
, the majority of
$|B_{n}|$
is located on the lower boundary, where
$\boldsymbol{A}_{0}^{a}$
and
$\boldsymbol{A}_{0}^{b}$
satisfy the solenoidal condition
$\unicode[STIX]{x1D735}_{h}\boldsymbol{\cdot }\boldsymbol{A}=0$
. The gauge
$\boldsymbol{A}_{p}^{c}$
(figure 4
g–i) lacks this property, and gives more radically different results from
$\boldsymbol{A}_{p}^{\ast }$
. Notice that
$\boldsymbol{A}_{p}^{c}$
leads to larger maximum values of
$|{\mathcal{A}}_{R}|$
, and that these are more localised than either the regions of strongest
$|{\mathcal{A}}_{R}^{\ast }|$
or of strongest
$J_{\Vert }$
(figure 3
c).
Field-line helicity on
$z=0$
for the Low–Lou example in four different gauges (top to bottom). The left and middle panels show
${\mathcal{A}}$
for the original and potential fields, respectively, while the right panel shows their difference
${\mathcal{A}}_{R}$
in each case, which is the relative field-line helicity. The definitions of the vector potentials are given in the text, but note that (j–l) show the minimal gauge
$\boldsymbol{A}^{\ast }$
. Dashed lines show contours of
$B_{z}=B_{pz}$
for context. All of the field-line helicities are normalised by the boundary flux
$\unicode[STIX]{x1D6F7}_{0}=(1/2)\int _{z=0}|B_{n}|\,\text{d}^{2}x$
.

Notice that the field-line helicity of the reference field,
${\mathcal{A}}_{p}$
, is weaker than
${\mathcal{A}}$
in both
$\boldsymbol{A}^{a}$
and
$\boldsymbol{A}^{b}$
, and even more so in
$\boldsymbol{A}^{\ast }$
. This is a good indication that these are ‘sensible’ gauge choices, since
$\boldsymbol{B}_{p}$
is the minimum-energy field and cannot have significantly twisted field lines (it can, however, still exhibit topological structure due to the non-uniform boundary conditions
$B_{pn}$
, cf. Prior & Yeates Reference Prior and Yeates2014). Similarly, although
${\mathcal{A}}^{\ast }$
is primarily located within the main current-carrying region (cf. figure 3
c), it does not completely vanish outside of this region. The boundary of this current-carrying region appears as a sharp separatrix between field lines with both ends on the lower boundary
$z=0$
and field lines with only one end on this boundary. Notice that the location of this separatrix differs between
$\boldsymbol{B}$
and
$\boldsymbol{B}_{p}$
, so that the relative field-line helicity map
${\mathcal{A}}_{R}$
inherits discontinuous jumps from both
${\mathcal{A}}$
and
${\mathcal{A}}_{p}$
.
As a validation exercise, we have verified that the all of the
${\mathcal{A}}_{R}$
in figure 4 integrate to give the same
$H_{R}$
, as they should by definition. Figure 5 shows the resulting
$H_{R}$
for each of the four gauges, as a function of the mesh spacing
$\unicode[STIX]{x0394}x$
for the four datacubes. Solid curves show volume integrals of
$(\boldsymbol{A}+\boldsymbol{A}_{p})\boldsymbol{\cdot }(\boldsymbol{B}-\boldsymbol{B}_{p})$
, using the composite trapezium rule, whereas dashed curves show estimates of
$H_{R}$
from integrating
${\mathcal{A}}_{R}$
using (3.1). For the latter computations, field lines were traced from a mesh with spacing
$\unicode[STIX]{x0394}x\times \unicode[STIX]{x0394}x$
on each of the six boundary faces, and the integral then estimated with the composite trapezium rule. It is clear from figure 5 that taking a finer mesh leads to convergence to a common value of
$H_{R}$
between the different gauges, whether computed by volume integration or from
${\mathcal{A}}_{R}$
. Moreover, this common value is consistent with the computations of Valori et al. (Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016, see their figure 7a).
Numerically estimated relative helicity
$H_{R}$
for the Low–Lou example, as a function of the numerical mesh spacing, using four different gauges as shown in the legend. In each case, solid lines/circles show direct volume-integrated
$H_{R}$
using the composite trapezium rule, while dashed lines/pluses are computed by integrating
${\mathcal{A}}_{R}|B_{n}|/2$
over all six boundary faces. The value of
$H_{R}$
is normalised by the square of the boundary flux
$\unicode[STIX]{x1D6F7}_{0}$
.

5.2 Titov–Démoulin equilibria
More realistic models of non-potential solar active regions are given by the Titov–Démoulin family of equilibria (Titov & Démoulin Reference Titov and Démoulin1999), in which the free magnetic energy is localised to a toroidal current channel contained within a surrounding potential field. We utilise datacubes of four such equilibria computed and kindly shared by Valori et al. (Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016). For details of the specific construction of these equilibria, see that paper. Here we just note that the domain is the Cartesian volume
$V=[-3.18,3.18]\times [-5.10,5.10]\times [0,4.56]$
, and that the primary difference between the four cases is the twist of magnetic field lines in the current channel. The cases are denoted
$N=0.1,0.5,1,3$
, where
$N$
is the (approximate) number of twists made by a field line along the current channel. Corresponding magnetic field-line plots are shown in figure 6(a,d,g,j). Note that the boundary conditions
$B_{n}$
and potential magnetic energy also differ between the cases. The relative free energies (ratio of non-potential to total magnetic energy) are
${\approx}0.002$
, 0.03, 0.20 and 0.15, respectively. In all computations here, we use datacubes with
$\unicode[STIX]{x0394}x=0.06$
.
The Titov–Démoulin solution for increasing (top to bottom) values of the twist parameter
$N$
, showing the magnetic field lines, field-line integrated parallel current
$J_{\Vert }/B_{0}$
and relative field-line helicity
${\mathcal{A}}_{R}^{\ast }$
in each case. The field lines are coloured by
$J_{\Vert }$
, with the same colour scale as the middle column. The colour scales are fixed; actual maxima of
$|J_{\Vert }/B_{0}|$
are 4.6, 21.2, 53.3, 199.4, and of
$|{\mathcal{A}}_{R}^{\ast }/\unicode[STIX]{x1D6F7}_{0}|$
are 0.03, 0.13, 0.31, 0.32, respectively.

Field-line helicity on
$z=0$
for the
$N=0.5$
Titov–Démoulin model in four different gauges (top to bottom). The format is the same as figure 4.

We begin our analysis with the same computation of
${\mathcal{A}}$
,
${\mathcal{A}}_{p}$
and
${\mathcal{A}}_{R}$
in four different gauges as for the Low–Lou equilibrium. These are shown in figure 7 for one of the datacubes:
$N=0.5$
. Once again, the results are clearly dependent on the gauge. However, in this case, the downward DeVore–Coulomb gauge (
$\boldsymbol{A}_{p}^{b}$
) gives very similar results to the minimal gauge (
$\boldsymbol{A}_{p}^{\ast }$
), whereas the upward DeVore–Coulomb gauge (
$\boldsymbol{A}_{p}^{a}$
) gives rather different results, along with
$\boldsymbol{A}_{p}^{c}$
. In all four cases,
${\mathcal{A}}$
agrees well with
${\mathcal{A}}_{p}$
outside of the toroidal current channel (which appears as two tear-drop shaped footpoints on this boundary). However, for
$\boldsymbol{A}_{p}^{b}$
and
$\boldsymbol{A}_{p}^{\ast }$
, the current channel has a much higher strength of
$|{\mathcal{A}}|$
than outside, whereas for
$\boldsymbol{A}_{p}^{a}$
and
$\boldsymbol{A}_{p}^{c}$
, comparable strengths of
$|{\mathcal{A}}|$
are found at locations both inside and outside the channel.
In this example, the relative field-line helicity
${\mathcal{A}}_{R}^{\ast }$
(and also
${\mathcal{A}}_{R}^{b}$
) is much more concentrated than in the Low–Lou equilibrium. This holds for all
$N$
, as shown in figure 6. It is strongest in the tear-drop shaped footpoints of the current channel, although diffuse non-zero values are found throughout the ‘closed field’ region (i.e. the region between the diagonal separatrices within which field lines have both ends on
$z=0$
and cross the central polarity-inversion line). There are also thin ridges in
${\mathcal{A}}_{R}^{\ast }$
along the separatrices; these arise because the separatrices are in slightly different locations in
$\boldsymbol{B}$
and
$\boldsymbol{B}_{p}$
. Outside of these separatrices,
${\mathcal{A}}_{R}^{\ast }$
is close to zero, reflecting the fact that these field lines are close to potential. Figure 8 shows a comparison of field lines of
$\boldsymbol{B}$
and
$\boldsymbol{B}_{p}$
for two of the datacubes, showing this effect.
Field lines of
$\boldsymbol{B}$
(purple) and
$\boldsymbol{B}_{p}$
(green), traced from the same starting points in
$y>0$
(to left in this view), for the Titov–Démoulin examples with (a)
$N=0.1$
and (b)
$N=1$
.

If we compare the maximum magnitude of
$|{\mathcal{A}}_{R}^{\ast }|$
as
$N$
is increased (figure 6), we see that the maximum
$|{\mathcal{A}}_{R}^{\ast }|$
(relative to
$\unicode[STIX]{x1D6F7}_{0}$
) increases from
$N=0.1$
to 0.5 and again from
$N=0.5$
to 1, but is comparable between
$N=1$
and 3, despite the fact that the maximum
$J_{\Vert }/B_{0}$
increases by a factor 4. This reflects the fact that
${\mathcal{A}}_{R}^{\ast }$
is a global topological measure that does not solely measure the local twist (or ‘self-helicity’) of magnetic field lines. However, it does highlight that
$|{\mathcal{A}}_{R}^{\ast }|$
will likely not relate directly to the stability of a given configuration, since the
$N=3$
case is expected to be kink unstable while the
$N=1$
(and
$N=0.1$
, 0.5) is expected to be stable (Valori et al.
Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016). The similar peak values of
$|{\mathcal{A}}_{R}^{\ast }|$
located in a smaller footprint for
$N=3$
(as seen in figure 6
k) is consistent with this case having a lower
$|H_{R}|$
than
$N=1$
, as found by Valori et al. (Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016).
Finally, we repeat the validation exercise of computing
$H_{R}$
, as for the Low–Lou model. Figure 9(a) shows the results in the same format as figure 5, except that the horizontal axis now labels the cases with different
$N$
(measured by the end-to-end twist, to facilitate comparison with figure 3a of Valori et al.
Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016). As for the Low–Lou example, we find consistent results when
$H_{R}$
is computed by volume integration. When computed from
${\mathcal{A}}_{R}$
via (3.1), we obtain consistent values for
$H_{R}$
for
$N=0.1$
, 0.5 and 3, but
$|H_{R}|$
is underestimated by up to 5 % for
$N=1$
, depending on the gauge. Further investigation shows that this is not due to the mesh resolution (of either the datacube or the mesh for computing
${\mathcal{A}}_{R}$
on the boundary), but is caused by the fact that the initial data do not perfectly satisfy the solenoidal condition on our staggered mesh. To show this, figure 9(b) shows the same computations of
$H_{R}$
when we include an additional correction to
$\boldsymbol{B}$
after computing the (initial)
$\boldsymbol{A}$
on the staggered mesh. This correction recomputes
$\boldsymbol{B}$
from the numerical curl of
$\boldsymbol{A}$
, so that the solenoidal condition is satisfied to machine precision, but at the expense of changing
$\boldsymbol{B}$
. With this correction, figure 9(b) shows that the estimate of
$H_{R}$
from
${\mathcal{A}}_{R}$
then agrees with the volume integral, in all four gauges. Notice however that
$|H_{R}|$
is then overestimated in
$\boldsymbol{A}^{b}$
, compared with the other gauges. This arises because the solenoidal correction has a greater effect on the current-carrying region in the downward DeVore gauge, since this region is located at lower
$z$
. Thus this affects the estimated helicity more. This illustrates the importance of the solenoidal condition in estimating helicity (Valori et al.
Reference Valori, Pariat, Anfinogentov, Chen, Georgoulis, Guo, Liu, Moraitis, Thalmann and Yang2016).
Numerically estimated relative helicity
$H_{R}$
for the Titov–Démoulin example, as a function of the end-to-end twist (in radians). As in figure 5, colours denote different gauges, and solid lines/circles show direct volume integrated
$H_{R}$
using the composite trapezium rule, while dashed lines/pluses are computed by integrating
${\mathcal{A}}_{R}|B_{n}|/2$
${\mathcal{A}}_{R}$
over all six boundary faces. In (b), an additional divergence-correction step is applied, as described in the text.

6 Conclusion
We have shown that it is possible to decompose the relative magnetic helicity
$H_{R}$
into a (flux-weighted) integral (3.1) over a quantity
${\mathcal{A}}_{R}$
called the relative field-line helicity. This quantity
${\mathcal{A}}_{R}(\boldsymbol{x})$
is itself an ideal-MHD invariant for each magnetic field line
$L(\boldsymbol{x})$
. Moreover,
${\mathcal{A}}_{R}(\boldsymbol{x})=0$
whenever
$\boldsymbol{B}=\boldsymbol{B}_{p}$
all along the field line
$L(\boldsymbol{x})$
. We propose that
${\mathcal{A}}_{R}$
is a useful measure to identify locations of significant topological structure within a wider magnetic field. Though
$H_{R}$
is gauge independent, our suggested definition of
${\mathcal{A}}_{R}$
requires computation of a vector potential satisfying certain conditions, as summarised in § 3.5. Both the vector potential and
${\mathcal{A}}_{R}$
are straightforward to compute in a Cartesian domain, and we have provided free numerical code for doing so.
The principle difficulty faced in this endeavour has been the fact that
${\mathcal{A}}_{R}$
is not uniquely defined by the requirements of (i) ideal invariance for every field line and (ii) vanishing when
$\boldsymbol{B}=\boldsymbol{B}_{p}$
all along a field line. Rather,
${\mathcal{A}}_{R}$
still depends on the gauge of the reference vector potential
$\boldsymbol{A}_{p}$
. Physically, we showed that this gauge dependence arises from a fundamental choice of how to define a corresponding surface for each field line. The value of
${\mathcal{A}}_{R}$
measures the ideal-invariant magnetic flux through this surface, but the definition of the surface depends on where it intersects the boundary, which in turn depends on the gauge of
$\hat{\boldsymbol{n}}\times \boldsymbol{A}_{p}$
on the boundary. The gauge dependence integrates out when integrating over all field lines to give
$H_{R}$
, but appears to be unavoidable when considering field-line helicity alone. Nevertheless, this does not mean that
${\mathcal{A}}_{R}$
is physically irrelevant or useless. Rather, it means that one must choose the gauge so that the corresponding magnetic fluxes measured by
${\mathcal{A}}_{R}$
are informative (cf. Yeates & Hornig Reference Yeates and Hornig2016).
Prior & Yeates (Reference Prior and Yeates2014) discuss the physical meaning of the original
$h(V)$
in different gauges, for the particular case of a magnetic field between two planes with
$B_{n}=0$
on the side boundaries. They show that it always measures the average pairwise winding number between two curves, but with respect to a reference frame that varies depending on the gauge. They proposed the best choice of gauge to be the so-called winding gauge,
$\boldsymbol{A}^{W}$
, in which
$h(V)$
measures the average winding number with respect to an untwisted Cartesian reference frame (corresponding to physical space). Here, we allow for more general magnetic fields which may enter or leave the side boundaries of the domain, so the winding gauge of Prior & Yeates (Reference Prior and Yeates2014) does not apply. Instead, we have proposed to use a ‘minimal gauge’
$\boldsymbol{A}^{\ast }$
, also chosen by Hornig (Reference Hornig2006). As discussed in § 4.2, such a gauge gives the simplest possible boundary distribution of
$\boldsymbol{A}$
, in a particular mathematical sense. It behaves sensibly in the examples in § 5 where it clearly peaks within the main current-carrying regions. When we consider the geometry of Prior & Yeates (Reference Prior and Yeates2014),
$\boldsymbol{A}^{\ast }$
does not precisely reduce to the winding gauge
$\boldsymbol{A}^{W}$
, since
$\boldsymbol{A}^{W}$
does not always satisfy condition (3.10). But preliminary computations suggest the two to be rather similar except on the side boundaries of the domain. This requires further investigation.
Finally, we have made some simplifying assumptions on the magnetic fields considered. Firstly, we have assumed that all magnetic field lines have finite length. The work of Arnold (Reference Arnold1986) suggests that the field-line helicity could be extended to an asymptotic form for ergodic field lines, although the concept of field-line helicity would be useful only if a single ergodic field line does not fill the whole volume. Secondly, we have assumed a domain with simple topology. The theory could also be extended to toroidal or spherical shell volumes, but in these cases additional restrictions would be needed on
$\boldsymbol{A}$
so as to define
${\mathcal{A}}$
and
${\mathcal{A}}_{p}$
uniquely. In fact, Yeates & Hornig (Reference Yeates and Hornig2016) have already considered the evolution of field-line helicity
${\mathcal{A}}$
in a spherical shell representing the global solar corona, using a specific DeVore–Coulomb gauge in spherical coordinates. Having established that this gauge was suited to the identification of magnetic flux ropes in the low corona, Lowder & Yeates (Reference Lowder and Yeates2017) went on to use this as a tool to identify magnetic flux ropes in non-potential simulations of the global solar corona over a full solar cycle. However, no attempt was made to optimise the gauge choice in the manner of § 4.2. This should also be addressed in future.
Acknowledgements
A.R.Y. was supported by STFC consortium grant ST/N000781/1 and Leverhulme Trust grant RPG-2017-169. M.H.P. thanks BP for a summer studentship. The authors are indebted to G. Valori and E. Pariat for sharing the numerical data, made possible through the ISSI International Team on Magnetic helicity estimations in models and observations of the solar magnetic field. We thank C. Prior for suggesting improvements to an earlier draft, and the anonymous referees for further improving the paper.
Appendix A. Proof of minimal property
Here we prove that a vector potential satisfying (3.10) on a closed boundary
$\unicode[STIX]{x2202}V$
minimises
$\oint _{\unicode[STIX]{x2202}V}|\hat{\boldsymbol{n}}\times \boldsymbol{A}|^{2}\,\text{d}^{2}x$
among all possible vector potentials.
To do this, suppose that
$\boldsymbol{A}^{\ast }$
satisfies the required condition
$\unicode[STIX]{x1D735}_{h}\boldsymbol{\cdot }\boldsymbol{A}^{\ast }=0$
on
$\unicode[STIX]{x2202}V$
, and note that any other vector potential on
$\unicode[STIX]{x2202}V$
may be written
$\boldsymbol{A}=\boldsymbol{A}^{\ast }+\unicode[STIX]{x1D735}\unicode[STIX]{x1D719}$
for some gauge function
$\unicode[STIX]{x1D719}$
. Then
The cross-term may be rewritten as
which vanishes because
$\unicode[STIX]{x2202}V$
is a closed surface. It follows that
so that the integral is minimised if
$\unicode[STIX]{x1D735}_{h}\unicode[STIX]{x1D719}=0$
, i.e. if
$\boldsymbol{A}\equiv \boldsymbol{A}^{\ast }$
.





