1 Introduction

As an alternative to general relativity, Rastall gravity is characterized by the modified conservation law of the stress energy–momentum tensor (SET) in curved spacetime [1]. The theory implies intriguing novelty in various aspects regarding black hole physics [2,3,4,5,6,7,8,9,10,11,12] and cosmology [13,14,15,16,17,18,19,20,21,22] as it has been explored recently by many authors. In particular, the rudimentary feature of Rastall gravity, in a natural manner, supplies an alternative implementation for the dark energy.

The potential limit of general relativity has been systematically investigated on the largest scale against various observational data, namely, the supernova, large scale structure, and the cosmic microwave background (CMB) measurements. Among others, one of the most significant findings is the apparent accelerating expansion of the Universe, and subsequently, the dark energy scenario has become the most accepted premise regarding a satisfactory account for the experimental data. Moreover, it is deduced that the Universe at the present day is mostly composed of dark energy and dark matter. Subsequently, the physical properties, as well as the cosmic evolution of dark energy, become an increasingly active area in cosmology [23,24,25,26,27], due to its immediate connection with our understanding of the fundamental nature of the Universe.

Although the standard \(\Lambda \) Cold Dark Matter (\(\Lambda \hbox {CDM}\)) model supplies a reasonable account for the observed properties of the cosmos, it also confronts several challenges such as cosmic coincidence problem and fine tuning problem. In this regard, alternative approaches are primarily carried out by modifying Einstein’s field equations, which can be further divided into two distinct categories. The first type of model focuses on the properties of the matter field, which gives rise to dynamical dark energy models. In the literature, efforts along this train of thought consist of quintessence [28], tachyon [29], k-essence [30], phantom [31], Chaplygin gas [32], holographic dark energy [33,34,35], agegraphic dark energy [36, 37], among others. The second type of approach, on the other hand, is motivated by generalizing the geometry in Einstein’s general relativity. Such attempts include f(R) [38], f(T) [39], f(RT) theory [40], Brans–Dicke theory [41], Gauss–Bonnet theory [42], Lovelock [43], and Horava–Lifshitz theories [44,45,46,47].

In general relativity, the SET is minimally coupled to the geometry. Consider a matter field that possesses a classical continuous symmetry, and a conserved current is implied according to the Noether theorem. However, as an infinitesimal symmetry transformation is made local, the action is no longer invariant, but rather it gives rise to a contribution associated with the Noether current. The above spacetime dependent transformation is a well-known procedure of introducing a gauge field into the theory. Here, the metric is playing the role of the gauge field for a diffeomorphism invariance, and the latter is related to the translation symmetry of the original theory. Subsequently, the Hilbert energy–momentum tensor, defined by the variation of the action of the matter field with respect to the metric, is conserved. In this context, it has been argued that the Rastall gravity can be viewed such that the curvature–matter coupling is implemented by a non-minimal fashion [48]. Therefore, the theory might be classified into the second category of modified gravity.

From a physical viewpoint, both the gravitationally induced particle production [49,50,51] and quantum effects in curved spacetime [52] might be associated with the violations of the usual conservation law of the SET. This particularly meaningful as it is understood that the conservation of SET does not lead to particle production [53]. From the viewpoint of relativistic kinetic theory, there is one more apparent mechanism even if the particle number is conserved, namely, the kinetic diffusive process. As it was pointed out in Ref. [54], the SET of the matter field is not conserved, as the evolution of the matter field is governed by the Fokker–Planck equation. Moreover, it can be shown that the divergence of the SET equals to a conserved four-current. In the study of cosmology, the above physical scenarios are relevant and evidently lead to important implications. In particular, the non-conserved part of the SET might give rise to the dark energy which, subsequently, is responsible for the present accelerating expansion of the Universe [14,15,16,17, 21, 22]. In Ref. [22], the authors studied the accelerating expansion of the Universe by employing a generalized Rastall theory. In particular, a non-minimal coupling between the geometry and a pressureless matter field is shown to lead the transition from the matter-dominated era to the accelerating expansion. The cosmic evolution is also investigated for homogeneous and isotropic flat Friedmann–Lemaître–Robertson–Walker (FLRW) metric in Ref. [55]. The model is shown to be equivalent to the particle creation mechanism in Einstein gravity in the framework of non-equilibrium thermodynamics.

