Introduction

Twisted flux tubes are prominent candidates for the progenitors of solar active regions1,2,3,4. Twist allows a flux tube to suffer less deformation in the convection zone compared to untwisted tubes, thus allowing it to survive and reach the photosphere to emerge2,5,6. Further, simulations of twisted flux tube emergence have reproduced signatures that can be found in observations1,3. This has led to observational proxies (such as sigmoidal field lines in the atmosphere3,7 and magnetic tongue patterns in magnetograms8,9) that are indicative of twisted tube emergence. Although highly suggestive, such proxies cannot provide direct and conclusive evidence of the emergence of a twisted flux tube from the convection zone to the solar atmosphere. This is because their signatures can also be created by magnetic fields that are not pre-twisted flux tubes10. Further, the signatures of these proxies can also be created by photospheric motions deforming simple magnetic fields, e.g., shearing flows along the polarity inversion line of an active region leading to sigmoidal field lines11,12. Some studies13,14,15, by focussing on photospheric motions deforming magnetic fields, have concluded that pre-twisted magnetic fields do emerge. However, the question of whether or not twisted magnetic flux tubes create active regions has remained open, despite these important results. This is largely due to the complex nature of flux emergence.

Twist in a magnetic field is a manifestation of magnetic topology, which describes the connectivity of field lines. A classical measure of magnetic topology is magnetic helicity16. This quantity describes the field line topology (in terms of Gauss linkage16 or winding17, depending on the precise application) weighted by magnetic flux. Further, the flux of magnetic helicity through the photosphere can be measured in solar observations18,19, so this topological quantity can potentially indicate what kind of magnetic topology is emerging. Many works18,19,20,21,22,23,24,25,26,27,28,29,30 have studied the injection of this quantity in active regions, but a clear-cut indication of an emerging magnetic field’s magnetic topology from magnetic helicity flux has remained elusive. One reason for this is that magnetic helicity combines two distinct properties, field line topology and magnetic flux, into one quantity. This combination can result in confounding the interpretation of the helicity flux. For example, an emerging field with simple (weak) field line topology could have a very strong field strength. Thus, a strong input of helicity does not necessarily indicate that complex (strong) magnetic topology is emerging into the solar atmosphere. Similarly, a magnetic field with a highly twisted topology but weak flux, can result in a weak helicity input, and so also not give an accurate indication of the true nature of the field line topology emerging into the atmosphere.

Magnetic winding17 is a renormalisation of magnetic helicity that removes the magnetic flux weighting, and thus provides a direct measure of magnetic topology. Despite its close connection to magnetic helicity, magnetic winding can behave very differently in an evolving magnetic field and, hence, provide distinct information. Further, magnetic winding flux can be calculated from observations just like the helicity flux (there also exist local versions that can be estimated in the solar atmosphere31). Magnetic winding flux has been studied in simulations of magnetic flux emergence, including twisted flux tubes and more complex magnetic topologies32,33. Over a wide range of physical parameters, the accumulation of winding (the time-integrated winding flux) during the initial emergence of a twisted flux tube produces a consistent signature: an initial increase in the magnitude of the winding input followed by a plateau. This signature indicates that the twisted tube (or, at least, a substantial part of it) passes through the photospheric boundary (where the flux calculation is performed) and then essentially remains above this plane afterwards (until perhaps much later times when the active region begins to decay, but we are only interested in the initial stages of emergence here). Even the effects of convection, in simulations, which act to drag down parts of the emerged field and create a serpentine geometry, have little effect on the winding input signature, as the magnetic topology is still dominated by the twist in the tube that remains primarily above the photospheric boundary. By contrast, the net magnetic helicity input can change sign during the emergence of twisted flux ropes due to the strength of convective down-flows, leading to a potential misinterpretation of the magnetic field’s structure, i.e. a failure to diagnose the true twisted nature of the emerging field33. This is not to say that the magnetic helicity flux produces an erroneous signal but, rather, that it provides information based on a combination of factors and not just the global magnetic topology. For this reason, previous observational studies of magnetic helicity input produce complex signatures. From this perspective, the combination of both magnetic winding and magnetic helicity can provide much more detailed information about the dynamics and topology of emerging magnetic fields.

In this work, we show that magnetic winding flux can be used to detect the emergence of pre-twisted magnetic fields in solar observations, as well as in simulations. We show that magnetic winding produces a clear and consistent signature for emerging flux tubes that is not found by studying the magnetic helicity flux. Combining the information given by magnetic winding with other proxies and measures (including magnetic helicity) provides a much more detailed picture of the topological structure and evolution of an emerging solar active region.

