  We present a three-dimensional numerical model for the generation and
evolution of the magnetic field in the solar convection zone, in which sunspots
are produced and contribute to the cyclic reversal of the large-scale magnetic
field. We then assess the impact of this dynamo-generated field on the
structure of the solar corona and solar wind. This model solves the induction
equation in which the velocity field is prescribed. This velocity field is a
combination of a solar-like differential rotation and meridional circulation.
We develop an algorithm that enables the magnetic flux produced in the interior
to be buoyantly transported towards the surface to produce bipolar spots. We
find that those tilted bipolar magnetic regions contain a sufficient amount of
flux to periodically reverse the polar magnetic field and sustain dynamo
action. We then track the evolution of these magnetic features at the surface
during a few consecutive magnetic cycles and analyze their effects on the
topology of the corona and on properties of the solar wind (distribution of
streamers and coronal holes, and of slow and fast wind streams) in connection
with current observations of the Sun.
