The purpose of this article is to use an algorithm to obtain a non-static solution to the Einstein–Euler equations of a spherically symmetric matter distribution of a perfect fluid. The equations obtained make up a nonlinear system of partial derivative equations (PDE), which in the vast majority of cases is quite difficult to solve, either analytically or numerically. In this context, the spherical symmetry of space-time is very useful since it allows to establish the self-similarity of the solutions. This assumption reduces the PDEs to a set of ordinary differential equations (ODE). Therefore, the self-similarity hypothesis is very powerful in the search for non-static analytical or numerical solutions. The ODEs thus established allow defining a set of variables adjusted to the boundary conditions of the spherical distribution of matter, together with an equation of state (EOS). In this work, Tolman’s V solution has been selected as EOS. Once the numerical integration has been carried out, the variables established in the ODE and some other physical variables determined in the algorithm (density, pressure, radiation, etc.) can present damped oscillations (rebounds), depending on the initial values. This behavior is similar to that found near phase transitions in condensed matter physics, but now the mass distribution plays the role of an order parameter. This result has been obtained in other simulations of numerical relativity, where the PDE obtained from the gravitational field equations are integrated and the expression of an ultrarelativistic fluid $$\left( P=\kappa \,\rho \right) $$ . It is important to note that there is the possibility of carrying out simulations with other EOS (with electrical charge, anisotropy, etc.) with this algorithm. Many of the calculations to obtain the field equations, such as the conservation equations, were performed using the GRTensorIII computational algebra package, running on Maple 2017; as well as some Maple routines that have been used for these types of problems.