1. Introduction

Cosmology is the branch of astronomy concerned with investigating the Universe as a whole from the Big Bang to today and further to what should occur in the future. The current generally accepted model of cosmology is the theory of the Big Bang. Cosmologists have puzzled over mysterious ideas like dark energy and dark matter. Cosmology spans the whole history of the Universe from birth to death with many secrets at every phase. The beginning of the 20th century brought new insights into this vast field of science. One of the greatest accomplishments of 20th-century physics is Albert Einstein’s theory of general relativity (GR). Edwin Hubble investigated the galaxy from a different standpoint and concluded that the Universe is not static but expanding. The expansion of the Universe became one of the most interesting research topics in the last decade. Results based on data from observing supernovas using the Hubble space telescope showed that the expansion of the Universe has accelerated [1]. This accelerating expansion of the Universe is caused by some unidentified energy with a powerful negative pressure, called dark energy.

There are several modified theories of gravity that are assumed to describe the real cause of this accelerating expansion of the Universe. Some popular modified theories are \(f(R)\), \(f( \mathcal{G} )\), \(f(R, \mathcal{G} )\), \(f( \mathcal{G} ,T)\), \(f(R,T)\), \(f(R,\phi)\), and \(f(R,R_{\alpha\beta}R^{\alpha\beta},\phi)\) theories, where \(T\), \(G\), \(R\), \(R_{\alpha\beta}\), and \(\phi\) are the respective energy–momentum trace, Gauss–Bonnet invariant, Ricci scalar, Ricci tensor, and scalar field. It is expected that the modification of GR can explain the accelerating expansion of the Universe.

The most attention was attracted to theories of \(f(R)\) gravity as a concept explaining the nature of dark energy and the gravitational potential. This is the simplest modified theory generalizing Einstein’s GR [2]. In [3], theories of \(f(R)\) gravity were studied in the framework of the Palatini approach which agrees with observations of accelerated expansion of the Universe. In [4], cylindrically symmetric solutions were studied in a space with the metric of \(f(R)\) gravity where the set of the modified Einstein equations were reduced to a single differential equation; it was shown how exact solutions corresponding to different models of \(f(R)\) gravity can be constructed. Nojiri and Odintsov [5] considered a classical generalization of GR as a unified explanation of inflation of the Universe at early times and later gravitational acceleration, studying the structure and cosmological properties of various modified theories and investigating differences in their representations and the relations between them. In [6], a review of the literature of the last decade can be found, devoted to some standard problems and recent achievements of modified gravity, such as \(f(R)\), \(f( \mathcal{G} )\), and \(f(T)\) theories in cosmology, and bouncing cosmology; the emphasis in this case is on the era of inflation and the epoch of acceleration at late times.

In [7], a solution of an \(f(R)\) theory of gravity in a cylindrically symmetric Gödel space–time was discussed, and the results of solutions of higher-order field equations and the Einstein field equations with a cosmological constant were also compared. In [8], cylindrically symmetric vacuum solutions were investigated using the Weyl metric in the context of modified \(f(T)\) gravity, where \(T\) is the torsion scalar. In [9], cylindrically symmetric solutions for a type of Gauss–Bonnet gravity were studied in detail, and the existence of some families of exact solutions was shown using three viable models. Also in that paper, the null energy condition was checked, and the existence of a cylindrical wormhole was predicted. In [10], static cylindrically symmetric solutions of the Einstein field equations were investigated in the vacuum case, and not only the well-known locally flat conic solution but also the space–time coefficients as powers of the radial coordinate were found.

Expanding and collapsing solutions using a nonstatic cylindrically symmetric space–time in the framework of \(f(R,T)\) theory were discussed in [11]; an auxiliary solution of the Einstein–Maxwell field equations was used. An expansion scalar was found whose positive and negative values ensure the respective expansion and collapse. In [12], cylindrical solutions were investigated in the framework of the so-called mimetic gravity, and a theorem that exact solutions with a nonzero cosmological constant are impossible for this theory was proved. An exact static cylindrically symmetric black-hole solution in a locally conformal Weyl gravity was presented in [13]; a solution containing a linear term that can yield a potential increasing linearly at large distances was found. In [14], a cylindrically symmetric Weyl space–time was studied, and a solution was found similar to the solution of Azadi et al. [4] for \(R=0\) and \(R=\text{const}\ne0\). In [15], the Einstein field equations were derived for a static cylindrically symmetric space–time in the presence of elastic matter, and analytic and numerical solutions satisfying the dominant energy condition were found. In [16] in the framework of \(f(R,T)\) gravity, exact solutions were investigated for a cylindrically symmetric space–time taking two different classes of models and then evaluating the energy densities and corresponding functions \(f(R,T)\) in each case.

