1 Introduction

General relativity (GR) is considered as the most fruitful theory for understanding the evolution of universe and its hidden secrets, yet the evidence of dark matter (DM) and the cosmic accelerating nature of spacetime put some challenges on this [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]. The Einstein’s GR explained the cosmological phenomena in a regime of weak field, while some modifications may be needed to study the strong fields in the scenario of accelerating expansion of the universe. In this direction, Qadir et al. [16] reinforced the requirement of the modified relativistic dynamics and indicated that this modification may help to settle down the problems related to DM and quantum gravity. As a result, many techniques were used like by introducing the cosmological constant as well as the modified theories from time to time.

Modified gravitational theories (MGTs) are actually the generalization of GR in which function of the Ricci scalar (R) is substituted in the Einstein–Hilbert action. These modified gravity theories are dubbed with the names, Einstein-\(\Lambda \) [17], f(R) [18,19,20,21] (R is the Ricci scalar), f(RT) [22,23,24,25] (T is the trace of energy momentum tensor), f(G) [26] (G is the Gauss–Bonnet term) and \(f(R,T,R_{\xi \pi } T^{\xi \pi })\) gravity [27,28,29,30]. In the recent times, Nojiri et al. [31] presented various mathematical techniques to understand burning issues of cosmos related to bouncing cosmos. They asserted that gravity mediated by f(R) and f(G) theories could be used to realize many hidden secrets of our universe. Once can observe the pity good agreement results between the cosmological models in MGTs and the observational data [32,33,34,35]. The f(RT) gravity is one of the MGTs, in which the f(R) is replaced with the function of R and T [36]. It is claimed that the evidence behind the dependence of T may come from the presence of imperfect fluid or it may be some kinds of quantum effects (for further reviews on DE and MGTs, see, for instance, [37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]).

In f(RT) gravity, many cosmological applications were discussed in [52,53,54,55,56,57,58]. From literature, some of them are, The non-static line element for collapsing of spherical body having anisotropic fluid were discussed in [59]. The static spherical wormhole solutions were found in [60, 61]. Furthermore, the perturbation techniques were used in study of spherical stars [62]. The effects on gravitational lensing due to f(RT) gravity were discussed in [63]. The spherical equilibrium theme of polytropic and strange stars were investigated in [64]. Houndjo [65] constructed few observationally notable cosmic models in f(RT) gravity for studying matter dominated era of the expanding universe. Baffou et al. [66] applied perturbation on the spacetimes of de-Sitter and power law models in order to explore some cosmic viability bounds.

Bamba et al. [67] analyzed the effects of higher degrees of freedom coming from MGT on the dynamical features of our accelerating cosmos. Bamba et al. [73] further checked the viability regimes on the parameters of f(G) gravity models and presented some mathematically consistent cosmic zones. The stability of gravitational evolving stellar bodies have been investigated in few models of f(R) gravity by [69, 71]. Das et al. [72] calculated exact relativistic models of spherical interiors in MGT and discussed the physical implications of their results on compact stars.

Yousaf and his collaborators examined the role of various curvature invariant functions on the existence as well as stability of the planar [74,75,76], spherical [17, 77,78,79,80] and cylindrical [23, 81,82,83] geometries. Sahoo with his coworkers [84,85,86] studied the viability of the spatially regular cosmos along with some other cosmological aspects in f(RT) gravity. Moraes et al. [64] worked out the stability of some well-known compact stars by computing their corresponding hydrostatic equations in \(f(R,T)=R+2\lambda T\) gravity.

The exploration on the existence of self-gravitating compact stars have always been a source of great attention among gravitational physicists [87,88,89,90,91,92,93,94]. In this direction, many researchers reconstructed different models for the study of anisotropic relativistic compact stars. Various physical properties, like masses of compact stars, radii, stability etc. and the moment of inertia of neutron stars were studied with the comparison developed with GR and other MGTs [95]. Virbhadra et al. [96,97,98] discussed the relation between naked singularity and black holes formation accompanied with a well-consistent mathematical stand point. Egeland [109] performed the modeling of neutron star by examining some mass radius relations and concluded that \(\Lambda \) should exist to justify the vacuum density. Sharif and Yousaf [99] also found these relations and checked the existence of compact structures in the platform of MGTs. Bhatti et al. [100] calculated dark dynamical variables and checked the dynamics of compact stars with the help of these variables. Recently, Yousaf et al. [101] investigated the stability of three different compact structures in the presence of dark sources terms mediated by quadratic, cubic and exponential f(R) formulations.

Here, we use the modified f(RT) gravity, which can be considered as more well established theory than that of cosmological constant. To explore the formation of relativistic anisotropic compact stellar objects in f(RT) gravity, we use two such a viable f(RT) models for three candidates of strange stars, i,e., Her X-1, SAXJ1808.4-3658 and 4U1820-30. We shall label these stars with CS1, CS2 and CS3, respectively. We find the solutions of relativistic anisotropic stellar bodies in f(RT) gravity, that enforce some constraints on the cosmic model parameters. In very next section, we formulate f(RT) equation of motions, after having the background of f(RT) gravity, we take anisotropic matter contents for static spherical star geometry. In Sect. 3, we demonstrate some of the physical viable models in f(RT) gravity. In Sect. 4, we explore the solutions and discussed the physical properties of relativistic compact stars through graphical illustrations. At the end, we finalize our results.

2 f(RT) gravity

The action for f(RT) gravity can be written as

