1 Introduction

Modified theories of gravity have secured extensive recognition after the innovative cosmological aspects of the expanding universe. This intriguing approach is considered as the most promising and optimistic to unveil the hidden characteristics of cosmos. Nojiri and Odintsov [1] introduced modified Gauss–Bonnet gravity (or \(f({\mathcal {G}})\) gravity) by including higher order correction terms through Gauss–Bonnet (GB) invariant. The motivation behind this theory comes from string theory at low energy scales which is expected to analyze effectively the late-time cosmic transitions. The GB invariant is a four-dimensional topological term which is a combination of the Ricci scalar (R), Ricci (\(R_{\alpha \beta }\)) and Riemann tensors (\(R_{\alpha \beta \mu \nu }\)), given by \({\mathcal {G}}=R^{2}-4R_{\alpha \beta }R^{\alpha \beta }+R_{\alpha \beta \mu \nu } R^{\alpha \beta \mu \nu }\). This second Lovelock scalar trivially contributes when included in matter Lagrangian but excludes spin-2 ghost instability [2, 3]. Bamba et al. [4] explored modified \(f({\mathcal {G}})\) as well as \(f(R,{\mathcal {G}})\) models with some emergent ingredients of finite-time future singularities and investigated higher-order curvature corrections to cure these singularities.

The formulation of appropriate spherically symmetric interior solution of self-gravitating system has always been problematic due to the presence of nonlinearity in the field equations. A plenty of work has been done in literature to tackle this issue. Mak and Harko [5] obtained exact anisotropic solution of the field equations and found the positively finite behavior of density and pressure supporting the core of stellar objects. Gleiser and Dev [6] investigated algorithm of anisotropic self-gravitating system with compactness \(\frac{M}{R}=\frac{4}{9}\) and obtained stable model for small measures of adiabatic index. Sharma and Maharaj [7] explored some anisotropic spherical exact solutions in the framework of linear combination of equation of state defining compactness of stellar objects. Kalam et al. [8] found compact models in the context of anisotropic regime using Karori and Barua metric. Bhar et al. [9] discussed the possibilities of existence of compact objects in higher dimensions. Maurya et al. [10] studied anisotropic solutions of compact stars in the presence of charge distribution.

The existence of exact interior solutions of self-gravitating systems in the presence of anisotropy have been carried out in a number of ways. In this regard, the minimal gravitational decoupling (MGD) approach appeared as significantly deterministic in finding the physically viable solutions for spherically symmetric stellar configuration. Ovalle [11] proposed this technique to extract some exact solutions for compact stellar objects in the framework of braneworld. The MGD approach is not a novel idea, indeed some ingredients make it specifically more attractive for searching new spherically symmetric solutions of the Einstein field equations. The main and foremost feature of this technique is that a simple solution can be extended into more complex domains. This technique could be started with a simple source (\(T^{(m)}_{\mu \nu }\)) in which another gravitational source (\(T^{*}_{\mu \nu }\)) can be added through a coupling constant \(\alpha \), i.e., \(T^{(m)}_{\mu \nu }\rightarrow \tilde{T}^{(tot)}_{\mu \nu }=T^{(m)}_{\mu \nu }+\alpha T^{*}_{\mu \nu }\) such that the spherical symmetry remains preserved. The reverse of this technique also works through de-coupling of gravitational sources. In order to find the solution of highly non-linear field equations with complex spherically symmetric gravitational sources, we split the source in simple components and find the solution for each of them. This leads to as many solutions as the number of components whose combination will yield the solution of the field equation corresponding to the original energy-momentum tensor. This technique provides a breakthrough in the search of anisotropic solutions extended from isotropic ones.

In this context, Ovalle and Linares [12] formulated an exact solution of the field equations for spherically symmetric isotropic compact distribution and concluded that their results present the braneworld form of Tolman-IV solution. Casadio et al. [13] developed some exterior solutions for spherically symmetric self-gravitating system using gravitational decoupling technique and found naked singularity at Schwarzschild radius. Ovalle [14] decoupled gravitational source to obtain anisotropic solutions from spherically symmetric isotropic solutions. Ovalle et al. [15] extended the isotropic solution by inclusion of anisotropy using MGD approach for static regime of stellar objects. Sharif and Sadiq [16] explored charged anisotropic spherical solution through this approach and also examined the viability conditions, stability criteria through squared speed of sound.

Compact stars being the relativistic massive objects (small size and extremely massive structure) possess very strong gravitational force which can be studied in modified theories of gravity. The curiosity to know more about compact stars brings in many researchers on the platform of modified theories of gravity. Zubair and Abbas [17] investigated the possibilities of formulation of compact star in f(R) gravity using Karori and Barua solution. Abbas and his collaborators [18] analyzed the anisotropic compact star solution in f(T) gravity and examined the surface redshift, stability as well as regularity conditions. Abbas et al. [19] analyzed the anisotropic compact star in \(f({\mathcal {G}})\) gravity and examined physical behavior of star with observational data. Sharif and Fatima [20] explored static spherically symmetric solutions in \(f({\mathcal {G}})\) gravity for both isotropic and anisotropic matter distributions.

