We consider an isothermal compressible fluid evolving on a cosmological background
which is either expanding or contracting toward the future. The Euler equations
governing such a flow consist of two nonlinear hyperbolic balance laws which we treat
in one and in two space dimensions. We design a finite volume scheme which is
fourth-order accurate in time and second-order accurate in space. This scheme allows
us to compute weak solutions containing shock waves and, by design, is well-balanced
in the sense that it preserves exactly a special class of solutions. Using this scheme,
we investigate the asymptotic structure of the fluid when the time variable
approaches infinity (in the expanding regime) or approaches zero (in the
contracting regime). We study these two limits by introducing a suitable rescaling
of the density and velocity variables and, in turn, we analyze the effects
induced by the geometric terms (of expanding or contracting nature) and the
nonlinear interactions between shocks. Extensive numerical experiments
in one and two space dimensions are performed in order to support our
observations.