The present study involves such an attempt to construct a reasonable scheme for cosmic evolution in a generalized Rastall gravity. In our model, the dark energy is implemented so that it is closely related to the violation of SET. The amount of violation is found to be more significant during the period when the contribution of dark energy increases and raises to its present value. It eventually becomes insignificant, as it is naturally dictated by the equations of motion. The resultant cosmic evolution experiences three stages, namely, radiation dominated, ordinary matter dominated, as well as dark energy and dark matter dominated eras. We also show that the eventual fate of the Universe is insensitive to the initial conditions, owing to the dynamical attractor behavior of the solution.

The rest of the paper is organized as follows. In the following section, we briefly discuss the generalized Rastall gravity utilized in the present study. The equations of motion of the cosmic evolution are derived in Sect. 3. Numerical results are presented in Sect. 4. Concluding remarks are given in the last section.

2 Generalized Rastall gravity

In Refs. [11, 12], based on the original idea by Rastall [1], we proposed a generalized formulation of the Rastall theory. To be specific, the equation of the gravitational field equation and that of the SET read

$$\begin{aligned} R_{\mu \nu }-\frac{1}{2}g_{\mu \nu }R= & {} \kappa \left( T_{\mu \nu }-{\mathscr {A}}_{\mu \nu }\right) ,\nonumber \\ \nabla _\mu {T^{\mu }}_{\nu }= & {} \nabla _\mu {{\mathscr {A}}^{\mu }}_{\nu }, \end{aligned}$$
(2.1)

where \(\kappa =8\pi G\). We also impose a physical requirement that the effect of \({{\mathscr {A}}^{\mu }}_{\nu }\) and its derivatives must vanish in flat spacetime. In fact, it can be shown that the above formulation is rather general so that several modified gravity theories could be viewed as its special cases [11].

As for the purpose of the present study, we consider a specific case, namely,

$$\begin{aligned} {\mathscr {A}}_{\mu \nu }=\lambda g_{\mu \nu } {\mathscr {H}} , \end{aligned}$$
(2.2)

where \({\mathscr {H}}\) vanishes when \(R=0\). On the other hand, as a scalar, \({\mathscr {H}}\) can be a function of the Ricci scalar R, \(T\equiv g^{\mu \nu }T_{\mu \nu }\) and other constants. By substituting the form of \({\mathscr {A}}_{\mu \nu }\) into Eq. (2.1), we have

$$\begin{aligned} R_{\mu \nu }-\frac{1}{2}g_{\mu \nu }R= & {} \kappa \left( T_{\mu \nu }-\lambda g_{\mu \nu }{\mathscr {H}}\right) ,\nonumber \\ \nabla _\mu {T^{\mu }}_{\nu }= & {} \lambda \nabla _\nu {\mathscr {H}} . \end{aligned}$$
(2.3)

For algebraic convenience, one defines

$$\begin{aligned} \tau _{\mu \nu }=T_{\mu \nu }-\lambda g_{\mu \nu }{\mathscr {H}} . \end{aligned}$$
(2.4)

Therefore, Eq. (2.3) can be rewritten in essentially the same form as in general relativity

$$\begin{aligned} R_{\mu \nu }-\frac{1}{2}g_{\mu \nu }R= & {} \kappa \tau _{\mu \nu } ,\nonumber \\ \nabla _\mu {\tau ^{\mu }}_{\nu }= & {} 0 . \end{aligned}$$
(2.5)

Although it is mathematically similar, usually, it is not physically appropriate to interpret \(\tau ^{\mu \nu }\) as the SET of the matter field [56]. If one contracts both sides of the gravitational field equation, it gives

$$\begin{aligned} R+\kappa T=4\kappa \lambda {\mathscr {H}}. \end{aligned}$$
(2.6)

Owing to the reasons to be discussed below, we choose

$$\begin{aligned} {\mathscr {H}}=\frac{R\left( R+\kappa T\right) }{4\kappa \lambda \left( 4\kappa \Theta -\kappa T\right) } , \end{aligned}$$
(2.7)

where \(\Theta \) is to be determined shortly. We note that, in the vacuum, both factors on the numerator vanish as \(R\rightarrow 0\). In order that \({\mathscr {H}}\) is a well-defined quantity, one requires that the denominator of Eq. (2.7) being regular even when \(R\rightarrow 0\).

By substituting \({\mathscr {H}}\) into Eq. (2.6), one finds a quadratic algebraic equation, which implies the following two solutions for R:

$$\begin{aligned} R= & {} -\kappa T,\nonumber \\ \text {or}~~~~~R= & {} \kappa \left( 4\Theta -T\right) . \end{aligned}$$
(2.8)

The first solution is not physically relevant, because here, we will investigate the scenario where R remains finite even when the matter field \(T_{\mu \nu }\) vanishes. This is precisely the case where dark energy plays a significant role in cosmic evolution. Therefore, we will only explore the implication of the second solution. For the present model, this implies that \(\Theta \) is nonvanishing, while \(T_{\mu \nu }\) vanishes. This, in turn, ensures that the denominator of Eq. (2.7) will be regular in our approach.

By substituting it back into field equations, one finds

$$\begin{aligned} R_{\mu \nu }-\frac{1}{2}g_{\mu \nu }R+\kappa g_{\mu \nu }\Theta= & {} \kappa T_{\mu \nu }, \nonumber \\ \nabla _\mu {T^{\mu }}_{\nu }= & {} \nabla _\nu \Theta . \end{aligned}$$
(2.9)

Before proceeding further, we pause to give a few comments regarding Eq. (2.9). First, if one assumes \(\Theta \equiv \Lambda _{\text {eff}}/\kappa \) where \(\Lambda _{\text {eff}}\) is a constant, the above equations become identical to those of the standard \(\Lambda \hbox {CDM}\) model. Therefore, it seems rather appealing to identify the physical content of \(\Theta \) with the cosmological constant. Although, in the present model, as further discussed below, its temporal dependence plays an essential role. In Ref. [12], it is demonstrated that an (anti-)de Sitter solution can be effectively found in Rastall gravity where the spacetime is asymptotically flat. It is achieved by taking \({\mathscr {H}}={\mathscr {H}}(R)\) and \(T_{\mu \nu }=0\). In other words, the above solution again confirms the previous findings that a metric in asymptotically flat Rastall gravity naturally gives rise to that in general relativity with a cosmological constant. Moreover, according to the second equation of Eq. (2.9), \(\Theta \) measures the violation of the SET. Indeed, from the viewpoint of the Rastall gravity, all different types of matter fields are described by \(T_{\mu \nu }\), as a result, the observation of dark energy merely reflects, to what degree, the SET of the matter field deviates from a conserved current. It is also worth mentioning that Eq. (2.9) is very similar to those obtained from different theories where the conservation of the SET is partly breaking (for instance, see Refs. [57, 58] and related discussions in the last section).

In the following section, we proceed to derive the equations for cosmic evolution and investigate their solutions. Accordingly, we will treat \(\Theta \) as a variable, and solve its temperoal dependence.

3 Cosmic evolution in generalized Rastall gravity

The equations for cosmic expansion can be formulated by employing the co-moving coordinates, in terms of which the SET of the matter field is given by

$$\begin{aligned} {T^{\mu }}_{\nu }= \left( \begin{array}{cccc} -\rho &{} 0 &{} 0 &{} 0\\ 0 &{} P &{} 0 &{} 0\\ 0 &{} 0 &{} P &{} 0\\ 0 &{} 0 &{} 0 &{} P\\ \end{array} \right) . \end{aligned}$$
(3.1)

According to the discussions in the previous section, we denote \(\Theta \equiv \rho _{\mathrm {de}}\), the energy density of the dark energy. It is noted, by using Eq. (2.4) and the solution Eq. (2.8), it is straightforward to show that the tensor \({\tau ^{\mu }}_{\nu }\) reads

$$\begin{aligned} {\tau ^{\mu }}_{\nu }= \left( \begin{array}{cccc} -\rho -\rho _{\mathrm {de}} &{} 0 &{} 0 &{} 0\\ 0 &{} P+P_{\mathrm {de}} &{} 0 &{} 0\\ 0 &{} 0 &{} P+P_{\mathrm {de}} &{} 0\\ 0 &{} 0 &{} 0 &{} P+P_{\mathrm {de}}\\ \end{array} \right) , \end{aligned}$$
(3.2)

where \(P_{\mathrm {de}}=-\rho _{\mathrm {de}}\) is recognized as the pressure of dark energy. In other words, although \(\Theta \) is not a constant, the equation of state of the dark energy still satisfies a simple form, namely, \(w_{\mathrm {de}}=\frac{P_{\mathrm {de}}}{\rho _{\mathrm {de}}}=-1\), which is in agreement with the observed results. Furthermore, the the cosmological principle implies that \(\rho =\rho (t)\), \(P=P(t)\), \(\rho _{\mathrm {de}}=\rho _{\mathrm {de}}(t)\), and \(P_{\mathrm {de}}=P_{\mathrm {de}}(t)\) are functions independent on spatial coordinates.