In this paper, we explore anisotropic spherically symmetric solutions using MGD approach. The paper is organized in the following format. In the next section, we discuss some basic terminologies of \(f({\mathcal {G}})\) gravity and corresponding field equations for multiple sources. Section 3 is devoted to MGD approach and corresponding junction conditions. In Sect. 4, we find exact anisotropic solutions using some constraints and check their physical behavior. Finally, we conclude our results in the last section.

2 Fluid configuration and field equations for multiple sources

The standard field equation for \(f({\mathcal {G}})\) gravity are [21]

$$\begin{aligned} R_{\rho \gamma }-\frac{1}{2} R g_{\rho \gamma }=\kappa T_{\rho \gamma }^{(tot)}, \end{aligned}$$
(1)

where \(\kappa \) is coupling constant with

$$\begin{aligned} T_{\rho \gamma }^{(tot)}=T_{\rho \gamma }^{(m)} +T_{\rho \gamma }^{({\mathcal {G}})}+\alpha \Theta _{\rho \gamma }. \end{aligned}$$
(2)

The energy-momentum tensor for perfect fluid configuration containing four-velocity field, density and pressure is

$$\begin{aligned} T_{\rho \gamma }^{(m)}=(\rho +P)U_{\rho }U_{\gamma }+Pg_{\rho \gamma }, \end{aligned}$$
(3)

and

$$\begin{aligned} T_{\rho \gamma }^{\left( {\mathcal {G}}\right) }= & {} \frac{1}{2\kappa }g_{\rho \gamma }f\left( {\mathcal {G}}\right) +\frac{1}{\kappa }\left[ \left( 4R_{\gamma \mu } R^{\mu }_{\rho }\right. \right. \nonumber \\&\left. \left. -2RR_{\rho \gamma }-2R_{\rho \mu \eta \nu }R^{\mu \eta \nu }_{\gamma } -4R_{\rho \mu \eta \gamma }R^{\mu \eta }\right) f_{{\mathcal {G}}}\left( {\mathcal {G}}\right) \right. \nonumber \\&\left. + \left( 4R_{\rho \gamma }-2Rg_{\rho \gamma }\right) \nabla ^{2} f_{{\mathcal {G}}}\left( {\mathcal {G}}\right) + 2R\nabla _{\rho }\nabla _{\gamma }f_{{\mathcal {G}}} \left( {\mathcal {G}}\right) \right. \nonumber \\&\left. - 4R_{\rho }^{\mu }\nabla _{\gamma }\nabla _{\mu }f_{{\mathcal {G}}} \left( {\mathcal {G}}\right) - 4R_{\gamma }^{\mu }\nabla _{\rho }\nabla _{\mu } f_{{\mathcal {G}}}\left( {\mathcal {G}}\right) \right. \nonumber \\&\left. + 4g_{\rho \gamma }R^{\mu \eta }\nabla _{\mu }\nabla _{\eta }f_{{\mathcal {G}}} \left( {\mathcal {G}}\right) - 4R_{\rho \mu \gamma \eta }\nabla ^{\mu }\nabla ^{\eta }f_{{\mathcal {G}}}\left( {\mathcal {G}}\right) \right] ,\nonumber \\ \end{aligned}$$
(4)

where \(\nabla ^{2}=\nabla _{\mu }\nabla ^{\mu }\) (\(\nabla _{\mu }\) denotes covariant derivative) is d’Alembert operator and \(f_{{\mathcal {G}}}({\mathcal {G}})\) represents derivative of generic function with respect to \({\mathcal {G}}\). The term \(\Theta _{\rho \gamma }\) describes an additional source coupling the gravity through constant \(\alpha \) [22] which may incorporate new fields (like scalar, vector or tensor fields) and will produce anisotropy in self-gravitating systems.

The line element of static spherically symmetric spacetime reads

$$\begin{aligned} ds^{2}=-e^{\eta (r)}dt^{2}+e^{\psi (r)}dr^{2} +r^{2}(d\theta ^{2}+\sin ^{2}\theta d\phi ^{2}), \end{aligned}$$
(5)

where \(\eta =\eta (r)\), \(\psi =\psi (r)\) denote the function of areal radius r ranging from core to the surface of star while \(U^{\mu }=e^{-\frac{\eta }{2}}\delta ^{\mu }_{0}\) for \(0<r<R\). The field Eqs. (1) with (5) yield