$$\begin{aligned} I=\int {d{x^4}\sqrt{-g}\left[ {f(R,T)+{L_{matter}}}\right] }, \end{aligned}$$
(2.1)

where g and \(L_{matter}\) indicate determinant of metric tensor and the matter Lagrangian, respectively. By varying the above equation with metric tensor, we get

$$\begin{aligned}&{R_{\xi \pi }}{f_R}-\frac{1}{2}{g_{\xi \pi }}f + \left( {{g_{\xi \pi }}{\nabla ^\xi }{\nabla _\mu } - {\nabla _\mu }{\nabla _\pi }} \right) {f_R}\nonumber \\&\quad = {T_{\xi \pi }} -{f_T}{\Theta _{\xi \pi }}-{f_T}{T_{\xi \pi }}, \end{aligned}$$
(2.2)

where the notations \({f_R},~{\nabla _\gamma }\) and \({f_T}\) are operators for covariant and partial derivatives of their arguments, respectively, while \({\Theta _{\mu \nu }}\) can be expressed through the stress-energy tensor (\(T_{\gamma \delta }\)) as

$$\begin{aligned} {\Theta _{\xi \pi }} = \frac{{{g^{\alpha \beta }}\delta {T_{\alpha \beta }}}}{{\delta {g^{\xi \pi }}}} = - 2{T_{\xi \pi }} + {g_{\xi \pi }}{L_m} - 2{g^{\alpha \beta }}\frac{{{\partial ^2}{L_m}}}{{\partial {g^{\xi \pi }}\partial {g^{\alpha \beta }}}}. \end{aligned}$$
(2.3)

The aim of this work is to check the different properties of some of the compact stars with locally anisotropic pressure. Now, we consider that the spherical distribution of geometric system is coupled with the following relativistic fluid

$$\begin{aligned} {T_{\mu \nu }} = (\rho + {P_t}){V_\mu }{V_\nu } - {P_t}{g_{\mu \nu }} + \Pi {X_\mu }{X_\nu }, \end{aligned}$$
(2.4)

in which \(\Pi \equiv P_r-P_\bot \) and \(\rho \) is the matter energy density and \({V_\gamma }\) and \(X_\gamma \) are the 4-vectors corresponding to fluid and radial directions, respectively. Under the non-tilted coordinate system, the four vectors satisfy \({V^\alpha }{V_\alpha }=1\) and \({X^\beta }{X_\beta }=-1\) relations. Equation (2.3) can be written, after choosing \(L_m=\rho \), as

$$\begin{aligned} {\Theta _{\alpha \beta }} = - 2{T_{\alpha \beta }} + \rho {g_{\alpha \beta }} \end{aligned}$$

Then, the field equations (2.2) boil down to

$$\begin{aligned} {R_{\xi \pi }} - \frac{1}{2}R{g_{\xi \pi }} = T_{\xi \pi }^{\text {eff}}, \end{aligned}$$
(2.5)

where \(T_{\xi \pi }^{\text {eff}}\) is dubbed with the effective stress energy tensor for f(RT) gravity whose mathematical formulations is given by

$$\begin{aligned} T_{\xi \pi }^{\text {eff}}= & {} \frac{1}{{{f_R}}}\left[ {(1 + {f_T})} \right. {T_{\xi \pi }} - \rho {g_{\xi \pi }}{f_R} + \frac{1}{2}(f - R{f_R}){g_{\xi \pi }} \nonumber \\&+ ({\nabla _\xi }{\nabla _\pi } - {g_{\xi \pi }}{\nabla ^\alpha }{\nabla _\alpha })\left. {f_R} \right] . \end{aligned}$$
(2.6)

Now, we wish to consider the diagonally symmetric static form of spherically symmetric spacetime as

$$\begin{aligned} d{s^2} = {e^{a}}d{t^2} - {e^{b}}d{r^2} - {r^2}\left( {d{\theta ^2} + {{\sin }^2}\theta d{\phi ^2}} \right) , \end{aligned}$$
(2.7)

where metric coefficients a and b are the r dependent functions. Our aim is to analyze the role of anisotropicity in the modeling of some stellar toy models. So, we assume that Eq. (2.7) is composed of the locally anisotropic fluid content given in Eq. (2.4). The f(RT) equations of motion (2.2) for the geometry (2.7) and fluid (2.4) yield

