We have developed a radiative transfer model of the dust and gas envel
opes around late-type stars. The gas kinetic temperature for each star
is calculated by solving equations of motion and the energy balance s
imultaneously. The main processes include viscous heating and adiabati
c and radiative cooling. Heating is dominated by viscosity as the grai
ns stream outward through the gas, with some contribution in oxygen-ri
ch stars by near-IR pumping of H2O followed by collisional de-excitati
on in the inner envelope. For O-rich stars, rotational H2O cooling is
a dominant mechanism in the middle part of the envelope, with CO cooli
ng being less significant. We have applied our model to three well-stu
died oxygen-rich red giant stars. The three stars cover a wide range o
f mass-loss rates, and hence they have different temperature structure
s. The derived temperature structures are used in calculating CO line
profiles for these objects. Comparison of the dust and gas mass-loss r
ates suggests that mass-loss rates are not constant during the asympto
tic giant branch phase. In particular, the results show that the low C
O 1-0 antenna temperatures of OH/IR stars reflect an earlier phase of
much lower mass-loss rate.