Results

Simulation example

An example of the winding signature described above, from a magnetohydrodynamic simulation of the initial stages of the emergence of a twisted flux tube, is shown in Fig. 1.

Fig. 1: Simulation of the initial emergence of a twisted magnetic tube.
figure 1

(a) displays field lines at \(t\) = 2500 s, with a slice indicating the horizontal photospheric boundary (red plane) where the magnetic field is measured. The \(x\)-, \(y\)- and \(z\)-directions are indicated. The colour bar indicates (dimensionless) magnetic field strength (to convert to physical units, see Methods: Numerical simulation details). Darker colours (mainly blue) indicate weaker field strengths and lighter colours (green and yellow) indicate stronger field strengths. In (b), the emergence accumulation \({L}_{{{{{\rm{emerge}}}}}}\) (yellow line), the braiding accumulation \({L}_{{{{{\rm{braid}}}}}}\) (red line), and the total winding accumulation \(L={L}_{{{{{\rm{emerge}}}}}}+{L}_{{{{{\rm{braid}}}}}}\) (blue line) are displayed. \(5\times {L}_{{{{{\rm{braid}}}}}}\) is displayed on the figure in order to convey clearly how \({L}_{{{{{{\rm{braid}}}}}}}\) develops in time.

Figure 1(a) shows the emerged flux tube, at \(t\)=2500s, which has been deformed significantly by convection and developed a serpentine field line geometry. Any clear visual resemblance to a twisted tube is lost and the emerged magnetic field has the form of a collection of magnetic arcades. Indeed, it is important to point out that when we refer to twisted tube emergence, we are not implying that a coherent twisted flux tube emerges bodily from the convection zone to the corona. Instead, the tube emerges into the photosphere and the bulk of the twist remains there, continually being deformed by convection. As the magnetic field expands into the atmosphere, it evolves into one or several shear arcades, depending on the complexity of the region and the subsequent magnetic reconfiguration1,2,3. Therefore, when we speak of realistic twisted flux tubes in the convection zone, we refer to compact (in a tubular-like domain) magnetic fields with a net value of non-zero helicity, i.e. an overall net twist. Perturbations due to convection, which add twist locally, as seen in Fig. 1(a), but add zero net helicity to the magnetic field do not affect the magnetic winding, which is clear from Fig. 1(b).

Figure 1(b) shows the accumulation of winding above the photospheric boundary. There are three profiles to consider: the total winding accumulation, the braiding accumulation and the emergence accumulation. The calculation of the magnetic winding depends on two components of the magnetic field line velocity \({{{{{\bf{u}}}}}}\) on the planar photospheric boundary: a velocity due to in-plane motion, \({{{{{{\bf{v}}}}}}}_{{{{{{\rm{||}}}}}}}\), and a velocity due to the emergence of the magnetic field, \(-{v}_{z}{{{{{{\bf{B}}}}}}}_{{{{{{\rm{||}}}}}}}{/B}_{z}\), where \({{{{{\bf{v}}}}}}=({{{{{{\bf{v}}}}}}}_{{{{{{\rm{||}}}}}}},{v}_{z})\) is the plasma velocity field and \({{{{{\bf{B}}}}}}=({{{{{{\bf{B}}}}}}}_{{||}},{B}_{z})\) is the magnetic field (parallel subscripts indicate being parallel to the photospheric plane). The braiding accumulation \({L}_{{{{{{\rm{braid}}}}}}}\) describes the winding input due to only the in-plane velocity and measures the entanglement of the magnetic field due to horizontal photospheric motions. The emergence accumulation \({L}_{{{{{{\rm{emerge}}}}}}}\) describes the winding input due to only the emergence velocity and measures the contribution to winding due to pre-entangled emerging magnetic field (for more details, see Methods: Helicity and winding flux calculations). The total winding accumulation follows the signature described previously. Importantly, the emergence accumulation dominates strongly over the braiding accumulation. This result states that the input of magnetic winding into the atmosphere is due primarily to the emergence of a pre-entangled magnetic field with a net twist and not due to horizontal motions twisting the magnetic field at the photosphere. The signature in Fig. 1(b) indicates that the emerging entangled field is dominated by a positive twist of the magnetic field lines. More complex field line topologies with zero net twist have been shown not to create such a clear plateau accumulation signature32. The magnetic winding is robust enough to detect the twisted field line topology despite the substantial deformation to the original flux tube in the convection zone. Another example of this, for an emerging twisted tube with perturbations adding zero net twist and no clear bipolar structure, is presented in the Supplementary Information.

Observational analysis

