Context. Coronal rain consists of cool and dense plasma condensations formed in coronal loops as a result of thermal instability.
Aims. Previous numerical simulations of thermal instability and coronal rain formation have relied on the practice of artificially adding a coronal heating term to the energy equation. To reproduce large-scale characteristics of the corona, the use of more realistic coronal heating prescription is necessary.
Methods. We analysed coronal rain formation and evolution in a three-dimensional radiative magnetohydrodynamic simulation spanning from convection zone to corona which is self-consistently heated by magnetic field braiding as a result of convective motions.
Results. We investigate the spatial and temporal evolution of energy dissipation along coronal loops which become thermally unstable. Ohmic dissipation in the model leads to the heating events capable of inducing sufficient chromospheric evaporation into the loop to trigger thermal instability and condensation formation. The cooling of the thermally unstable plasma occurs on timescales that are comparable to the duration of the individual impulsive heating events. The impulsive heating has sufficient duration to trigger thermal instability in the loop but does not last long enough to lead to coronal rain limit cycles. We show that condensations can either survive and fall into the chromosphere or be destroyed by strong bursts of Joule heating associated with a magnetic reconnection events. In addition, we find that condensations can also form along open magnetic field lines.
Conclusions. We modelled, for the first time, coronal rain formation in a self-consistent 3D radiative magnetohydrodynamic simulation, in which the heating occurs mainly through the braiding and subsequent Ohmic dissipation of the magnetic field. The heating is stratified enough and lasts for long enough along specific field lines to produce the necessary chromospheric evaporation that triggers thermal instability in the corona.