  We investigate ionization and heating of gas in the dense, shielded
clumps/cores of molecular clouds bathed by an influx of energetic, charged
cosmic rays (CRs). These molecular clouds have complex structures, with
substantial variation in their physical properties over a wide range of length
scales. The propagation and distribution of the CRs is thus regulated
accordingly, in particular, by the magnetic fields threaded through the clouds
and into the dense regions within. We have found that a specific heating rate
reaching $10^{-26}$ erg cm$^{-3}$ s$^{-1}$ can be sustained in the dense
clumps/cores for Galactic environments, and this rate increases with CR energy
density. The propagation of CRs and heating rates in some star-forming
filaments identified in IC 5146 are calculated, with the CR diffusion
coefficients in these structures determined from magnetic field fluctuations
inferred from optical and near-infrared polarizations of starlight, which is
presumably a magnetic-field tracer. Our calculations indicate that CR heating
can vary by nearly three orders of magnitude between different filaments within
a cloud due to different levels of CR penetration. The CR ionization rate among
these filaments is similar. The equilibrium temperature that could be
maintained by CR heating alone is of order $1~{\rm K}$ in a Galactic
environment, but this value would be higher in strongly star-forming
environments, thus causing an increase in the Jeans mass of their molecular
clouds.