2. Field equations in \(f(R)\) gravity

In this section, we briefly describe the modified field equations. We consider the Lagrangian [8]

$$\mathcal L=R+\sum_{n=2}^Na_nR^n, $$
(1)

where \(R\) is the Ricci scalar and the \(a_n\) are arbitrary coefficients. We use this Lagrangian to modify the Einstein field equations such that gravitational waves are reducible to a conformally invariant form by an appropriate choice of the arbitrary coefficients. Using the variational principle, from action (1), we obtain the field equations [17]

$$\begin{aligned} \, R_{ij}-\frac{1}{2}g_{ij}R+\sum_{n=2}^Nna_n R^{n-1}\biggl[\biggl(R_{ij}- \frac{1}{2n}g_{ij}R-\frac{n-1}{R}(R_{\,;i;j}-g_{ij}\,\Box R)\biggr)-{}& \nonumber \\ {}-{\frac{(n-1)(n-2)}{R^2}}(R_{\,;i}R_{\,;j}-g_{ij} R_{\,;\alpha}R^{\,;\alpha})\biggr]&{}=\kappa T_{ij}. \end{aligned}$$
(2)

In the vacuum case, we can write these equations as

$$MR_{ij}-\frac{1}{2}g_{ij}L-M_{;i;j}+g_{ij}\,\Box M=0, $$
(3)

where

$$M=1+\sum_{n=2}^Nna_nR^{n-1},\qquad L=R+\sum_{n=2}^Na_nR^n. $$
(4)

Writing Eqs. (3) in a contracted form, we obtain the relation between \(M\) and \(R\)

$$MR-2L+3\,\Box M=0. $$
(5)

Taking this relation into account, we write modified Einstein equations (3) in the form

$$\frac{MR_{ij}-M_{;i;j}}{g_{ij}}=\frac{1}{4}(MR-\Box M). $$
(6)

Below, we use them to simplify the field equations.

3. Vacuum solution for a Weyl space–time

We start with the general form of the metric in the cylindrical Weyl coordinates \((t,r,\phi,z)\) [4]

$$ds^2=-e^{2k-2u}\,dt^2+e^{2k-2u}\,dr^2+w^2e^{-2u}\,d\phi^2+e^{2u}\,dz^2, $$
(7)

where \(w=w(r)\), \(k=k(r)\), and \(u=(r)\). The corresponding scalar curvature is

$$R=-\frac{2(wk''-wu''-u'w'+wu^{ \prime \,2}+w'')}{e^{2k-2u}w}, $$
(8)

where the prime denotes the derivative with respect to the radial coordinate. From Eq. (6), we see that the combination \(A_i\equiv(MR_{ii}- M_{;i;i})/g_{ii}\) (with fixed indices) is independent of the index \(i\) and therefore \(A_i=A_j\) for all \(i\) and \(j\). We can then write the independent field equations

$${-M''}+2M'(k'-u')+ M\biggl(-\frac{-2k'w'}{w}+\frac{w''}{w}+2u^{ \prime \,2}\biggr)=0,$$
(9)
$$\phantom{-}M'(k'w^2-ww')+ Mw^2\biggl(-\frac{-k'w'}{w}+\frac{w''}{w}-k''\biggr)=0,$$
(10)
$$\phantom{-}M'(wk'-2u'w)+ Mw\biggl(-k''+2u''-\frac{-k'w'}{w}+\frac{2w'u'}{w}\biggr)=0,$$
(11)

corresponding to \(A_t=A_r\), \(A_t=A_\phi\), and \(A_t=A_z\). Differentiating Eq. (10) with respect to \(r\), we obtain

$$\begin{aligned} \, M''={}&\frac{1}{w(wk'-w')}(k^{(3)}\times{} \nonumber \\ &{}\times M w^2+3M w k''w'-wk'M'w'+M wk'w''+ M k'w^{ \prime \,2}+M'w^{ \prime \,2}-M w^{(3)}w-Mw' w''). \end{aligned}$$
(12)

