  We study the evolution of baryonic gas in cosmologically growing dark matter
halos. To accurately model both the inner and outer regions of the halos, we
use a dark matter density profile that transitions smoothly from the NFW
profile within the virial radius to a more realistic flat profile far beyond
the halo. We construct a dark matter gravitational potential consistent with
this density profile, and we use a "cosmological" potential that accounts for
gas evolution consistent with Hubble expansion at large radii. Gas is
initialized with a density $\approx$ 0.2 times the dark matter density,
consistent with the universal baryon fraction $\rho_{\rm g}/(\rho_{\rm
g}+\rho_{\rm DM}) \approx 0.17$. We study the formation of the virial shock and
evolution of the baryon fraction, including the effects of radiative cooling
and AGN jet feedback. The feedback is powered by the accretion of cold gas onto
a central supermassive black hole (SMBH). The cores of the halo exhibit heating
and cooling cycles, whose strength and duration depend on the feedback
efficiency and the halo mass. The central SMBH initially grows exponentially
with time in the early quasar phase, but the growth slows down at later times.
The baryon fraction in the core decreases with increasing feedback efficiency
and decreasing halo mass. While the halo outskirts evolve self-similarly, the
core density is non-evolving, in agreement with cluster observations. We
analyze the correlations between the properties of the gas and the central
SMBH, and explore the existence of a fundamental plane.