We now present direct evidence of twisted flux tube emergence in solar observations. For the purpose of this article, we focus on clean cases (isolated and coherent bipolar regions) that can be compared to, as closely as possible, the results from simulations. The active regions in the observations we consider are much larger than that of the simulation presented earlier. However, the result that we are testing for is not strictly scale-dependent, i.e., the same signature applies to large or small tubes, as long as they emerge above the photospheric boundary.

We first consider the National Oceanic and Atmospheric Region (NOAA) active region AR11318. We choose to study this region as it represents a small and simple bipolar region that can be compared to, within reason, flux emergence simulations. This region has also been studied in detail by measuring a range of different observational signatures29. These signatures, however, are still not enough to confirm that a coherent twisted flux tube has emerged to create this bipolar region. Figure 2 shows the winding accumulation for the initial emergence of AR11318, starting from 20:00UT on October 11th 2011, when the active region was located at −15° with respect to the central meridian, and lasting for 80 h. This time span covers both the initial increase of line-of-sight magnetic flux and a period of its stabilisation29. To perform winding flux calculations, we use Space-Weather Helioseismic and Magnetic Imager (HMI) Active Region Patches (SHARP)34 vector magnetograms taken by HMI on board of the Solar Dynamics Observatory (SDO), and we determine the plasma velocity using the Differential Affine Velocity Estimator for Vector Magnetograms (DAVE4VM)35. The SHARP vector magnetograms have a pixel resolution of 0”.5 and a time cadence of 720 s.

Fig. 2: Winding accumulation for AR11318.
figure 2

The emergence accumulation \({L}_{{{{{\rm{emerge}}}}}}\) (yellow line), the braiding accumulation \({L}_{{{{{{\rm{braid}}}}}}}\) (red line), and the total winding accumulation \(L={L}_{{{{{\rm{emerge}}}}}}+{L}_{{{{{\rm{braid}}}}}}\) (blue line) are displayed. The missing data are between t = 20 and t = 30 h. Source data are provided as a Source Data file.

Between t = 20 and t = 30 h, there are missing data, which result in an artificial plateau in the accumulation curves. Ignoring this data gap, the total winding accumulation \(L\) (calculated with both velocity components) follows the signature of Fig. 1(b) (and other simulations32,33), namely a strong rise followed by a plateau. It is clear from Fig. 2 that the emergence accumulation dominates strongly over the braiding accumulation, and so the winding input is due primarily to the emergence of a pre-twisted structure rather than an untwisted structure whose twist develops in the solar atmosphere due to photospheric motions. If, during the data gap, the curves were to follow their approximately constant gradients (a reasonable assumption based on the behaviour of the gradients immediately before and after the data gap), the difference between \({L}_{{{{{\rm{emerge}}}}}}\) and \({L}_{{{{{\rm{braid}}}}}}\) would be even greater than that displayed in Fig. 2. This signature, together with those found previously29 for AR11318 (magnetic tongues and the development of sigmoidal field lines) that follow the emergence evolution expected from simulations of twisted tube emergence1,2,3, clearly and directly demonstrates that the region was formed by an emerging twisted flux tube.

Figure 3 displays distributions of (a) \({{{\rm{d}}}}{L}_{{{{{{\rm{braid}}}}}}}/{{{\rm{d}}}}t\) and (b) \({{{\rm{d}}}}{L}_{{{{{{\rm{emerge}}}}}}}/{{{\rm{d}}}}t\) of AR11318 at \(t=42\,\)h. The contribution due to emergence dominates the region between the sunspots, where the horizontal part of the twisted tube emerges. The contribution due to braiding is much weaker and spread throughout the domain. There are also coherent patches near the sunspots which move apart during the emergence of the region.

Fig. 3: Winding flux distributions for AR11318 during the rise phase.
figure 3

Distributions of (a) \({{{\rm{d}}}}{L}_{{{{{\rm{braid}}}}}}/{{{{\rm{d}}}}}t\) and (b) \({{{\rm{d}}}}{L}_{{{{{\rm{emerge}}}}}}/{{{\rm{d}}}}t\) of AR11318 at \(t=42\,\)h. The orange contours indicate a field strength of 800 G (and thus indicate the sunspot locations). X and Y are distances along the \(x\)- and \(y\)-directions.

At later times, once the main bulk of the flux tube has emerged, and the winding accumulation reaches its plateau, the large-scale features of the magnetic winding distributions disperse. Figure 4 displays distributions of (a) \({{{\rm{d}}}}{L}_{{{{{{\rm{braid}}}}}}}/{{{\rm{d}}}}t\) and (b) \({{{\rm{d}}}}{L}_{{{{{{\rm{emerge}}}}}}}/{{{\rm{d}}}}t\) of AR11318 at \(t=78\) h.

