  We study the emergence of magnetic flux from the near-surface layers of the
solar convection zone into the photosphere. To model magnetic flux emergence,
we carried out a set of numerical radiative magnetohydrodynamics simulations.
Our simulations take into account the effects of compressibility, energy
exchange via radiative transfer, and partial ionization in the equation of
state. All these physical ingredients are essential for a proper treatment of
the problem. Furthermore, the inclusion of radiative transfer allows us to
directly compare the simulation results with actual observations of emerging
flux. We find that the interaction between the magnetic flux tube and the
external flow field has an important influence on the emergent morphology of
the magnetic field. Depending on the initial properties of the flux tube (e.g.
field strength, twist, entropy etc.), the emergence process can also modify the
local granulation pattern. The emergence of magnetic flux tubes with a flux of
$10^{19}$ Mx disturbs the granulation and leads to the transient appearance of
a dark lane, which is coincident with upflowing material. These results are
consistent with observed properties of emerging magnetic flux.