$$\begin{aligned}&\kappa \left( \rho -T_{0}^{0\left( {\mathcal {G}}\right) }-\alpha \Theta _{0}^{0}\right) \nonumber \\&\quad =\frac{1}{r^{2}}+\left( \frac{\psi '}{r} -\frac{1}{r^{2}}\right) e^{-\psi \left( r\right) }, \end{aligned}$$
(6)
$$\begin{aligned}&\kappa \left( P+T_{1}^{1\left( {\mathcal {G}}\right) }+\alpha \Theta _{1}^{1}\right) \nonumber \\&\quad =-\frac{1}{r^{2}}+\left( \frac{\eta '}{r} +\frac{1}{r^{2}}\right) e^{-\psi \left( r\right) }, \end{aligned}$$
(7)
$$\begin{aligned}&\kappa \left( P+T_{2}^{2\left( {\mathcal {G}}\right) }+\alpha \Theta _{2}^{2}\right) \nonumber \\&\quad =\left( \frac{\eta '}{2r}+\frac{\eta ''}{2} +\frac{\eta '^{2}}{4}-\frac{\eta '\psi '}{4} -\frac{\psi '}{2r}\right) e^{-\psi \left( r\right) }, \end{aligned}$$
(8)

where \(T_{0}^{0({\mathcal {G}})}\), \(T_{1}^{1({\mathcal {G}})}\) and \(T_{2}^{2({\mathcal {G}})}\) are given in Appendix A. The expression for GB invariant takes the form

$$\begin{aligned} {\mathcal {G}}=\frac{2e^{-2\psi }}{r^{2}}\left[ \left( \eta '^{2}+2\eta ''\right) \left( 1-e^{\psi }\right) +\eta '\psi '\left( e^{\psi }\right) \right] , \end{aligned}$$
(9)

where prime denotes the derivative with respect to r. The corresponding conservation equation reads

$$\begin{aligned}&\frac{dP}{dr}+\frac{dT_{1}^{1\left( {\mathcal {G}}\right) }}{dr} +\alpha \frac{d\Theta _{1}^{1}}{dr}\nonumber \\&\quad + \frac{\eta '}{2}\left( \rho +P+T_{1}^{1\left( {\mathcal {G}} \right) }-T_{0}^{0\left( {\mathcal {G}}\right) }\right) +\frac{2}{r}\left( T_{1}^{1\left( {\mathcal {G}}\right) } -T_{2}^{2\left( {\mathcal {G}}\right) }\right) \nonumber \\&\quad +\frac{\alpha \eta '}{2}\left( \Theta _{1}^{1}-\Theta _{0}^{0}\right) +\frac{2\alpha }{r}\left( \Theta _{1}^{1}-\Theta _{2}^{2}\right) =0. \end{aligned}$$
(10)

It is found that the system of non-linear differential equations (610) consists of seven unknown functions (\(\psi \), \(\eta \), \(\rho \), P, \(\Theta _{0}^{0}\), \(\Theta _{1}^{1}\), \(\Theta _{2}^{2}\)). We adopt systematic approach of Ovalle [15] to determine these unknowns. For the system (610), the matter contents (effective density, effective isotropic pressure and effective tangential pressure) can be identified as

$$\begin{aligned} \bar{\rho }=\rho -\alpha \Theta _{0}^{0},\quad \bar{P}_{r}=P+\alpha \Theta _{1}^{1},\quad \bar{P}_{t}=P+\alpha \Theta _{2}^{2}. \end{aligned}$$
(11)

This clearly shows that the source \(\Theta _{\rho \gamma }\) can, in general, bring in anisotropy \(\bar{\Delta }=\bar{P}_{t}-\bar{P}_{r}=\alpha (\Theta _{2}^{2}-\Theta _{1}^{1})\) into the inner of stellar distribution.

3 Gravitational decoupling by MGD approach

In this section, we use MGD approach to find solution of the system (610) by transforming the field equations such that the source \(\Theta _{\rho \gamma }\) takes the form of effective equations which might incorporate anisotropy. Let us consider the perfect fluid solution (\(\psi \), \(\eta \), \(\rho \), P) with \(\alpha =0\) using line element

$$\begin{aligned} ds^{2}=-e^{\chi (r)}dt^{2}+\frac{dr^{2}}{\xi (r)}+r^{2}(d\theta ^{2} +\sin ^{2}\theta d\phi ^{2}), \end{aligned}$$
(12)

where \(\xi (r)=1-\frac{2m}{r}\) contains the Misner-Sharp mass “m” for the fluid configuration. We take the effects of source \(\Theta _{\rho \gamma }\) in isotropic model by encoding the geometrical deformation undertaken by perfect fluid metric (12) as [15]

$$\begin{aligned} \chi \rightarrow \eta =\chi +\alpha f, \quad \xi \rightarrow e^{-\psi }=\xi +\alpha h, \end{aligned}$$
(13)

where f and h are geometrical deformations offered to temporal and radial metric ingredients. The possibly minimal geometric deformation among aforementioned deformations is

$$\begin{aligned} f\rightarrow 0, \quad h\rightarrow h^{*}, \end{aligned}$$
(14)

where the radial metric component endures deformation while the temporal component remains the same. Hence the minimal geometric deformation equation (14) turns out to be

$$\begin{aligned} \chi \rightarrow \eta =\chi , \quad \xi \rightarrow e^{-\psi }=\xi +\alpha h^{*}, \end{aligned}$$
(15)

where \(h^{*}\) is the deformation function associated to radial metric component. Using Eq. (15), the system (610) splits up into two sets.

The first set gives

$$\begin{aligned} \kappa \left( \rho -T_{0}^{0\left( {\mathcal {G}}\right) }\right)= & {} \frac{1}{r^{2}} -\left( \frac{\xi '}{r} +\frac{\xi }{r^{2}}\right) , \end{aligned}$$
(16)
$$\begin{aligned} \kappa \left( P+T_{1}^{1\left( {\mathcal {G}}\right) }\right)= & {} -\frac{1}{r^{2}}+\left( \frac{\chi '}{r} +\frac{1}{r^{2}}\right) \xi \left( r\right) , \end{aligned}$$
(17)
$$\begin{aligned} \kappa \left( P+T_{2}^{2\left( {\mathcal {G}}\right) }\right)= & {} \left( \frac{\chi '}{2r}+\frac{\chi ''}{2} +\frac{\chi '^{2}}{4}\right) \xi \left( r\right) \nonumber \\&+\left( \frac{\chi '}{4}+\frac{1}{2r}\right) \xi '\left( r\right) , \end{aligned}$$
(18)

and the second one containing the source is

$$\begin{aligned} \kappa \Theta _{0}^{0}= & {} \frac{h^{*'}}{r}+\frac{h^{*}}{r^{2}}, \end{aligned}$$
(19)
$$\begin{aligned} \kappa \Theta _{1}^{1}= & {} h^{*}\left( \frac{\chi '}{r}+\frac{1}{r^{2}}\right) , \end{aligned}$$
(20)
$$\begin{aligned} \kappa \Theta _{2}^{2}= & {} \left( \frac{\chi '}{2r}+\frac{\chi ''}{2} +\frac{\chi '^{2}}{4}\right) \xi \left( r\right) +\left( \frac{\chi '}{4}+\frac{1}{2r}\right) \xi '\left( r\right) ,\nonumber \\ \end{aligned}$$
(21)

The above system (1921) looks similar to the spherically symmetric field equations for anisotropic fluid configuration with source \(\Theta _{\rho \gamma }\) (\(\rho =-\Theta _{0}^{0},~ P_{r}=\Theta _{1}^{1},~ P_{t}=\Theta _{2}^{2}\)) corresponding to the metric

$$\begin{aligned} ds^{2}=-e^{\chi (r)}dt^{2}+\frac{dr^{2}}{h^{*}(r)} +r^{2}(d\theta ^{2}+\sin ^{2}\theta d\phi ^{2}). \end{aligned}$$
(22)

However, the right-hand side of system (1921) deviates from the anisotropic solution by term \(\frac{1}{r^{2}}\) which constitutes the effective matter components as

$$\begin{aligned} \bar{\rho }= & {} \Theta _{0}^{0*}=\Theta _{0}^{0}-\frac{1}{\kappa r^{2}},\nonumber \\ \bar{P}_{r}= & {} \Theta _{1}^{1*}=\Theta _{1}^{1}-\frac{1}{\kappa r^{2}},\nonumber \\ \bar{P}_{t}= & {} \Theta _{2}^{2*}=\Theta _{2}^{2}. \end{aligned}$$
(23)

The junction conditions provide smooth matching of interior and exterior geometries at the surface of the stellar object to investigate some significant features of their evolution. For instance, the interior spacetime geometry of stellar distribution is obtained through MGD as

$$\begin{aligned} ds^{2}= & {} -e^{\eta _{-}(r)}dt^{2}+\left( 1-\frac{2\bar{m}}{r} \right) ^{-1}dr^{2}\nonumber \\&+r^{2}(d\theta ^{2}+\sin ^{2}\theta d\phi ^{2}), \end{aligned}$$
(24)

where the interior mass is \(\bar{m}=m(r)-\frac{r}{2}\alpha h^{*}\). Consider the general exterior metric as

$$\begin{aligned} ds^{2}=-e^{\eta _{+}(r)}dt^{2}+e^{\psi _{+}(r)}dr^{2}+r^{2}(d\theta ^{2} +\sin ^{2}\theta d\phi ^{2}). \end{aligned}$$
(25)

The continuity of the first fundamental form of matching conditions, i.e., \([ds^{2}]_{\Sigma }=0\) (\(\Sigma \) is hypersurface or star’s surface (\(r=R\))) yields

$$\begin{aligned} \eta _{+}(R)=\eta _{-}(R),\quad 1-\frac{2M_{0}}{R}+\alpha h^{*}(R)=e^{\psi _{+}(R)}. \end{aligned}$$
(26)

Similarly, the continuity of second fundamental form (\([G_{\rho \gamma }t^{\gamma }]_{\Sigma }=0\), where \(t^{\gamma }\) is a unit four-vector in radial direction) leads to

$$\begin{aligned}&P_{R}+\alpha (\Theta _{1}^{1}(R))^{-}+(T_{1}^{1({\mathcal {G}})}(R))^{-}\nonumber \\&\quad =\alpha (\Theta _{1}^{1}(R))^{+}+(T_{1}^{1({\mathcal {G}})}(R))^{+}. \end{aligned}$$
(27)

Using the matching condition (26), we obtain \((T_{1}^{1({\mathcal {G}})}(R))^{-}=(T_{1}^{1({\mathcal {G}})}(R))^{+}\) which implies that

$$\begin{aligned} P_{R}+\alpha (\Theta _{1}^{1}(R))^{-}=\alpha (\Theta _{1}^{1}(R))^{+}, \end{aligned}$$
(28)

yielding

$$\begin{aligned} P_{R}+\frac{\alpha h^{*}}{\kappa } \left( \frac{\eta '}{R}+\frac{1}{R^{2}}\right) =\frac{\alpha f^{*}}{\kappa R^{2}}\left( \frac{R}{R-2M}\right) , \end{aligned}$$
(29)

where \(f^{*}=0\) is the outer radial geometric deformation for Schwarzschild metric given as

$$\begin{aligned} ds^{2}= & {} -\left( 1-\frac{2m}{r}\right) dt^{2}+\left( 1-\frac{2m}{r}+\alpha h^{*}\right) ^{-1}dr^{2}\nonumber \\&+r^{2}\left( d\theta ^{2}+\sin ^{2}\theta d\phi ^{2}\right) . \end{aligned}$$
(30)

The necessary and sufficient conditions for smooth matching of MGD interior and exterior Schwarzschild metrics (filled by the field of the source \(\Theta _{\rho \gamma }\)) are given by the constraints Eqs. (2629). If the exterior geometric metric is taken as the standard Schwarzschild metric (\(f^{*}=0\)) then

$$\begin{aligned} \bar{P}_{R}=P_{R}+\frac{\alpha h^{*}}{\kappa } \left( \frac{\eta '}{R}+\frac{1}{R^{2}}\right) =0. \end{aligned}$$
(31)

In the following, we take a known isotropic spherically symmetric solution for our systematic analysis.

4 Interior solutions

In order to obtain anisotropic solution using MGD decoupling, it is important to find out perfect fluid spherically symmetric solution. In particular, we choose Krori and Barua solution for physical relevance as [23]

$$\begin{aligned} e^{\eta }= & {} e^{Br^{2}+C}, \end{aligned}$$
(32)
$$\begin{aligned} e^{\chi }= & {} \xi ^{-1}(r)=e^{Ar^{2}}, \end{aligned}$$
(33)
$$\begin{aligned} \rho= & {} \frac{e^{-Ar^{2}}}{\kappa r^{2}}\left( e^{Ar^{2}}+2Ar^{2}-1\right) +T_{0}^{0\left( {\mathcal {G}}\right) }, \end{aligned}$$
(34)
$$\begin{aligned} P= & {} \frac{e^{-Ar^{2}}}{\kappa r^{2}}\left( -e^{Ar^{2}}+2Br^{2}+1\right) -T_{1}^{1\left( {\mathcal {G}}\right) }, \end{aligned}$$
(35)

where A, B and C are constants that can be derived through matching conditions. The rationale for the aforementioned solution is its singularity-free feature which satisfies physical conditions inside the spherical distribution. For exterior geometric configuration as Schwarzschild metric, the junction condition yields

$$\begin{aligned} A= & {} -\frac{1}{R^{2}}\ln \left( 1-\frac{2M_{0}}{R}\right) ,\quad B=\frac{M_{0}}{R^{2}\left( R-2M_{0}\right) }, \end{aligned}$$
(36)
$$\begin{aligned} C= & {} \ln \left( \frac{R-2M_{0}}{R}\right) -\frac{M_{0}}{R-2M_{0}}, \end{aligned}$$
(37)

with compactness \(\frac{M_{0}}{R}<\frac{4}{9}\) (\(M_{0}\) is the total mass). The above expressions through the matching conditions ensure the continuity of the interior and exterior regions at the boundary of the star which definitely will vary in the presence of source \(\Theta _{\rho \gamma }\).

Now, we evaluate anisotropic solution, i.e., \(\alpha \ne 0\) in the interior spherical distribution. The temporal and radial metric contents are given by Eqs. (15) and (32) whereas the geometric deformation and source are connected through Eqs. (1921). For this purpose, various choices can be considered such as the equation of state, some particular forms of density as well as pressure or some physically motivated restrictions on \(h^{*}\) [15, 16, 24,25,26,27]. In any case, we need to remain concerned with physical acceptability of the solution. In the following, we address this problem by taking some conditions to generate physically acceptable interior solutions.

Fig. 1
figure 1

Plots of \(\bar{\rho }\) (left plot, row-1), \(\bar{P}_{r}\) (right plot, row-1), \(\bar{P}_{t}\) (left plot, row-2) and \(\bar{\Delta }\) (right plot, row-2) against r using \(M_{0}=1M_{\odot }\) and \(R=(0.2)^{-1}M_{\odot }\) for solution-I

Fig. 2
figure 2

Plots of energy conditions against r and \(\beta \) using \(M_{0}=1M_{\odot }\) and \(R=(0.2)^{-1}M_{\odot }\) for solution-I

4.1 Solution-I

Herein, we apply the constraint on source component \(\Theta _{1}^{1}\) and solve the field equations for deformation function \(h^{*}\) and source \(\Theta _{\rho \gamma }\). One can observe that the exterior geometry of Schwarzschild metric is compatible with interior matter configuration as long as \(P+T_{1}^{1({\mathcal {G}})}\sim \alpha (\Theta _{1}^{1}(R))_{-}\). The simplest choice which satisfies this crucial requirement is

$$\begin{aligned} \alpha \Theta _{1}^{1}=P+T_{1}^{1({\mathcal {G}})}\quad \Rightarrow \quad h^{*}=\xi -\frac{1}{1+r\eta '}, \end{aligned}$$
(38)

where we have used Eqs. (17) and (20). Equation (38) mimics the radial metric component as

$$\begin{aligned} e^{-\psi }=(1+\alpha )\xi -\frac{\alpha }{1+2Br^{2}}. \end{aligned}$$
(39)

The interior geometric component in Eqs. (33) and (39) represent minimally deformed Krori and Barua solution by generic anisotropic source \(\Theta _{\rho \gamma }\). In the limit \(\alpha \rightarrow 0\), Eq. (39) yields standard isotropic spherical solutions (3235).

The continuity of first fundamental form of junction conditions gives

$$\begin{aligned} Br^{2}+C=\ln \left( 1-\frac{2M}{R}\right) , \end{aligned}$$
(40)
$$\begin{aligned} 1-\frac{2M}{R}=(1+\alpha )\xi -\frac{\alpha }{1+2BR^{2}}, \end{aligned}$$
(41)

whereas the continuity of second fundamental form (\(P(R)+T_{1}^{1({\mathcal {G}})}+\alpha (\Theta _{1}^{1}(R))_{-}=0\)) reads

$$\begin{aligned} P(R)+T_{1}^{1({\mathcal {G}})}=0\Rightarrow A=\frac{\ln (1+2BR^{2})}{R^{2}}, \end{aligned}$$
(42)

where expression in (38) has been utilized. Using Eq. (41), the Schwarzschild mass is obtained as

$$\begin{aligned} \frac{2M}{R}=\frac{2(1+\alpha )M_{0}}{R}+\frac{\alpha }{1+2BR^{2}}-\alpha . \end{aligned}$$
(43)

Using this in Eq. (40), we have

$$\begin{aligned} BR^{2}+C=\ln \left( (1+\alpha )\left( 1-\frac{2M_{0}}{R}\right) -\frac{\alpha }{1+2BR^{2}}\right) , \end{aligned}$$
(44)

where the constant C is expressed in terms of B. Equations (4244) give the necessary and sufficient conditions for smooth matching of interior and exterior spacetimes on the surface of star. Using the mimic constraint (38), the anisotropic solution (\(\bar{\rho }, \bar{P}_{r}, \bar{P}_{t}\)) is given by

$$\begin{aligned} \bar{\rho }= & {} \frac{1}{\kappa \left( r+2Br^{3}\right) ^{2}}\left[ \left( 1+2\left( 1+\alpha \right) Ar^{2}e^{-Ar^{2}}\right. \right. \nonumber \\&\left. \left. +\left( 1-\alpha \right) e^{-Ar^{2}}+\kappa r^{2}T_{0}^{0\left( {\mathcal {G}}\right) }\right) \right. \nonumber \\&\left. \times \left( 1+4Br^{2}\left( 1+Br^{2}\right) \right) +\alpha \left( 1-2Br^{2}\right) \right] , \end{aligned}$$
(45)
$$\begin{aligned} \bar{P}_{r}= & {} \frac{1}{\kappa r^{2}}\left( 1+\alpha \right) \left( \left( 2Br^{2}+1\right) e^{-Ar^{2}}\right. \nonumber \\&\left. -1+\kappa r^{2}T_{1}^{1\left( {\mathcal {G}}\right) }\right) , \end{aligned}$$
(46)
$$\begin{aligned} \bar{P}_{t}= & {} \frac{1}{\kappa \left( r+2Br^{3}\right) ^{2}}\left[ \alpha Ar^{2}e^{-Ar^{2}}\left( 1+5Br^{2}\right. \right. \nonumber \\&\left. \left. +8B^{2}r^{4}+4b^{3}r^{6}\right) +Br^{2}e^{-Ar^{2}}\right. \nonumber \\&\left. \times \left( -2\left( 3+\alpha \right) +3Br^{2}\left( 3\alpha - 4\right) -4B^{2}r^{4}\left( 2+3\alpha \right) \right. \right. \nonumber \\&\left. \left. -4\alpha B^{3}r^{6}\right) +\alpha B^{2}r^{4}\right. \nonumber \\&\left. \times \left( 3+2Br^{2}\right) -e^{-Ar^{2}}+\left( 1+\kappa r^{2}T_{1}^{1\left( {\mathcal {G}}\right) }\right) \left( \right. \right. 1\nonumber \\&\left. \left. +4Br^{2}+4B^{2}r^{4}\right) \right] , \end{aligned}$$
(47)
$$\begin{aligned} \bar{\Delta }= & {} \bar{P}_{t}-\bar{P}_{r} =\frac{1}{\kappa \left( r+2Br^{3}\right) ^{2}} \left[ 1+e^{-Ar^{2}}\left( -1\right. \right. \nonumber \\&\left. \left. -Ar^{2}\left( 1+5Br^{2}+8B^{2}r^{4}\right. \right. \right. \nonumber \\&\left. \left. \left. +4B^{3}r^{6}\right) +Br^{2}\left( -4-3Br^{2} +4B^{2}r^{4}+4B^{3}r^{6}\right) \right) \right. \nonumber \\&\left. +B^{2}r^{4}+4Br^{2}\right. \nonumber \\&\left. -2B^{3}r^{6}+\kappa T_{1}^{1\left( {\mathcal {G}}\right) } r^{2}\left( 1+4Br^{2} +4B^{2}r^{4}\right) \right] . \end{aligned}$$
(48)
Fig. 3
figure 3

Plots of \(|\nu _{st}^{2}-\nu _{sr}^{2}|\) against r and \(\beta \) using \(M_{0}=1M_{\odot }\) and \(R=(0.2)^{-1}M_{\odot }\) for solution-I

Fig. 4
figure 4

Plots of \(\bar{\rho }\) (left plot, row-1), \(\bar{P}_{r}\) (right plot, row-1), \(\bar{P}_{t}\) (left plot, row-2) and \(\bar{\Delta }\) (right plot, row-2) against r and \(\alpha \) using \(M_{0}=1M_{\odot }\) and \(R=(0.3)^{-1}M_{\odot }\) for solution-II

Fig. 5
figure 5

Plots of energy conditions against r and \(\alpha \) using \(M_{0}=1M_{\odot }\) and \(R=(0.3)^{-1}M_{\odot }\) for solution-II

4.2 Solution-II

In this case, we take another choice of mimic constraint on density for physically acceptable solution. This constraint (\(\alpha \Theta _{0}^{0}\sim \rho -T_{0}^{0({\mathcal {G}})}\)) implies that

$$\begin{aligned} h^{*}=\frac{c_{1}}{r}+e^{-Ar^{2}}-1, \end{aligned}$$
(49)

where \(c_{1}\) is the integration constant. By adopting the same methodology as prescribed in solution-I, we obtain the junction conditions as

$$\begin{aligned}&\alpha R(e^{-AR^{2}}-1)+\alpha c_{1}+2(M-M_{0})=0, \end{aligned}$$
(50)
$$\begin{aligned}&BR^{2}+C=\ln \left( 1-\frac{2M_{0}}{R}+\frac{\alpha c_{1}}{R}+ \alpha (e^{-AR^{2}}-1\right) , \end{aligned}$$
(51)

The anisotropic solution satisfying the above matching condition becomes

$$\begin{aligned} \bar{\rho }= & {} (1-\alpha )\left[ \frac{e^{-Ar^{2}}}{\kappa r^{2}}\left( e^{Ar^{2}}+2Ar^{2}-1\right) +T_{0}^{0({\mathcal {G}})}\right] , \end{aligned}$$
(52)
$$\begin{aligned} \bar{P}_{r}= & {} \frac{1}{\kappa r^{3}}[2Be^{-Ar^{2}}r^{3}(\alpha +1)+2\alpha Br^{2}(c_{1}-r)\nonumber \\&+re^{-Ar^{2}}(\alpha +1)- (1+\alpha )r-T_{1}^{1({\mathcal {G}})}\kappa r^{3}, \end{aligned}$$
(53)
$$\begin{aligned} \bar{P}_{t}= & {} -\frac{1}{2\kappa r^{3}}\left[ 2Be^{-Ar^{2}}\alpha r^{5}(A-B)+2\alpha B^{2}r^{4}(r-c_{1})\right. \nonumber \\&\left. -4Be^{-Ar^{2}}r^{3}(1+\alpha )\right. \nonumber \\&\left. +4B\alpha r^{2}(4r-3c_{1})+2re^{-Ar^{2}}(Ar^{2}-1)\right. \nonumber \\&\left. +2r+\alpha c_{1}+2\kappa r^{3}T_{1}^{1({\mathcal {G}})}\right] \end{aligned}$$
(54)

with anisotropic parameter

$$\begin{aligned} \bar{\Delta }=\bar{P}_{t}-\bar{P}_{r}= & {} -\frac{\alpha }{2\kappa r^{3}}\left[ 2B e^{-Ar^{2}}r^{5}(A-B)\right. \nonumber \\&\left. +2B^{2}r^{4}\left( r-c_{1}\right) +2re^{-Ar^{2}}\right. \nonumber \\&\left. \times \left( Ar^{2}+1\right) +Bc_{1}r^{2}+3c_{1}+2r\right] .\nonumber \\ \end{aligned}$$
(55)

4.3 Graphical analysis of some specific solutions

In this section, we analyze anisotropic matter distribution prescribed by solutions I and II for specific form of generic function as

$$\begin{aligned} f({\mathcal {G}})=\beta {\mathcal {G}}^{n}, \end{aligned}$$
(56)

where \(\beta \) is constant and \(n>0\) [28]. In order to examine the solution-I graphically, we use \(n=2\) and \(\beta =0.25\) while the constant A is taken from Eq. (42). The free parameters B and C are fixed through matching conditions for isotropic distribution given in Eqs. (36) and (37). For compact star, the energy density as well as radial pressure must be positive, finite and maximum at its core, i.e., it must obey monotonically decreasing behavior as radial component r increases. The plot of effective energy density \(\bar{\rho }\) is shown in Fig. 1 (left plot, row-1). It is observed that density gives the maximum value at the interior of star and decreases gradually as r increases. It is also found that the density increases with increase in \(\beta \) which presents more dense spherical structure while it decreases with increase in decoupling constant \(\alpha \). This demonstrates that the model becomes less dense in the presence of coupling parameter.

The radial (\(\bar{P}_{r}\)) and tangential pressures (\(\bar{P}_{t}\)) show the same pattern against radius of stellar object while tangential pressure decreases with increase in \(\beta \) as compared to radial (remains the same). It is seen that the radial pressure decreases when \(\alpha \) increases as compared to the inverse behavior of tangential pressure for \(\alpha \). The anisotropy parameter \(\bar{\Delta }\) gives necessary information about anisotropy of the fluid configuration. For \(\bar{P}_{t}>\bar{P}_{r}\), the anisotropy parameter remains positive which shows that it is outward directed while for \(\bar{P}_{t}<\bar{P}_{r}\), it corresponds to inward directed. In our case, we measure anisotropy outward directed scenario (Fig. 1, right plot, row-2). Moreover, the generic anisotropy remains the same for \(\beta \) while increases with increase in \(\alpha \). It is crucial to check the viability of the resulting solutions. For this purpose, we investigate the energy conditions which describe physically realistic matter configuration. The corresponding energy conditions are defined as

$$\begin{aligned}&\bar{\rho }\ge 0,\quad \bar{\rho }+\bar{P}_{r}\ge 0,\quad \bar{\rho }+\bar{P}_{t}\ge 0,\quad \bar{\rho }-\bar{P}_{r}\ge 0,\\&\bar{\rho }-\bar{P}_{t}\ge 0,\quad \bar{\rho }+\bar{P}_{r}+2\bar{P}_{t}\ge 0. \end{aligned}$$
Fig. 6
figure 6

Plots of \(|\nu _{st}^{2}-\nu _{sr}^{2}|\) against r and \(\alpha \) using \(M_{0}=1M_{\odot }\) and \(R=(0.3)^{-1}M_{\odot }\) for solution-II

These conditions are shown graphically for the derived anisotropic solution in Fig. 2 which indicates the validity of all energy condition and hence viability of the resulting anisotropic solution. For the stability analysis, we plot the squared speed of sound as shown in Fig. 3. For stability of the solution, the condition \(0<|\nu _{st}^{2}-\nu _{sr}^{2}|<1\), must be satisfied. Figure 3 shows \(|\nu _{st}^{2}-\nu _{sr}^{2}|\le 1\) for small \(\alpha \) but it is violated for its large value.

For analyzing physical characteristics of solution-II, we choose constants A, B, C from the matching conditions (36) and (5051) whereas free parameters set as \(c_{1}=-0.5\), \(\beta =1.2\) and \(n=3\), respectively. It is observed that the behavior of \(\bar{\rho }\), \(\bar{P}_{r}\) and \(\bar{P}_{t}\) against r is consistent with solution-I whereas both the radial and tangential pressure decreases linearly with increase in parameter \(\alpha \) (Fig. 4). The plot of these matter contents shows that as \(r\rightarrow 0\), they attain their maximum and this, in fact, indicates the high compactness of the core of the star validating that our model under analysis is viable for the outer region of the core. Moreover, anisotropy is greater at the surface of star than that of core which shows opposite behavior as compared to solution-I. The plots of energy conditions (Fig. 5) show that our solution satisfies all energy bounds which suffices for the viable solution. However, the stability condition is violated (Fig. 6).

5 Concluding remarks

Recently, the minimal gravitational decoupling approach has extensively been used to obtain exact solutions for interior configuration of stellar distribution. In this work, we have used MGD decoupling technique in \(f({\mathcal {G}})\) gravity to extend interior isotropic spherical solution to anisotropic solution contained in gravitational source. For this purpose, we have introduced a new source in isotropic energy-momentum tensor constituting the field equations for anisotropic matter distribution. We have introduced minimal geometrical deformation in metric functions (radial metric component only). It is found that the corresponding field equations with source can be split into two systems: one corresponds to standard field equations of \(f({\mathcal {G}})\) gravity and other contains the source term with deformed coefficients. These two systems express that there is a purely gravitational interaction, without direct exchange of energies.

We have studied junction condition for smooth matching of interior and exterior geometries for the deformed Schwarzschild spacetime. For anisotropic solution, we have taken a known solution then extended it through the source added in perfect fluid geometry. We have imposed constraints on the effective energy density and effective pressure which constitute solutions I and II, respectively. For physical acceptability, we have introduced specific generic function and examined energy conditions as well as squared speed of sound and anisotropy parameter. We have observed that solution-I as well as solution-II are physically acceptable and corresponds to stability of stellar object. Finally, we would like to mention here that our results for the first solution are consistent with those obtained in general relativity (GR) [15, 16]. It is also worth mentioning here that modified \(f({\mathcal {G}})\) gravity provides viable spherically symmetric solutions (as the energy conditions for both solutions are satisfied) due to inclusion of correction terms as compared to GR in which the second type of solutions do not meet the energy bounds [15, 16].