Fig. 4: Winding flux distributions of AR11318 during the plateau phase.
figure 4

Distributions of (a) \({{{\rm{d}}}}{L}_{{{{{{\rm{braid}}}}}}}/{{{\rm{d}}}}t\) and (b) \({{{\rm{d}}}}{L}_{{{{{{\rm{emerge}}}}}}}/{{{\rm{d}}}}t\) of AR11318 at \(t=78\) h. The orange contours indicate a field strength of \({B}_{z}=800\) G. X and Y are distances along the \(x\)- and \(y\)-directions.

The large-scale coherent features of the emergence contribution seen in Fig. 3(b) have all but disappeared as no significant magnetic field (i.e. on the active region scale) with nontrivial topology is emerging.

The behaviour of the winding profiles and distributions can be explained with the aid of the cartoon shown in Fig. 5. This cartoon indicates what parts of an emerging twisted magnetic field contribute to the winding accumulation. The emergence velocity is most prominent between the sunspots where \({B}_{z}\) is weaker and \({{{{{{\bf{B}}}}}}}_{{||}}\) is at its strongest. It is between the sunspots where the main bulk of the twisted tube emerges and this results in a strong signal in the emergence accumulation (see Fig. 3(b)). The in-plane velocity is stronger near the sunspots and is generally weaker between the sunspots. These considerations are important for understanding why the magnetic winding flux can detect the emergence of large-scale entanglement (twist in this case) clearly whereas the magnetic helicity flux may not. In magnetic helicity flux calculations, each point on the photosphere is weighted by \({B}_{z}\). The effect of this is to make the contribution of the emergence velocity small, since \({B}_{z}\) is weaker between the sunspots (for the simple emerging twisted tube under consideration here). Hence, the magnetic helicity flux input is dominated by the in-plane velocity contribution at the sunspots, which is weighted by strong \({B}_{z}\). Therefore, the magnetic helicity flux may not adequately diagnose the emergence of twisted magnetic field emerging between the sunspots. Figure 6 displays the helicity accumulation for AR11318. The importance of the emergence and braid components is now the opposite to that of the winding, in line with our description above. Figure 7 shows the helicity input distributions at \(t=42\) h. Again, as per the above discussion, the helicity input is dominated by the sunspots, due to the weighting of strong \({B}_{z},\) and so the bulk of the signature of the twisted flux tube emerging between the spots is missed.

Fig. 5: Influence of velocity components.
figure 5

A cartoon showing field lines (in blue) of an emerging twisted flux tube above a planar boundary (shown in grey) representing the photosphere. A map of \({B}_{z}\) is displayed on the photospheric boundary. White indicates \({B}_{z} \; > \;0\) and black indicates \({B}_{z} \; < \;0\). The field line velocity \({{{{{\bf{u}}}}}}\) has two components: in-plane (purple) and emergence (orange), which play important roles at different parts of an emerging twisted flux tube, as indicated. Scale is not presented as the result applies to both large and small flux tubes.

Fig. 6: Helicity accumulation for AR11318.
figure 6

The emergence accumulation \({H}_{{{{{{\rm{emerge}}}}}}}\) (yellow line), the braiding accumulation \({H}_{{{{{{\rm{braid}}}}}}}\) (red line), and the total helicity accumulation \(H={H}_{{{{{{\rm{emerge}}}}}}}+{H}_{{{{{{\rm{braid}}}}}}}\) (blue line) are displayed. Source data are provided as a Source Data file.

Fig. 7: Helicity flux distributions.
figure 7

Distributions of (a) \({{{\rm{d}}}}{H}_{{{{{{\rm{emerge}}}}}}}/{{{\rm{d}}}}t\) and (b) \({{{\rm{d}}}}{H}_{{{{{{\rm{braid}}}}}}}/{{{\rm{d}}}}t\) of AR11318 at \(t=42\) h. The orange contours indicate a field strength of \({B}_{z}=800\)G (and thus indicate the sunspot locations). X and Y are distances along the \(x\)- and \(y\)-directions.