We proceed to derive the equations of motion in terms of the FLRW metric

$$\begin{aligned} ds^2=-dt^2+a(t)^2\left[ \frac{dr^2}{1-kr^2}+r^2\left( d\theta ^2+\sin (\theta )^2d\varphi ^2\right) \right] ,\nonumber \\ \end{aligned}$$
(3.3)

where k represents the curvature density of the Universe. Therefore, the (0, 0) and (1, 1) components of gravitational field equation in Eq. (2.9) can be rewritten as

$$\begin{aligned} \left( \frac{\dot{a}}{a}\right) ^2+\frac{k}{a^2}= & {} \frac{8\pi G}{3}\left( \rho +\rho _{\mathrm {de}}\right) ,\nonumber \\ \frac{2\ddot{a}}{a}+\left( \frac{\dot{a}}{a}\right) ^2+\frac{k}{a^2}= & {} -8\pi G\left( P-\rho _{\mathrm {de}}\right) , \end{aligned}$$
(3.4)

while the equation regarding the SET gives

$$\begin{aligned} \dot{\rho }+\dot{\rho }_{\mathrm {de}}=-\left( \rho +P\right) \frac{\dot{a}}{a} . \end{aligned}$$
(3.5)

We note only two of the above three equations are independent.

We consider the matter content of the Universe consists of radiation, ordinary matter, dark matter, and dark energy. Radiation, ordinary matter, and dark matter are assumed to be independent between one another. They satisfy the standard equations of states, namely, \(P_{\mathrm {r}}=\frac{1}{3}\rho _{\mathrm {r}}\) and \(P_{\mathrm {m}}=P_{\mathrm {dm}}=0\). Therefore, the total pressure and density of the matter fields are given by

$$\begin{aligned} \rho= & {} \rho _{\mathrm {r}}+\rho _{\mathrm {m}}+\rho _{\mathrm {dm}},\nonumber \\ P= & {} P_{\mathrm {r}} +P_{\mathrm {m}}+P_{\mathrm {dm}}=P_{\mathrm {r}}=\frac{1}{3}\rho _{\mathrm {r}} . \end{aligned}$$
(3.6)

As independent fluid components, we further assume that radiation and ordinary matter satisfy, respectively, an equation regarding the conservation of its SET, namely,

$$\begin{aligned} \dot{\rho }_{\mathrm {m}}+\rho _{\mathrm {m}}\frac{\dot{a}}{a}= & {} 0,\nonumber \\ \dot{\rho }_{\mathrm {r}}+\left( \rho _{\mathrm {r}}+\frac{1}{3}\rho _{\mathrm {r}}\right) \frac{\dot{a}}{a}= & {} 0 , \end{aligned}$$
(3.7)

For the dark matter, however, the corresponding equation is constrained by Eq. (3.5). It is not difficult to show that the resultant equation reads

$$\begin{aligned} \dot{\rho }_{\mathrm {dm}}+\dot{\rho }_{\mathrm {de}}+\rho _{\mathrm {dm}}\frac{\dot{a}}{a}=0 . \end{aligned}$$
(3.8)

Now, there is only one free variable left, and for the last equation, we impose a rather simple scenario:

$$\begin{aligned} \rho _{\mathrm {de}}=\beta \rho _{\mathrm {dm}} , \end{aligned}$$
(3.9)

which can be viewed as to effectively incorporate a specific type of interaction between the dark energy and dark matter. We note that this is in tune with the fact that Eq. (3.8) also demonstrates that dark matter and dark energy are related. Otherwise, in comparison with Eq. (3.7), the second term on the l.h.s. of Eq. (3.8) would have not been present.

Eqs. (3.7), (3.8) and (3.9) can be solved analytically to give

$$\begin{aligned} {\rho }_{\mathrm {dm}}= & {} {\rho }_{\mathrm {dm}0}\left( \frac{a_0}{a}\right) ^{\frac{3}{1+\beta }},\nonumber \\ {\rho }_{\mathrm {m}}= & {} {\rho }_{\mathrm {m}0}\left( \frac{a_0}{a}\right) ^{3},\nonumber \\ {\rho }_{\mathrm {r}}= & {} {\rho }_{\mathrm {r}0}\left( \frac{a_0}{a}\right) ^{4} . \end{aligned}$$
(3.10)