From Eq. (11), we obtain the value of \(M'\):

$$M'=\frac{M}{w(k'-2u')}(wk''+k'w'-2wu''-2u'w'). $$
(13)

Substituting the values of \(M'\) and \(M''\) in Eq. (9) and the value of \(M'\) in Eq. (10), we now obtain

$$\begin{aligned} \, \frac{M}{w(k'-2u')(wk'-w')}[-w^{ \prime \,3}(k'-2u')+ w w^{ \prime \,2}(2k'u'-4u^{ \prime \,2}-k''+2u'')+\qquad& \nonumber \\ {}+w^3\bigl(2k^{ \prime \,2}(k''-2u''+u^{ \prime \,2})+ 2k^{(3)}u'-k'(k^{(3)}+2u'(k''-2u'')+4u^{ \prime \,3})\bigr)-{}& \nonumber \\ {}-w^2(k'-2u')(4k''w'+2k'u'w'-2u''w'+2u^{ \prime \,2}w'-w^{(3)})]&{}=0 \end{aligned}$$
(14)

and

$$\frac{M}{w(k'-2u')}[ww'(k''-2u'')+k'(w^{ \prime \,2}+w)(2wu''-w'')- 2u'(w^{ \prime \,2}+w^2k''-ww'')]=0. $$
(15)

It is easy to see from the obtained equations that \(M=0\), and this gives

$$1+2a_2R+3a_3R^2+\cdots+na_nR^{n-1}=0. $$
(16)

This relation exactly coincides with the result obtained in [7] in the context of exact solutions of the modified field equations. Here, we emphasize that it relates \(k(r)\), \(u(r)\), and \(w(r)\). Relation (16) depends only on the arbitrary constants introduced in Hilbert Lagrangian (1) to compensate the additional gravitational potential in the gravitational wave equation [18].

We present several examples of exact solutions of the field equations. Equation (16) for \(n=2\) gives \(1+2a_2R=0.\) Substituting expression (8) for the Ricci scalar \(R\) in this relation, we obtain

$$we^{2k-2u}-4a_2(wk''-wu''-u'w'+wu^{ \prime \,2}+w'')=0. $$
(17)

This is a complicated nonlinear second-order differential equation with three unknowns. We start with the simplest case \(w(r)=1\) to restrict the two parameters \(k(r)\) and \(u(r)\). We further assume that \(k(r)\) and \(u(r)\) are linearly dependent on each other, \(k(r)=\xi u(r)\), where \(\xi\) is a constant. Simplifying Eq. (17), we obtain

$$1-4a_2e^{2(\xi-1)k(r)}[\xi^2(k'(r))^2-(\xi-1)k''(r)]=0. $$
(18)

We write a solution of the differential equation with \(\xi=1\) as

$$ k(r)=c_1\pm\frac{r}{2\sqrt{a_2}},$$
(19)

where \(c_1\) is an integration constant. In this case, metric (8) becomes

$$ds^2=-dt^2+dr^2+e^{-2(c_1\pm\frac{r}{2\sqrt{a_2}})}d\phi^2+ e^{2(c_1\pm\frac{r}{2 \sqrt{a_2}})}dz^2,\quad a_2\ne0. $$
(20)

This is an interesting singularity-free solution of the modified field equations with the constant Ricci scalar \(R=-1/2a_2\).

Similarly, we can construct a solution for \(n=2\), \(w(r)=r\), and \(\xi=1\), which yields the metric

$$\begin{aligned} \, ds^2={}&-dt^2+dr^2+r^2\exp\biggl\{-2\biggl(\pm\frac{\sqrt{a_2(a_2+r)}}{a_2}+ \log(\sqrt{a_2(a_2+r)}\pm a_2)+c_2\biggr)\biggr\}d\phi^2+{} \nonumber \\ &{}+\exp\biggl\{2\biggl(\pm\frac{\sqrt{a_2(a_2+r)}}{a_2}+ \log(\sqrt{a_2(a_2+r)}\pm a_2)+c_2\biggr)\biggr\}dz^2, \end{aligned}$$
(21)

where \(c_2\) is an integration constant. This metric belongs to the same class as (20).

As the next step, we consider \(n=3\), Eq. (16) for the Ricci scalar then becomes quadratic, and we have two roots

$$R=\frac{-a_2\pm\sqrt{a_2^2-3a_3}}{3a_3}. $$
(22)

We can also construct some solutions in this case. We note that all these solutions represent cylindrically symmetric space–times with a constant Ricci scalar [4]. More importantly, we can obtain many significant cosmological solutions by choosing different parameters \(n\) and \(\xi\).

We now discuss some other solutions. Transforming Eqs. (14) and (15), we obtain

$$\begin{aligned} \, -w^{ \prime \,3}(k'-2u')+ww^{ \prime \,2}(2k'u'-4u^{ \prime \,2}-k''+2u'')+\kern50mm& \nonumber \\ {}+w^3\bigl(2k^{ \prime \,2}(k''-2u''+u^{ \prime \,2})+ 2k^{(3)}u'-k'(k^{(3)}+2u'(k''-2u'')+4u^{ \prime \,3})\bigr)-{}& \nonumber \\ {}-w^2(k'-2u')(4k''w'+2k'u'w'- 2u''w'+2u^{ \prime \,2}w'-w^{(3)})&{}=0, \end{aligned}$$
(23)

and

$$ww'(k''-2u'')+k'(w^{ \prime \,2}+w)(2wu''-w'')-2u'(w^{ \prime \,2}+w^2k''-ww'')=0. $$
(24)

For simplicity, we set \(w(r)=1\), and these equations then reduce to

$$2k^{ \prime \,2}(k''-2u''+u^{ \prime \,2})+2k^{(3)}u'- k'\bigl(k^{(3)}+2u'(k''-2u'')+4u^{ \prime \,3}\bigr)=0 $$
(25)

and

$$k'u''-u'k''=0. $$
(26)

The last equation is a linear second-order differential equation. Solving (26), we obtain

$$u(r)=d_2+d_1k(r), $$
(27)

where \(d_1\) and \(d_2\) are integration constants. Substituting \(u(r)\) in Eq. (25), we obtain a differential equation in the terms of \(k(r)\):

$$2d_1^2k^{ \prime \,4}-2(d_1-1)k^{ \prime \,2}k''+2k'^{ \prime \,2}-k'k^{(3)}=0. $$
(28)

It has different solutions with different \(d_1\). For simplicity, we choose \(d_1=1\), and then

$$2k^{ \prime \,4}+2k'^{ \prime \,2}-k'k^{(3)}=0. $$
(29)

The solution of this equation has the form

$$k(r)=d_5\pm \operatorname{erf} ^{-1}\biggl(\pm\frac{2e^{-d_3/4}(d_4+r)}{\sqrt{\pi}}\biggr), $$
(30)

where \(d_3\), \(d_4\), and \(d_5\) are integration constants. The metric coefficient \(k(r)\) is expressed in terms of the inverse error function [19]–[26], which is odd [27], and we can therefore write solution (30) as

$$k(r)=d_5+ \operatorname{erf} ^{-1}\biggl(\frac{2e^{d_3/4}(d_4+r)}{\sqrt{\pi}}\biggr). $$
(31)

The behavior of \(k(r)\) for several values of \(d_3\), \(d_4\), and \(d_5\) is shown in Fig. 1.

Fig. 1.
figure 1

The dependence \(k(r)\) for different \(d_3\), \(d_4\), and \(d_5\).

Using Eq. (31), we obtain the other metric coefficient

$$u(r)=d_2+d_5+ \operatorname{erf} ^{-1}\biggl(\frac{2e^{-d_3/4}(d_4+r)}{\sqrt{\pi}}\biggr). $$
(32)

Consequently, the metric for the solution becomes

$$\begin{aligned} \, ds^2={}&-e^{-2c_2}\,dt^2+e^{-2c_2}\,dr^2+ \exp\biggl\{-2\biggl(c_2+c_5+ \operatorname{erf} ^{-1}\biggl(\frac{2e^{-c_3/4}(c_4+r)} {\sqrt{\pi}}\biggr)\!\biggr)\biggr\}d\phi^2+{} \nonumber \\ &{}+\exp\biggl\{2\biggl(c_2+c_5+ \operatorname{erf} ^{-1}\biggl(\frac{2e^{-c_3/4}(c_4+r)} {\sqrt{\pi}}\biggr)\!\biggr)\biggr\}dz^2. \end{aligned}$$
(33)

Such a space–time has a nonconstant Ricci scalar

$$R=-2\exp\biggl\{-2 \operatorname{erf} ^{-1}\biggl(\frac{2e^{-c_3/4}(c_4+r)} {\sqrt{\pi}}\biggr)^{\!2}+2c_2-\frac{c_3}{2}\biggr\}. $$
(34)

We note that relation (16) yields a family of solutions with a constant Ricci scalar and we have an interesting solution in this case for which the Ricci scalar is not constant.

Solutions (20), (21), and (33) correspond to the class of cylindrical solutions already discussed by Bronnikov [23], [24]; these solutions are given as

$$ds^2=-e^{2\delta}\,dt^2+e^{2\lambda}\,dr^2+ e^{2\beta}\,d\phi^2+e^{2\chi}\,dz^2, $$
(35)

where \(\delta=\delta(r)\), \(\lambda=\lambda(r)\), \(\chi=\chi(r)\), and \(\beta=\beta(r)\). In particular, solutions with \(\chi=-\beta\), as in our case, can be applied to soliton-like configurations, for which two conditions are implied: the existence of a spatial asymptotic form according to which our system is regarded as an isolated cylindrically symmetric source of gravity or a cosmic string; the global regularity of the space–time and the fields [25].

4. Vacuum solutions for a Gödel space–time

We consider the cylindrically symmetric Gödel metric of general form [21]

$$ds^2=(dt+x\,d\phi)^2-dr^2-y^2\,d\phi^2-dz^2, $$
(36)

where \(x=x(r)\) and \(y=y(r)\) are arbitrary parameters to be determined. The Ricci scalar curvature for space–time (36) is

$$R=\frac{4yy''-x^{ \prime \,2}}{2y^2}. $$
(37)

From Eq. (6), we again introduce the notation \(A_{ij}=(MR_{ij}- M_{;i;j})/g_{ij}\). We can then write the field equations

$$M (x^{ \prime \,2}-yy'')-M''y^2=0,$$
(38)
$$M'(xx'y-y^2y')+M(xx''y-xx'y'-y^2y''+x^{ \prime \,2}y)=0,$$
(39)
$$Mx^{ \prime \,2}=0,$$
(40)
$$M(x'y'-x''y)-M'x'y=0 ,$$
(41)

corresponding to \(A_{tt}=A_{rr}\), \(A_{tt}=A_{\phi\phi}\), \(A_{tt}=A_{zz}\), and \(A_{tt}=A_{t\phi}\). Differentiating Eq. (41) with respect to \(r\), we obtain

$$M''=\frac{Mx'y''-2M'x''y-Mx^{(3)}y}{x'y}. $$
(42)

From Eq. (39), we obtain

$$M'=\frac{M[Y(xx''+x^{ \prime \,2})-xx'y'-y^2y'']}{y(yy'-xx')}. $$
(43)

Substituting the expressions for \(M'\) and \(M''\) in (39) and (41), we derive the corresponding equations

$$M \biggl[x^{ \prime \,2}+\frac{x^{(3)}y^2}{x'}+ \frac{2yx''(xx'y'-y(x x''+x^{ \prime \,2})+y^2y'')}{x'(xx'-yy')}-2yy''\biggr]=0,$$
(44)
$$My(yx''y'-x'(yy''+y^{ \prime \,2})+x^{ \prime \,3})=0.$$
(45)

It can be seen that \(M=0\) follows from Eqs. (40), (44), and (45), and we again obtain exactly the same relation (16) as for the cylindrically symmetric Weyl space–time. By virtue of Eq. (37), it determines a relation between \(x(r)\) and \(y(r)\) and depends on arbitrary constants.

We discuss several examples. We set \(n=2\), and then \(1+2a_2R=0\) in simplest case. Substituting the scalar curvature \(R\) in this relation, we obtain an equation for two functions \(x(r)\) and \(y(r)\):

$$y^2+a_2(4yy''-x^{ \prime \,2})=0. $$
(46)

We assume that the relation between \(x(r)\) and \(y(r)\) is defined as \(x(r)=\psi y(r)\), where \(\psi\) is a constant. With this taken into account, the solution of Eq. (46) becomes

$$y(r)=2^{4/\beta} e^{r/\sqrt{a_2\beta}}\bigl[a_2 \beta(\mu_1e^{(r/2)\sqrt{\beta/a_2}}-\mu_2)^2\bigr]^{-2/\beta}, $$
(47)

where \(\beta=\psi^2-4\) and \(\mu_1\) and \(\mu_2\) are integration constants. Consequently, metric (36) is written as

$$\begin{aligned} \, ds^2={}&\bigl(dt+2^{4/\beta}\psi e^{r/\sqrt{a_2\beta}} \bigl[a_2\beta(\mu_1e^{(r/2)\sqrt{\beta/a_2}}- \mu_2)^2\,\bigr]^{-2/\beta}d\phi\bigr)^2-dr^2-{} \nonumber \\ &{}-\bigl(2^{4/\beta}e^{r/\sqrt{a_2\beta}} \bigl[a_2\beta(\mu_1e^{(r/2)\sqrt{\beta/a_2}}- \mu_2)^2\,\bigr]^{-2/\beta}\bigr)^2d\phi^2-dz^2. \end{aligned}$$
(48)

For \(a_2=-1/2\), \(\psi=\sqrt{2}\), \(\mu_1=2^{3/4}\), and \(\mu_2=0\), space–time (48) reduces to the Gödel metric [21]

$$ds^2=dt^2-dr^2+\frac{e^{2r}}{2}\,d\phi^2-dz^2+2e^r\,dt\,d\phi $$
(49)

with the condition

$$1+4a_2+12a_3+\dots+na_n2^{n-1}=0, $$
(50)

which was also discussed in [7].

Similarly, for \(n=3\), metric (36) becomes

$$\begin{aligned} \, ds^2={}&\biggl(dt+\psi f_2\cosh\biggl[ \frac{\sqrt{\beta}(8a_2f_1+12a_3f_1+r)} {2\sqrt{4a_2+6a_3}}\biggr]^{-4/\beta}d\phi\biggr)^{\!2}-dr^2-{} \nonumber \\ &{}-\biggr(f_2\cosh\biggl[\frac{\sqrt{\beta}(8a_2f_1+12a_3f_1+r)} {2\sqrt{4a_2+6a_3}}\biggr]^{-4/\beta}\biggr)^{\!2}d\phi^2-dz^2, \end{aligned}$$
(51)

where \(f_1\) and \(f_2\) are integration constants. Similar solutions for a Gödel-type universe were previously found in the framework of a fourth-order theory of gravity in [28].

We find one more solution using Eqs. (44) and (45):

$$x^{ \prime \,2}+\frac{x^{(3)}y^2}{x'}+ \frac{2yx''(xx'y'-y(xx''+x^{ \prime \,2})+y^2y'')}{x'(xx'-yy')}-2yy''=0,$$
(52)
$$y(yx''y'-x'(yy''+y^{ \prime \,2})+x^{ \prime \,3})=0.$$
(53)

Solving differential equation (53), we obtain

$$y(r)=\pm \sqrt{2g_2-2g_1x+x^2}, $$
(54)

where \(g_1\) and \(g_2\) are integration constants. We substitute \(y(r)\) in Eq. (52) and obtain a differential equation in \(x(r)\):

$$\frac{(2g_1^2-2g_2-2g_1x+x^2)x^{ \prime \,2}}{2g_2-2g_1x+x^2}+ \frac{x^{(3)}(2g_2-2g_1x+x^2)}{x'}- \frac{2(2g_2-2g_1x+x^2)x'^{ \prime \,2}}{x^{ \prime \,2}}=0. $$
(55)

We found numerical solutions of this equation with \(g_1=1\) and \(g_2=1/2\); plots of the functions \(x(r)\) and \(y(r)\) are shown in Fig. 2.

Fig. 2.
figure 2

Functions \(x(r)\) and \(y(r)\) with \(g_1=1\) and \(g_2=1/2\).

5. Results and conclusions

We have obtained the solution of the field equations for a higher-order theory of gravity obtained by modifying the Einstein theory. This modification is based on the conformal invariance in the Weyl and Gödel metrics. We considered a Lagrangian of form (1), which yields modified field equations (2) for a higher-order theory of gravity. We solved these field equations in a cylindrically symmetric space–time in the vacuum case, where the energy–momentum tensor vanishes \((T_{ij}=0)\) because \(\rho=0\) and \(p=0\). Using the Weyl and Gödel metrics, we derived relation (16). Both space–times are solutions of the higher-order field equations under condition (16). Our solution coincides with the solution of the Einstein field equations with a cosmological constant found in [21]. Based on the obtained results, we conclude that a higher-order theory of gravity yields a more suitable and realistic Universe than the Einstein field equations. Solving the differential equations, we constructed plots of the metric coefficients.

We draw several conclusions:

  1. The coefficients of higher-order terms in the considered \(f(R)\) gravity yield a cumulative effect like the cosmological constant in the Einstein theory of gravity [29]. In fact, constant-curvature solutions do not correspond to the new class of solutions, which somehow belong to the family of solutions of GR.

  2. The metric coefficients \(k(r)\) and \(u(r)\) are expressed in terms of a function inverse to the error function and therefore behave similarly to it. Different integration constants lead only to a shift and rescaling of metric coefficients (31) and (32).

  3. The metric coefficients \(x(r)\) and \(y(r)\), which we found from Eq. (55) using numerical methods, increase as the gravitational potential increases and increase weakly as the radial component increases. The behavior of the metric coefficients indicates the massiveness of the Universe with a high gravitational potential.