It is of interest to note that the plateau of the magnetic winding accumulation (and, for this particular region, the plateau of the magnetic helicity accumulation) occurs after the plateau of the emerging line-of-sight magnetic flux accumulation (see Fig. 6 of Romano et al.29). Therefore, if increasing magnetic flux traditionally represents the emergence phase of the active region and the flux plateau represents the start of its decay phase, why do the winding and helicity accumulations continue to grow in the decay phase? The answer is that the magnetic flux accumulation does not provide a complete picture of the emergence process. Flux emergence simulations have long supported the two-stage picture of flux tube emergence, where a twisted tube can rise to the base of the photosphere and emerge into the atmosphere after a time delay2,3,33. The line-of-sight magnetic flux accumulation records the main flux build-up due to the sunspots, but does not take into account the emergence of the horizontal magnetic field between the sunspots. The magnetic winding and helicity fluxes do take this horizontal magnetic field into account, with the signal more dominant in the winding flux than the helicity flux. Therefore, since the emergence of the horizontal part of the emerging magnetic field need not be co-temporal with the behaviour of the line-of-sight magnetic flux accumulation, the magnetic winding and helicity accumulations do not need to be in one-to-one time correspondence with the magnetic flux accumulation either. Also, the braiding of field lines at the photosphere is expected to continue after the initial phase of emergence due to subsequent photospheric motions, so this contribution can also result in the lack of a one-to-one time correspondence between the magnetic winding and helicity accumulations and the magnetic flux accumulation.

Other clean examples of twisted flux tube emergence can be found. Figure 8 shows the winding accumulation during the initial emergence of AR12203, starting at 13:00UT on 30th October 2014 and lasting for 80 h, just as for AR11318 in Fig. 2. In this region, a negative (left-handed) twist emerges into the atmosphere. Again, the emergence accumulation dominates strongly over the braiding accumulation and provides a clear signature that the magnetic topology of this region comes initially from the emergence and not photospheric shearing motions. Examining other signatures, such as those studied previously for AR1131829, reveals a similar initial evolution. Figure 9 displays the helicity accumulation of AR12203. As for AR11318, the importance of the emergence and braiding contributions has now switched compared to the winding accumulation. These helicity inputs, unlike the winding inputs, do not give a clear indication of how the topology of the emerging magnetic field enters into the atmosphere.

Fig. 8: Winding accumulation of AR12203.
figure 8

The emergence accumulation \({L}_{{{{{{\rm{emerge}}}}}}}\) (yellow line), the braiding accumulation \({L}_{{{{{{\rm{braid}}}}}}}\) (red line), and the total winding accumulation \(L={L}_{{{{{{\rm{emerge}}}}}}}+{L}_{{{{{{\rm{braid}}}}}}}\) (blue line) are displayed. Source data are provided as a Source Data file.

Fig. 9: Helicity accumulation for AR12203.
figure 9

The emergence accumulation \({H}_{{{{{{\rm{emerge}}}}}}}\) (yellow line), the braiding accumulation \({H}_{{{{{{\rm{braid}}}}}}}\) (red line), and the total helicity accumulation \(H={H}_{{{{{{\rm{emerge}}}}}}}+{H}_{{{{{{\rm{braid}}}}}}}\) (blue line) are displayed. Source data are provided as a Source Data file.

Discussion

Magnetic winding, in combination with other measurable quantities (such as magnetic helicity) and proxies, provides a powerful analysis tool that can give direct information about magnetic topology. We have given examples of active region observations where the magnetic winding gives a clear indication that the emerging magnetic field is composed of pre-twisted magnetic field. This confirms that, as assumed in many theoretical studies, pre-twisted flux tubes play a fundamental role in active region formation. The pre-twisted magnetic field that emerges into the photosphere represents a source to explain, self-consistently, the shearing, rotational and compressional motions invoked in models of coronal mass ejection formation. These motions can develop due to the transportation of twist into the higher atmosphere as the magnetic field expands into the corona1,3,36,37. Although we have presented evidence that twisted flux tubes can create active regions, it is likely that other magnetic topologies also emerge to create active regions. This is an important area of research, for which magnetic winding will play a pivotal role.

Methods

Numerical simulation details

The flux emergence simulation was performed using the open-source Lare3D code38, which solves the equations of magnetohydrodynamics (MHD). The version we used includes an extended energy equation to allow for the modelling of convection, the details of which are described in a previous study33. The setup of the simulation is almost identical to that previous study but, for completeness, we describe the key details of the computational model. The nondimensional equations solved are those of compressible and ideal MHD,