$$\begin{aligned} \rho&= {e^{ - b}}\left[ {\left\{ \frac{1}{4}a'{{(r)}^2}+{\frac{{a''}}{2}- \frac{b'}{4}a'+ \frac{{a'}}{r}} \right\} {f_R}\left( {R,T} \right) }\right. \nonumber \\&\quad \left. + \left( {\frac{{b'(r)}}{2} - \frac{2}{r}} \right) { {f_R}' - \frac{{f_R}}{2}{e^{b}}-{f_R}{{^\prime }^\prime }} \right] , \end{aligned}$$
(2.8)
$$\begin{aligned} P_r&= \frac{{{e^{ - b}}}}{{\left( {1 + {f_T}\left( {R,T} \right) } \right) }}\left[ {\left\{ { - \frac{{a''}}{2} - \frac{b'}{4}a' + \frac{{b'}}{r}}-\frac{1}{4}a'^2 \right\} {f_R}} \right. \nonumber \\&\quad \left. + \left( {\frac{{a'}}{2} + \frac{2}{r}} \right) {f_R}^\prime + \frac{{e^{b}}}{2}{f_R} \right] - \frac{{\rho {f_T}}}{{\left( {1 + {f_T}} \right) }}, \end{aligned}$$
(2.9)
$$\begin{aligned} P_t&= \frac{{{e^{ - b}}}}{{\left( {1 + {f_T}} \right) }}\left[ {\left\{ {e^{b}}+{\frac{r}{2}\left( {b'- a'} \right) - 1} \right\} \frac{{{f_R}}}{{{r^2}}}}+ \left\{ -\frac{1}{2}( {b'-a'})\right. \right. \nonumber \\&\quad \left. \left. + \frac{1}{r} \right\} { {f_R}^\prime +{f_R}^{\prime \prime }+ \frac{{f_R}}{2}{e^{b}} }\right] -\frac{{\rho {f_T}}}{{\left( {1 + {f_T}} \right) }}, \end{aligned}$$
(2.10)

where the over prime indicates \(\partial /\partial r\) operator.

In order to analyse the impact of f(RT) gravity on the construction of stellar models, we assume the separable form of R and T in f(RT) model as follows

$$\begin{aligned} f(R,T)=f_i(R)+g(T). \end{aligned}$$
(2.11)

This choice of separable R and T can be regarded as a possible linear corrections in the well-known f(R) theory. By choosing \(f_i(R)\) from [33] along with the linear combination of g(T), the viable f(RT) model can be designed. Therefore, we suppose \(g(T)=\epsilon T\) in which \(\epsilon \) is a very small positive number. In this context, Eqs. (2.8)–(2.10) provide

$$\begin{aligned} \rho&= \frac{1}{{2(1 + 2\epsilon )}}\left[ {\frac{{(2 + 5\epsilon )}}{{(1 +\epsilon )}}{\varphi _1} + \epsilon {\varphi _2} + 2\epsilon {\varphi _3}} \right] , \end{aligned}$$
(2.12)
$$\begin{aligned} P_r&= \frac{{ - 1}}{{2(2\epsilon + 1)}}\left[ {\frac{\epsilon }{{\left( {\epsilon +1} \right) }}{\varphi _1} - (2 + 3\epsilon ){\varphi _2} + 2\epsilon {\varphi _3}} \right] , \end{aligned}$$
(2.13)
$$\begin{aligned} P_t&= \frac{{ - 1}}{{2(1 + 2\epsilon )}}\left[ {\frac{\epsilon }{{(1 +\epsilon )}}{\varphi _1} + \epsilon {\varphi _2} - 2(1+ \epsilon ){\varphi _3}} \right] ,\nonumber \\ \end{aligned}$$
(2.14)

where

$$\begin{aligned} {\varphi _1}&= {e^{ - b}}\left[ {\left( {\frac{a'^2}{4}+\frac{{a''}}{2} - \frac{b'}{4}a' + \frac{{a'}}{r}} \right) {f_R}}+ \left( {\frac{{b'}}{2} - \frac{2}{r}} \right) \right. \\&\quad \left. \times {f_R}^\prime -\frac{{f_R}}{2}{e^{b}} - {f_R}^{\prime \prime } \right] ,\\ {\varphi _2}&= \frac{{{e^{ - b}}}}{{\left( {1 + \epsilon } \right) }} \left[ {\left( {\frac{{b'}}{r} - \frac{{a''}}{2} - \frac{b'}{4}a' - \frac{1}{4}a'^2} \right) {f_R}}+ \left( {\frac{2}{r}+\frac{{a'}}{2}} \right) \right. \\&\quad \left. \times {f_R}^\prime + \frac{1}{2}{e^{b}}{f_R} \right] ,\\ {\varphi _3}&= \frac{{{e^{ - b}}}}{{\left( {1 + \epsilon } \right) }} \left[ {\left( {{e^{b}}-\frac{1}{2}r\left( {a'-b'} \right) - 1} \right) \frac{{{f_R}}}{{{r^2}}}}\right. \\&\quad \left. + \left\{ {\frac{1}{r}-\frac{1}{2}\left( {b'-a'} \right) } \right\} {{f_R}^\prime + \frac{{f_R}}{2}{e^{b}} + {f_R}^{\prime \prime }} \right] . \end{aligned}$$

We write a and b as a combinations of radial coordinates suggested by Krori and Barua [110]. They proposed the specific forms of these functions as \(a(r) =B r^2 +C\) and \(b(r)=A r^2\), where A,  B and C are the three constant numbers. One can find the values of this triplet (A,  B,  C) by considering some appropriate boundary conditions. Then, Eqs. (2.12)–(2.14) yield

$$\begin{aligned} \rho&= \frac{{{\mathrm{{e}}^{ - A{r^2}}}}}{{2{r^2}\left( {1 + \epsilon } \right) \left( {1 + 2\epsilon } \right) }}[ - {\mathrm{{e}}^{A{r^2}}}{r^2}\left( {1 + \epsilon } \right) f_i \nonumber \\&\quad + (2( - 1 - 2\epsilon + 3B{r^2} \epsilon + {B^2}{r^4}\epsilon + {\mathrm{{e}}^{A{r^2}}} \nonumber \\&\quad \times \left( {1 + 2\epsilon } \right) + A{r^2}\left( {2 + 4\epsilon - B{r^2}\epsilon } \right) )\nonumber \\&\quad + {\mathrm{{e}}^{A{r^2}}}{r^2}(1 + \epsilon )R)f_i'+ r(( - 4 - 6\epsilon + 3B{r^2}\epsilon \nonumber \\&\quad + A{r^2}(2 + 3\epsilon )){R^\prime }f_i''-r\left( {2 + 3\epsilon } \right) {R^{\prime \prime }}f_i''\nonumber \\&\quad - r\left( {2 + 3\epsilon } \right) {R^\prime }^2f_i''')], \end{aligned}$$
(2.15)
$$\begin{aligned} {P_r}&= \frac{{{\mathrm{{e}}^{ - A{r^2}}}}}{{2{r^2}\left( {1 + \epsilon } \right) \left( {1 + 2\epsilon } \right) }}[{\mathrm{{e}}^{A{r^2}}}{r^2}\left( {1 + \epsilon } \right) f_i \nonumber \\&\quad - (2( - 1 - 2\epsilon + {B^2}{r^4} \epsilon + {\mathrm{{e}}^{A{r^2}}}(1 + 2\epsilon ) \nonumber \\&\quad - B{r^2}\left( {2 + \epsilon + A{r^2}\epsilon } \right) ) + {\mathrm{{e}}^{A{r^2}}}{r^2}\left( {1 + \epsilon } \right) R)f_i' \nonumber \\&\quad + r[\{4 + 6\epsilon + A{r^2}\epsilon + B{r^2}( 2 + \epsilon ) \}\nonumber \\&\quad \times R'f_i'' - r\epsilon R''f_i'' - r\epsilon R'^2f_i''']], \end{aligned}$$
(2.16)
$$\begin{aligned} {P_t}&= \frac{{{\mathrm{{e}}^{ - A{r^2}}}}}{{2{r^2}\left( {1 + \epsilon } \right) \left( {1 + 2\epsilon } \right) }}[{\mathrm{{e}}^{A{r^2}}}r\left( {1 + \epsilon } \right) fi \nonumber \\&\quad - r[2\{ - B(2 + \epsilon + B{r^2}(1 + \epsilon )) + A(1 + 2\epsilon \nonumber \\&\quad + B{r^2}(1 + \epsilon ))\}+ {\mathrm{{e}}^{A{r^2}}}\left( {1 + \epsilon } \right) R]f_i'+2{R^\prime } f{i^{\prime \prime }}\nonumber \\&\quad - 2A{r^2}{R^\prime }f{i^{\prime \prime }}+ 2B{r^2}{R^\prime }f{i^{\prime \prime }} +2\epsilon R'f_i''\nonumber \\&\quad -3A{r^2}\epsilon R'f_i'' + B{r^2}\epsilon R' f_i'' + 2f_i''rR'' + 3r\epsilon R''f_i'' \nonumber \\&\quad + 2r{R^\prime }^2f_i'''+ 3r\epsilon R'^2f_i''']. \end{aligned}$$
(2.17)

3 Boundary conditions

We consider a timelike hypersurface denoted by \(\Omega \) that has differentiated interior manifold given in Eq. (2.7) and outer geometry. The exterior region is through the vacuum Schwarzschild spacetime as

$$\begin{aligned} d{s^2}&= \left( {1 - \frac{{2M}}{r}} \right) d{t^2}-{\left( {1 - \frac{{2M}}{r}} \right) ^{ - 1}}d{r^2} \nonumber \\&\quad - {r^2}\left( {d{\theta ^2} + \sin {\theta ^2}d{\varphi ^2}} \right) , \end{aligned}$$
(3.1)

where M is the gravitating matter content. At the boundary surface \(\Omega \), the continuity of the metric variables \(g_{tt},~g_{rr}\) and the \(\partial g_{tt}/\partial r\) provide the following constraints

$$\begin{aligned} A&= \frac{{ - 1}}{{{R^2}}}\ln \left( {1 - \frac{{2M}}{R}} \right) , \quad B = \frac{M}{{{R^3}}}{\left( {1 - \frac{{2M}}{R}} \right) ^{ - 1}}, \end{aligned}$$
(3.2)
$$\begin{aligned} C&= \ln \left( {1 - \frac{{2M}}{R}} \right) - \frac{M}{R}{\left( {1 - \frac{{2M}}{R}} \right) ^{ - 1}}. \end{aligned}$$
(3.3)

For the smooth and continuous matching of the manifolds, the above constraints at \(\Omega \) should be fulfilled. We now pick some observational values of A,  B and C from the literature to check the construction as well as the stability of the compact stellar bodies. We consider, three stellar toy models Her X-1, SAXJ1808.4-3658 and 4U1820-30 labeled with CS1, CS2 and CS3 here. The masses of these star candidates are 0.88, 1.435 and 2.25 solar masses, respectively. All of these stellar structures satisfy Buchdahl Bondi bound as their 2M / R ratios are less than 8 / 9. We further suppose that the junction conditions at the stellar core are [113]

$$\begin{aligned} \rho (r) = {\rho _c}\end{aligned}$$
(3.4)
$$\begin{aligned} \frac{{da}}{{dr}}(0) = 0,\end{aligned}$$
(3.5)
$$\begin{aligned} b(0) = 0, \end{aligned}$$
(3.6)

where \(\rho _c\) is the critical mass density.

Fig. 1
figure 1

Graph for the density (km\(^{-2}\)) evolution with both f(RT) models

Table 1 The observational values of the radii R, masses M, compactness \(\mu \), and the constants B and A for CS1, CS2 and CS3

4 Various f(RT) models

The aim of this section is to study some of the notable f(RT) models. We want to analyze the influences of these f(RT) models in the construction and stability of the compact stellar candidates in the background of some observations. We shall discuss some realistic features of spherical systems like, compactness, stability, evolution of energy density with radial coordinate, the measurement of anisotropic pressure evolution and the different energy conditions. The results obtained such investigations may provide some hidden realities corresponding to the both theoretical and astrophysical regimes. Equation (2.11) provides

$$\begin{aligned} f(R,T)=fi(R)+ \epsilon T, \end{aligned}$$
(4.1)

where \(i=1,~2\). There has been very interesting results which reveal that the inclusion of extra dark energy/DM components mediated from alternative theories could bring some exciting results. For instance, collapse time, existence of more compact structure, stability, phenomenon of core formation and above all can be well influenced by these dark source terms unlike GR. The reexamination of GR problems in alternatives theories may be helpful to shed some light on the models viability and their usefulness on physical grounds. The cross-examinations may present both quantitative and qualitative different consequences than that of GR.

It is of particular interest for many researchers to explore the predictions as well as the outcomes of modified gravitational theories like f(RT) theory concerning the existence of stellar structure and their stability. The f(RT) gravity can be treated as a mathematical tool to examine various unknown features of gravitational dynamics at large scales. Schaefer and Koyama [102] generalized their study of gravitational collapse of spherical structures in the realm of modified gravity and Birkhoff-theorem and found enhanced cluster merging rates as well as overdensed populations of relativistic structures (due to modified gravity). Capozziello et al. [103] computed modified Lané-Emden expression with metric f(R) corrections and Newtonian approximation. They get some exceptional results of density and pressure distribution in the analysis of the hydrostatic scenario of few celestial bodies. Cembranos et al. [104] studied stellar structure formation in the background of modified gravity and found comparatively higher contraction in the collapsing rate of spherical systems at its initial stages unlike GR.

Astashenok et al. [105] examined the impact of few modified gravity formulations on the existence of compact structure and inferred that there exists some models whose corrections could lead arena of having relatively more compact stars than in GR. Yousaf and Bhatti [106] studied the influences of modified dark source terms on mass-radius relationships for compact stars and concluded that some extended gravities mediated by Lagrangians \(\alpha R^2\) and \(\frac{\alpha R^2-\beta R}{1+\gamma R}\) are likely to host supermassive relativistic systems with comparatively smaller radii than in GR. Resco et al. [107] numerically calculated apparent masses of neutron star models in modified gravity and inferred that generically some modified extra degrees of freedom likely to keep significantly massive neutron star with smaller radii than in GR. Such type of investigations could provide theoretical well-consistent way to handle and study classes of massive and super massive structures at large scales. Bamba et al. [73] claimed that modified gravitational dynamics could provide an additional platform in few regions of spacetime that could lead to stable configurations of relativistic system. In this paper, we found relatively stellar bodies with much higher densities than that found in GR [108] as seen from Fig. 1.

In the following we discuss two different f(RT) models.

4.1 Model 1

Firstly, we take the tanh modification of the Ricci scalar function that was proposed by [114]. In this respect, the f(RT) gravity model (4.1) give

$$\begin{aligned} f(R,T)= R-\alpha \hat{R} \tanh \left( \frac{R}{\hat{R}}\right) +\epsilon T, \end{aligned}$$
(4.2)

where \(\alpha \in \mathbb {R}^+\) and \(\hat{R}\in \mathbb {R}^+\) in which \(\mathbb {R}^+\) denotes the set of positive real numbers. On setting \(\alpha = 0\), the dynamics of Einstein’s gravity can be discussed.

4.2 Model 2

Next, we consider another viable formulations of f(R) gravity that was first suggested by [115, 116]. Under this context, Eq. (4.1) becomes

$$\begin{aligned} f(R,T)= R+\gamma \hat{R} \left( \left( 1+\frac{R^2}{\hat{R^2}}\right) ^{-q}-1\right) +\epsilon T, \end{aligned}$$
(4.3)

where \(\hat{R},~\gamma \) and q are the free non zero and non negative parameters.

In the coming section, we will use these two viable model for further investigation of compact stars.

5 Some physical properties

This section is devoted to analyze various aspects of some compact stellar toy models. We assume three different star distributions, i.e., CS1, CS2, CS3 as well as two observationally consistent f(RT) models. Upon substituting this data in Eqs. (2.8)–(2.10), we get values of matter variables in the form of four parameters, \(\alpha ,~\hat{R},~q\) and \(\epsilon \). Then, we study some physical features to obtain the realistic configurations of compact stellar structures (shown in Table 1). The comparison between our theoretical outcomes and the observational data may provide the strong evidences for f(RT) models. We shall show our results with the help of plots.

5.1 Density and pressure evolutions

This section is devoted to analyze the matter parameters of all the three stellar bodies whose variations are depending on the radial coordinate. We check the radial variations in the anisotropic pressure, energy density and their corresponding radial derivatives. Now with the help of Eqs. (2.8)–(2.10), we plot Fig. 1 for all the three stellar models in the background of two above mentioned f(RT) models. We infer that the behavior of energy densities keep on increasing till the constraint \(r\rightarrow 0\). This indicates the distribution of \(\rho \) to be increasing with respect to the decreasing choices of r. One can say from these that our stellar toy models are of having highly compact cores in the degrees of freedom coming from Eqs. (4.2) and (4.3). Figures 2 and 3 describe the plots of the variations in the components of the star pressure.

Fig. 2
figure 2

Graph for the radial pressure (km\(^{-2}\)) evolution with both f(R) models

Fig. 3
figure 3

Graph for the transverse pressure (km\(^{-2}\)) evolution with both f(RT) models

Fig. 4
figure 4

Graph describing \(d\rho /dr\) with respect to r for both f(R) models

Furthermore, Figs. 4, 5 and 6 are describing the variations in the r derivative of \(\rho \) and \(p_i\). One can observe from these that \(\frac{d\rho }{{dr}}<0,~\frac{dp_r}{{dr}}<0\) and \(\frac{dp_t}{{dr}}<0\) for the given two viable models and the three toy models. Under the constraint \(r=0\), one can notice that the r variations of all the matter variables vanishes, such that

$$\begin{aligned} \frac{d\rho }{{dr}}= & {} 0,\\ \frac{dp_r}{{dr}}= & {} 0. \end{aligned}$$

Furthermore, the twice variations of these structural quantities have been found to be negative. These consequences are providing a seed for the high compact profiles of such star structures around their subsequent cores, thus indicating that the configurations of compact and dense stars do exists in the arena of f(RT) gravity.

Fig. 5
figure 5

Graph describing \(dp_r/dr\) with increasing r for both f(R) models

Fig. 6
figure 6

Graph describing \(dp_t/dr\) with increasing r for both f(R) models

Fig. 7
figure 7

ECs viability for three stellar bodies with \(f(R,T)= R-\alpha \hat{R} \tanh \left( \frac{R}{\hat{R}}\right) +\epsilon T\)

Fig. 8
figure 8

ECs viability for three stellar bodies with \(f(R,T)= R+\gamma \hat{R} \left( (1+\frac{R^2}{\hat{R^2}})^{-q}-1\right) +\epsilon T\)

5.2 Energy conditions

For a realistic matter content distribution, one need to check some particular conditions, such a mathematical conditions are called energy conditions (ECs). These mathematical conditions are the coordinate-invariant. In the regime of modified f(RT) gravity like the effective forms of density and the anisotropic pressure, the null energy Condition (NEC) and the weak energy conditions (WEC) are devised, respectively, as

$$\begin{aligned}&\bullet \text {NEC}\Leftrightarrow {\rho ^{\text {eff}}} + {P_i^{\text {eff}}} \ge 0,\\&\bullet \text {WEC}\Leftrightarrow {\rho ^{\text {eff}}} \ge 0 \text { and } {\rho ^{\text {eff}}} + {P_i^{\text {eff}}} \ge 0, \end{aligned}$$

while the rest of ECs, i.e., strong energy condition (SEC) and dominant energy condition (DEC) give

$$\begin{aligned}&\bullet \text {SEC}\Leftrightarrow {\rho ^{\text {eff}}+2{P_t^{\text {eff}}}+ 3{P_r^{\text {eff}}}} \ge 0 \text { and } {\rho ^{\text {eff}}} + {P_i^{\text {eff}}} \ge 0,\\&\bullet \text {DEC} \Leftrightarrow {\rho ^{\text {eff}}} \ge 0 \text { and } {\rho ^{\text {eff}}} \pm {P_i^{\text {eff}}} \ge 0. \end{aligned}$$

It has been easily be figure out from the plots shown in Figs. 7 and 8 that our under considerations of both models with CS1, CS2 and CS3 obey all ECs. This suggests that anisotropic fluid content (2.4) describes the realistic source of gravitational effects.

5.3 TOV equation

A mathematical expression that provide some restrictions on the geometrical distributions of the relativistic spherical system, which is normally hydrostatic equilibrium and is often called as TOV equation. For the spherical line element, this equation is written as

$$\begin{aligned} \frac{{d{P_r}}}{{dr}} + \frac{{a'(\rho + {P_r})}}{2} + \frac{{2({P_r} - {P_t})}}{r} = 0, \end{aligned}$$
(5.1)

The above equation contains three well-known interactions, i.e., the gravitational, \((F_g)\), hydrostatic, \((F_h)\) and anisotropic, \((F_a)\) forces. Therefore, one may write above equation as

$$\begin{aligned} F_g + F_h + F_a= 0. \end{aligned}$$
(5.2)

The values of these forces by using of Eqs. (2.8)–(2.10) gives

$$\begin{aligned} F_g&\equiv -B r (\rho +P_r)=\frac{-1}{1+\epsilon }\left[ 2B\exp (Ar^2)r \{2(B+A)f_i'\right. \\&\quad \left. +(B+A)R'rf_i''-R''f_i''-R'^2fi'''\}\right] ,\\ F_h&\equiv -\frac{{d{p_r}}}{{dr}}=\frac{\exp (-Ar^2)}{2r^3(1+\epsilon )(1+2\epsilon )}[4\{1+2\epsilon +B^2r^4\epsilon \\&\quad +A^2Br^6\epsilon -\exp (Ar^2) (1+2\epsilon )+Ar^2\\&\quad \times (1+2Br^2+2\epsilon -B^2r^4\epsilon )\}fi'+r\{-r(4+3(2+Ar^2)\epsilon \\&\quad +Br^2(2+\epsilon ))f_i'''R'^2+R'\{(2\\&\quad +8Ar^2-6Br^2+4ABr^4+2\epsilon +11Ar^2\epsilon -3Br^2\epsilon \\&\quad +2A^2r^4\epsilon +2B^2r^4\epsilon +\exp (Ar^2)(2\\&\quad +4\epsilon ) +\exp (Ar^2)r^2(1+\epsilon )R)f_i''+3r^2\epsilon R''f_i'''\}\\&\quad -f_i''r((4+6\epsilon +3Ar^2\epsilon +Br^2(2+\epsilon ))R''\\&\quad -r\epsilon R''') +r^2\epsilon R'^3fi''''\}],\\ F_a&\equiv \frac{{2({P_r} - {P_t})}}{r}=\frac{2\exp (-Ar^2)}{r^3(1+\epsilon )}[\{\exp (Ar^2)\\&\quad -(1+Ar^2-Br^2)(1+Br^2)\}f_i' +r\{-(1+Ar^2)\\&\quad \times f_i'' R'+f_i''rR''+R'^2rf_i'''\}]. \end{aligned}$$

Using above relations together with observational values of A,  B and C from Table 1, we have drawn some diagrams mentioned in Fig. 9. In Fig. 9, the left plot is for f(RT) model (4.2) and right plot is for model (4.3). The role of these three types of interactions with respect to r (km) has been seen in this diagram in the modeling of compact bodies CS1, CS2 and CS3.

Fig. 9
figure 9

Graph describing \(F_g,~F_h\) and \(F_a\) with r (km)

Fig. 10
figure 10

Change in \(v_{sr}^2\) versus r (km) of CS1, CS2 and CS3

5.4 Stability analysis

This section illustrates the stability of the compact relativistic structures. It would be interesting to mention that, for any arbitrary relativistic observer, only those stellar bodies are worthy to study which remain in stable position after the application of fluctuations. Thus, the stability problem is among the burning issues for the relativistic astrophysicists. With this intentions, we analyze the stable regimes of our under considerations stellar models by applying the technique developed by [117]. This scheme could be useful to study the phenomenon of cracking. According to this scheme, the stellar system must have the ranges of \(v^2_{sr}\) and \(v^2_{st}\) between 0 and 1, e.g., in the closed interval [0, 1], here \(v_{sr}\) and \(v_{st}\) represent the radial and transverse sound speeds, respectively. These variables are defined as follows

$$\begin{aligned} \frac{{d{P_r}}}{{d\rho }} = v_{sr}^2,\quad \frac{{d{P_t}}}{{d\rho }} = v_{st}^2. \end{aligned}$$

Now, using Eqs. (2.8)–(2.10), their values are calculated as

$$\begin{aligned} v_{sr}=\sqrt{\frac{\chi }{\Psi }},\quad v_{st}=\sqrt{\frac{\phi }{\Psi }}, \end{aligned}$$
Fig. 11
figure 11

Change in \(v_{st}^2\) versus r (km) of CS1, CS2 and CS3

Fig. 12
figure 12

Change in \(v_{st}^2 - v_{sr}^2\) versus r (km) of CS1, CS2 and CS3

Fig. 13
figure 13

Change in \(\Delta \) versus r

where

$$\begin{aligned} \chi&=r\{4r^3(B^2(1+\epsilon )+A^2(1+2\epsilon +Br^2(1+\epsilon ))\nonumber \\&\quad -AB(3+2\epsilon +Br^2(1+\epsilon )))f'+r\{2(1\nonumber \\&\quad +\epsilon )+Br^2(2+\epsilon ) -3Ar^2(2+3\epsilon )\}R'^2fi'''\nonumber \\&\quad +R'\{(6Br^2-2+2B^2r^4-2\epsilon +3Br^2\epsilon +2B^2\nonumber \\&\quad \times r^4\epsilon +2A^2r^4(2+3\epsilon )-Ar^2 (8+11\epsilon \nonumber \\&\quad +2Br^2(3+2\epsilon ))-\exp (Ar^2)r^2(1+\epsilon )R\}fi''+3r^2\nonumber \\&\quad \times (2+3\epsilon )R''fi'''\}+rfi''\{(2(1+\epsilon )+Br^2(2+\epsilon )\nonumber \\&\quad -3Ar^2(2+3\epsilon ))R''+r(2+3\epsilon )R'''\}\nonumber \\&\quad +r^2(2+3\epsilon )R'^3fi''''\}, \end{aligned}$$
(5.3)
$$\begin{aligned} \Psi&=-4[\exp (Ar^2)(1+\epsilon )-1-2\epsilon -B^2r^4\epsilon \nonumber \\&\quad +A^2r^4\{2+(4-Br^2)\epsilon \}+Ar^2\{-1(4Br^2-2\nonumber \\&\quad +B^2r^4)\epsilon \}]fi'+r\{r(3(Br^2-2)\epsilon -4\nonumber \\&\quad +3Ar^2(2+3\epsilon ))R'^2fi'''+R'((2+14Ar^2-4A^2r^4+2\epsilon \nonumber \\&\quad +23Ar^2(1+\epsilon ) fi''=3r^2(2+3\epsilon )R''fi''')\nonumber \\&\quad +rfi''((3Br^2\epsilon -4-6\epsilon +3Ar^2(2+3\epsilon ))R''-r(2\nonumber \\&\quad +3\epsilon )R''')-r^2(2+3\epsilon )R'^2fi'''')\}, \end{aligned}$$
(5.4)
$$\begin{aligned} \phi&=4[4\{1+2\epsilon +B^2r^4\epsilon +A^2Br^6\epsilon -\exp (Ar^2)(1+2\epsilon )\nonumber \\&\quad +Ar^2(1+2Br^2+2\epsilon -B^2r^4\epsilon )\}fi'\nonumber \\&\quad +r\{-r(4+3(2+Ar^2)\epsilon )+Br^2(2+\epsilon )\}R'^2fi'''\nonumber \\&\quad +R'\{(2+8Ar^2-6Br^2+4ABr^4+2\epsilon \nonumber \\&\quad +11Ar^2\epsilon -3Br^2\epsilon +2A^2r^4\epsilon +2B^2r^4\epsilon \nonumber \\&\quad +\exp (Ar^2)(2+4\epsilon )+\exp (Ar^2)r^2(1+\epsilon )R)fi''\nonumber \\&\quad +3r^2\epsilon R''fi'''\}-rfi''\{(4+6\epsilon +3Ar^2\epsilon \nonumber \\&\quad +Br^2(2+\epsilon ))R''-r\epsilon R'''\}+r^2\epsilon R'^3fi'''']. \end{aligned}$$
(5.5)

To reach the stable window, the transverse and radial speeds of the relativistic spherical manifolds must obey \(0 \le v_{sr}^2 \le 1\) and \(0 \le v_{st}^2 \le 1\). We plotted some graphs by using Eqs. (4.2) and (4.3) and (5.3)–(5.5) along with Table 1. One can clearly see from the Figs. 10 and 11 that \(v_{sr}^2 \) and \(v_{st}^2 \) are within the stability range for all three observed compact stellar structures. Furthermore, Fig. 12 shows the stability modes like

$$\begin{aligned} 0< |v_{st}^2-v_{sr}^2|<1. \end{aligned}$$

This indicate that our compact spherical geometries are within the stability bounds even in the presence of extra degrees of freedom coming from (4.2) and (4.3) f(RT) models.

5.5 The measurement of anisotropy

The extent of anisotropicity as well as its magnitude within a local anisotropic fluid distributions can be defined as

$$\begin{aligned} \Delta \equiv \frac{2}{r}({P_t} - {P_r}). \end{aligned}$$

Using Eqs. (2.8)–(2.10), we can write \(\Delta \) as

$$\begin{aligned} \Delta&=\frac{2\exp (-Ar^2)}{r^3(1+\epsilon )}[\{\exp (Ar^2)\\&\quad -(1+Ar^2-Br^2)(1+Br^2)\}fi' +r\{-(1+Ar^2)\\&\quad \times R'fi''+rfi''R''+rR'^2fi'''\}]. \end{aligned}$$

The above equation contains fi terms. We use the two different viable fi models from Eqs. (4.2) and (4.3) and get the three different equations, each incorporating a particular f(RT) model corrections. After using observational results of the compact stars given in Table 1, we terminated with six set of equations. We check the behavior of anisotropy in the degrees of anisotropicity in the background of relativistic compact objects, by plotting these equations. It can be seen from the plot shown in Fig. 13 that the \(\Delta \) is remained greater than zero for all the three relativistic compact stellar structures which resulting that the influence of radial pressure, \(P_r\) is lesser than that of transverse pressure, \(P_t\). This outward directed measure of anisotropy for these two viable models.

6 Summary

As the universe is accelerating, this ground reality attracts researchers towards the extension of GR and modified theories of gravity. The first modification to GR gives birth to f(R) gravity, which provides a good attention while the extension of this modification gives rise to f(RT) gravity and attain much attentions because of some quantum effects arising in the theory. These modifications appear in the field of low energy action for effective quantum gravity theory.

In this work, we study the anisotropic relativistic compact stellar objects with static and spherical structures. For this purpose, we consider the relativistic compact stellar objects whose interior geometry is based on anisotropy in f(RT) gravity. Krori and Barua [110] proposed the relativistic interiors of stellar bodies through specific metric combinations. With these techniques, we connect this interior geometry with the exterior Schwarzschild geometry and find the constant (in term of mass and radius) of interior metric over the boundary. After this, we used some observational data from which we find the numerical values of these constants. Then we put these numerical values in our calculations and plots our results.

In this paper, we have used BK solution, according to which \(a(r) =B r^2 +C\) and \(b(r)=A r^2\), where A,  B and C are the three constant numbers which can be evaluated depending on several physical requirements. Such solutions [110] are claimed to be singularity-free for the static spherical systems in the background of GR. Furthermore, this solution is asserted to be regular everywhere and the matter variables, like mass density, pressure etc are finite all over within the relativistic spherical system.

It is of our interest to check the outcomes and the predictions of one of the extended gravities, i.e., f(RT) theory regarding the existence and stability of spherical stars. Therefore, we have explored the modified version of the TOV equation in the realm of couple of f(RT) models. Figure 9 states that for the particular choices of f(RT) model parameters, there exists some eras under which system could attain equilibrium condition by keeping all the forces sum to be zero. It is worthy to mention that usual GR forces are being modified due to f(RT) models, thus producing some extra effects in the forces \(F_g,~F_h\) and \(F_a\). The stability of our compact stars not only depends upon KB-solution but also on the choices of parameters involved in f(RT) models mentioned in Eqs. (4.2) and (4.3). The difference of the squares of sound speeds, i.e, \(v_{st}^2-v_{sr}^2\) has been found to be within [0, 1], thus describing our relativistic stars to be in stable window with certain values of parameters involved in the corresponding f(RT) models.

The energy density remains positive and maximum at the core of compact stars. Energy conditions holds for all these three compact stars and the radial as well as the transverse equation of state parameter are in a usual range i.g. \(0< \omega _i < 1\), here \(i = r, t\). This indicate that the interior structures of these relativistic compacts stellar objects are composed of normal ordinary matter. For all case, we find the anisotropy directed outward, e.g., \(p_t > p_r\) or \( \Delta > 0\). Similarly, the transverse as well as the radial sound speed for all these compact stars are in stable limits that implies the stability of these spherical anisotropic compact bodies in the realm of f(RT) gravity.