Magnetic flux ropes – twisted bundles of magnetic field – are common structures in the solar corona which are responsible for many observed coronal features. For instance, flux rope ejections are the main progenitors of CMEs. The life of a magnetic flux rope normally undergoes two different phases. First is the formation of the flux rope in a coronal active region, a process that can last weeks. Second, the flux rope can be ejected into the outer atmosphere, in a period of a few hours. The slow formation phase can be approximated as quasi-static, in a regime dominated by magnetic forces, whereas the ejection phase is sudden and fast, the coronal plasma is compressed and heated, and the evolution is driven by both magnetic field and plasma. In this nugget we describe how we can model the full life span of a magnetic flux rope, from formation to ejection, by coupling our MHD ejection model with a magnetofrictional model for the slow formation phase.
Flux Rope Formation
The magnetofrictional model of Mackay and van Ballegooijen (2006)  describes the formation of a flux rope in the solar corona starting from a configuration with two bipoles, which evolves by means of magnetic diffusion and photospheric motions (differential rotation and meridional flows). In the model, after 19 days of evolution, a flux rope forms in the left hand side bipole which bears more tilt than the other at day 0 (Figure 1). The magnetofrictional technique is appropriate to model slow phenomena driven uniquely by the magnetic field, such as the magnetic flux rope formation. In addition, the technique is computationally very efficient and allows us to follow the evolution of a wide portion of the solar disk for a period of weeks. In contrast, once the flux rope ejection has started, and the Lorentz force produces sudden and fast motions of the field lines, we need modelling that can also account for the thermal pressure gradients and the evolution of the plasma. Therefore, we feed the final snapshot of the magnetofrictional model into a 3D MHD simulation, as its initial condition. Our 3D MHD simulation is carried out in spherical coordinates.
Coupling of the two models
We run MHD simulations with the code AMRVAC, developed by KU Leuven (Keppens et al., 2012) .
The magnetofrictional model, due to its assumptions, needs only the magnetic field and the velocity, to evolve the system. On the other hand, the MHD code needs also the density of plasma and the thermal pressure. In order to couple the magnetofrictional model with AMRVAC, we interpolate the magnetic field B and assume values for the other MHD variables. We perform the 3D interpolation in spherical coordinates of the magnetofrictional grid into the grid adopted by the MHD code and subsequently we complete the set of MHD variables needed to run the simulation on AMRVAC by assuming uniform pressure, zero plasma velocity, and density proportional to the square of the magnetic field intensity.
The MHD simulations starts from the non-equilibrium conditions computed by the Magnetofrictional model. We run our 3D MHD simulation on 128x128x128 points equally spaced in spherical coordinates (r,θ,φ). In Figure 2 we show the initial magnetic configuration consisting of the three arcades connecting the polarities of the bipoles, and an overlying external field connecting the two external polarities. Inside the left hand bipole is the flux rope. The Lorentz force is positive under the flux rope and pushes it upwards (Figure 3).
We follow the evolution of the system over 100 Alfven times (τ), and it can be split in two phases
Day 19, t<20 τ:
The flux rope is ejected upwards within the bipole arcade, maintaining its shape (Figure 4). The plasma embedded in the flux rope is dragged with it. The motion of the flux rope alters the surroundings, and while the magnetic arcades are compressed by the rising flux rope, the plasma and magnetic field is pulled inward underneath.
Day 19, t>20 τ
Later the flux rope interacts also with the external field and the ejection becomes more complex. Some field lines, initially connecting the polarities of the bipole, reconnect with the external field (Figure 5). The plasma keeps travelling upwards at a speed of about 100 km/s. At the end of the simulation the flux rope magnetic field lines have reached the top of the simulation box at 2.5 solar radii and the density distribution has also expanded to the edge of the domain.
Thanks to the coupling of two useful tools, a magnetofrictional model and MHD simulations, we are able to model the ejection of a magnetic flux rope starting from the conditions naturally created due to the formation of the flux rope itself. The ejection is caused by the out-of-equilibrium initial conditions. The magnetic field and plasma constituting the flux rope are expelled outwards generating the early phase of a CME.
-  Mackay, D. H. & van Ballegooijen, A. A. 2006, ApJ, 641, 577
-  Keppens, R., Meliani, Z., van Marle, A. J., et al. 2012, Journal of Computational Physics, 231, 718