Here, the radiation and ordinary matter evolve as in standard \(\Lambda \hbox {CDM}\) model. Also, the evolution of the dark energy accompanies that of dark matter, which reads

$$\begin{aligned} {\rho }_{\mathrm {de}}= & {} \beta \rho _{\mathrm {dm}}=\beta {\rho }_{\mathrm {dm}0} \left( \frac{a_0}{a}\right) ^{\frac{3}{1+\beta }} . \end{aligned}$$
(3.11)

Here, the index 0 indicates the values at present.

One can also rewrite the field equation similar to the Friedman equation. By introducing the Hubble parameter \(H\equiv \frac{\dot{a}}{a}\) and and the spatial curvature density

$$\begin{aligned} {\rho }_{\mathrm {k}}\equiv & {} -\frac{3k}{8\pi G a^2}={\rho }_{\mathrm {k}0}\left( \frac{a_0}{a}\right) ^{2} . \end{aligned}$$
(3.12)

one finds

$$\begin{aligned} \Omega _{\mathrm {r}}+\Omega _{\mathrm {m}}+\Omega _{\mathrm {dm}}+\Omega _{\mathrm {de}}+\Omega _{\mathrm {k}}=1, \end{aligned}$$
(3.13)

where the \(\Omega _i=\frac{8\pi G\rho _i}{3H^2}\) with \(i=\mathrm {r, m, dm, de, k}\) indicating the density parameters of radiation, ordinary matter, dark matter, dark energy, and spatial curvature respectively.

The deceleration parameter \(q\equiv -\frac{\ddot{a}a}{\dot{a}^2}\) is found to be

$$\begin{aligned} q=\Omega _{\mathrm {r}}-\Omega _{\mathrm {de}}+\frac{\Omega _{\mathrm {m}}+\Omega _{\mathrm {dm}}}{2}. \end{aligned}$$
(3.14)
Fig. 1
figure 1

The calculated cosmic evolutions of dimensionless density parameters as functions of \(a/a_0\). The present day \(a/a_0=1\) is indicated by a vertical black solid line. The quantities \(\Omega _{\mathrm {de}}, \Omega _{\mathrm {dm}}, \Omega _{\mathrm {m}}\), and \(\Omega _{\mathrm {r}}\) are represented by black, orange, red, and green curves. The calculations are carried out for different parameters in generalized Rastall gravity. The cosmic evolution evaluated by using the specific initial conditions which reproduces the measurements is presented by solid curves. Those obtained by using different perturbed initial conditions are indicated by dashed and dotted curves

4 Numerical results

In the section, we present the numerical results in Figs. 1, 2, 3, 4, 5, 6, 7 and 8. We first determine the constants of the integration regarding equations of the cosmic evolution by the values of the measurements to date [59]. To be specific, we choose \(\Omega _{\mathrm {dm}0}=0.27\), \(\Omega _{\mathrm {de}0}=0.68\), \(\Omega _{\mathrm {m}0}=0.05\). Also, we assume a spatially flat Universe by considering \(k=0\). Moreover, the redshift \(z=1100\), where the energy density of ordinary matter exceeds that of the radiation, is also taken as an input [60]. Subsequently, for the proposed model, the parameter \(\beta \) is found to be 2.52, which will be used in the remainder of this paper. The calculations are then carried out for the generalized Rastall theory, which are compared against those from the standard \(\Lambda \hbox {CDM}\) model. The corresponding results obtained by adopting the above parameters are shown in Figs. 1, 2, 3, 4 and 5 by the solid curves in different colors.

Fig. 2
figure 2

The same as Fig. 1. The calculated cosmic evolutions of dimensionless density parameters as functions of \(a/a_0\). The calculations are carried out for the standard \(\Lambda \hbox {CDM}\) model. The cosmic evolution, as well as the results regarding arbitrary initial perturbations, are shown in solid, dashed, and dotted curves. The zoomed-in plot illustrates the density parameters in the vicinity of \(a/a_0=1\)

Fig. 3
figure 3

An comparison of the calculated cosmic evolutions of the density parameters of dark energy between the two models. The results of the standard \(\Lambda \hbox {CDM}\) model are shown in solid curves, and those of the generalized Rastall theory are indicated by dash-dotted curves

