  This paper introduces a new disk code, called ProDiMo, to calculate the
thermo-chemical structure of protoplanetary disks and to interpret gas emission
lines from UV to sub-mm. We combine frequency-dependent 2D dust continuum
radiative transfer, kinetic gas-phase and UV photo-chemistry, ice formation,
and detailed non-LTE heating & cooling balance with the consistent calculation
of the hydrostatic disk structure. We include FeII and CO ro-vibrational line
heating/cooling relevant for the high-density gas close to the star, and apply
a modified escape probability treatment. The models are characterized by a high
degree of consistency between the various physical, chemical and radiative
processes, where the mutual feedbacks are solved iteratively. In application to
a T Tauri disk extending from 0.5AU to 500AU, the models are featured by a
puffed-up inner rim and show that the dense, shielded and cold midplane
(z/r<0.1, Tg~Td) is surrounded by a layer of hot (5000K) and thin (10^7 to 10^8
cm^-3) atomic gas which extends radially to about 10AU, and vertically up to
z/r~0.5. This layer is predominantly heated by the stellar UV (e.g.
PAH-heating) and cools via FeII semi-forbidden and OI 630nm optical line
emission. The dust grains in this "halo" scatter the star light back onto the
disk which impacts the photo-chemistry. The more distant regions are
characterized by a cooler flaring structure. Beyond 100AU, Tgas decouples from
Tdust even in the midplane and reaches values of about Tg~2Td. Our models show
that the gas energy balance is the key to understand the vertical disk
structure. Models calculated with the assumption Tg=Td show a much flatter disk
structure.
