1 Introduction

The volume integral

$$ \mathscr{H}(t) \equiv \int_{\mathcal{V}} (\mathbf{A}\cdot\mathbf{B} )\,{\mathrm {d}}\mathcal {V} $$

is the helicity of the vector field \(\mathbf{B}=\boldsymbol{\nabla}\times\mathbf{A}\) in a given volume \(\mathcal{V} \), with \(\mathbf{A}(\mathbf{x},t)\) representing the corresponding space- and time-dependent vector potential. If the field consists of a discrete collection of flux tubes, ℋ is the winding number (Moffatt 1969) expressing their degree of mutual linkage. By extension, Eq. (1) is a measure of the entangling (“knottedness”) of the field’s streamlines.

For a given vector potential \(\mathbf{A}\), the addition of the gradient of a (sufficiently regular but otherwise arbitrary) scalar function, i.e., the transformation \(\mathbf{A}\longrightarrow\mathbf{A}+\boldsymbol{\nabla}\psi\), does not change the resulting \(\mathbf{B}\). This property of the definition of \(\mathbf{B}\) is called gauge-invariance. Due to this freedom in the gauge, ℋ is not uniquely defined, since

$$ \mathscr{H}(\mathbf{A}+\boldsymbol{\nabla}\psi)= \mathscr{H}(\mathbf{A}) + \int_{{\partial\mathcal{V}}} ( \psi\mathbf{B} ) \cdot {\mathrm {d}}\mathbf{S}- \int_{\mathcal{V}}\psi (\boldsymbol{\nabla}\cdot\mathbf{B} ) \,{\mathrm {d}}\mathcal {V}, $$

where \({\mathrm {d}}\mathbf{S}={\mathrm {d}} S\hat{\mathbf{n}}\), with \({\mathrm {d}} S\) being the infinitesimal element of the bounding surface \({\partial\mathcal{V}}\) of the volume \(\mathcal{V}\), and \(\hat{\mathbf{n}}\) the outward-oriented normal to \({\partial\mathcal{V}}\). Hence, ℋ is not gauge-invariant unless two conditions are met: First, the vector field \(\mathbf{B}\) must be solenoidal, as implied by its definition as curl of \(\mathbf{A}\), and, second, the volume’s bounding surface \({\partial\mathcal{V}}\) must be a flux surface of \(\mathbf{B}\), i.e., \((\mathbf{B}\cdot\hat {\mathbf{n}} )|_{\partial\mathcal{V}}=0\). When applied to a magnetic field \(\mathbf{B}\), the solenoidal requirement is satisfied by virtue of Maxwell equations, although possibly only to a finite extent in numerical experiments, and \({\partial\mathcal{V}}\) is a flux surface if no magnetic field line is threading the boundary. This latter requirement is rarely satisfied in natural systems, and makes Eq. (1) of little interest for practical use.

On the other hand, helicity has the fundamental property of being strictly conserved in ideal magneto-hydrodynamics (MHD, Woltjer 1958). Since MHD evolution in the absence of dissipation preserves the topology of the magnetic field, the field lines’ winding numbers, or, more generally, magnetic helicity, cannot be changed during the evolution. Even more appealing is the fact that magnetic helicity, contrary to magnetic energy, is very well conserved in non-ideal dynamics as well (Berger 1984), as expected theoretically because it cascades to large scales rather than to the small, dissipative scales (see, e.g., Frisch et al. 1975). Thanks to these properties, helicity has the possibility of being used as a constraint for the magnetic field evolution. For isolated systems, conservation of helicity effectively restricts the allowed time-evolution to helicity-conserving paths in phase-space, which, for instance, yielded the so-called Taylor hypothesis on magnetic field relaxation (see, e.g., Taylor 1986). In the solar context, helicity conservation is involved in magnetic field dynamos (see, e.g., Brandenburg and Subramanian 2005), as well as a potential trigger of CMEs (see, e.g., Rust 1994)

1.1 Relative Magnetic Helicity

In order to overcome the limitations of Eq. (1), Berger and Field (1984) and Finn and Antonsen (1985) introduced the relative magnetic helicity

$$ \mathscr{H}_{\mathcal{V}}\equiv \int_{\mathcal{V}} (\mathbf{A}+\mathbf{A}_{\mathrm {p}} )\cdot (\mathbf{B}- \mathbf{B}_{\mathrm {p}} ) \,{\mathrm {d}}\mathcal {V}, $$

of a magnetic field \(\mathbf{B}\) with respect to a reference magnetic field \(\mathbf{B}_{\mathrm {p}}=\boldsymbol{\nabla}\times\mathbf{A}_{\mathrm {p}}\). Even though Eq. (3) allows for an arbitrary reference field, here we adopt the usual choice of the electric current-free (potential) field for \(\mathbf{B}_{\mathrm {p}}\). This choice has the following motivation: in order for \(\mathscr {H}_{\mathcal{V}}\) in Eq. (3) to be gauge invariant, the input and potential fields, \(\mathbf{B}\) and \(\mathbf{B}_{\mathrm {p}}\), respectively, must be solenoidal, and such that

$$ (\hat{\mathbf{n}}\cdot\mathbf{B})\vert _{\partial \mathcal{V}}= (\hat{\mathbf{n}}\cdot\mathbf{B}_{\mathrm {p}})\vert _{\partial\mathcal{V}}. $$

With such a prescription, the potential field that is chosen as a reference is uniquely defined and represents the minimal energy state for a given distribution of the normal component of the field on the boundaries (see, e.g., Valori et al. 2013). Moreover, \({\partial\mathcal{V}}\) needs not to be a flux surface for \(\mathscr {H}_{\mathcal{V}}\) to be gauge-invariant, and the definition Eq. (3) can be applied to arbitrary field distributions.

Berger (2003) derived a useful decomposition of Eq. (3) as

$$ \mathscr{H}_{\mathcal{V}}=\mathscr{H}_{\mathcal{V},J}+\mathscr {H}_{\mathcal{V},JP} $$


$$\begin{aligned} \mathscr{H}_{\mathcal{V},J} \equiv& \int_{\mathcal {V}} (\mathbf{A}-\mathbf{A}_{\mathrm {p}} )\cdot (\mathbf{B}- \mathbf{B}_{\mathrm {p}} ) \,{\mathrm {d}}\mathcal {V}, \end{aligned}$$
$$\begin{aligned} \mathscr{H}_{\mathcal{V},JP} \equiv& 2 \int_{\mathcal{V}}\mathbf{A}_{\mathrm {p}} \cdot (\mathbf{B}- \mathbf{B}_{\mathrm {p}} ) \,{\mathrm {d}}\mathcal {V}. \end{aligned}$$

The two definitions in Eqs. (6), (7) have the property of being separately gauge-invariant under the same assumptions guaranteeing the gauge-invariance of \(\mathscr{H}_{\mathcal{V}}\). The first term \(\mathscr{H}_{\mathcal{V},J}\) corresponds to the general definition of helicity equation (1), but this time of the current-carrying part of the field only, \((\mathbf{B}-\mathbf{B}_{\mathrm {p}})=\boldsymbol{\nabla}\times(\mathbf{A}-\mathbf{A}_{\mathrm {p}})\). By construction, such a field has no normal component on the boundary, i.e., has \({\partial\mathcal{V}}\) as a flux surface. The second term \(\mathscr{H}_{\mathcal{V},JP}\) has no intuitive interpretation, but is a sort of mutual helicity that basically takes care of the flux threading \({\partial\mathcal{V}}\) (via the transverse component of \(\mathbf{A}_{\mathrm {p}}\)), and is gauge-invariant because only the current-carrying part of \(\mathbf{B}\) appears.

The conservation properties of the relative magnetic helicity were numerically tested by Pariat et al. (2015), confirming that helicity is a very well conserved quantity even in presence of very strong dissipation. The equation regulating the relative magnetic helicity variation rate due to dissipation and flux through the boundaries is also derived by Pariat et al. (2015). In the particular case of the simulation of a jet eruption examined in that article, relative helicity is conserved more than one order of magnitude better than free energy.

In the particular case of applications to the solar atmosphere, one additional complication is that the magnetic field cannot be measured in the solar corona with the resolution necessary for the computation of magnetic helicity. The magnetic field is instead inferred by inverting spectropolarimetric measurements of emission from lower, higher-density layers of the atmosphere, yielding basically two-dimensional maps of the field vector mostly at photospheric heights, see e.g., Lites (2000). Therefore, in order to compute the helicity, it is first necessary to introduce a model of the solar corona based on the observed photospheric field values. In this work we exclude addressing this problem directly by using numerical models of magnetic fields, in this way testing the different helicity methods in a strictly controlled environment.

In summary, magnetic helicity is a fundamental quantity of plasma physics that is almost exactly conserved in most conditions. This can be relevant in fusion plasmas, as well as in astrophysical ones. In this article we focus on solar applications, but the conclusions derived are general enough to be extended to other fields.

In the following we refer to the relative magnetic helicity equation (3) computed with respect to the potential field defined by the boundary condition Eq. (4) simply as helicity, and we consider \(\mathcal{V}\) to be a single, rectangular, 3D, finite volume. More general formulations are possible, e.g., Longcope and Malanushenko (2008) introduces a procedure for defining reference fields on multiple sub-volumes, possibly covering the entire open space. We also refer to the discussion and references in Prior and Yeates (2014) for a physical interpretation of ℋ in Eq. (1) under several different gauges in the presence of open field lines threading opposite faces of \(\mathcal{V}\).

1.2 Overview of the Methods for the Estimation of Helicity

Several methods of helicity estimation are currently available. A practical categorization, according to decreasing levels of required input information, results into

  • finite volume (FV)

  • twist-number (TN)

  • helicity-flux integration (FI)

  • connectivity-based (CB)

methods. In practical applications, some assumption about the unknown coronal magnetic field need to be made, and the above groups of methods essentially differ in the nature of this assumption and in the correspondent helicity definition. A synoptic view of the available methods for the estimation of magnetic helicity in finite volumes is presented in Table 1.

Table 1 Synoptic view of helicity computation methods, their properties and formulation, as described in Sect. 1.2. The subset of methods actually tested in this paper is listed in Table 2

Finite volume (FV) methods entirely rely on external techniques, such as nonlinear force-free field extrapolations or MHD simulations, to produce numerical models of the coronal magnetic field, (see, e.g., Wiegelmann et al. 2015). The “finite volume” characterization indicates that the methods are designed to provide the helicity value in a bounded volume, typically one employed in a 3D numerical simulation, as opposed to methods that estimate the helicity in a semi-infinite domain. The helicity in a given volume at a given time can be directly computed if the magnetic field is known at each location in \(\mathcal{V}\) at that time. Therefore, FV methods are direct implementation of Eq. (3) which requires only the computation of the vector potentials for a given discretized magnetic field \(\mathbf{B}\) in \(\mathcal{V}\), see e.g., Thalmann et al. (2011), Valori et al. (2012), Yang et al. (2013b), Amari et al. (2013), Rudenko and Anfinogentov (2014), Moraitis et al. (2014). Despite the apparent straightforward task that such methods have, differences in the gauge, in the implementations, and in the sensitivity to the input discretized magnetic field may impact on the accuracy of the helicity estimation. To test the accuracy of finite volume methods is the main focus of this article, and such methods are extensively described in Sect. 2.

The field-line helicity method by Russell et al. (2015) is also using the full 3D vector magnetic field in a volume as an input to the method. Rather than producing a single number for the value of Eq. (3) in \(\mathcal{V}\), the field-line helicity method provides the value of helicity associated to a single flux tube, and follows its evolution in time. In this sense, the FL method is a powerful investigating tool for studying the distribution of helicity in numerical simulations, especially those involving reconnection processes. Given its peculiar and focussed applications, we do not discuss this method further, and refer the reader to the above-mentioned article.

Similarly to FV methods, the twist-number (TN) method (see, e.g., Guo et al. 2010) requires in input the 3D discretized magnetic field vector. The method also assumes the presence of a flux rope in the coronal volume, and proceeds by relating the twist of that structure with helicity. The level of approximation of the true helicity value that is implied by such a technique is assessed here for the first time. Application of this method to observations can be found in Guo et al. (2013).

Helicity-flux integration (FI) methods, do not make any assumption about the coronal field, but rather assume that the helicity accumulated in a given volume is the result of the helicity flux through the volume boundaries, from a given point in time onward, see, e.g., Eq. (5) in Berger and Field (1984) for negligible dissipation. Such an estimation requires the knowledge of the time evolution of magnetic and velocity fields on the bounding surface of the considered volume (see e.g., Eq. (16) in Berger 1999. The vector potential of the potential field appearing there can be derived from the field distribution on the boundaries). Under these assumptions, in the case of negligible dissipation, no information on the magnetic field inside the volume is necessary.

In practical applications, such methods follow the time evolution of the photospheric field and assume that the flux of helicity through that boundary accumulates in the coronal field, see e.g., Chae et al. (2001). Since only the flux is computed, FI methods can only estimate the variation of accumulated helicity with respect to an unknown initial state. Methods that exploit this approach appear in Nindos et al. (2003), Pariat et al. (2005), LaBonte et al. (2007), Liu and Schuck (2012), among others, but direct comparisons between them do not yet exist.

A method of computing the helicity that also uses only the distribution of magnetic field on the bottom boundary is the connectivity-based (CB) method (Georgoulis et al. 2012). The method is based on modeling the unknown connectivity of the coronal field with a collection of slender force-free flux tubes, each with different constant force-free parameter \(\alpha\equiv(\boldsymbol{\nabla}\times\mathbf{B})/\mathbf{B}\). More specifically, the CB method takes in input the photospheric observations and models the coronal field as a single (linear) or a collection of (nonlinear) flux tube(s) as an integral step of the helicity computation itself. The set of flux tubes is obtained assuming that the line connectivity is, globally, the shortest possible, mimicking the compact character of the more flare-productive active regions. In this way, the connectivity-based method requires as input only the knowledge of the magnetic field distribution at the photosphere, at each time. Different flux tubes have a different value of the force-free parameter, hence the characterization of the method as “nonlinear”, despite the simplification of neglecting the braiding between different flux tubes that is used in summing up the helicity and energy contributions of individual flux tubes. Therefore, the CB method is an approximate, nonlinear method that is meant to produce a lower-limit estimation of the true helicity associated to a flux-balanced coronal field in a very fast way. In this sense, the CB method does not share the same purpose of finite volume and helicity-flux integration methods, which, in the ideal situation, are in principle capable of obtaining the true value of helicity in a volume, at the price of requiring more information in input.

Both the TN and the CB methods are based on the representation of the magnetic field as a collection of a discrete number of finite-sized flux tubes, as opposite to a continuous three-dimensional field. We therefore categorized both methods as discrete flux-tubes (DT) methods, see Table 1.

1.3 Systematic Comparison of Methods

Section 1.2 briefly introduced the methods currently available for the estimation of \(\mathscr{H}_{\mathcal{V}}\). Many of those have been independently tested and already applied to observations. However, the accuracy, mutual consistency, and sensitivity of these methods are not sufficiently tested, while a systematic comparison of methods in both their theoretical as well as practical aspects is necessary. This work is the first one of a series of papers undertaking such a task. Beside benchmarking, the ultimate goal of this series is no less than to assess if and how can helicity be meaningfully used as a tracer of the evolution of the magnetic field in magnetized plasmas. To that purpose, we designed a collection of progressively more complex and realistic discretized test fields, starting with 3D solutions of the force-free equations, proceeding then to time-dependent MHD simulations of flux emergence, and finally to applications to real solar observations.

The present article is focussed on FV methods, whereas in Pariat et al. (2017) we mostly focus on FI methods and the comparison with the CB method. Subsequent papers are dedicated to the TN method (Guo et al. 2017), and to applications to observed solar active regions. The results of this and of subsequent articles presented in this section are the direct outcome of the International Team on magnetic helicity hosted at ISSI-Bern in the 2014–2016 period.Footnote 1 As a reference for future testing, we make available the data cube of each employed test field and the complete results of the analysis in tabular form, of which the plots presented here are a subset. That material can be found in the section Publications of the ISSI website given in the footnote.