$$\left(\frac{\partial }{\partial t}+{{{{{\bf{v}}}}}}\cdot {{{{{\boldsymbol{\nabla }}}}}}\right)\rho =-\rho {{{{{\boldsymbol{\nabla }}}}}}\cdot {{{{{\bf{v}}}}}},$$
(1)
$$\rho \left(\frac{\partial }{\partial t}+{{{{{\bf{v}}}}}}\cdot {{{{{\boldsymbol{\nabla }}}}}}\right){{{{{\bf{v}}}}}}=-{{{{{\boldsymbol{\nabla }}}}}}p+\left({{{{{\boldsymbol{\nabla }}}}}}\times {{{{{\bf{B}}}}}}\right)\times {{{{{\bf{B}}}}}}+{{{{{\boldsymbol{\nabla }}}}}}\cdot {{{{{\boldsymbol{\sigma }}}}}}+ \rho {{{{{\bf{g}}}}}},$$
(2)
$$\rho \left(\frac{\partial }{\partial t}+{{{{{\bf{v}}}}}}\cdot {{{{{\boldsymbol{\nabla }}}}}}\right)\varepsilon =-p{{{{{\boldsymbol{\nabla }}}}}}\cdot {{{{{\bf{u}}}}}}+{{{{{\boldsymbol{\sigma }}}}}}{{{{{\rm{:}}}}}}{{{{{\boldsymbol{\nabla }}}}}}{{{{{\bf{v}}}}}}-\frac{\varepsilon -{\varepsilon }_{0}}{\tau },$$
(3)
$$\rho \left(\frac{\partial }{\partial t}+{{{{{\bf{v}}}}}}\cdot {{{{{\boldsymbol{\nabla }}}}}}\right){{{{{\bf{B}}}}}}=\left({{{{{\bf{B}}}}}}\cdot {{{{{\boldsymbol{\nabla }}}}}}\right){{{{{\bf{v}}}}}}-\left({{{{{\boldsymbol{\nabla }}}}}}\cdot {{{{{\bf{v}}}}}}\right){{{{{\bf{B}}}}}},$$
(4)
$${{{{{\boldsymbol{\nabla }}}}}}\cdot {{{{{\bf{B}}}}}}=0.$$
(5)

The variables are the density \(\rho\), the pressure \(p\), the magnetic field \({{{{{\bf{B}}}}}}\), the plasma velocity field \({{{{{\bf{v}}}}}}\), the (uniform) gravitational acceleration \({{{{{\bf{g}}}}}}\), the ratio of specific heats \(\gamma =5/3\) and the specific energy density \(\varepsilon =p/[\left(\gamma -1\right)\rho ]\). The associated temperature is given by \(T=(\gamma -1)\varepsilon\). The viscosity tensor \({{{{{\boldsymbol{\sigma }}}}}}\) is that of a Newtonian fluid33. Radiative effects in the atmosphere are modelled with the Newton cooling term in Eq. (3). Here, \(\tau\) is the cooling time scale and \({\varepsilon }_{0}\) is the profile of the specific energy density at the start of the simulation.

The variables are made dimensionless with respect to photospheric values: pressure \({p}_{{{{{\rm{ph}}}}}}=1.4\times {10}^{4}\) Pa; density \({\rho }_{{{{{\rm{ph}}}}}}=2\times {10}^{-4}\) kg m−3; speed \({v}_{{{{{\rm{ph}}}}}}=6.8\) km s−1; scale height \({H}_{{{{{\rm{ph}}}}}}=170\) km; time \({t}_{{{{{\rm{ph}}}}}}=25\) s; surface gravity \({g}_{{{{{\rm{ph}}}}}}=2.7\times {10}^{2}\) m s−2; magnetic field strength \({B}_{{{{{\rm{ph}}}}}}=1.3\times {10}^{3}\) G; temperature \({T}_{{{{{\rm{ph}}}}}}=5.6\times {10}^{3}\) K. The cooling time has a dimensionless value of \(\tau =0.5\).

The computational domain is split into four regions. Beneath the atmosphere is the convection zone \((z \; < \; 0)\). Above the convection zone is a layer representing the photosphere/chromosphere \((0\;\le\; z\le 10)\). Above this lies the transition region \((10 \; < \; z\;\le\; 20)\) and the corona \((z \; > \; 20)\). Here, \(z\) is the dimensionless height variable. The initial background atmosphere is in hydrostatic balance, with a plane-parallel temperature profile given by

