  We present results on the heating of the inter-cluster medium (ICM) by
gravitational potential energy from in-falling satellites. We calculate the
available excess energy of baryons once they are stripped from their satellite
and added to the ICM of the hosting environment. this excess energy is a strong
function of environment and we find that it can exceed the contribution from
AGNs or supernovae (SN) by up to two orders of magnitude in the densest
environments/haloes. Cooling by radiative losses is in general fully
compensated by gravitational heating in massive groups and clusters with hot
gas temperature > 1 keV. The reason for the strong environment dependence is
the continued infall of substructure onto dense environments during their
formation in contrast to field-like environments. We show that gravitational
heating is able to reduce the number of too luminous galaxies in models and to
produce model luminosity functions in agreement with observations.
