  A numerical hydrodynamical model for the evolution of spherically symmetric
collapsing clouds, designed for the calculation of the thermal structure of
these objects in both the prestellar and protostellar stages of their
evolution, is presented. Distinctive features of the model include the
possibility of independently describing the temperatures of the gas and dust,
which is extremely important when calculating the thermal structure of
prestellar and protostellar clouds, and the account of the radiation flux from
the central protostar. This model is used to compare the theoretical density
and temperature distributions with observations for nearby sites of star
formation obtained with the Herschel Space Observatory. Application of the
diffusion approximation with a flux limiter describes well the radial density
and temperature distributions in protostellar clouds. However, significant
differences between the model and observational density profiles were found for
prestellar stages, suggesting the presence of appreciable deviations from
equilibrium in the prestellar clouds. An approximate method for calculating the
thermal structure of a cloud based on the adaptive $\tau$-approximation is
presented. Application of the $\tau$-approximation yields good agreement with
the diffusion approximation for the prestellar phase, but produces appreciable
discrepancies for the protostellar phase, when the thermal structure of the
accreting envelope is determined by the radiation of the protostar.
