  Observations suggest a power-law relation between the coronal emission in
X-rays, $L_{\rm{X}}$, and the total (unsigned) magnetic flux at the stellar
surface, $\Phi$. The physics basis for this relation is poorly understood. We
use three-dimensional (3D) magnetohydrodynamics (MHD) numerical models of the
coronae above active regions, that is, strong concentrations of magnetic field,
to investigate the $L_{\rm{X}}$ versus $\Phi$ relation and illustrate this
relation with an analytical model based on simple well-established scaling
relations. In the 3D MHD model horizontal (convective) motions near the surface
induce currents in the coronal magnetic field that are dissipated and heat the
plasma. This self-consistently creates a corona with a temperature of 1 MK. We
run a series of models that differ in terms of the (unsigned) magnetic flux at
the surface by changing the (peak) magnetic field strength while keeping all
other parameters fixed. In the 3D MHD models we find that the energy input into
the corona, characterized by either the Poynting flux or the total volumetric
heating, scales roughly quadratically with the unsigned surface flux $\Phi$.
This is expected from heating through field-line braiding. Our central result
is the nonlinear scaling of the X-ray emission as $L_{\rm{X}}\propto
\Phi^{3.44}$. This scaling is slightly steeper than found in recent
observations that give power-law indices of up to only 2 or 3. Assuming that on
a real star, not only the peak magnetic field strength in the active regions
changes but also their number (or surface filling factor), our results are
consistent with observations. Our model provides indications of what causes the
steep increase in X-ray luminosity by four orders of magnitude from solar-type
activity to fast rotating active stars.