Fig. 4
figure 4

The calculated deceleration parameter q as a function of \(a/a_0\). The present day \(a/a_0=1\) is indicated by a vertical black solid line. The calculations are carried out for different parameters in generalized Rastall gravity. The cosmic evolution evaluated by using the specific initial conditions which reproduces the measurements is presented by solid curves. Those obtained by using different perturbed initial conditions are indicated by dashed and dotted curves

Fig. 5
figure 5

The same as Fig. 4. The calculated deceleration parameter q as a function of \(a/a_0\). The calculations are carried out for the standard \(\Lambda \hbox {CDM}\) model. The cosmic evolution, as well as the results regarding arbitrary initial perturbations, are shown in solid, dashed, and dotted curves. The zoomed-in plot illustrates the deceleration parameters in the vicinity of \(a/a_0=1\)

Fig. 6
figure 6

An comparison of the calculated deceleration parameter q between the two models. The results of the standard \(\Lambda \hbox {CDM}\) model are shown in solid curves, and those of the generalized Rastall theory are indicated by dash-dotted curves

Fig. 7
figure 7

The dynamic attractor solution in the generalized Rastall gravity. The results show the deviations from the specific solution governed by a specific choice of initial conditions. The calculations are carried out for the differences in the density parameter of dark energy \(\Omega _{\mathrm {de}}\) (x-axis) and those in deceleration parameter q (y-axis). Each individual curve is obtained by evaluating the cosmic evolution with an arbitrary initial condition. The red dashed curve and black dotted curve correspond to the same perturbations investigated in Figs. 1 and 4. The calculations are carried out for generalized Rastall gravity by using the parameters given in the text

Fig. 8
figure 8

The amount of deviation from a conserved SET, shown as a function of \(a/a_0\). The calculations are carried out for generalized Rastall gravity by using the model parameters described in the text

On top of the above solution, the initial conditions of the relevant equations are arbitrarily perturbed at an instant with a sufficiently large redshift. In other words, due to the perturbations, the constants of integration will no longer remain unchanged, and the calculations are performed for a system of five equations, namely, Eqs. (3.4), (3.7), (3.8), and (3.9) for five variables a, \(\rho _{\mathrm {de}}\), \(\rho _{\mathrm {dm}}\), \(\rho _{\mathrm {r}}\), and \(\rho _{\mathrm {m}}\) for given \(\beta \). Subsequently, we investigate how the evolution of the composition of the Universe, and in particular, the density parameters at present day \(a/a_0=1\), depends on different initial conditions. The latter are presented in dashed and dotted curves in Figs. 1, 2, 4, and 5 for both models.

As expected, from Fig. 1, the results show that the cosmic evolution consists of three stages, namely, the radiation dominated, ordinary matter dominated, as well as dark energy and dark matter dominated eras. Also, it can be clearly inferred that the eventual fate of the Universe, calculated by the present model, is insensitive to the initial conditions. To be specific, the density parameters for the dark energy and dark matter all converge to the given values, irrelevant to specific initial conditions. Meanwhile, during the evolution, the compositions of the radiation and ordinary matter reflet the details of the perturbed initial conditions. This point becomes particularly evident as one compares the above results against those of the standard \(\Lambda \hbox {CDM}\) model shown in Fig. 2. In the \(\Lambda \hbox {DCM}\) model, the density parameters at present \(a/a_0=1\) are dictated largely by the initial conditions, as shown by the zoomed-in plot of Fig. 2. We note that the present findings are in agreement with other approaches [35, 61], which incorporate the interaction between the dark energy and dark matter. The difference for the present model is that, in the framework of Rastall theory, the dark energy degree of freedom appears naturally from the deviation from the conservation law of the SET.

To clearly illustrate the difference in the resultant cosmic evolution between the two models, we present a comparison of the calculated density parameters in Fig. 3. It is found that although the density parameters of the dark energy and dark matter are identical at the present day in both models, their respective rates of change are distinct. In the \(\Lambda \hbox {CDM}\) model, the density parameter increases rapidly at \(a/a_0=1\), whereas that of the matter falls dramatically. As a result, to reproduce their measured values at the present day, one must carefully tune the initial conditions, which, in turn, gives rise to the related coincidence problem, as illustrated in Fig. 2. In the generalized Rastall theory, on the other hand, the evolutions of ordinary matter and dark matter are separated. The dark matter starts to arise together with the dark energy, owing to their interaction, after the ordinary matter dominated era. Moreover, both the dark energy and dark matter begin to saturate at the present day. Therefore their values do not sensitively depend on the initial conditions.

