  We study the magnetospheric structure and the ionospheric Joule Heating of
planets orbiting M-dwarf stars in the habitable zone using a set of
magnetohydrodynamic (MHD) models. The stellar wind solution is used to drive a
model for the planetary magnetosphere, which is coupled with a model for the
planetary ionosphere. Our simulations reveal that the space environment around
close-in habitable planets is extreme, and the stellar wind plasma conditions
change from sub- to super-Alfvenic along the planetary orbit. As a result, the
magnetospheric structure changes dramatically with a bow shock forming in the
super-Alfvenic sectors, while no bow shock forms in the sub-Alfvenic sectors.
The planets reside most of the time in the sub-Alfvenic sectors with poor
atmospheric protection. A significant amount of Joule Heating is provided at
the top of the atmosphere as a result of the planetary interaction with the
stellar wind. For the steady-state solution, the heating is about 0.1-3\% of
the total incoming stellar irradiation, and it is enhanced by 50\% for the
time-dependent case. The significant Joule Heating obtained here should be
considered in models for the atmospheres of habitable planets in terms of the
thickness of the atmosphere, the top-side temperature and density, the boundary
conditions for the atmospheric pressure, and particle radiation and transport.