$$T\left(z\right)=\left\{\begin{array}{c}\begin{array}{c}1-\delta z\frac{\gamma \;-\;1}{\gamma },z \; < \; 0,\\ 1,0\le z\le 10,\\ {150}^{\left[\frac{z-10}{10}\right]},10 \; < \; z\le 20,\end{array}\\ 150,z \; > \; 20,\end{array}\right.$$
(6)

where \(\delta\) is a nondimensional parameter that controls convection. For a convectively unstable layer that produces convection cells at the photosphere with properties close to those on the Sun, we take \(\delta =1.3\).

In order to excite convection, at \(t=0\), a perturbation in the \(z\)-component of the velocity is introduced and has the form

$${v}_{z}=\frac{1}{10}{e}^{-{\left(z+5\right)}^{2}}\left[2{\cos }\left(\frac{2\pi x}{6\sqrt{3}}\right){\cos }\left(\frac{2\pi y}{18}\right)+{\cos }\left(\frac{4\pi y}{18}\right)\right].$$
(7)

This perturbation is also used in a previous study33, though other similar perturbations can also produce the same required effect.

The initial magnetic field is given, in cylindrical coordinates, by

$${B}_{r}=0,{B}_{y}={B}_{0}{e}^{-\frac{{r}^{2}}{{d}^{2}}},{B}_{\theta }=\alpha r{B}_{y},$$
(8)

where \({r}^{2}={x}^{2}+{(z-{z}_{{{{{\rm{axis}}}}}})}^{2}\), \(d\) is the flux tube radius, \({B}_{0}\) is the field strength at the axis of the tube and \(\alpha\) is the uniform twist. For the simulation presented here, we take \({z}_{{{{{\rm{axis}}}}}}=-15,\) \(d=3\), \({B}_{0}=2.5\;(3.25\times {10}^{3}{{{{{\rm{G}}}}}})\) and \(\alpha =0.4\). To make the tube buoyant, a density deficit is introduced, with a profile of the form \(\exp (-{y}^{2}/{\lambda }^{2})\), where \(\lambda =20\).

The computational domain size is \(\left(x,y,z\right)\in \left[-{{{{\mathrm{80,80}}}}}\right]\times \left[-{{{{\mathrm{80,80}}}}}\right]\times [-{{{{\mathrm{30,80}}}}}]\). There is a uniform resolution of 4323.

Helicity and winding flux calculations

The helicity flux through the photospheric boundary \(P\) is given by

$$\frac{{{{{\rm{d}}}}}H}{{{{\rm{d}}}}t}=-\displaystyle\frac{1}{2\pi }\displaystyle\int_{P\times P}\frac{{{{\rm{d}}}}\theta \left({{{{{\bf{x}}}}}},\;{{{{{\bf{y}}}}}}\right)}{{{{\rm{d}}}} t}{B}_{z}\left({{{{{\bf{x}}}}}}\right){B}_{z}\left({{{{{\bf{y}}}}}}\right){{{{\rm{d}}}}}^{2}x\,{{{{\rm{d}}}}}^{2}y,$$
(9)

where \({B}_{z}\) is the component of the magnetic field \({{{{{\bf{B}}}}}}\) orthogonal to \(P\), \({{{{{\bf{x}}}}}}\) and \({{{{{\bf{y}}}}}}\) are position vectors in \(P\) that mark the intersection of field lines with the plane, and \(\theta \left({{{{{\bf{x}}}}}},{{{{{\bf{y}}}}}}\right)\) is the angle made by the vector \({{{{{\bf{x}}}}}}-{{{{{\bf{y}}}}}}\) in \(P\). The rate of change of this angle, measuring the rate of pairwise rotation of field lines, is given by

$$\frac{{{{\rm{d}}}}\theta \left({{{{{\bf{x}}}}}},{{{{{\bf{y}}}}}}\right)}{{{{\rm{d}}}}t}={{{{{{\bf{e}}}}}}}_{z}{{{{{\boldsymbol{\cdot }}}}}}\frac{\left({{{{{\bf{x}}}}}}-{{{{{\bf{y}}}}}}\right)}{{\left|{{{{{\bf{x}}}}}}-{{{{{\bf{y}}}}}}\right|}^{{{{{{\bf{2}}}}}}}}{{\times }}\left(\frac{{{{\rm{d}}}}{{{{{\bf{x}}}}}}}{{{{\rm{d}}}}t}-\frac{{{{\rm{d}}}}{{{{{\bf{y}}}}}}}{{{{\rm{d}}}}t}\right),$$
(10)

where \({{{{{{\bf{e}}}}}}}_{z}\) is the unit vector orthogonal to \(P\). In the formula above, the motion of a point \({{{{{\bf{x}}}}}}\), representing the intersection of a field line with \(P\), is given by the field line velocity \({{{{{\bf{u}}}}}}\)18,19,

$${{{{{\bf{u}}}}}}\left({{{{{\bf{x}}}}}}\right)=\frac{{{{\rm{d}}}}{{{{{\bf{x}}}}}}}{{{{\rm{d}}}}t}={{{{{{\bf{v}}}}}}}_{{{{{{\rm{||}}}}}}}\left({{{{{\bf{x}}}}}}\right)-\frac{{v}_{z}\left({{{{{\bf{x}}}}}}\right)}{{B}_{z}\left({{{{{\bf{x}}}}}}\right)}{{{{{{\bf{B}}}}}}}_{{{{{{\rm{||}}}}}}}\left({{{{{\bf{x}}}}}}\right),$$
(11)

where \({{{{{\bf{v}}}}}}\) is the plasma velocity. The first term on the right-hand side is the in-plane velocity which braids the magnetic field in the atmosphere. The second term on the right-hand side is due to the emergence of the magnetic field, which causes apparent motion of the field line. The braiding contribution to helicity (and, similarly for the winding defined below) is found by setting \({{{{{\bf{u}}}}}}={{{{{{\bf{v}}}}}}}_{{||}}.\) Similarly, the emergence contribution is found by setting \({{{{{\bf{u}}}}}}=-{v}_{z}{{{{{{\bf{B}}}}}}}_{{||}}{/B}_{z}\).

The winding flux is given by

$$\frac{{{{\rm{d}}}}L}{{{{\rm{d}}}}t}=-\frac{1}{2\pi }{\int }_{P\times P}\frac{{{{\rm{d}}}}\theta \left({{{{{\bf{x}}}}}},{{{{{\bf{y}}}}}}\right)}{{{{\rm{d}}}}t}{\sigma }_{z}\left({{{{{\bf{x}}}}}}\right){\sigma }_{z}\left({{{{{\bf{y}}}}}}\right){{{{\rm{d}}}}}^{2}x\,{{{{\rm{d}}}}}^{2}y,$$
(12)

where the \({{{{{{\bf{e}}}}}}}_{z}\)-component of the magnetic field is replaced by the indicator function

$${\sigma }_{z}\left({{{{{\bf{x}}}}}}\right)=\left\{\begin{array}{c}1\,\,\,\,\,\,\,{{{\mbox{if}}}}\,{B}_{z}\left({{{{{\bf{x}}}}}}\right)\, > \, 0\, {{{\mbox{and}}}}\,\left|{{{{{\boldsymbol{B}}}}}}\left({{{{{\bf{x}}}}}}\right)\right|\, > \,\varepsilon ,\hfill\\ -1\,\,{{{\mbox{if}}}}\,{B}_{z}\left({{{{{\bf{x}}}}}}\right) \, < \, 0\,{{{\mbox{and}}}}\,\left|{{{{{\boldsymbol{B}}}}}}\left({{{{{\bf{x}}}}}}\right)\right|\, > \,\varepsilon ,\hfill\\ 0\,\,\,\,\,\,\, {{{\mbox{if}}}}\,{B}_{z}\left({{{{{\bf{x}}}}}}\right) = 0\, {{{\mbox{or}}}}\,\left|{{{{{\boldsymbol{B}}}}}}\left({{{{{\bf{x}}}}}}\right)\right|\, {{\le }} \,\varepsilon ,\hfill\end{array}\right.$$
(13)

where \(\varepsilon\) is a field strength cut-off32,33. The above integrals were determined numerically using a standard trapezoidal method. In this work, the winding inputs from the observations are calculated with a cut-off of \(\varepsilon =50\) G. Note that the 1-sigma error associated with SHARP data of the longitudinal magnetic field measurements is 10 G.

The sensitivity of the magnetic winding accumulation to the choice of cut-off is similar to that of the magnetic helicity accumulation, in the sense that both accumulations decay similarly as the cut-off is increased. An example of this is shown in Fig. 10, where both winding and helicity accumulations of AR11318 (starting from the end of the data gap) for different cut-offs are displayed.

Fig. 10: Cut-off sensitivity.
figure 10

The accumulations for AR11318 starting from the end of the data gap (see Fig. 2). (a) shows the magnetic winding accumulations and (b) shows the magnetic helicity accumulations. Four different cut-offs \(\varepsilon\) are considered (blue: \(\varepsilon =50\), red: \(\varepsilon =100\), yellow: \(\varepsilon =200\), purple: \(\varepsilon =400\)). Source data are provided as a Source Data file.

As mentioned in the main text, plasma velocity \({{{{{\bf{v}}}}}}\) was obtained from observations using the DAVE4VM35 method. The results presented were calculated with the version of the code written in Python but we have also checked the results using the version written in the Interactive Data Language (IDL). The SHARP vector magnetograms used for the presented results were downloaded using SunPy39 from the Joint Science Operations Center (JSOC) database.