1.4 This Article

In view of the large scope of the project outlined in Sect. 1.3, it is necessary in the first place to determine the respective limits, field of applications, and precision of each of the existing FV methods, and check if FV methods can be reliably used to benchmark other, more approximate methods.

More in detail, we wish to properly quantify the reliability of \(\mathscr{H}_{\mathcal{V}}\) estimations when the field is known in the volume \(\mathcal{V}\). Such a reliability can be tested by quantifying the sensitivity and robustness of the estimations with respect to resolution, energy and helicity properties of the input field, and sensitivity to violation of the solenoidal constraint by the discretized field.

In order to compare and benchmark existing methods against the above properties in a representative variety of relevant setting, we consider test cases that confront the methods with increasing complexity, uncertainties, and realism. We consider strongly-controlled-environment, equilibrium test-cases such as the Low and Lou (1990) and Titov and Démoulin (1999) solutions of the force-free equations. Such tests provide basic benchmarking as they differ for helicity content, resolution, and accuracy of the solenoidal property. Then, two series of snapshots from MHD numerical simulations of flux emergence resulting in stable (Leake et al. 2013) and unstable (Leake et al. 2014) configurations are considered. The flux emergence test cases are also meant to build a bridge toward FI methods studied in Pariat et al. (2017), which is more focussed in understanding how the helicity information is modified when the knowledge of the magnetic field is limited (typically to the photosphere only).

In addition to FV methods, in this article we also consider two DT methods, namely the twist-number (TN) and the connectivity-based (CB) methods. These methods were already used to obtain estimates of the magnetic helicity in several observational studies (Guo et al. 2013; Georgoulis and LaBonte 2007; Georgoulis et al. 2012; Tziotziou et al. 2012, 2013, 2014; Moraitis et al. 2014). Benchmarking DT methods together with the FV ones enables the reader to better interpret results of past and future studies applying such methods. From a different point of view, the TN method is included because it requires the same information as the other finite volume methods, i.e., the full knowledge of the magnetic field in the entire considered volume. The CB method is included because, despite requiring only the photospheric vector magnetogram, it can use any available information of the coronal connectivity. Also, similarly to FV methods, the connectivity-based method can be applied to a single time snapshot, rather than requiring a series of temporal snapshots, which is the case for the FI methods. A list of the methods tested in this article is given in Table 2.

Table 2 Summary of the methods employed in this article, their short label, their categorization according to Table 1, the section of this article where they are described, and their main bibliographic reference

The methods applied in this article are described in Sect. 2, whereas the numerical magnetic fields used as tests are discussed in Sect. 4. Section 3 summarizes the diagnostic tools used for the comparing the results. The main results of the comparison are then discussed in Sect. 5, with specific discussion of the dependence on resolution presented in Sect. 6 and of the dependence on the solenoidal property given in Sect. 7. An overview of the FV methods results is given in Sect. 8, whereas the comparative tests with DT methods are presented in Sect. 9. Finally our conclusions are summarized in Sect. 10.

2 Helicity Computation Methods

Finite volume methods require the knowledge of the magnetic field \(\mathbf{B}\) in the entire volume \(\mathcal{V}\), and differ essentially in the way in which the vector potentials are computed. The methods presented here compute vector potentials employing either the Coulomb gauge (\(\boldsymbol{\nabla}\cdot\mathbf{A}=0\)) or the DeVore gauge (\(A_{\mathrm {z}}=0\), DeVore 2000). Due to the gauge-invariant property of Eq. (3), the employed gauge should be irrelevant for the helicity value. It may have, however, consequences on the number and type of equations to be solved for that purpose. Methods using the Coulomb gauge differ in the way in which the magnetic fields and the corresponding vector potentials are split into potential and current-carrying parts. Hence, they differ to some extent in the equations that they solve. Methods applying the DeVore gauge are applications of the method in Valori et al. (2012) that differ only in the details of the numerical implementation. In the following, different FV methods are identified by the gauge they employ (DeVore or Coulomb), followed by the initial of the author of the reference article describing its implementation (e.g., Coulomb_GR labels the Coulomb method described in Rudenko and Myshyakov 2011), see Table 2.

All the FV methods considered in this article, except for the Coulomb_GR method, define the reference potential field as \(\mathbf{B}_{\mathrm {p}}=\boldsymbol{\nabla}\phi\), with \(\phi\) being the scalar potential, solution of

$$\begin{aligned} \nabla^{2} \phi =&0, \end{aligned}$$
$$\begin{aligned} (\hat{\mathbf{n}}\cdot\boldsymbol{\nabla}\phi ) \vert _{\partial\mathcal{V}} =& ( \hat{\mathbf{n}}\cdot\mathbf{B} )\vert _{\partial \mathcal{V}}, \end{aligned}$$

such that the constraint equation (4) is satisfied. Errors in solving equations (8), (9) are a first source of inaccuracy for the methods.

2.1 Methods Employing the Coulomb Gauge

Vector potentials in the Coulomb gauge satisfy

$$\begin{aligned} \nabla^{2}\mathbf{A}_{\mathrm {p}} =&0, \end{aligned}$$
$$\begin{aligned} \boldsymbol{\nabla}\cdot\mathbf{A}_{\mathrm {p}} =&0, \end{aligned}$$
$$\begin{aligned} \hat{\mathbf{n}}\cdot (\nabla\times\mathbf{A}_{\mathrm {p}} ) \vert _{\partial\mathcal{V}} =& ( \hat{\mathbf{n}}\cdot\mathbf{B} ) |_{\partial\mathcal {V}}, \end{aligned}$$

for the vector potential of the potential field, and

$$\begin{aligned} \nabla^{2} \mathbf{A} =&-\mathbf{J}, \end{aligned}$$
$$\begin{aligned} \boldsymbol{\nabla}\cdot\mathbf{A} =&0, \end{aligned}$$
$$\begin{aligned} \hat{\mathbf{n}}\cdot (\nabla\times\mathbf{A} ) \vert _{\partial\mathcal{V}} =& ( \hat{\mathbf{n}}\cdot\mathbf{B} ) |_{\partial\mathcal {V}}, \end{aligned}$$

for the vector potential of the input field, where \(\mathbf{J}=\boldsymbol{\nabla}\times \mathbf{B}\). The conditions Eqs. (12) and (15) are the translation into vector potential representation of Eq. (4). The accuracy of Coulomb methods depend on the accuracy in solving numerically the above Laplace and Poisson problems. This includes the accuracy in fulfilling numerically the gauge condition, i.e., the solenoidal property of the vector potentials \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\).

From the computational point of view, the numerical effort required to solve for the vector potentials consists, in general, in the solutions of Eqs. (10)–(12) and (13)–(15), i.e., of six 3D Poisson/Laplace problems, one for each Cartesian component of the vector potentials \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\).

2.1.1 Coulomb_JT

In order to solve Eqs. (10)–(12) and (13)–(15), appropriate additional boundary conditions for \(\mathbf{A}\) and \(\mathbf{A}_{\mathrm {p}}\) on the boundaries of the 3D-rectangular computational domain need to be specified. For this purpose, the method of Thalmann et al. (2011), decomposes \(\mathbf{A}\) into a current-carrying and a potential (current-free) part, in the form \(\mathbf{A}=\mathbf{A}_{\mathrm {c}}+\mathbf{A}_{\mathrm {p}}\). The reproduction of the input fields’ flux at the volume’s boundaries, \({\partial\mathcal{V}}\), is entirely dedicated to \(\mathbf{A}_{\mathrm {p}}\) (obeying Eqs. (10)–(12)). The electric current distribution in \(\mathcal{V}\) and on \({\partial \mathcal{V}}\), on the other hand, are delivered by \(\mathbf{A}_{\mathrm {c}}\) (Eqs. (13), (14) with \(\mathbf{A} _{\mathrm {c}}\) instead of \(\mathbf{A}\) and Eq. (15) replaced by \(\hat{\mathbf{n}} \cdot (\nabla\times\mathbf{A}_{\mathrm {c}} ) \vert _{\partial\mathcal{V}}=0\)).

In particular, the tangential components of \(\mathbf{A}_{\mathrm {p}}\) on a particular face, \(f\), of the 3D computational domain are specified to be the 2D stream function of a corresponding Laplacian field, \(\phi_{f}\), in the form \(\mathbf{A}_{{\mathrm {p}}, \mathbf{t}}=-\hat{\mathbf{n}}\times\boldsymbol{\nabla}_{t}\phi_{f}\), where \(\boldsymbol{\nabla} _{t}\) is the 2D-gradient tangential operator on the face \(f\). The Laplacian field itself is gained by substituting in Eq. (12) and seeking the solution of the derived 2D Laplace problem \(\nabla ^{2}_{t}\phi_{f}=-\hat{\mathbf{n}}\cdot\mathbf{B}\), for which boundary conditions on the four edges of each face \(f\) need to be specified. This approach of defining \(\mathbf{A}_{\mathrm {p}}\) on \({\partial\mathcal {V}}\) is in principle used by all Coulomb methods considered in the present study, but the specific way in which the 2D Laplace problems are formulated is different.

Thalmann et al. (2011) use Neumann conditions in the form \(\partial _{n}\phi_{f}=c_{f}\), where \(c_{f}\) is a constant along a particular face and \(\partial_{n}\) is the derivative in the direction normal to the edge of the face \(f\) (see their Sect. 2.1 for details). The different \(c_{f}\) are constructed in such a way that the total outflow through the volume’s bounding surface \({\partial\mathcal{V}}\) is minimized. In this way, a vanishing tangential divergence (\(\nabla_{t}\cdot\mathbf{A}_{{\mathrm {p}},\mathbf{t}}=0\)) is enforced on \({\partial\mathcal{V}}\), and following Gauss’ theorem, Eqs. (10)–(12) are approximately fulfilled.

Another difference of the applied Coulomb methods is how the current-carrying vector potential \(\mathbf{A}_{\mathrm {c}}\) is calculated and its solenoidality enforced. Thalmann et al. (2011) solves Eq. (13) for \(\mathbf{A}_{\mathrm {c}}\) numerically, similar to Yang et al. (2013a), just with differing boundary conditions. In the Coulomb_JT case, \(\nabla_{t}\cdot\mathbf{A}_{\mathrm{c}, \mathbf{t}}=0\) on \({\partial\mathcal{V}}\) is explicitly enforced in order to fulfill the Coulomb gauge for \(\mathbf{A} _{\mathrm {c}}\).

The method discussed in Thalmann et al. (2011) is implemented in C. The Poisson and Laplace problems are solved numerically using the Helmholtz solver in Cartesian coordinates of the Intel® Mathematical Kernel Library.

2.1.2 Coulomb_SY

The Coulomb_SY method is described in Yang et al. (2013a,b). In the original formulation of Yang et al. (2013a), the method requires a balanced magnetic flux through each of the side boundaries of the volume. This restriction has been further removed in Yang et al. (2013b). In order to solve Eqs. (10), (12) and (13), (15), the Coulomb_SY method additionally enforces the boundary condition \((\hat{\mathbf{n}}\cdot\mathbf{A}_{\mathrm {p}} )|_{\partial\mathcal{V}}=(\hat{\mathbf{n}}\cdot\mathbf{A})|_{\partial \mathcal{V}}=0\) at all boundaries. Then, the transverse vector potential at the boundaries and the vector potential at the edges is obtained by using Gauss’ theorem. After obtaining the boundary values, Yang et al. (2013a,b) firstly resolve the Laplace equation (10) and the Poisson equation (13) to obtain an initial guess of the solution, \(\mathbf{A}_{\mathrm {p}}'\) and \(\mathbf{A}'\). These preliminary solutions satisfies Eqs. (12) and (15), but not the Coulomb gauge condition. The Coulomb_SY method then uses a divergence-cleaning technique based on the Helmholtz vector decomposition to iteratively impose the Coulomb constraint to the vector potentials, without modifying their values at the boundaries. Comparing with the Coulomb_JT method, in Coulomb_SY are the vector potentials that are decomposed, rather than the boundary contributions. The method is implemented in Fortran; Poisson and Laplace problems are solved numerically using the Helmholtz solver in Cartesian coordinates of the IMSL® (International Mathematics and Statistics Library).

2.1.3 Coulomb_GR