In Figs. 4, 5 and 6, one shows the resultant deceleration parameters for different initial conditions as functions of redshift in both models. Again, it is found that the deceleration parameter eventually approaches a given value, independent of specific initial conditions. Regarding both models, the values of q are identical at \(a/a_0=0\), and the general trend is also found to be similar. However, for the Rastall gravity, one observes that q has begun to converge at \(a/a_0=0\). This is different from the case of the \(\Lambda \hbox {CDM}\) model where, again, at the present-day q is falling rapidly. As a result, the related value of q is sensitively governed by the specific initial conditions.

The above properties regarding the generalized Rastall theory can be shown more transparently as one focuses on the deviations from the specific solution discussed at the beginning of the section. The corresponding results are presented in Fig. 7 where one studies the discrepancies in cosmic evolutions by arbitrarily perturbing the initial conditions. To illustrate, we have chosen to show the differences in the density parameter of dark energy \(\Omega _{\mathrm {de}}\) and the deceleration parameter q. It is observed that the solution displays the properties of a dynamic attractor, which is reminiscent of quintessence and k-essence models. In other words, it is found that the deviations in evolution regarding different initial conditions all converge to the origin. Therefore, they are insensibility to the initial conditions in the present approach.

Last but not least, in Fig. 8, we show the amount of deviation from a conserved SET, which is the 0-component of the r.h.s. of Eq. (2.1), as a function of \(a/a_0\), for the generalized Rastall theory. As discussed above, for the present model, the amount of violation is related to the dynamical evolution of the dark energy. As shown in Fig. 8, the deviation is time-dependent. Its magnitude becomes more significant when the dark energy evolves more rapidly, and the peak is found to locate at approximately \(a/a_0 \sim 0.3\). On the other hand, the SET is mostly conserved in the infinite past and future.

5 Discussions and concluding remarks

Owing to the fact that one has to discard one of the solutions of Eq. (2.8), which introduces a vanishing factor on both sides of Eq. (2.7), the numerator of the equation is chosen as a second-order polynomial. In fact, Eq. (2.7) only contains \(\Theta \) as an unknown scalar function, which is identified with a dynamical cosmological constant. For this reason, it is actually a rather economical choice of ansatz in the present model.

In comparison to the standard \(\Lambda \hbox {CDM}\) model, effectively, the proposed scheme only contains one additional variable, \(\Theta \). The latter is described by the assumed equation of motion Eq. (3.9). In this context, it is a minimal scheme necessarily to describe the dynamical evolution of dark energy. In comparison to other recent studies [22, 55] about cosmic evolution in Rastall theory, the present approach introduces a unified scheme to deal with different matter contents of the Universe. In other words, by solving a closed system of equations, different eras of cosmic evolution are derived naturally. Moreover, we argue that our model possesses a dynamic attractor solution, which provides a possible explanation for the coincidence problem.

It is also interesting to mention that the non-conserved SET can be treated in terms of a generalized version of the two measure theories [62, 63]. In this case, the dynamics can be derived from an action which consists of two measures. In particular, the latter involves a scalar density in the place of the usual factor of the Jacobian \(\sqrt{-g}\). The theory is recently generalized in order to accommodate the fact the SET is not conserved as one considers the diffusive process in the relativistic Fokker–Plank equation [54]. There, the divergence of the SET is shown to be related to the conserved particle flow. This can be achieved by replacing the dynamic spacetime four-vector in the original theory by the gradient of a scalar field [57, 58]. The resultant theory gives rise to a unified description of the interacting dark energy and dark matter. It is, therefore, intriguing to compare the above approach against the Lagrangian formalism of Rastall theory.

To summarize, the present study involves an attempt to propose a scheme for cosmic evolution in a generalized Rastall gravity. In our model, the physical content of the dark energy is attributed to the non-conserved sector of the SET. The resultant cosmic evolution is naturally found to consists of three stages, namely, radiation dominated, ordinary matter dominated, as well as dark energy and dark matter dominated eras. Also, for the present model, it is shown that the eventual fate of the Universe is largely insensitive to the initial conditions, and the cosmic coincidence problem is therefore averted. Furthermore, we show that the amount of violation is found to be more significant when the dark energy evolves dynamically.