Sunspots and active regions are two of the many manifestations of the solar magnetic field. This field plays an important role in causing phenomena such as coronal mass ejections, flares, and coronal heating. Therefore, it is important to study the origin of sunspots and active regions and determine the underlying mechanism which creates them. It is believed that flux tubes rising from the bottom of the convection zone can create sunspots. However, there are still unanswered questions about this model. In particular, flux tubes are expected to expand as they rise, hence their strength weakens and some sort of reamplification mechanism must complement this model to match the observational properties of sunspots. To compensate for the absence of such an amplification mechanism, the field strength of the flux tubes, when at the bot- tom of the convection zone, must be far stronger than present dynamo models can explain.
In the last few years, there has been significant progress toward a new model of magnetic field concentrations based on the negative effective magnetic pressure instability (NEMPI) in a highly stratified turbulent plasma. NEMPI is a large-scale instability caused by a negative contribution to the total mean- field pressure due to the suppression of the total turbulent pressure by a large- scale magnetic field. In this thesis, I study for the first time NEMPI in the presence of a dynamo-generated magnetic field in both spherical and Cartesian geometries. The results of mean-field simulations in spherical geometry show that NEMPI and the dynamo instability can act together at the same time such that we deal with a coupled system involving both NEMPI and dynamo effects simultaneously. I also consider a particular two-layer model which was previously found to lead to the formation of bipolar magnetic structures with super-equipartition strength in the presence of a dynamo-generated field. In this model, the turbulence is forced in the entire domain, but the forcing is made helical in the lower part of the domain, and non-helical in the upper part. The study of such a system in spherical geometry showed that, when the stratification is strong enough, intense bipolar regions form and, as time passes, they expand, merge and create giant structures. To understand the underlying mechanism of the formation of such intense, long-lived bipolar structures with a sharp boundary, we performed a systematic numerical study of this model in plane parallel geometry by varying the magnetic Reynolds number, the scale separation ratio, and Coriolis number. Finally, I investigate the formation of the current sheet between bipolar regions and reconnection of oppositely orientated magnetic field lines and demonstrate that for large Lundquist numbers, S, the reconnection rate is nearly independent of S – in agreement with recent studies in identical settings.