The Coulomb_GR method is described in Rudenko and Myshyakov (2011). A distinctive feature of the algorithm is that the Coulomb_GR method defines the reference potential field in terms of vector potential \(\mathbf{B}_{\mathrm {p}} =\boldsymbol{\nabla}\times\mathbf{A}_{\mathrm {p}}\), rather than using Eqs. (8), (9). The corresponding boundary value problem, Eq. (10), is solved with the constraint equation (11) and the boundary condition \((\mathbf{A}_{\mathrm {p}} \cdot\hat{\mathbf{n}}) |_{\partial\mathcal{V}}=0\). The Laplace problem is divided into six sub-problems, one for each side of \(\mathcal{V}\). Such a splitting of the Laplace problem is correct only if the total magnetic flux is zero (balanced) on each side of the box independently. To satisfy this requirement, a compensation field \(\mathbf{B}_{\mathrm {p}}^{\mathrm{m}} = {\boldsymbol{\nabla}}\times\mathbf{A}_{\mathrm {p}}^{\mathrm{m}}\) is introduced. It is built as a field of 5 magnetic monopoles located outside of the box. Positions and charge of the monopoles are selected such as to compensate unbalanced flux on each side of the volume independently. The modified magnetic field \(\mathbf{B}'= \mathbf{B}- \mathbf{B}_{\mathrm {p}}^{\mathrm{m}} \) has zero total flux on each face independently and can be correctly used as a boundary condition for the sub-problems

$$ \hat{\mathbf{n}}\cdot \bigl(\boldsymbol{\nabla} \times\mathbf{A}_{\mathrm {p}}^{f_{i}} \bigr) \big\vert _{f_{j}} = \delta _{ij}\bigl(\hat{\mathbf{n}}\cdot \mathbf{B}'\bigr)\big\vert _{f_{j}}, $$

where \(\mathbf{A}_{\mathrm {p}}^{f_{i}}\) is the vector potential of sub-problem solution corresponding to the side \(f_{i}\).

After solving all sub-problems, the full solution is then obtained by summation of the solutions of the six sub-problems \(\mathbf{A}^{f_{i}}\) and the vector potential of a compensation field, \(\mathbf{A}^{\mathrm{m}}\), as

$$ \mathbf{A}_{\mathrm {p}}= \mathbf{A}_{\mathrm {p}}^{\mathrm{m}} + \sum _{i =1}^{6}\mathbf{A}_{\mathrm {p}}^{f_{i}}. $$

The field described by the first term of Eq. (17), instead, is flux balanced on each side of the box independently.

Instead of solving numerically the Poisson problem equations (13)–(15), the Coulomb_GR methods adopts a decomposition similar to the one in Coulomb_JT method, i.e., \(\mathbf{A}=\mathbf{A}_{\mathrm {c}}+\mathbf{A}_{\mathrm {p}}\), but the vector potential of the current-carrying part of the field is computed as

$$ \mathbf{A}_{\mathrm {c}}(\mathbf{r})=-\frac{1}{4\pi} \int_{\mathcal{V}}\frac {\mathbf{r}-\mathbf{r}'}{|\mathbf{r} -\mathbf{r} '|^{3}} \times ( \mathbf{B}- \mathbf{B}_{\mathrm {p}} ) \,{\mathrm {d}}\mathcal {V}. $$

In contrast to other methods, the solutions of the Laplace and Poison problems for the \(\mathbf{A}^{f_{i}}\) components are derived analytically as decompositions into a set of orthonormal basis functions. The detailed description of the strategy for solving these equations can be found in the original paper by Rudenko and Myshyakov (2011).

In the current implementation the method is relatively demanding in terms of running time. Therefore, it is applied here only to a subset of test cases.

2.2 Methods Employing the DeVore Gauge

Using DeVore gauge \(A_{\mathrm {z}}=0\) (DeVore 2000), Valori et al. (2012) derived the expression for the vector potential of the magnetic field \(\mathbf{B}\) in the finite volume \(\mathcal{V} =[x_{1},x_{2}]\times [y_{1},y_{2}]\times[z_{1},z_{2}]\) as

$$ \mathbf{A}=\mathbf{b}+\hat{\mathbf{z}}\times \int_{z}^{z_{2}}\mathbf{B}\,{\mathrm {d}} z', $$

where the integration function \(\mathbf{b}(x,y)=\mathbf{A}(z=z_{2})\) obeys to

$$ \partial_{x} b_{\mathrm {y}}-\partial_{y} b_{\mathrm {x}}=B_{\mathrm {z}}(z=z_{2}), $$

and \(b_{\mathrm {z}}=0\). The particular solution of Eq. (20) employed here is

$$\begin{aligned} b_{\mathrm {x}} =&-\frac{1}{2} \int_{y_{1}}^{y} B_{\mathrm {z}}\bigl(x,y',z=z_{2} \bigr) \,{\mathrm {d}} y', \end{aligned}$$
$$\begin{aligned} b_{\mathrm {y}} =& \frac{1}{2} \int_{x_{1}}^{x} B_{\mathrm {z}}\bigl(x',y,z=z_{2} \bigr) \,{\mathrm {d}} x', \end{aligned}$$

but see Valori et al. (2012) for alternative options. The above equations are applied in the computation of the vector potential of the potential field too by substituting \(\mathbf{B}\) with \(\mathbf{B}_{\mathrm {p}}\) everywhere in Eqs. (19)–(22). In particular, using Eqs. (21), (22) for both \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\) implies \(\mathbf{A}_{\mathrm {p}}=\mathbf{A}\) at \(z=z_{2}\), although this is not necessarily required by the method.

The DeVore gauge can be exactly imposed also in numerical applications, which is generally not the case for the Coulomb gauge. On the other hand, since \(A_{\mathrm {z}}=0\), then

$$ B_{\mathrm {x}}=-\partial_{z} A_{\mathrm {y}}= \partial_{z} \int _{z}^{z_{2}}B_{\mathrm {x}}\,{\mathrm {d}} z', $$

where Eqs. (20) and (21), (22) where used; a similar expression holds for \(B_{\mathrm {y}}\). Hence, the accuracy of DeVore method in reproducing \(B_{\mathrm {x}}\) and \(B_{\mathrm {y}}\) from \(\mathbf{A}\) of Eq. (19) depends only on how accurately the relation

$$ \partial_{z} \int_{z}^{z_{2}}= \mbox{ identity} $$

is verified numerically. On the other hand, even when Eq. (24) is obeyed to acceptable accuracy, one can easily show that, for a non-perfectly solenoidal field \(\mathbf{B}_{\mathrm{ns}}\), it is

$$ \mathbf{B}_{\mathrm{ns}}-\boldsymbol{\nabla}\times\mathbf{A}=\hat{\mathbf{z}} \int _{z}^{z_{2}} ( \boldsymbol{\nabla}\cdot \mathbf{B}_{\mathrm{ns}} ) \,{\mathrm {d}} z', $$

as derived in Eq. (B.4) of Valori et al. (2012). Hence, the accuracy in the reproduction of the \(z\)-component of the field depends on the solenoidal level of the input field (and on how accurately Eq. (20) is solved).

All DeVore-gauge methods discussed in this study employs Eqs. (8), (9) and (19)–(22), but they differ in the way integrals are defined, and in the way the solution to Eq. (8) is implemented. The computationally most demanding part of the method is the solution of the 3D scalar Laplace equation for the computation of the potential field, Eq. (8). This makes DeVore methods computationally appealing since they require very little computation time.

2.2.1 DeVore_GV

DeVore_GV is the original implementation described in Valori et al. (2012), where the requirement equation (24) is enforced by defining the \(z\)-integral operator as the numerical inverse operation of the second order central differences operator, see Sect. 4.2 in Valori et al. (2012). The Poisson problem for the determination of the scalar potential \(\phi \) in Eqs. (8), (9) is solved numerically using the Helmholtz solver in the proprietary Intel® Mathematical Kernel Library (MKL).

Following Eq. (39) in Valori et al. (2012), the DeVore gauge for the potential field can be reduced to the Coulomb gauge. We checked the effect of this gauge choice in the tests below, and found no significant difference with the standard DeVore gauge. The DeVore-Coulomb gauge for the potential field is thus no further discussed here.

2.2.2 DeVore_KM

DeVore_KM is described in Moraitis et al. (2014). This implementation has two main differences with the one of DeVore_GV. The first is in the solver of Laplace’s equation. DeVore_KM uses the routine HW3CRT that is included in the freely available FISHPACK library (Swartztrauber and Sweet 1979). A test, however, with the corresponding Intel MKL solver revealed minor differences in the solutions obtained with the two routines, and a factor of \(\leq2\) more computational time required by the FISHPACK solver. The second and most important difference with the DeVore_GV method is in the numerical calculation of integrals and derivatives in Eqs. (19)–(22). In DeVore_KM integrations are made with the modified Simpson’s rule of error estimate \(1/N^{4}\) (Press et al. 1992), with \(N\) being the number of integration points, and, in the special case \(N=2\), with the trapezoidal rule instead. In addition, differentiations are made using the appropriate (centered, forward or backward) second-order numerical derivative, without trying to numerically realize Eq. (24). Finally, Eqs. (19)–(22) in DeVore_KM are used in the same way for both the potential and the reference fields.

2.2.3 DeVore_SA

DeVore_SA follows the general scheme of the DeVore_GV method with two differences. The first one is that Eqs. (8), (9) for the potential \(\phi \) are solved in Fourier space separately for all faces of the box. In particular, the problem is divided into six sub-problems using

$$ \phi= \phi^{c} + \sum_{i=1}^{6} \phi_{i}, $$

where \(\phi^{c}\) is the 3D scalar potential of the compensation field \(\mathbf{B} ^{\mathrm{c}}=\boldsymbol{\nabla}\phi_{c}\) and \(\phi_{i}\) are 3D solutions for the potential field with the normal component given on \(i\)st side of \(\mathcal{V}\) and vanishing boundary conditions on the other sides of \(\mathcal{V}\). The individual Laplace problems for each \(\phi_{i}\) are then solved in Fourier space following the general scheme of the potential and linear force-free field extrapolation employing the fast Fourier transform by Alissandrakis (1981). For the application here, the original extrapolation algorithm is modified to take into account the imposed boundary conditions. This method of solving equations (8), (9) will be described in a dedicated forthcoming paper.

The second difference with the DeVore_GV method is that Eq. (19) is modified by introducing a new integration function \(\mathbf{c}\) that is computed using \(B_{z}\) from any level \(z_{r}\) inside the data cube. In particular, by addition and subtraction to Eq. (19), one has

$$ \mathbf{A} =\mathbf{b} +\hat{\mathbf{z}} \times \biggl( \int_{z}^{z_{2}} \mathbf{B} \,\mathrm{d}z^{\prime}+ \int_{z_{r}}^{z_{2}} \mathbf{B} \,\mathrm{d}z^{\prime}- \int_{z_{r}}^{z_{2}} \mathbf{B} \,\mathrm{d}z^{\prime}\biggr), $$

which can be re-casted as

$$ \mathbf{A} = \mathbf{c} +\hat{\mathbf{z}} \times \biggl( \int_{z}^{z_{2}} \mathbf{B} \,\mathrm{d}z^{\prime}- \int_{z_{r}}^{z_{2}} \mathbf{B} \,\mathrm{d}z^{\prime}\biggr), $$

where we have defined

$$ \mathbf{c}=\mathbf{b}+ \hat{\mathbf{z}} \times \int_{z_{r}}^{z_{2}} \mathbf{B} \,\mathrm{d}z^{\prime}. $$

Taking the \(x\)- and \(y\)-derivatives of Eq. (29), and using Eq. (20) and \(\boldsymbol{\nabla}\cdot\mathbf{B}=0\), one derives

$$ \partial_{x} c_{y} - \partial_{y} c_{x} = B_{z}(z = z_{r}). $$

The solution of Eq. (30) is then analogous to Eqs. (21), (22), where \(B_{z}(z =z_{2})\) is replaced by \(B_{z}(z=z_{r})\). Tests using the LL case of Sect. 4.1 shown that the minimal error in \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\) is obtained for \(z_{r} = (z_{2}-z_{1})/2\). The vector potential is finally computed following Eq. (28).

This scheme coincides with the original one of DeVore_GV if \(z_{r}\) is taken at the top boundary of the box, i.e., for \(\mathbf{c}(z_{r} = z2) = \mathbf{b}\).

2.3 Discrete Flux-Tubes Methods

Berger and Field (1984) and Démoulin et al. (2006) have shown that the relative magnetic helicity can be approximated as the summation of the helicity of \(M\) flux tubes:

$$ \mathscr{H}\simeq\sum_{i=1}^{M} \mathcal{T}_{i} \varPhi_{i}^{2} + \sum _{i=1}^{M} \sum_{j=1, j\neq i}^{M} \mathcal{L}_{i,j} \varPhi_{i} \varPhi_{j}, $$

where \(\mathcal{T}_{i}\) denotes the twist and writhe of magnetic flux tube \(i\) with flux \(\varPhi_{i}\), and \(\mathcal{L}_{i,j}\) is the linking number between two magnetic flux tubes \(i\) and \(j\) with fluxes \(\varPhi_{i}\) and \(\varPhi_{j}\), respectively. The first and second term on the right hand side of Eq. (31) represents the self and mutual helicity, respectively. With the approximation of discrete magnetic flux tubes, the physical quantity of the magnetic helicity is related to the topological concept of the writhe, twist and linking number of curves, and the magnetic flux associated with those curves. The formulae of computing these topological quantities for both close and open curves have been derived in Berger and Prior (2006) and Démoulin et al. (2006). For the purpose of our comparison it must be noticed that discrete flux-tubes methods do not provide the vector potentials and potential fields in the considered volumes like FV methods. Therefore, the comparison between DT methods and FV methods is necessarily restricted to the helicity values only. The twist-number method and connectivity-based method presented in this section adopt different assumptions in the helicity formulae and the magnetic field models to compute the magnetic helicity.

2.3.1 Twist-Number

The TN method is described in Guo et al. (2010, 2013). This method is aimed at computing the helicity of a highly twisted magnetic structure, such as a magnetic flux rope. A magnetic flux rope is considered as an isolated, single flux tube such that only the self magnetic helicity is computed. The helicity contributed by the writhe is also omitted assuming that the flux rope is not highly kinked. With these two assumptions, the magnetic helicity of a single highly twisted structure is simplified as

$$ \mathscr{H}_{\mathrm{twist}}\simeq\mathcal{T} \varPhi^{2}, $$

where \(\mathcal{T}\) is the twist number of the considered magnetic flux rope with flux \(\varPhi\). In order to estimate \(\mathcal{T}\), the formula derived in Berger and Prior (2006) to compute the twist number of a sample curve referred to an axis is employed. Practically, the axis can be determined by the symmetry of a magnetic configuration or by other assumptions, such as requiring it to be horizontal and to follow the polarity inversion line (Guo et al. 2010). The boundary of the flux rope is determined by the quasi-separatrix layer (QSL) that is found to wrap the flux rope (Guo et al. 2013). Then the twist density, \({\mathrm {d}}\mathcal{T}/{\mathrm {d}} s\), at an arc length \(s\) is:

$$ \frac{{\mathrm {d}}\mathcal{T}}{{\mathrm {d}} s} = \frac{1}{2 \pi} \mathbf{T} \cdot \mathbf{V} \times \frac{{\mathrm {d}}\mathbf{V}}{{\mathrm {d}} s}. $$

Two unit vectors are used in Eq. (33): \(\mathbf{T}(s)\), that is tangent to the axis curve, and \(\mathbf{V}(s)\), that is normal to \(\mathbf{T}\) and pointing from the axis curve to the sample curve. By integrating the equation along the axis curve the total twist number is derived. Equation (33) is suitable for smooth curves in arbitrary geometries without self intersection. Since it makes no assumption about the magnetic field, it can be applied to both force-free and non-force-free magnetic field models.

2.3.2 Connectivity-Based

The CB method was introduced by Georgoulis et al. (2012) and was used by a number of studies thereafter. In principle, the method requires only the full (vector magnetic field) photospheric boundary condition to self-consistently estimate a lower limit of the free energy and the corresponding relative helicity.

A key element of the method is the discretization of a given, continuous photospheric flux distribution into a set of partitions with known spatial extent and flux content. Each partition is then treated as the collective footprint of one or more flux tubes. To map the relative locations of these footprints, one either infers or calculates the coronal magnetic connectivity that distributes the partitioned magnetic flux into opposite-polarity connections, treated thereafter as discrete magnetic flux tubes. The flux content of these connections, with both ends within the photospheric field of view (FOV), constitutes the magnetic connectivity matrix corresponding to the given photospheric boundary condition.

The unknown coronal connectivity is either inferred by any explicit solution of the volume magnetic field or calculated with respect to the existing photospheric boundary condition. In the first case, individual field-line tracing associates connected flux with photospheric partitions, providing the magnetic connectivity matrix upon summation of individual field-line contributions. Obviously, only magnetic field lines entirely embedded in the finite volume are taken into account. In the second case, a simulated-annealing method is used to absolutely and simultaneously minimize the flux imbalance (hence achieving connections between opposite-polarity partitions) and the (photospheric) connection length. This criterion is designed to emphasize photospheric magnetic polarity inversion lines by assigning higher priority to connections alongside them. The converged simulated-annealing solution, that provides the connectivity matrix, is unique for a given photospheric partition map. More information and examples are provided in Georgoulis et al. (2012) and Tziotziou et al. (2012, 2013).

The connectivity matrix in a collection of partitions of both polarities will reveal a number of \(M\) discrete, assumed slender, flux tubes with flux contents \(\varPhi_{i}\); \(i \equiv\{ 1, \ldots, M \}\). The respective force-free parameters \(\alpha_{i}\) are assumed constant for a given flux tube but vary between different tubes, thus implementing the nonlinear force-free (NLFF) field approximation. Force-free parameters for each flux tube are the mean values of the force-free parameters of the tubes’ respective footprints, each calculated by the relation \(\alpha_{i}={{4 \pi} \over {c}} {{I_{i}} \over {\mathcal{F}_{i}}}\); \(i \equiv\{ 1, \ldots, M' \}\) for \(M'\) magnetic partitions, where \(I_{i}\) is the total electric current of the \(i\)-partition and \(\mathcal{F}_{i}\) its flux content. The total current is calculated by applying the integral form of Ampére’s law along the outlining contour of the partition.

Knowing \(\mathcal{F}_{i}\), \(\alpha_{i}\), and the relative positions of each flux tube’s footpoints, Georgoulis et al. (2012) showed that a lower limit of the free magnetic energy for a collection of \(M\) flux tubes is

$$ E_{c_{CB}} \equiv E_{c_{(CB; \mathit{self})}} + E_{c_{(CB; \mathit{mutual})}} = A \lambda^{2} \sum_{i=1}^{M} \alpha_{i}^{2} \varPhi_{i}^{2 \delta} + {{1} \over {8 \pi}} \sum_{l=1}^{M} \sum _{m=1; l \ne m}^{M} \alpha_{l} \mathcal{L}_{lm} \varPhi_{l} \varPhi_{m}, $$

where \(A\), \(\delta\) are known fitting constants, \(\lambda\) is the length element (the pixel size in observed photospheric magnetograms), and \(\mathcal{L}_{lm}\) is the mutual-helicity parameter for a pair \((l, m)\) of flux tubes. This parameter is inferred geometrically, by means of trigonometric interior angles for the relative positions of the two pairs of flux-tube footpoints. The locations of point-like footpoints of the slender flux tubes coincide with the flux-weighted centroids of the respective flux partitions. As included in Eq. (34), the parameter \(\mathcal{L}_{lm}\) does not include braiding between the two flux tubes, that can be found only by the explicit knowledge of the coronal connectivity. Additional complexity via braiding will only add to the free energy \(E_{c_{CB}}\) in Eq. (34). Therefore, the above \(E_{c_{CB}}\) is already a lower limit of the actual \(E_{c}\), assuming only “arch-like” (i.e., one above or below the other) flux tubes that do not intertwine around each other. In addition, Eq. (34) does not include an unknown free-energy term that is due to the generation, caused by induction, of potential flux tubes around the collection of non-potential ones (Démoulin et al. 2006). Such a term would again contribute to the mutual term of the free energy.

The corresponding self-consistent relative helicity is, then,

$$ H_{m_{CB}} \equiv H_{m_{(CB; \mathit{self})}} + H_{m_{(CB; \mathit{mutual})}} = 8 \pi A \lambda^{2} \sum_{i=1}^{M} \alpha_{i} \varPhi_{i}^{2 \delta} + \sum _{l=1}^{M} \sum_{m=1; l \ne m}^{M} \mathcal{L}_{lm} \varPhi_{l} \varPhi_{m}. $$

From Eqs. (34), (35) we identically have \(E_{c_{CB}} \equiv0\) for potential flux tubes (\(\alpha_{i} =0\); \(i \equiv\{ 1,\ldots,M \}\)). For \(H_{m_{CB}}=0\) in this case, we further require \(\sum_{l=1}^{M_{p}} \sum_{m=1; l \ne m}^{M_{p}} \mathcal{L}_{lm_{P}} \varPhi _{l} \varPhi_{m} =0\), where \(\mathcal{L}_{lm_{P}} \ne\mathcal{L}_{lm}\) is the mutual-helicity factor for a collection of \(M_{p} \ne M\) collection of potential flux tubes. As Démoulin et al. (2006) discuss, this can be the case for a flux-balanced potential-field boundary condition. In practical situations of not-precisely flux-balanced magnetic configurations, however, one may approximate \(H_{m_{CB; \mathit{mutual}}} =0\), in case all \(\alpha_{i}\); \(i \equiv\{ 1,\ldots,M \}\) are zero within uncertainties \(\delta\alpha_{i}\), which are fully defined in this analysis. More generally, one may use the “energy-helicity diagram” correlation of Tziotziou et al. (2012, 2014) to infer \(| H_{m_{CB}}| \propto E_{c_{CB}}^{0.84 \pm0.05}\) for \(E_{c_{CB}} \longrightarrow0\).

3 Analysis Metrics

Apart from extremely simplistic magnetic fields, the analytical computation of the relative magnetic helicity in a non-magnetically bounded system is highly non-trivial. Even with simple natural-world-relevant models relative magnetic helicity cannot be analytically estimated. Similarly, the exact value of \(H_{\mathcal{V}}\) in the finite volume of the 3D discretized magnetic fields used here as tests is, in general, not known. Hence, we need to provide indirect accuracy metrics to judge the examined methods.

The main goal of the analysis presented below is to compare the helicity values that are obtained employing the potential field and vector potentials computed with the methods described in Sects. 2.1 and 2.2. Since the helicity of \(\mathbf{B}\) defined by Eq. (3) involves the corresponding potential field \(\mathbf{B}_{\mathrm {p}}\), as well as the vector potentials for \(\mathbf{B}_{\mathrm {p}}\) and \(\mathbf{B}\), this basically implies providing a quantitative estimation of the accuracy of such fields. To that purpose, we introduce normalized quantities and metrics as follows:

For each discretized magnetic field, we define \(H_{\mathcal{V}}\) as the helicity defined in Eq. (3) normalized to \(\varPhi^{2}\),

$$ H_{\mathcal{V}}\equiv\mathscr{H}_{\mathcal{V}}/ \varPhi^{2}, $$


$$ \varPhi(\mathbf{B})=\frac{1}{2} \int_{\mathrm{z}=0} \bigl| B_{\mathrm {z}}\bigl(x',y',z=0 \bigr) \bigr|\,{\mathrm {d}} x\,{\mathrm {d}} y $$

is half of the unsigned flux through the bottom boundary, corresponding to the injected flux for an exactly flux-balanced configuration. In that normalization, a uniformly twisted flux rope with field lines having \(N\) turns has an helicity equal to \(N\) (see e.g., Démoulin and Pariat 2009). In computing the helicity values with different methods we refrain from using simplifications of Eq. (3) coming from the specific gauge in use, in this way keeping the comparison as general as possible. Hence, for each FV method and for each test case, the value of \(H_{\mathcal{V}} \) as defined by Eq. (36) is obtained by computing separately the four volume contributions of Eq. (3) and normalizing them to \(\varPhi^{2}\). We reserve the calligraphic symbol ℋ for non-normalized helicities.

The numerically obtained \(H_{\mathcal{V}}\) values depend in principle on many factors. In the first place, different methods may have a different level of accuracy in computing the vector potentials of the test and potential fields, depending on the strategy applied to solve the relevant equations, see Sect. 2. Second, the reference potential field is uniquely defined by the requirement that \(H_{\mathcal{V}}\) is gauge invariant, yielding to Eq. (4). However, without violating that requirement, the potential field can equivalently be computed both as the curl of the vector potential, as in some methods of Sect. 2.1, or as the gradient of the scalar potential. Numerically, the derived potential fields may not be identical for different methods. Finally, since helicity estimation methods are developed for application to research-relevant dataset, all employed tests are defined on discretized grids of moderate- to high-resolution, and therefore violate the solenoidal property to some extent (cf. Valori et al. 2013). Different methods might be affected differently by small violations of the solenoidal property of the test field. Substantial violations of the solenoidal property are not considered here since the very definition of \(H_{\mathcal{V}}\) is devoid of meaning in that case.

We report in Tables 810 the complete listing of all employed metrics for all FV methods and test cases considered in this study. On the other hand, in the next sections we provide concise summaries of the tables’ values for subsets of test cases and/or methods. To this purpose, we compute the mean of the relevant \(H_{\mathcal{V}}\) values, and a relative spread around it, defined as the standard deviation of the \(H_{\mathcal{V}}\) values distribution over the mean. In addition, in order to discern among different factors influencing \(H_{\mathcal{V}}\) values, several diagnostic metrics are here introduced.

3.1 Accuracy of Vector Potentials

The vector potentials required in the helicity computation of Eq. (36) must reproduce the correspondent magnetic fields as accurately as possible. In order to compare two vector fields \(\mathbf{X}\) and \(\mathbf{Y}\) in \(\mathcal{V}\) we employ the metrics

$$\begin{aligned} \epsilon_{\mathrm {N}} =&1-\frac{\sum_{i}|\mathbf{X}_{i}-\mathbf{Y}_{i}|}{\sum_{i}|\mathbf{X}_{i}|}, \end{aligned}$$
$$\begin{aligned} \epsilon_{\mathrm {E}} =&\frac{\sum_{i}|\mathbf{Y}_{i}|^{2}}{\sum_{i}|\mathbf{X}_{i}|^{2}}, \end{aligned}$$

which are, respectively, the complement of the normalized vector error and the energy ratio, introduced by Schrijver et al. (2006).Footnote 2 Both are unity if \(\mathbf{X}_{i}=\mathbf{Y}_{i}\) in all grid points \(i\) in \(\mathcal{V}\). The metrics are applied to the pair \((\mathbf{X}=\mathbf{B}_{\mathrm {p}},\mathbf{Y}=\boldsymbol{\nabla}\times\mathbf{A}_{\mathrm {p}})\) or \((\mathbf{X} =\mathbf{B},\mathbf{Y}=\boldsymbol{\nabla}\times\mathbf{A})\), to quantitatively assess the accuracy of a vector potential in reproducing the corresponding magnetic field. Additional metrics defined in Schrijver et al. (2006) are either not particularly sensitive, or not providing essential additional information in the cases examined below. For the interested reader, they are listed in Appendix B.

For the metrics defined here, as well as for the integral in Eq. (36), we use standard numerical prescriptions, as those in Appendix A of Valori et al. (2013). In particular, we compute the curl and divergence operators using a second-order, central-difference discretization scheme for points in the interior of \(\mathcal{V}\). Values on the volume-bounding surface, \({\partial\mathcal{V}}\), are taken from the input magnetic fields.

3.2 Quantification of the Solenoidal Property

The test cases used in this article must have a value of \(\boldsymbol{\nabla}\cdot\mathbf{B}\) small enough to be considered numerically solenoidal. In order to quantify the level of solenoidality, we apply here the decomposition of the energy of the magnetic field in \(\mathcal{V}\) into solenoidal and nonsolenoidal contributions, as in Valori et al. (2013). Using that decomposition, a fraction \(E_{\mathrm{div}}\) of the total magnetic energy can be associated to the nonsolenoidal component of the field. In this article, all energy contributions are normalized to the total energy, \(E\), of the test case in exam. More details on the decomposition can be found in Appendix A.

For reference, we occasionally include the divergence metric proposed in Wheatland et al. (2000) and often used in the literature to test the solenoidal property of discretized fields, defined as the average over all \(n\) grid nodes, \(\langle|f_{i}(\mathbf{B})|\rangle =(\sum_{i} |f_{i}|)/n\), of the fractional flux,

$$ f_{i}(\mathbf{B})=\frac{\int_{v} \boldsymbol{\nabla}\cdot\mathbf{B}_{i} \,\mathrm{d}v}{\int _{\partial v} |\mathbf{B}_{i}| \,\mathrm{d}S} \simeq \frac{\boldsymbol{\nabla}\cdot\mathbf{B}_{i}}{6|\mathbf{B}|_{i} /\Delta}, $$

through the surface \(\partial v\) of an elementary volume \(v\) including the node \(i\). The rightmost expression in Eq. (40) holds for a grid of uniform and homogeneous resolution \(\Delta\). Therefore, it may be appropriately used as a metric for the methods analyzed in this study, since they all are based on uniform Cartesian grids. The smaller the value of \(\langle|f_{i}|\rangle\), the more solenoidal the field. However, the actual value of this metric depends on the number of grid points \(n\) and the resolution \(\Delta\), therefore it makes most sense to apply it to identical discretized volumes. In addition, this metric is used when the energy one is not applicable, for instance, when checking the solenoidal property of vector potentials in Coulomb gauge methods, \(\langle|f_{i}(\mathbf{A})|\rangle\), as in Sect. 7.

4 Test Fields

In order to be able to critically test the different helicity computation methods of Sect. 2, the test fields used in this study are chosen such that they represent challenging tests, at the same time including aspects of relevance for solar physics. From the point of view of the fields’ structure, we include both compact structures with concentrated currents as in Fig. 1b and c, as well as more extended structures with currents threading also the lateral and top boundaries, as in Fig. 1a and d. Similarly, we consider both static (Fig. 1a and b) and time evolving (Fig. 1c and d) fields, representing typical magneto-static and magneto-hydrodynamic applications. In the following, the most relevant properties of the test fields used in this study are discussed in some detail. In particular, the solenoidal properties of the discretized magnetic fields are quantified using the method described in Sect. 3.1. The results of the analysis of the input fields is given in full in Table 7, and a selection thereof is graphically presented in the following sections. In particular, Table 7 also reports the fractional flux defined in Eq. (40) for all test fields considered here.

Fig. 1
figure 1

Representative field lines of the four employed test cases: (a) low and Lou (LL) force-free equilibrium, see Sect. 4.1; (b) Titov and Démoulin (TD) force-free equilibrium for \(N=1\) and \(\Delta=0.06\), see Sect. 4.2; (c) snapshot at \(t=155\) of the stable MHD simulation (MHD-st), and (d) snapshot at \(t=140\) of the unstable MHD simulation (MHD-un), see Sect. 4.3. Yellow field lines depict the flux rope, red field lines belong to the ambient magnetic field, except for the LL case where no flux rope is present and the field lines’ color scheme does not apply. A cyan semi-transparent iso-contour of the current density is shown at 15 %, 35 %, 11 %, and 10 % of its maximum in the four cases (a) to (d), respectively

4.1 Low and Lou

The Low and Lou model (Low and Lou 1990; Wiegelmann and Neukirch 2006, hereafter LL) is a 2.5D solution of the zero-\(\beta\) Grad-Shafranov equation, analytical except for the numerical solution of an ordinary differential equation. In particular, the four LL cases considered here are different discretizations of the same solution (corresponding to \(n=1\), \(l=0.3\), \(\phi=\pi/4\) in the notation of Low and Lou 1990), in the same \(\mathcal{V}=[-1,1]\times[-1,1]\times[0,2]\) volume. From this solution, four test cases are constructed where the above volume is discretized using 32, 64, 128, and 256 nodes per side. Since the solution of the ordinary differential equation that defines the LL field is always the same in the four cases, the only factor changing among the different LL cases is the resolution. As a test for helicity methods, LL represents a large-scale, force-free field with large-scale smooth currents distributed in the entire volume. This latter aspect is not supported by observations of solar active regions. However, being almost analytic, the LL equilibrium offers a tightly controlled test case. Here, this test field is used mostly in Sect. 6.2 for exploring the dependence of the finite volume methods on spatial resolution.

Figure 2a shows that for the LL test cases, while \(E_{\mathrm{free}} \simeq 26~\%\) and hardly changes with resolution, the solenoidal error of the input field varies from 0.1 % to 4 % as pixels become coarser (see also Table 7). Hence, the value of \(H_{\mathcal{V}}\) for the LL cases computed by the different methods will be affected simultaneously by the combined effects of resolution in the computation of the vector potentials on one hand, and by the different degree of violation of the solenoidal property by the test field on the other.

Fig. 2
figure 2

Normalized free (blue connected triangles) and nonsolenoidal (green connected crosses) energies for the test cases (a) LL; (b) TD as a function of twist; (c) TD as a function of resolution; (d) MHD-st; (e) MHD-un (f) divergence test MHD-st-div(\(\mathbf{B}\)), as a function of \(\delta\), see Sect. 7

4.2 Titov and Démoulin

The Titov and Démoulin model (Titov and Démoulin 1999, hereafter TD) is a parametric solution of the 3D force-free equations constituted by a current ring embedded in a confining potential field. By considering the portion of the ring above a given (photospheric) plane, the TD equilibrium is possibly the simplest 3D model of a bipolar active region with localized direct currents, see Fig. 1b. Differently from the LL case, the current is tethering only the bottom boundary, while the field is potential on the lateral and top boundaries of the volume considered here.

The TD model has significant topological complexity, in the sense that, for different values of its defining parameters, can exhibit a finite twist of \(N\) end-to-end turns, bald patches, and an hyperbolic flux tube (Titov et al. 2002). In this article we consider six realizations of that solution, in different combinations of twist and spatial resolution. Unless differently stated, in the following we refer to twist of the TD cases as the average twist over the current ring’s cross section at the flux rope apex, as computed, e.g., in Sect. 4 of Valori et al. (2010).

Since the equations in Titov and Démoulin (1999) are given in implicit form, the twist of each equilibria is obtained by trial and error. In all six TD cases considered here, the discretized volume is \([-3.18, 3.18]\times[-5.10, 5.10]\times[0.00, 4.56]\), the distance between the charges and the current ring center is \(L=0.83\), the depth of the current ring center is \(d=0.83\), and the ring’s radius is \(R=1.83\). We refer to Valori et al. (2010) for definitions and normalizations of the TD parameters, where the Low_HFT case has the same parameters as the \(N=1\) case here. Based on previous tests (see e.g., Török et al. 2004; Kliem and Török 2006), all cases presented here are stable equilibria, except for the \(N=3\) one, which is almost certainly kink-unstable.

TD-Twist Test Cases

We consider equilibria defined by parameters given in Table 3 resulting into flux ropes with different average twist. The resolution (uniform pixel size) is \(\Delta=0.06\) for all four cases, i.e., given by a grid of \(107\times171\times79\) nodes. The energy decomposition of the TD twist cases are shown in Fig. 2b. The solenoidal errors vary between 0.1 % and 2 %, monotonically increasing with twist except for the \(N=3\) case, which corresponds to a much thinner flux tube that satisfies the local cylindrical approximation better. Their contribution in relative energy is always one order of magnitude smaller than the free energy. The only exception is the \(N\simeq0.05\) case where the twist is lower and the field is almost potential (\(E_{\mathrm{free}}\simeq0.1~\%\)). In this case solenoidal errors are slightly larger than the free energy, but anyway extremely small (\(E_{\mathrm{div}}=0.2~\%\)).

Table 3 Parameters of the TD twist test cases, with resolution \(\Delta=0.06\); \(N\) is the approximate end-to end number of turns, \(a\) and \(d\) are the minor radius and the depth of the center of the current ring, \(q\) is the strength of the magnetic charges generating the confining field. The \(N=1\) case here is the same as the \(\Delta=0.06\) case of Table 4. We refer to Valori et al. (2010) for definitions and normalizations of the TD parameters

TD-Resolution Test Cases

The three equilibria for this test are the N1 case in Table 4 at resolution \(\Delta=0.06\), and two additional equilibria with exactly the same parameters but with \(\Delta=0.03\) and 0.12, respectively. The energy decomposition of the TD resolution tests summarized in Fig. 2c shows that the free energy is independent of resolution (at about 2 % of the total energy), and that the solenoidal errors depend only very weakly on it (cf. Table 7). While the former is expected, the latter confirms that solenoidal errors in the (non-relaxed) numerical implementations of TD equilibria have a stronger dependence on twist than on resolution that is mostly generated by the match at the interface between flux rope and ambient potential field.

Table 4 Parameters of the TD resolution test cases, with \(N\simeq1\); \(\Delta\) is the spatial resolution (\(n_{x}\), \(n_{y}\), \(n_{z}\)) are the number of nodes in the \(x\)-, \(y\)- and \(z\)-directions, respectively. The case \(\Delta=0.06\) here is the same the \(N=1\) case in Table 3. We refer to Valori et al. (2010) for definitions and normalizations of the TD parameters

In the construction of TD equilibria, the local matching between current ring and potential environment field at the flux rope’s boundary is done in locally cylindrical coordinates, hence some spurious Lorentz forces and solenoidal errors are present at the interface between the two flux systems. For such reasons, when employed as an initial state of numerical simulations, an MHD relaxation is normally applied beforehand to remove such residual forces and errors, see e.g., Török and Kliem (2003). For the purpose of computing the relative magnetic helicity, however, the relaxation step is unnecessary as long as the errors in the solenoidal property of the field are small enough, which is the case here.

4.3 MHD-Emergence Stable and MHD-Emergence Unstable

The MHD cases are simulations of stable (hereafter, MHD-st) and unstable (hereafter, MHD-un) evolutions of flux emergence published in by Leake et al. (2013) and (2014), respectively. These simulations offer the possibility of studying the time evolution of the helicity as the flux breaks through the photospheric layers, slowly accumulates in the coronal volume, and either reaches stability or erupts.

More in detail, the MHD-st case is a sub-domain of the Strong Dipole case by Leake et al. (2013), which was obtained using a stretched grid. Here we consider five snapshots of that simulation, and for each one the magnetic field is interpolated using a grid of \(233\times 233\times 174\) nodes with a uniform mesh size \(\Delta=0.86\) discretizing the volume \([-100,100]\times [-100,100]\times [0, 149]\) (in units of \(L_{0}\), see Leake et al. 2013 for more details). The interpolation is expected to introduce spurious solenoidal errors, but is required to accommodate for the requirements of all helicity computation methods. Compared to the original data, the bottom boundary of the interpolated mesh corresponds to the photospheric level, the top boundary to \(z=150\), and the domain is reduced in the lateral extension. The time series includes snapshots at \(t=[50, 85, 120, 155, 190]\). The MHD-un case, corresponding to the Medium Dipole case of Leake et al. (2014), is prepared in a similar way, but the time series is \(t=[50, 80, 110, 140, 150, 160, 190]\). Leake et al. (2014) identify the starting time of the eruption around \(t=120\) and the erupting structure is leaving the domain between \(t=150\) and \(t=160\), see, e.g., their Fig. 11.

In the MHD simulation, the stable and unstable cases are obtained only by changing strength and orientation of the coronal field, but nothing of the emerging flux rope. In this sense, the two simulations are very similar, albeit resulting in a very different end state. Note that in the MHD cases, \(E_{\mathrm{free}}\), \(E_{\mathrm {p}}\), and hence \(E\) are all dynamically evolving in time. In the unstable case, the small variation of the ratio \(E_{\mathrm{free}}(t)/E (t)\) (of about 0.05 points in Table 7) during the eruption, actually corresponds to a variation of 93 units of free energy with the maximum total energy before the eruption being equal to 464 units.

Figure 2d, e show that, in both MHD-st and MHD-un cases, the solenoidal errors slightly decrease during the MHD evolution from at most 1.6 % at the beginning of the simulations, to 0.5 % at their end. Due to the interpolation, the actual values of the solenoidal errors are larger than for the original simulations, but the trend in time is presumably the same. In addition to the helicity estimation discussed in Sect. 4.3, the snapshot at \(t=50\) of MHD-st is also used as the reference case for the test on the effect of nonzero divergence independently of resolution, as described in Sects. 4.4 and 7.

With respect to TD and LL cases, the MHD-st and MHD-un tests confront the finite volume methods with a higher complexity in the field, with the formation of small scales, and with the coronal re-organization of the connectivity in time, see Fig. 1c, d. Moreover, these cases contain large currents and large free energies, of the order of 50 % to 60 % of the total magnetic energy, depending on the type and stage of the evolution, see Table 7 and Fig. 2d, e. Naturally, such cases are of interest for our discussion since they are supposed to mimic more realistically the difficulties that helicity estimation methods face in solar applications.

4.4 Parametric Nonsolenoidal Test Case

The application of Eq. (3) to a field with nonzero divergence makes simply no sense in terms of helicity because Eq. (3) becomes gauge-dependent. However, in the routine situation of numerical studies, a finite value of divergence is always present. The question arises, what is the value of divergence that is tolerable in computing helicity, i.e., that is producing a helicity value close to the one obtained for the solenoidal field? A complication of the problem is that the value of helicity is in general not known, not even for the test cases presented here. Hence, we are forced to reformulate our question in terms of variation of \(H_{\mathcal{V}}\) obtained by each method as a function of the increasing divergence. In practice, we check how each method behaves for increasing violation of the solenoidal property, but we are not in the position of stating which method gives the more “correct” value as divergence increases.

To this purpose, we designed a dedicated MHD-emergence stable div(\(\mathbf{B}\)) test (hereafter, MHD-st-div(\(\mathbf{B}\))) by considering a numerically solenoidal field to which divergence is added in a controlled way and without changing the resolution, as done in Eqs. (14), (15) of Valori et al. (2013), to whom we refer for the details. In brief, starting from the snapshot of the magnetic field \(\mathbf{B}\) at \(t=50\) of the MHD-st case, a solenoidal field \(\mathbf{B}_{\mathrm {s}}\) is produced by removing the divergence part \(\mathbf{B}_{\mathrm{ns}}\) of \(\mathbf{B}\). A parametric, generally nonsolenoidal field,

$$ \mathbf{B}_{\delta}=\mathbf{B}_{\mathrm {s}}+ \delta\mathbf{B}_{\mathrm {ns}}, $$

is then constructed by adding the divergence part back, multiplied by a scalar amplitude \(\delta\). In this way, the original spatial structure of \(\mathbf{B}_{\mathrm {ns}}\) is kept in \(\mathbf{B}_{\delta} \) but its amplitude is modified according to the chosen value of \(\delta\). The case \(\delta=0\) corresponds the numerically solenoidal field \(\mathbf{B}_{\mathrm {s}} \), whereas \(\delta=1\) reproduces the original test field \(\mathbf{B}\), i.e., the snapshot of MHD-st at \(t=50\). The method for building the vector field \(\mathbf{B}_{\mathrm{ns}}\) is detailed in Sect. 7.1 of Valori et al. (2013).

By increasing the value of \(\delta\), progressively more divergence can be added, yielding a larger amplitude of the nonsolenoidal component. A trial-and-error tuning of \(\delta\) resulted into six MHD-st-div(\(\mathbf{B}\)) test fields with nonsolenoidal contributions as a function of the parameter \(\delta\) as summarized in Table 5 and Fig. 2f. In the following, different MHD-st-div(\(\mathbf{B}\)) test cases are identified by the correspondent fraction of \(E_{\mathrm{div}}\).

Table 5 Parameters \(\delta\) and corresponding values of relative nonsolenoidal energy for the MHD-st-div(\(\mathbf{B}\)) test, see Eq. (44)

The dependence of FV methods on solenoidal errors as modeled by Eq. (41) is discussed in Sect. 7.

5 Results: Finite Volume Methods

In this section we discuss the accuracy of FV methods presented in Sect. 2 using the test cases introduced in Sect. 4. As mentioned above, such methods require the full knowledge of the 3D magnetic field. Obviously, a non-perfectly solenoidal input field cannot be reproduced by a vector potential, and will affect each method in a different way. Therefore, the comparison between methods presented below should be read against the properties of the input field as described in Sect. 4. The purpose of these comparisons is not only to assess absolute accuracy in specific tests, but also to address the sensitivity of the methods towards certain studied parameters, such as resolution, twist, and topological complexity.

As anticipated in Sect. 3.1, the vector potentials obtained by FV methods are judged on their ability of reproducing the test fields and their corresponding potential fields. Indirectly, this is also a measure of the accuracy of the methods in the computation of \(H_{\mathcal{V}}\). The full metrics’ values are provided in Tables 89, together with the computed values of helicity, and a partial but representative selection is reproduced in the plots of the next sections.

5.1 Dependence on Twist in the Titov and Démoulin Case

Figure 3a shows the dependence on the twist of \(H_{\mathcal{V}}\) computed by the different FV methods. With the exception of the Coulomb_GR method, all other methods are basically producing the same value of \(H_{\mathcal{V}}\) at all twists. More quantitatively, the spread in \(H_{\mathcal{V}}\) computed including all twist values and all methods except for the Coulomb_GR method, is only 2 %. In fact, DeVore methods are practically indistinguishable from each other. For a given twist value, for instance at \(N=1\), the spread of \(H_{\mathcal{V}}\) values around the average −0.079 is only 2.3 %, whereas average and spread become −0.084 and 16 %, respectively, if Coulomb_GR is included. The \(H_{\mathcal{V}}\) from the Coulomb_GR method, on the other hand, follows the same trend as the other methods, but has values about a factor two larger. In addition, there is no apparent correlation between the spread of \(H_{\mathcal{V}} \) and the value of the twist. All methods seem to be unaffected by this particular aspect of complexity of the field, at least at the resolution considered here. On the other hand, recalling the dependence on twist of the solenoidal errors discussed in Sect. 4.2 and Fig. 2b, it is found that larger spreads in \(H_{\mathcal{V}}\) correlates to larger values of divergence.

Fig. 3
figure 3

TD-twist test: (a) normalized helicity \(H_{\mathcal{V}}\); (b) complement of the normalized vector for the test field \(\epsilon _{\mathrm {N}}(\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\)

In order to address specifically the methods’ accuracy, we show in Fig. 3b the complement of the normalized vector error, \(\epsilon_{\mathrm {N}}(\mathbf{B}, \boldsymbol{\nabla}\times\mathbf{A})\) (cf. Eq. (38)), between the test field \(\mathbf{B}\) and the rotation of the corresponding vector potential \(\mathbf{A}\) computed by each method. The DeVore methods sport extremely high accuracy metric of \(\epsilon _{\mathrm {N}} =0.994\) or higher, and are indeed indistinguishable from each other. The Coulomb_SY accuracy correlates inversely with the solenoidal errors of that test (cf. Fig. 2b), in the sense that the accuracy is lower for proportionally larger values of \(E_{\mathrm{div}}\), as could be expected. Given the high accuracy in all twist cases, such a dependence in not very clearly visible in Fig. 3b. Among the Coulomb methods, the Coulomb_SY method has accuracy values (e.g., \(\epsilon_{\mathrm {N}}=0.976\) at \(N=1\)) that are only slightly worse than the DeVore methods. Similarly to DeVore-gauge methods, the Coulomb_SY accuracy correlates inversely with the solenoidal errors, but in this case with more pronounced variations. The vector potential computed by the Coulomb_GR method has the largest error in reproducing the input field, with values of the complement of the error vector as small as \(\epsilon_{\mathrm {N}}=0.88\). A trend similar to Coulomb_GR’s one is found for the Coulomb_JT method but with a slightly smaller error (\(\epsilon_{\mathrm {N}}=0.903\)). Apparently, both Coulomb_GR and Coulomb_JT method show an accuracy in this test that directly correlates with the solenoidal errors, i.e., the accuracy is lower (smaller values of \(\epsilon_{\mathrm {N}}\)) for smaller values of \(E_{\mathrm{div}}\). This counterintuitive trend, however, is not confirmed by the tests in Sect. 7, and has to be regarded as insignificant. On the other hand, one could equally conjecture that Coulomb_GR and Coulomb_JT methods show a direct correlation between \(\epsilon_{\mathrm {N}}\) and the free energy \(E_{\mathrm{free}}\), see again Fig. 2b. In this sense, Coulomb_GR and Coulomb_JT could be said to obtain more accurate results for fields with higher currents, which can be understood in terms of a stronger source term in Eq. (13), and is not contradicted by the tests presented in the following sections. We notice that, even for similar values of \(\epsilon_{\mathrm {N}}\), the helicity values obtained by the Coulomb_GR and Coulomb_JT methods are quite different, the latter aligning with the DeVore ones within 2 %-variation.

As for the average \(H_{\mathcal{V}}\) values, the TD-twist test cases in Fig. 3a demonstrate that more twist does not necessarily translate into larger helicity values. Indeed, the \(N=3\) case has a smaller helicity than \(N=1\). The higher twist of the \(N=3\) case is obtained by reducing the radius of the current channel (\(a\) in Table 3) without changing the ambient field (i.e., the magnetic “charges”, \(q\)). The dependence of the current on \(a\) is weak (see Eq. (6) of Titov and Démoulin 1999), and the difference in \(H_{\mathcal{V}}\) is mostly due to the difference in the—dominant—mutual helicity between ambient field and current channel.

In conclusion, in the TD-twist test cases all methods, with the exception of the Coulomb_GR one, provide the same value of helicity within 2 % of variation. Furthermore, in a range of different twist ranging from practically zero to 3 full turns, no evidence of direct influence of the amount of twist on the accuracy of the methods is found. The variation of the accuracy with twist clearly correlates for most of the methods with the solenoidal errors, but an inverse correlation is also found for the Coulomb_JT and Coulomb_GR methods.

5.2 Time Evolution in the MHD-Emergence Stable and MHD-Emergence Unstable Cases

Figure 4 shows the helicity evolution for the MHD-st and MHD-un cases. No solution from the Coulomb_GR method is included for the MHD-st and MHD-un cases due to the long computation time that is required to obtain the two time series. The spread in \(H_{\mathcal{V}}\) computed including all available methods and time snapshots is basically negligible in the MHD-st case, amounting to just 0.2 %, see Fig. 4a. Hence, in the MHD-st case, even more than in the TD-twist case of Sect. 5.1, all considered methods yield essentially the same value of \(H_{\mathcal{V}}\), which is a very encouraging result in view of future applications. The spread in \(H_{\mathcal{V}}\) is very small also in the MHD-un case, being 3 % at the end of the simulation. Even though this represents a modestly larger spread in \(H_{\mathcal{V}}\) values, one has to recall that the MHD-un case corresponds to a time evolution where an eruption rearranges drastically the magnetic field, with ejection of field and currents from the top boundary. The challenge posed to numerical accuracy in such cases is indeed very high.

Fig. 4
figure 4

Normalized helicity \(H_{\mathcal{V}}\) for the (a) MHD-st and (b) MHD-un, as a function of time. No result from the Coulomb_GR method is included here due to computing-time limitations

Concerning the accuracy metrics for the magnetic field, Fig. 5 shows the \(\epsilon_{\mathrm {N}}(\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\) (cf. Eq. (38)), for the MHD-st and MHD-un cases, respectively, as a function of time. The accuracy metric shows that Coulomb_SY and all DeVore methods have comparable accuracy, of about 0.96 and 0.97 on average, respectively. On the other hand, the Coulomb_JT method has an accuracy for the complement of the vector error of \(\epsilon_{\mathrm {N}}=0.54\) at the beginning of the simulation, increasing up to \(\epsilon_{\mathrm {N}}=0.77\) at the end. Comparing with the evolution in the MHD-un case, we notice that the metric \(\epsilon_{\mathrm {N}}\) drops to worse values in correspondence of the eruption, which correlates in time with the passage of current carrying field through the top boundary (without necessarily contradicting the direct correlation between \(\epsilon_{\mathrm {N}}\) and \(E_{\mathrm{free}}\) noticed for the Coulomb_JT method in Sect. 5.1, cf. Fig. 5b with Fig. 2e).

Fig. 5
figure 5

Complement of the normalized vector for the test field, \(\epsilon_{\mathrm {N}} (\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\), for the MHD-st (a) and the MHD-un (b) cases, as a function of time

Indeed, the simulation MHD-st and MHD-un are similar in many respects, but one essential difference from the point of view of the \(H_{\mathcal{V}}\) computation is that the eruption in the MHD-un case generates the transit of a plasmoid carrying significant field through the top boundary. This seems to have hardly any consequence for DeVore methods, but may have more severe consequences for Coulomb methods that use the normal component of the field to specify the boundary conditions for \(\mathbf{A}\) (cf. Eq. (15)). The reason of the increase in the error might then be due to the fact that the Coulomb_JT method practically enforces flux balance by concentrating to the top boundary any possible error deriving from a nonsolenoidal input field (see Sect. 2.1). As significant field transits through the boundary as a consequence of the eruption, larger solenoidal errors affect the value of the field there and, as a consequence, the solution of \(\mathbf{A}_{\mathrm {p}}\) that is computed form the boundary values. The correlation between the drop in the metrics of Coulomb_JT in correspondence with the plasmoid passage through the top boundary supports this speculation.

As for the average \(H_{\mathcal{V}}\) values, it is worth noticing that, for the simulation in exam, “larger \(H_{\mathcal{V}}\) value” does not immediately translate into “more likely to erupt”. Indeed, Fig. 5 shows that, according to all methods, the MHD-un case has less helicity than the stable one, MHD-st.

In conclusion, the helicity values \(H_{\mathcal{V}}\) in this most relevant test of MHD evolutions, both stable and unstable, show a very good agreement between different methods, namely within 3 % in the most challenging MHD-un case. It is only using very sensitive metrics such as \(\epsilon_{\mathrm {N}}\) that differences between methods of vector potentials’ computations can be disclosed. The results presented in this section are very encouraging for applications of helicity estimation methods to numerical simulations. The obtained values are largely independent of the specific methods employed, provided that the solenoidal property is sufficiently fulfilled, which allows for accurate and reliable studies of the properties of helicity as tracer of magnetic field evolution.

6 Dependence on Resolution

Numerical resolution, taken here to be the voxel size as customary in simulations, affects the solenoidal property of the input field as well as the accuracy of finite volume (FV) methods in solving for the vector potentials. Here we address the issue directly, trying to separate each contribution.

6.1 TD Resolution Test: Major Field Complexity with Little Flux Through Boundaries

Figure 2c shows that the solenoidal error in the TD-resolution cases is practically independent of resolution, and amounts to \(E_{\mathrm{div}} \simeq3~\%\) at most in the examined resolution interval, \(\Delta=[0.03,0.12]\). Similarly, the \(H_{\mathcal{V}}\) values for each method separately, see Fig. 6a, are all essentially independent of resolution, except for a small variation of about 1 % for the Coulomb_JT case. On the other hand, the spread in values between methods over all resolutions is definitely more significant, being equal to 20 % if all methods are included, and 4 % if Coulomb_GR is excluded. Hence, this is a first indication that differences between methods (4 % at least) are more important than resolution (1 % at most) in determining the value of \(H_{\mathcal{V}}\), for similar levels of solenoidal errors.

Fig. 6
figure 6

TD resolution test: (a) normalized helicity \(H_{\mathcal{V}}\); (b) complement of the normalized vector \(\epsilon_{\mathrm {N}}(\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\)

Figure 6b shows the complement of the normalized vector for the test field \(\epsilon_{\mathrm {N}}(\mathbf{B}, \boldsymbol{\nabla}\times\mathbf{A})\) (cf. Eq. (38)). The analysis of the complement of the vector error again separates the methods more markedly. There are no appreciable differences between the three DeVore methods, all around \(\epsilon_{\mathrm {N}}=0.99\). Errors are larger on average going from Coulomb_SY (\(\epsilon _{\mathrm {N}}=0.97\)), to Coulomb_JT (\(\epsilon_{\mathrm {N}}=0.90\)), to the Coulomb_GR (\(\epsilon_{\mathrm {N}}=0.89\)).

Since there is no strong dependence on resolution of the solenoidal error in the TD-resolution case, then any such dependence that is found in the value of \(H_{\mathcal{V}}\) should be due to specific sensitivity of the different method to resolution.

6.2 LL Resolution Test: Minor Field Complexity with Significant Flux Through the Boundaries

In the tests analyzed so far, differences in \(H_{\mathcal{V}}\) are limited, except for the Coulomb_GR method and, to a slightly lesser extent, the Coulomb_JT method. In order to progress further in the analysis we consider the LL case described in Sect. 4.1.

Figure 7 summarizes the detailed analysis of the resolution effects on the computation of \(H_{\mathcal{V}}\) in that case. The main result is that a very clear dependence of \(H_{\mathcal{V}}\) on resolution is found when FV methods are applied to the LL case, see in particular Fig. 7a. In more detail, excluding again Coulomb_GR, the spread in \(H_{\mathcal{V}}\) at \(n=64\) is only 0.8 % (11 % if Coulomb_GR is included). This is even smaller than the spread in \(H_{\mathcal{V}}\) for the TD case of Sect. 6.1, at a comparable level of \(E_{\mathrm{div}}\) (cf. the end-to-end twist = 2.11 data point in Fig. 2a with the \(n=64\) data point of Fig. 2b). In the LL case we can decrease the resolution even further, thereby following the trends over a longer interval.

Fig. 7
figure 7

LL resolution test: (a) normalized helicity, \(H_{\mathcal{V}}\); complement of the normalized vector error for the test field for the (b) potential, \(\epsilon_{\mathrm {N}}(\mathbf{B}_{\mathrm {p}},\boldsymbol{\nabla}\times\mathbf{A}_{\mathrm {p}})\), and (c) test field, \(\epsilon_{\mathrm {N}}(\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\); energy ratios for the (d) potential, \(\epsilon_{\mathrm {E}}(\mathbf{B}_{\mathrm {p}},\boldsymbol{\nabla}\times\mathbf{A}_{\mathrm {p}})\), and (e) test field, \(\epsilon_{\mathrm {E}}(\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\); (f\(\langle|f_{i}\mathbf{A}_{\mathrm {p}}|\rangle\) and \(\langle |f_{i}\mathbf{A}|\rangle\) for the Coulomb methods only; as a function of resolution

All methods show an increase of \(H_{\mathcal{V}}\) to more negative values for larger pixel size, with the exception of the \(n=32\) data point of the Coulomb_GR method. This is markedly different from the trend in Sect. 6.1 where, for a test field with basically the same \(E_{\mathrm{div}}\) across different resolutions, the \(H_{\mathcal{V}}\) values found by different methods were also basically independent of resolution, albeit not the same. Therefore, the dependence of \(H_{\mathcal{V}}\) on resolution in the LL case can be directly related to the presence of larger \(\boldsymbol{\nabla}\cdot\mathbf{B}\) at lower resolutions, as Fig. 2a shows. On the other hand, for a given resolution, the spread due to different methods ranges from 0.3 % at higher resolution, to 2.3 % at the lower one (5.4 % if Coulomb_GR is included). Among the different methods, DeVore_GV give less variable values with \(\Delta\), whereas Coulomb_JT is more sensitive to it (and Coulomb_GR even more).

The complement of the normalized vector error and the energy metrics show as usual more differences between the methods. The DeVore methods are all very accurate in the computation of \(\mathbf{A}_{\mathrm {p}}\), with DeVore_SA slightly less sensitive than DeVore_KM and DeVore_GV (see Fig. 7b). Differences become entirely negligible in the computation of \(\mathbf{A}\) (cf. Fig. 7c). The energy metrics \(\epsilon_{\mathrm {E}}\) (cf. Eq. (39)) provide similar information, with more accentuated spreads (see Fig. 7d and e). Therefore, we conclude that the most important difference between the three implementations of the DeVore method (DeVore_SA, DeVore_KM, DeVore_GV) is how the potential field is computed.

Among the Coulomb methods, Coulomb_SY is the more accurate one on average, and is only marginally less accurate than the DeVore methods, having slightly larger inaccuracies in computing \(\mathbf{A}_{\mathrm {p}}\) than \(\mathbf{A}\). The Coulomb_GR method is even more accurate in this case than most of the DeVore methods in the computation of \(\mathbf{A}_{\mathrm {p}}\) (in both \(\epsilon_{\mathrm {N}}\) and \(\epsilon_{\mathrm {E}} \) metrics), but yields contradictory metrics for \(\mathbf{A}\) (poor \(\epsilon_{\mathrm {N}}\) but good \(\epsilon_{\mathrm {E}}\)). This results into \(H_{\mathcal{V}}\) values that stand more clearly apart form the trend. The Coulomb_GR improvement of \(\epsilon_{\mathrm {N}}\) with coarser pixel size in Fig. 7c is difficult to interpret without additional testing. The Coulomb_JT method lies somewhere in between the other two Coulomb methods, but overall yields \(H_{\mathcal{V}}\) values in line with the DeVore methods. The computation of \(\mathbf{A}_{\mathrm {p}}\) (respectively, \(\mathbf{A}\)) with the Coulomb_JT method yields \(\epsilon_{\mathrm {N}}\simeq0.88\) (respectively, \(\epsilon _{\mathrm {N}}\simeq0.90\)) but is not particularly sensitive to resolution. Interestingly, Fig. 7d shows that the spread in energy metric for the potential field has an overall value including all methods of just 1.2 %, with a maximum value of 2 % at the lowest resolution. The same metrics for the input fields are 1.6 % and 2.4 %, respectively. In summary, the energy metric \(\epsilon_{\mathrm {E}}\), even though not exactly reproducing the accuracy of the methods as quantified by \(\epsilon _{\mathrm {N}}\), indicates a small spread of energy in the field recomputed from the vector potentials, even at low resolution and for all methods.

DeVore methods can impose the gauge \(A_{\mathrm {z}}=0\) and \(A_{\mathrm {p},\mathrm{z}}=0\) exactly also in numerical implementations. On the contrary, the gauge conditions \(\boldsymbol{\nabla}\cdot\mathbf{A}=0\) and \(\boldsymbol{\nabla}\cdot\mathbf{A}_{\mathrm {p}}=0\) in Coulomb methods are numerically fulfilled only up to a finite precision. Hence, errors in fulfilling the gauge requirements might become a source of inaccuracy by generating spurious, nonsolenoidal components of the vector potentials. In order to quantify how well the solenoidal property of the vector potentials is satisfied for each Coulomb-gauge-based FV method, we show in Fig. 7f the fractional fluxes, \(\langle|f_{i}(\mathbf{A})|\rangle\) and \(\langle|f_{i}(\mathbf{A}_{\mathrm {p}} )|\rangle\), as defined in Eq. (40), for the \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\) solution of the LL resolution test cases, respectively. All Coulomb methods satisfy the gauge better (i.e., have lower \(\langle|f_{i}|\rangle\)) at higher resolutions, with similar rates of change, except for the Coulomb_SY method that has a minimum in correspondence of the \(n=64\) data point. The Coulomb_SY method satisfies the Coulomb gauge with almost identical accuracy for both \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\), to a relatively low degree (\(\langle|f_{i}|\rangle\simeq10^{-4}\)). The other two Coulomb methods show larger differences in the fulfillment of the solenoidal property of \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\). In particular, both the Coulomb_GR method and the Coulomb_JT method respect the gauge condition better for \(\mathbf{A}_{\mathrm {p}}\) than for \(\mathbf{A}\). The difference is minimal for Coulomb_GR—about \(3\times10^{-5}\)—and about one order of magnitude for Coulomb_JT. At the same time, Coulomb_JT provides the most solenoidal \(\mathbf{A}_{\mathrm {p}}\) and \(\mathbf{A}\) of all Coulomb methods, at all resolutions, with values of \(\langle |f_{i}|\rangle\) below \(10^{-8}\) for both potentials at the highest resolution.

In summary, the proper fulfillment of the Coulomb gauge is attained at different level of accuracy by the different methods, especially as far as \(\mathbf{A}\) is concerned, but no obvious correlation between violation of the solenoidal property of the vector potentials and accuracy of the vector potential is found.

7 Dependence on Divergence

In Sects. 6.1 and 6.2 we show that the pixel size affects not only the accuracy of methods in solving for the vector potentials, but also the degree of divergence that is caused by the resolution of the test fields. More generally, in practical cases, when trying to estimate the helicity of a 3D dataset, a nonzero divergence of \(\mathbf{B}\) is always present. It is thus of practical importance to determine the level of confidence of an helicity measurement given its level of nonsolenoidality, here expressed in function of \(E_{\mathrm{div}}\). The present section aims at giving a first test of the impact of the nonsolenoidal effect on the degree of precision of helicity measurements.

Similarly to classical helicity (cf. Eq. (2)), assuming that \(\mathbf{B} \) and \(\mathbf{B}_{\mathrm {p}}\) effectively have the same distribution of the normal component on \({\partial\mathcal{V}}\), a gauge transformation \((\mathbf{A},\mathbf{A}_{\mathrm {p}}) \longrightarrow(\mathbf{A}+\boldsymbol{\nabla}\psi, \mathbf{A}_{\mathrm {p}}+\boldsymbol{\nabla}\psi _{p})\) induce the following difference on the relative magnetic helicity:

$$ \mathscr{H}_{\mathcal{V}}(\mathbf{A}+\boldsymbol{\nabla}\psi,\mathbf{A}_{\mathrm {p}}+ \boldsymbol{\nabla}\psi_{p}) = \mathscr{H}_{\mathcal{V}}(\mathbf{A},\mathbf{A}_{\mathrm {p}}) - \int_{\mathcal{V}} (\psi+\psi_{p}) (\boldsymbol{\nabla}\cdot\mathbf{B}- \boldsymbol{\nabla}\cdot \mathbf{B}_{\mathrm {p}} ) \,{\mathrm {d}}\mathcal {V}. $$

Comparing one FV method against another is theoretically equivalent to performing a gauge transformation: for a purely solenoidal field they should provide identical values of helicity within the numerical precision of each method. While for a finite nonsolenoidal field it is always theoretically possible to find a gauge transformation that will lead to a significantly large difference, in practice most methods are solving for \(\mathbf{A}\) and \(\mathbf{A}_{\mathrm {p}}\) in such a way that the amplitude of the vector potentials turns out to be dominant over the contributions from the gauges \(\psi\) and \(\psi_{p}\). Hence, for a given dataset, the difference of amplitude of the vector potentials computed by each method is relatively small. Thus, for a given \(E_{\mathrm{div}}\), the different methods provide helicity values that remain within a certain range of each other. As \(E_{\mathrm{div}}\) is infinitely small, the methods are expected to provide helicity values which are close to each other, while for large \(E_{\mathrm{div}}\), the methods should provide helicity values presenting a larger spread.

In the present section, we consider the MHD-st-div(\(\mathbf{B}\)) test described in Sect. 4.4, which allows us to estimate the dispersion of the helicity values obtained with the different methods for different level of nonsolenoidality. In the present test the Coulomb_GR method is not included because of computational limitations.

The amplitude of the nonsolenoidal component in the MHD-st-div(\(\mathbf{B}\)) test field as quantified by \(E_{\mathrm{div}}\) for different values of \(\delta\) in Eq. (41) is reported in Table 5 and shown in Fig. 2f, where \(E_{\mathrm{div}}\) is shown growing from 0.2 % up to 14 % for the considered range of \(\delta \) values (the corresponding values of \(\langle|f_{i}|\rangle\) can be find in Table 7). The contributions \(E_{\mathrm{J},\mathrm{ns}}\) and \(E_{\mathrm {mix}}\) to \(E_{\mathrm{div}}\) in Eq. (44) and their variation with \(\delta\) are shown in Fig. 8a. The energy \(E_{\mathrm{div}}\) turns out to be a nonlinear function of \(\delta\), with a minimum close, but not at, \(\delta=0\). This apparent contradiction is due to the definition equation (44) that forbids cancellation between different contributions, and practically shifts the zero of \(E_{\mathrm{div}}\) to slightly higher values. For completeness, the nonsolenoidal error \(E_{\mathrm{ns}}\) given by Eq. (44) without the absolute value, i.e., allowing for cancellation between terms, is also plotted in Fig. 8a.

Fig. 8
figure 8

MHD-st-div(\(\mathbf{B}\)) test (a) nonsolenoidal contributions to the energy, as a function of the divergence parameter, \(\delta\), see Eqs. (41), (44). As a function of \(E_{\mathrm{div}}\): (b) helicity \(H_{\mathcal{V}}\); (c) complement of the normalized vector error for the test field, \(\epsilon_{\mathrm {N}}(\mathbf{B},\boldsymbol{\nabla}\times\mathbf{A})\); (d\(\langle|f_{i}\mathbf{A}|\rangle\) for the Coulomb methods only

The values of \(H_{\mathcal{V}}\) obtained in the MHD-st-div(\(\mathbf{B}\)) test cases are plotted in Fig. 8b. We confirmed that for low values of \(E_{\mathrm{div}}\), the methods are providing \(H_{\mathcal{V}}\) which are close to each other, while the dispersion of the values obtained are spreading as \(E_{\mathrm{div}}\) is increasing. All method follow a qualitatively similar exponential trend as a function of \(E_{\mathrm{div}}\), both in \(H_{\mathcal{V}}\) (Fig. 8b) as well as in the accuracy metric \(\epsilon_{\mathrm {N}}(\mathbf{B},\boldsymbol{\nabla}\times \mathbf{A})\) (Fig. 8c). The only exception to a smooth trend is the \(E_{\mathrm{div}}=2~\%\)-case of the Coulomb_JT method, for which no particular reason was identified.

In the most solenoidal case, for \(E_{\mathrm{div}}=0.2~\%\), the relative dispersion of \(H_{\mathcal{V}}\) obtained is of 0.8 %. Excluding the \(E_{\mathrm{div}}=2~\%\)-case of the Coulomb_JT method, for each case with \(E_{\mathrm{div}}\le4~\%\), the relative spread in \(H_{\mathcal{V}}\) remains lower than 1 %. At \(E_{\mathrm{div}}=2~\%\), taking all the methods into account, the relative spread in the \(H_{\mathcal{V}}\) is of the order of 6 %.

Excluding the Coulomb_GR method, we note that in all the previous tests, the maximum spread of \(H_{\mathcal{V}}\) observed was of 4 % (in the TD-resolution test of Sect. 6.1). This incline us to state that within that range of \(E_{\mathrm{div}}\), the differences between the methods are not related to the nonsolenoidality but rather to the intrinsic numerical error within each method.

For \(E_{\mathrm{div}}= 8.2~\%\), the relative dispersion of \(H_{\mathcal{V}}\) is also relatively low, equal to \(1.9~\%\). However, in the least solenoidal case, for \(E_{\mathrm{div}}=14.4~\%\), the dispersion in helicity estimation obtained for the different methods reaches \(18~\%\) of the average value. This is much higher than most of the errors that we have encountered so far. We believe that in this range of \(E_{\mathrm{div}}\), the gauge dependence is directly impacting the estimation of \(H_{\mathcal{V}}\).

The implementations of DeVore’s method (DeVore_KM, DeVore_GV and DeVore_SA) yields very similar results, both in values and in trends. The trend already noticed in Fig. 7b is confirmed by the accuracy of the vector potential quantified by \(\epsilon_{\mathrm {N}}\) in Fig. 8c. From the analysis in Sect. 6.2, we tend to attribute this difference to the accuracy in the solution of Eq. (8) being higher for DeVore_SA with respect to DeVore_KM and DeVore_GV. Similarly, the Coulomb_SY and Coulomb_JT methods deliver analogous \(H_{\mathcal{V}}\) and \(\epsilon_{\mathrm {N}}\) curves (see Fig. 8b and c). However, they strongly differ in the accuracy with which the Coulomb gauge condition is respected, as Fig. 8d shows. Confirming the result of the LL case of Sect. 4.1, the Coulomb_JT method respect the Coulomb-gauge condition extremely well for \(\mathbf{A}_{\mathrm {p}}\) (\(\langle|f_{i}|\rangle\simeq10^{-9}\)), and still excellently for \(\mathbf{A}\) (\(\langle|f_{i}|\rangle\simeq10^{-6}\) or lower). Interestingly, \(\langle|f_{i}(\mathbf{A}_{\mathrm {p}})|\rangle\) is practically independent of \(E_{\mathrm{div}}\), confirming that the strategy adopted by the Coulomb_JT method for solving equation (10) is very much able to handle flux unbalance resulting from solenoidal errors in \(\mathcal{V}\). However, even though the solenoidal property of the vector potentials is definitely better verified by the Coulomb_JT method than by the Coulomb_SY, the accuracy of the vector potential does not reflect this trend. The Coulomb_SY vector potentials, indeed, have much higher values of \(\langle|f_{i}(\mathbf{A}_{\mathrm {p}})|\rangle\simeq\langle|f_{i}(\mathbf{A})|\rangle\simeq10^{-4}\) than those by the Coulomb_JT method. In this sense, the divergence-cleaning strategy adopted by Coulomb_SY is less efficient in imposing the Coulomb gauge. However, such values of \(\langle|f_{i}|\rangle\) seem still low enough to guarantee a relative high accuracy, as testified by \(\epsilon_{\mathrm {N}}\) of Fig. 8c.

The test discussed here, of course, does not pretend to be general in assessing the influence of the nonsolenoidality on helicity estimations, and further tests are likely to be required. However, it represents one well-controlled example that enables an estimate of the degree of confidence of a helicity estimations for given a finite nonsolenoidality level.

In summary, according to our tests, errors in respecting the solenoidal constraint might be still ignorable as long as \(E_{\mathrm{div}}\) is below 1 %, but become abruptly more important above that threshold. For a dataset with \(E_{\mathrm{div}}\) comprised between 1 and 8 %, using on FV method or the other would lead up to 6 % difference in the estimation of \(H_{\mathcal{V}}\) (excluding Coulomb_GR method). For higher \(E_{\mathrm{div}}\), the gauge invariance starts to have significant effects.

According to the above discussion, most of the tests employed in the remaining sections of this work have nonsolenoidal contributions that are mostly ignorable, with few data points where \(E_{\mathrm{div}}\) (and hence its influence on \(H_{\mathcal{V}}\)) is of the order of few percent (cf. Fig. 2 and Table 7).

8 Discussion of FV Methods

The previous sections discuss the results of FV methods when applied to a variety of test fields that differ for topological complexity, importance and distribution of currents in the volume, stability properties. Factors that seem to influence the accuracy in the computation of \(H_{\mathcal{V}}\) in FV methods range from the distribution of strong currents at the top boundary (see Coulomb_JT in Sect. 5.2 in particular), to the solver employed for the construction of the reference potential field, as for the DeVore methods in Sect. 6.1. In this sense, the solar-like separation between a current-carrying and a more potential part of the coronal field seems to favor accuracy in helicity computations, possibly because in this way currents do not affect the boundary conditions for Coulomb methods. However, as TD and LL tests show, the accuracy of the helicity computed by different methods is not always directly related to the accuracy of the vector potentials in reproducing the corresponding fields. Two of the Coulomb methods, Coulomb_JT and Coulomb_SY, despite their lesser accuracy in solving for the vector potentials (when compared to the accuracy of the DeVore methods), they still deliver a helicity in line with that obtained by the DeVore methods. On the other hand, while, e.g., Coulomb_GR is of similar (in)accuracy as the other two Coulomb methods, it delivers slightly different helicity values. Likely, given the nonlocal nature of \(H_{\mathcal{V}}\), such details depend on the particular spatial distribution of the solenoidal errors on a case by case basis, which may affect how the different distributions of values combine into \(H_{\mathcal{V}}\). This is in a way confirmed by the remarkable absence of differences in the MHD-st case, in which \(H_{\mathcal{V}}\) is dominated by the large contribution of the potential field. Similarly, we find no strong influence on the methods’ accuracy by the amount of twist in the field of the TD case, where the self-helicity \(H_{\mathrm {J}}\) is almost a factor 100 smaller than the total helicity \(H_{\mathcal{V}}\), Sect. 5.1.

A strong effect on helicity values is found from errors in the solenoidal property of the input field. In Sect. 7 a test field is considered that has increasing value of solenoidal error, as measured by the normalized fraction of the energy associated with magnetic monopoles, \(E_{\mathrm{div}}\).

We find a rapid increase of \(H_{\mathcal{V}}\) fluctuations as \(E_{\mathrm{div}}\) grows above 1 %, see e.g., Fig. 8d. We also extensively test the effect of resolution, which is found to affect helicity values basically in two ways: Directly, by affecting the solution of the Poisson solvers that compute the scalar or vector potentials, and indirectly, by increasing the solenoidal error in the input field and consequently weakening the consistency between potentials and boundary conditions. By increasing the solenoidal error, resolution may influence the helicity value significantly in heavily under-resolved cases, as in Fig. 7, for which systematic quantifications of solenoidal errors must be put in place. On the other hand, when resolution is not pushed to limits, differences between methods account for larger spread in \(H_{\mathcal{V}}\) values than resolution, as Fig. 6a and Sect. 6.1 show.

From the point of view of the accuracy, vector potentials computed with the DeVore methods reproduce the input field more accurately in most of the cases, see e.g., Fig. 6. Among the DeVore methods, accuracy is improved mostly for better solutions of the Laplace equation defining the potential field, Eq. (8). Other details of implementation, such as the definition of derivative and integrals, play a minor role.

Coulomb methods, need to impose the solenoidality of the vector potential in the entire volume, and may suffer more from the inconsistent boundary values for Laplace/Poisson equations that the methods solve. In this respect, the Coulomb_SY strategy of divergence cleaning is not as efficient as the parametric tuning of the integration constants (the \(c_{f}\) constants of Sect. 2) employed by Coulomb_JT (see Figs. 7f and 8d). On the other hand, the accuracy of the Coulomb_SY method in the construction of the vector potentials is found in all tests performed here to be always better than that of the Coulomb_JT method. Therefore, the accuracy of the vector potential is not directly influenced by the accuracy with which the gauge condition is satisfied. The computation of \(\mathbf{A}\) poses in general more difficulties for Coulomb methods than that of \(\mathbf{A}_{\mathrm {p}}\), in a way contrary to the DeVore methods. In particular, the Coulomb_JT method seems to be sensitive to current on the boundaries (as MHD-un show, see Fig. 5), possibly, because they yield inconsistent boundary values for Eqs. (10), (13). The Coulomb_GR method, finally, has mostly issues in computing an \(\mathbf{A}\) that reproduces the field accurately enough, which result in the largest departures of \(H_{\mathcal{V}}\) from average values of all methods.

In the tests presented here it is clearly found that the fulfillment of the Coulomb gauge is quite variable among the Coulomb methods. However, using the LL test case as a reference, we find that an average value of the fractional flux of \(\langle|f_{i}(\mathbf{A})|\rangle \) below \(10^{-3}\) yields helicity values comparable with those from DeVore methods (e.g., within 0.8 % in the moderate-resolution case of \(n=64\), see Sect. 4.1).

Hence, in a balance between accuracy and applicability, a clear advantage of DeVore methods over Coulomb methods is that the gauge can be imposed exactly in the former, whereas it need to be insured numerically on the latter. This translates into simpler and more efficient implementations of the method, and to more accurate estimations of \(H_{\mathcal{V}}\). On the other hand, the Coulomb gauge yields generally simpler analytical expression of more straightforward interpretation by eliminating those terms that depend on the divergence of the vector potentials. This offers, for instance, a possibility of a better comparison and integration with FI methods. Also, the Coulomb gauge allows a natural interpretation of helicity in terms of Gauss linking number, see e.g., Berger (1999) and references therein, which is an interpretation tool often used in helicity studies.

9 Comparison with Discrete Flux-Tubes Methods

On the grounds of the discussion of the previous sections, and with the limitations there specified, we consider here one of the FV methods, namely the DeVore_GV one, to give the correct value of helicity, and we compare the DT methods against it. As discussed in Sect. 2.3, the comparison between DT and FV methods is by necessity limited to the estimated helicity value, given the different level of approximation and required information of the two groups of methods.

9.1 Twist-Number Method

The twist-number method needs identifiable flux-rope structures in order to be applied. The dependence of the method on some of its parameters (e.g., on the choice of the QSL surface defining the flux rope and on the location of the axes of the flux rope, see Sect. 2.3.1) is specific to the method and requires a testing strategy that is different from the one applicable to the other FV methods. Therefore, we defer that discussion to a separate dedicated paper, in preparation at the time of writing, where the TN method is tested using TD, MHD-st and MHD-un cases, as well as some nonlinear force-free field models (Guo et al. 2017). Here, we only report the results of the application of the TN method to the TD cases.

The Q map (as defined by Eq. (24) in Titov et al. 2002) defining the QSL used to identify the flux rope volume is shown in the left panel of Fig. 9 in the \(N=3\) case. We select 100 sample field lines, which are randomly distributed within the QSL, for the magnetic flux rope. We compute the twist of each field line referred to the axis as described in Sect. 2.3. The (nonnormalized) twist of the magnetic flux rope \(\mathscr {H}_{\mathrm{twist}}\) defined in Eq. (32) is computed as the average of the twist of the sample field lines, and the uncertainties are computed by the standard deviation of their distribution (see Table 6). An example of the twist distribution of the sample magnetic field lines as a function of the distance from the flux rope axis is given in the right panel of Fig. 9.

Fig. 9
figure 9

Application of the TN method to the TD \(N=3\) case. Left: a vertical slice of the Q map in the \(xz\)-plane at \(y = 0\) corresponding to the middle of the flux rope along its axis. Red (blue) plus sign indicates the position of the axis (sample field lines). Right: twist of the sample magnetic field lines along the distance, \(r\), from the origin

Table 6 Helicity in the twist (upper) and resolution (lower) TD tests, computed with the FV-DeVore_GV method (2nd to 4th column), and with the TN method (5th column). Note that \(\mathscr {H}_{\mathcal{V}}\), \(\mathscr{H}_{\mathcal{V},J} \), and \(\mathscr{H}_{\mathrm{twist}}\) are not normalized

Since the TN method approximates the total helicity by the self-helicity only, Fig. 10 compares the not-normalized value of \(\mathscr{H}_{\mathcal{V},J}\) of Eq. (6) from the DeVore_GV method with the \(\mathscr{H}_{\mathrm{twist}}\) from the TN method. A more extensive view of the comparison is reported in Table 6.

Fig. 10
figure 10

Application of the TN method to the TD-twist (a) and resolution (b) tests. The two curves represent the values of \(\mathscr{H}_{\mathrm{twist}}\) of Eq. (32) for the TN method, and of the (nonnormalized) value of \(\mathscr{H}_{\mathcal{V},J}\) for the DeVore_GV method

We find that the accuracy of the estimation increases for higher resolutions and higher twist. In particular, in the \(N=3\) case, \(\mathscr{H}_{\mathrm{twist}}\) has the same value of \(\mathscr{H}_{\mathcal{V},J} \) within errors. In the other cases, larger differences between the TN method and DeVore_GV method are present. By contrast, the not-normalized values of the total helicity \(\mathscr {H}_{\mathcal{V}} =-7.2\) for DeVore_GV for the case \(N=1\), i.e., the total helicity is two orders of magnitude larger than the current helicity in the \(N=1\) case.

We conclude that the quantity \(\mathscr{H}_{\mathrm{twist}}\) provided by the TN method is an estimation of \(\mathscr{H}_{\mathcal{V},J}\) rather than of ℋ (or equivalently \(H_{\mathcal{V}}\)), likely because no modeling of the mutual helicity part is included. Moreover, the accuracy of the method is higher for highly twisted structures, above \(N=1\) in out tests. For \(N=3\), the correct value of \(\mathscr{H}_{\mathcal{V},J}\) is reproduced.

9.2 Connectivity-Based Method

As for the TN method, the CB method can be compared to FV methods only regarding the estimated helicity values. However, we test here for the first time some of the assumptions made in the derivation of the CB method (force-freeness and minimal connectivity-length principle, see Sect. 2.3.2), and their impact on the obtained helicity values. These novel comparisons are made possible by the reliability assessment of FV methods discussed in the previous sections. Moreover, the comparison of the CB methods with the FI methods is discussed in detail by Pariat et al. (2017).

The connectivity-based method is designed for applications to solar magnetograms with a complex flux distribution and an unknown coronal magnetic field. If the lower boundary includes only two connected partitions the code automatically uses the linear force-free field approach of Georgoulis and LaBonte (2007), in which a single value of the force-free parameter \(\alpha\) is used for the entire volume. When the NLFF mode switches on, the CB method has the possibility to replaces the total photospheric magnetic flux by the connected magnetic flux, namely the one included in the magnetic connectivity matrix, see Sect. 2.3. The CB code was tuned to use almost the entire flux of the magnetograms in all case presented here, except when differently explicitly stated.

When applied to the TD cases, where currents are localized, the CB in LFF-mode tends to pick up mostly the potential field component. On the other hand, when applied to the LL cases, where a large-scale \(\alpha\) is present, the CB method yields values of \(H_{\mathcal{V}} \) that are three to four times larger than FV methods. This overestimation effect in case of the LFF field approximation was also reported by Georgoulis et al. (2012). For these two sets of tests, where a single dipole appears, the CB method is hampered by the limitations of the linear force-free theory. Hence, we do not report further on such applications here.

In the MHD-st and MHD-un cases, instead, the magnetogram is complex enough to have more than one connectivity domain. The CB method worked in the NLFF mode for all snapshots at all times, in both MHD-st and MHD-un cases. Figure 11a shows an example of the flux partition and of the resulting connectivity matrix for the MHD-st case at \(t=150\).

Fig. 11
figure 11

Application of the CB method to the MHD-st case. (a) Magnetic connectivity of the MHD-emergence stable model at \(t=150\) used for the calculation of magnetic helicity in the CB method. The partitioned normal magnetic field component on the lower (assumed photospheric) boundary is shown in gray-scale, with black/white contours outlining positive/negative-polarity partitions. The flux-weighted centroids of the partitions are denoted by crosses. Magnetic connections are projected on the lower boundary by colored lines, with different colors denoting different connected-flux contents. The connected flux includes approx. 93.6 % of the total flux present in the field of view. (b) The force-freeness metric \(\sigma_{J}\) as a function of the height of the bottom boundary for MHD-st at \(t=155\). The vertical orange dotted line represents the location of the bottom boundary in the tests of Sect. 9.2, corresponding to \(z=8.9\)

Figure 12 compare the CB method with the DeVore_GV finite volume method.

Fig. 12
figure 12

Comparison of \(H_{\mathcal{V}}\) between the CB and the DeVore_GV method applied to the MHD-st (a, c) and MHD-un cases (b, d) in the full domain (a, b) and in the reduced, more force-free domain (c, d). In panels (c), (d) CB method (blue crosses), the CB method with 3D connectivity information included (green crosses), and the DeVore_GV method (red squares). Note that the DeVore_GV values (c, d) are not the same as (a, b) and in Fig. 4 because the considered volume is different

In the MHD-st case (Fig. 12a), between \(t=50\) and \(t=95\), the of \(H_{\mathcal{V}}\) values obtained by the CB method match reasonably well those from the DeVore_GV one, within a factor 2 at most. Starting from \(t=95\) onwards, however, the \(H_{\mathcal{V}}\) values obtained by the CB method settle on a lower, roughly constant value \(H_{\mathcal{V}}=0.016\), on average. At the end of the simulations this average is about eight times lower than the value reached by the DeVore_GV method.

On the other hand, in the MHD-un case (Fig. 12b), the agreement between the DeVore_GV and the CB methods is very good (within 9 % on average, from \(t=95\) onwards), and the two curves overlap for most of that phase. A local maxima in the CB curve is even present at the time of the eruption, very much the same as for the DeVore_GV method. However, this is not distinguishable from previous, even more pronounced ones, and it would be challenging to identify the time of the eruption only as a decrease of \(H_{\mathcal{V}}\) in the CB time series. As a matter of fact, the examination of the time evolution of the magnetic field at \(z=0\) in the MHD-st and MHD-un simulations shows that there is very little differences between the two cases. Since the CB method aims at an approximate estimation of helicity that is based only on the flux distribution at the (photospheric) bottom boundary at a given time, the task of distinguishing MHD-st from MHD-un based only on the field on that one plane is a very arduous one, indeed. This is probably the reason why the CB method provides similar average values of \(H_{\mathcal{V}}\) for both the MHD-st (equal to 0.015, from \(t=95\) onwards) and the MHD-un case (equal to 0.070 on the same time interval).

Besides the similarity of the MHD-st and MHD-un field distributions at \(z=0\), differences with the DeVore_GV method may have several origins. First of all, the CB-method approach yields a minimal value of helicity for a given photospheric configuration. In this sense, it is expected that the CB \(H_{\mathcal{V}}\)-curves lay, on average, below the DeVore_GV ones, as they do at varying levels in all panels of Fig. 12.

Secondly, the CB method models the coronal field as a discrete collection of a finite number of constant-\(\alpha\) flux tubes. Hence, it can be expected to have better chances of success if the magnetic field is force-free. Figure 11b shows at a representative time, however, that in large part of the volume of the MHD-st case the field is not force-free, as quantified by the relative ratio of the current that is perpendicular to the field in the volume, \(\sigma_{J}\equiv(\int _{\mathcal{V}}|\mathbf{J} _{\perp}| \,{\mathrm {d}}\mathcal {V})/(\int_{\mathcal{V}}|\mathbf{J}| \,{\mathrm {d}}\mathcal {V})\). In particular, the value of \(\sigma_{J}\) computed for increasing heights of the bottom boundary decreases from 0.7 to 0.25 in the first 20 pixels above the bottom boundary.

In order to test how important is the force-free assumption in this case, we repeat the \(H_{\mathcal{V}}\) calculation with the CB and DeVore_GV methods in a reduced volume starting at \(z=8.9\), where \(\sigma_{J}\) at this height has dropped to the value 0.29, see Fig. 11b. The corresponding curves are shown by the blue crosses in Fig. 12c and d for MHD-st and MHD-un, respectively. Since the volume is now changed, also the corresponding DeVore_GV estimations are recalculated for this reduced, more force-free volume. In the MHD-st case, the average CB \(H_{\mathcal{V}}\) after \(t=95\) is 0.07, which is 3.5 times smaller than the final value obtained by the DeVore_GV method (against a factor 8 of the full-volume case). In the MHD-un case in Fig. 12d, the curves obtained by the two methods are slightly closer than in the full-volume case of Fig. 12b, although only marginally (the ratio of the end values being 1.5). Hence, the application to the more force-free, upper part of the volume improves the match between the CB and the DeVore_GV results, markedly so in the MHD-st case, which is a clear indication that the fulfillment of the force-free requirement may help to partially compensate for the \(H_{\mathcal{V}}\) underestimation in Fig. 12a.

Thirdly, the connectivity map between flux partitions is obtained by the CB method as part of the minimization method discussed in Sect. 2.3. However, when the 3D coronal field is available, the true connectivity map can be constructed from the numerical simulation, and the influence of the minimization tested. The result of such a test are represented by the green symbols in Fig. 12c and d, for the stable and unstable cases, respectively (again in the reduced, more force-free volume). It must be noticed that using the 3D information implies a decrease of the amount of flux included in the connectivity matrix to 60–80 %, compared to the 95 % or more employed in the two cases above, since tracking of field lines intersecting the lateral and top boundaries cannot be completed in the CB method, even in case these lines return to the simulation volume by intersecting a different boundary location. The contribution of these lines is, then, ignored.

In general, Fig. 12c demonstrates that the knowledge of the true connectivity in the MHD-st case improves the matching between CB and DeVore_GV methods. The CB-average (after \(t=95\)) \(H_{\mathcal{V}}\) value is slightly above 0.10, which results in just a factor two between the corresponding end values. In the MHD-un case, differences with the standard application of the CB method that does not used the three-dimensional connectivity information are less significant, except for a slight increase of the mismatch with the DeVore_GV method (e.g., the ratio between end values of \(H_{\mathcal{V}}\) obtained by the two methods is down to 1.9). Such relatively small variations can be explained in terms of reduced connected flux. We also recall that, for the CB method, an error analysis by Moraitis et al. (2014) is available that was not included in the discussion presented in this article. It is likely that some of the fluctuations discussed above fall within the error estimation provided by that analysis.

In conclusion, in the MHD-un case the agreement between CB and DeVore_GV (and, by extension, FV) methods is within 10 %, which is very good considering the much more limited amount of information that the CB method requires. On the other hand, in the MHD-st case the helicity is significantly under-estimated, by a factor eight at the end of the simulation. The deficit in \(H_{\mathcal{V}}\) that the CB method shows in the MHD-st case, can be partially ascribed to the exiguous differences between the MHD-st and MHD-un cases in terms of flux distributions at \(z=0\). Additionally, the field at that plane is not quite force-free, and the CB results are shown to improve for a more force-free test volume. Furthermore, the minimization of the connectivity matrix seems to represent connectivity fairly well, in the sense that the implementation of the full three-dimensional information, although improving the CB estimation in the MHD-st case, does not entirely remove the under-estimation of \(H_{\mathcal{V}}\).

10 Conclusions

In this work we review, benchmark, and compare the currently available methods for the computation of the relative magnetic helicity, \(H_{\mathcal{V}}\), in finite volumes. Given that the three-dimensional magnetic-field solutions we use are common for all tested methods, the problem essentially reduces to computing the vector potential of a given discretized input magnetic field. The considered methods group into Coulomb (\(\boldsymbol{\nabla}\cdot\mathbf{A}=0\)) and DeVore (\(A_{\mathrm {z}} =0\)) methods, according to the gauge in which the vector potentials are written. A total of six different implementations including three Coulomb methods (Coulomb_JT, Coulomb_SY, and Coulomb_GR) and three DeVore methods (DeVore_SA, DeVore_KM, and DeVore_GV) are included which differ in the equations they solve and/or in their numerical implementations. Details of these implementations can be found in Thalmann et al. (2011) (Coulomb_JT), Yang et al. (2013b) (Coulomb_SY), Rudenko and Anfinogentov (2014) (Coulomb_GR), Valori et al. (2012) (DeVore_GV), Moraitis et al. (2014) (DeVore_KM), and in Sect. 2.2 (DeVore_SA). Accordingly, a different level of numerical complexity and computational effort is required to solve for the vector potentials, with the Coulomb methods being essentially far more demanding than DeVore methods (see Sect. 2). As a case in point, the Coulomb_GR method could not be tested on cases above \(128^{3}\) pixels due to the large running time required by its current implementation.

The tested methods are put under severe strain by choosing a variety of numerical test input fields that are considered to be relevant for helicity studies in solar-physics applications, from 3D force-free equilibria (LL and TD of Sects. 4.1 and 4.2, respectively), to snapshots of time-dependent non-force-free MHD simulations of flux emergence (Sect. 4.3). Depending on details of the test field being studied, the accuracy in the computation of \(H_{\mathcal{V}}\) by different methods is found to vary to some extent, especially for Coulomb methods. We can, however, definitely conclude that in solar-like cases practically all FV methods converge to the same helicity value within few percent.Footnote 3 Such a spread is likely to be overrun by other sources of errors in applications to observed—and reconstructed—coronal fields, but it is definitely to be considered in helicity estimations of numerical simulations.

More in detail, the helicity values \(H_{\mathcal{V}}\) in the most relevant test of time-dependent MHD evolution in a coronal model volume (i.e., the MHD-st and MHD-un tests of Sect. 4.3) show a very good agreement of few percent between different methods, somewhat independently of the details in the vector potentials computation, see e.g., Fig. 4. Such errors are as small as 0.2 % in the case where the field is slowly evolving, and always below 3 % even in the highly dynamical eruptive phase. Similarly, excluding the Coulomb_GR case, despite differences in the accuracy of the vector potential computation, helicity values computed by different methods for the TD-twist case are within 2 %. In other words, when helicity computations are applied to numerical volumes as in this article, differences in the way \(H_{\mathcal{V}}\) is computed can amount to 3 % at most.

Such an agreement is tested and verified to hold independently of the dynamical evolution of the field and consistently throughout the MHD evolution of an eruption, thereby justifying the application of FV methods to the study of helicity in numerical simulations, and for benchmarking other helicity computation methods. For instance, Pariat et al. (2017) employs finite volume methods to benchmark helicity-flux integration methods applied to MHD-st and MHD-un evolution, where the flux of helicity is estimated by the photospheric evolution of the field.

In addition to finite volume methods, we also include other two methods that use (Guo et al. 2010, TN) or optionally make use of (Georgoulis et al. 2012, CB) the 3D information of the magnetic field in the volume, see Sect. 9. The TN method estimates the helicity content of a field by parametrically fitting a flux rope to it. Therefore, it is applicable to tests that include an identifiable flux rope, namely to TD, MHD-st, and MHD-un cases. For the TD cases, we find that the TN method yields relatively accurate estimations of twist and possibly of \(\mathscr{H}_{\mathcal {V},J}\) in high-twist cases, but not of the total helicity \(H_{\mathcal{V}}\). A report on the application of the TN method to other cases, including the MHD-st and MHD-un ones, is in preparation by Guo et al. (2017).

The CB method is designed to be applied to complex photospheric flux distributions with an unknown coronal magnetic field, where a multi-polar partition of the flux yields a coronal field approximated by a collection of flux tubes of constant \(J_{z}/B_{\mathrm {z}}\). In addition, a minimal free energy and the corresponding relative helicity are sought. Cases like the LL and TD have a too simple connectivity for the CB method, which then falls back to a single flux-tube, purely linear approximation of the (force-free) field. In the more complex MHD-un case, the CB method provides an estimation of the helicity that is, on average, within 10 % of the one obtained by FV methods. This is a positive result given that the CB method employs only the photospheric information, whereas FV methods use the full 3D information about the coronal field. The MHD-st case poses more difficulties to the coronal field approximation within the CB method, which, in this case, underestimate significantly the helicity content of the field.

Finite volume methods can be used when the magnetic field is known in the entire volume of interest. However, in applications to solar observations, the magnetic field is typically known only on a surface at photospheric heights, and only with limited accuracy. Hence, in order to know the magnetic helicity in a given coronal volume, a model need to be computed that approximates the coronal field on the base of its photospheric values, which introduce an additional dependence to the estimated \(H_{\mathcal{V}}\) values. The impact on helicity values of the employed coronal model, being it from a nonlinear force-free extrapolation or from a data-driven simulation, is yet to be tested. Alternatively, the CB method can be used, as it is designed for such cases. A further alternative would be to compute the flux of helicity passing through the “photospheric plane” in time. Reviewing and benchmarking FI methods for the estimation of the helicity flux is the subject of Pariat et al. (2017).