  It is well known that cosmic rays (CRs) contribute significantly to the
pressure of the interstellar medium in our own Galaxy, suggesting that they may
play an important role in regulating star formation during the formation and
evolution of galaxies. We will present a novel numerical treatment of the
physics of CRs and its implementation in the parallel smoothed particle
hydrodynamics (SPH) code GADGET-2. In our methodology, the non-thermal CR
population is treated self-consistently in order to assess its dynamical impact
on the thermal gas as well as other implications on cosmological observables.
In simulations of galaxy formation, we find that CRs can significantly reduce
the star formation efficiencies of small galaxies. This effect becomes
progressively stronger towards low mass scales. In cosmological simulations of
the formation of dwarf galaxies at high redshift, we find that the total
mass-to-light ratio of small halos and the faint-end of the luminosity function
are affected. In high resolution simulations of galaxy clusters, we find lower
contributions of CR pressure, due to the smaller CR injection efficiencies at
low Mach number flow shocks inside halos, and the softer adiabatic index of
CRs, which disfavours them when a composite of thermal gas and CRs is
adiabatically compressed. Within cool core regions, the CR pressure reaches
equipartition with the thermal pressure leading to an enhanced compressibility
of the central intra-cluster medium, an effect that increases the central
density and pressure of the gas. While the X-ray luminosity in low mass cool
core clusters is boosted, the integrated Sunyaev-Zel'dovich effect is only
slightly changed. The resolved Sunyaev-Zel'dovich maps, however, show a larger
variation with an increased central flux decrement.
