1 Introduction

Polytropic equations of state have played a remarkable role in astrophysics (see [1, 2] and references therein), and have been extensively used to study the stellar structure. For example, white dwarfs have been modeled considering Newtonian polytropes [3, 4] while in more compact configurations (e.g. neutron stars, super Chandrasekhar white dwarfs) [5, 6] general relativistic polytropes have been extensively studied (see, for example, and the references therein [7,8,9,10,11,12,13,14,15]).

For an isotropic fluid, the theory of polytropes is based on the polytropic equation of state which reads

$$\begin{aligned} P=K\rho _0^{\gamma }=K\rho _{0}^{1+1/n} , \end{aligned}$$
(1)

where P denotes the isotropic pressure, \(\rho _{0}\) stands for the mass (baryonic) density and K, \(\gamma \), and n are usually called the polytropic constant, polytropic exponent, and polytropic index, respectively. Once the equation of state (1) is assumed, the whole system is described by the Lane–Emden equation that may be numerically solved for any set of the parameters of the theory. When the constant K is calculated from natural constants, the polytropic equation of state may be used to model a completely degenerate Fermi gas in the non-relativistic (\(n = 5/3\)) and relativistic limit (\(n = 4/3\)). In this case, Eq. (1) provides a way of modeling compact objects such as white dwarfs and allows to obtain in a rather direct way the Chandrasekhar mass limit. Otherwise, if K is a free parameter, the models can be used to describe either an isothermal ideal gas or a completely convective star. These models related to isothermal ideal gas are relevant in the so-called Schönberg–Chandrasekhar limit [2].

Although local isotropy is a very common assumption in the study of compact objects, there is strong evidence that suggests that for certain ranges of density, a large number of physical phenomena can cause local anisotropy. A possible source is related to intense magnetic fields observed in compact objects such as white dwarfs, neutron stars or magnetized strange quark stars [16,17,18,19,20]. Another source is the high indexes of viscosity expected to be present in neutron stars, in highly dense matter produced by opacity of matter to neutrinos in the collapse of compact objects [21,22,23], and in the superposition of two isotropic fluids, to name a few. It is important to note that, although the degree of anisotropy may be small, the effects produced on compact stellar objects may be appreciable [24,25,26,27,28,29,30]. So, the assumption of an isotropic pressure is a very stringent condition, specially in a situation in which the compact object is modeled as a structure with high density (as neutrons stars, for example). Besides, the isotropic pressure condition becomes unstable by the presence of physical factors such as dissipation, energy density inhomogeneity and shear, this has been recently proven in [31]. Thus, after assuming that the fluid pressure is anisotropic, the two principal stresses (say \(P_r\) and \(P_\bot \)) are unequal and the polytrope equation of state reads

$$\begin{aligned} P_r=K\rho _{0}^{\gamma }=K\rho _0^{1+1/n} . \end{aligned}$$
(2)

Note that, the introduction of \(P_{\perp }\) as a new variable yields an additional degree of freedom and therefore Eq. (2) is not enough to integrate the Lane–Emden equation. Thus, in order to decrease the number of degrees of freedom the introduction of an additional equation of state is mandatory. Alternatively, we can impose certain conditions on the metric variables as the vanishing of the Weyl tensor, implemented in [6] to obtain a conformally flat polytrope for anisotropic matter. This condition has its own interest, since it has been seen that highly compact configurations may be obtained with the specific distribution of anisotropy created by such a condition. Other approaches as the Randall-Sundrum model [32] or 5-dimensional warped geometries have served as an inspiration for other type of conditions, relating radial derivatives of the metric functions in spherically symmetric spacetimes, that produce self–gravitating spheres embedded in a 5-dimensional flat space-time (embedding class one). In this regard, it is clear that embedding of four-dimensional spacetimes into higher dimensions is a very useful tool in order to generate astrophysical interior models. Even more, models embedded in five dimensional spacetimes satisfy the so–called Karmarkar or class I condition [33] (for recent developments see, [34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55], for example) which allows to choose one of the metric functions as the one which generates the total solution. In this work we consider stellar interiors supported by anisotropic fluids fulfilling the polytropic equation of state for the radial pressure and additionally, we implement the class I condition to close the system and construct the corresponding generalized Lane–Emden equation.

The manuscript is organized as follows. In the next section we review the main aspects of anisotropic polytropes and obtain the generalize Lane–Emden equation. Next, we introduce the class I condition and solve the Lane–Emden equation numerically. We conclude this section with a brief discussion about the incidence of the class I condition on the Tolman mass. The last section is devoted to final remarks and conclusions.

2 The polytrope for anisotropic fluid

2.1 The field equations and conventions

Let us consider a static and spherically symmetric distribution of anisotropic matter which metric, in Schwarzschild–like coordinates, is parametrized as

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

where \(\nu \) and \(\lambda \) are functions of r. The metric (3) has to satisfy Einstein field equationsFootnote 1

$$\begin{aligned} G^\mu _\nu = - 8 \pi T^\mu _\nu . \end{aligned}$$
(4)

The matter content of the system is described by the energy–momentum tensor

$$\begin{aligned} T_{\mu \nu }=(\rho +P_{\perp })u_{\mu }u_{\nu }-P_{\perp }g_{\mu \nu }+(P_{r}-P_{\perp })s_{\mu }s_{\nu }, \end{aligned}$$
(5)

where \(\rho \) is the total energy density,

$$\begin{aligned} u^{\mu }=(e^{-\nu /2},0,0,0), \end{aligned}$$
(6)

is the four velocity of the fluid and \(s^{\mu }\) is defined as

$$\begin{aligned} s^{\mu }=(0,e^{-\lambda },0,0), \end{aligned}$$
(7)

with the properties \(s^{\mu }u_{\mu }=0\), \(s^{\mu }s_{\mu }=-1\).

Replacing (3), (5), (6) and (7) in (4), we have

$$\begin{aligned} T^0_0=\rho= & {} -\frac{1}{8\pi }\bigg [-\frac{1}{r^{2}}+e^{-\lambda }\left( \frac{1}{r^{2}}-\frac{\lambda '}{r}\right) \bigg ], \end{aligned}$$
(8)
$$\begin{aligned} - T^1_1 = P_{r}= & {} -\frac{1}{8\pi }\bigg [\frac{1}{r^{2}}-e^{-\lambda }\left( \frac{1}{r^{2}}+\frac{\nu '}{r}\right) \bigg ], \end{aligned}$$
(9)
$$\begin{aligned} -T^2_2= & {} P_{\perp }=\frac{1}{8\pi }\bigg [ \frac{e^{-\lambda }}{4} \left( 2\nu '' +\nu '^{2}-\lambda '\nu '+2\frac{\nu '-\lambda '}{r} \right) \bigg ], \end{aligned}$$
(10)

where primes denote derivative with respect to r. Furthermore, we shall consider that the fluid distribution is surrounded by the Schwarzschild vacuum, namely

$$\begin{aligned} ds^{2}= & {} \left( 1-\frac{2M}{r}\right) dt^{2}-\left( 1-\frac{2M}{r}\right) ^{-1}dr^{2}\nonumber \\&-r^{2}(d\theta ^{2}+\sin ^{2}d\phi ^{2}), \end{aligned}$$
(11)

where M represents the total energy of the system. In order to match the two metrics smoothly on the boundary surface \(r=r_{\varSigma }=\mathrm constant\), we require continuity of the first and second fundamental forms across that surface. As a result of this matching we obtain the well known result,

$$\begin{aligned} e^{\nu _{\varSigma }}= & {} 1-\frac{2M}{r_{\varSigma }}, \end{aligned}$$
(12)
$$\begin{aligned} e^{-\lambda _{\varSigma }}= & {} 1-\frac{2M}{r_{\varSigma }} \end{aligned}$$
(13)
$$\begin{aligned} P_{r_{\varSigma }}= & {} 0, \end{aligned}$$
(14)

where the subscript \(\varSigma \) indicates that the quantity is evaluated at the boundary surface. From the radial component of the conservation law,

$$\begin{aligned} \nabla _{\mu }T^{\mu \nu }=0, \end{aligned}$$
(15)

one obtains the generalized Tolman–Oppenhei-mer–Volkoff equation for anisotropic matter which reads,

$$\begin{aligned} P_{r}'=-\frac{\nu '}{2}(\rho +P_{r})+\frac{2}{r}(P_{\perp }-P_{r}). \end{aligned}$$
(16)

Alternatively, using

$$\begin{aligned} \nu '=2\frac{m+4\pi P_{r}r^{3}}{r(r-2m)}, \end{aligned}$$
(17)

where the mass function m is as usually defined as

$$\begin{aligned} e^{-\lambda }=1-2m/r , \end{aligned}$$
(18)

we may rewrite Eq. (16) in the form

$$\begin{aligned} P_{r}'=-\frac{m+4\pi r^{3} P_{r}}{r(r-2m)}(\rho +P_{r})+\frac{2}{r}\varDelta , \end{aligned}$$
(19)

where

$$\begin{aligned} \varDelta =P_{\perp }-P_{r}, \end{aligned}$$
(20)

measures the anisotropy of the system.

For the physical variables appearing in (19) the following boundary conditions apply

$$\begin{aligned} m(0)=0,\qquad m(\varSigma )=M, \qquad P_{r}(r_{\varSigma })=0. \end{aligned}$$
(21)

As already mentioned in the introduction, in order to integrate equation (19), we shall need additional information. In this work we use the polytropic equation of state for the radial pressure and the class I condition in order to close the system. In the next section we will implement the polytropic equation of state to construct the general Lane–Emden equation.

2.2 Relativistic polytrope for anisotropic fluids

When considering the polytropic equation of state within the context of general relativity, two different possibilities arise, leading to the same equation in the Newtonian limit [5]. The first one, preserves the original polytropic equation of state (1) and the second case allows another (natural) possibility that consists in assuming that the relativistic polytrope is defined by,

$$\begin{aligned} P_{r}=K\rho ^{\gamma }= K\rho ^{1+\frac{1}{n}} . \end{aligned}$$
(22)

In this case the baryonic density \(\rho _0\) is replaced by the total energy density \(\rho \) in the polytropic equation of state. The general treatment is very similar for both cases and therefore, for simplicity, we shall restrict here to the case described by (22). It can be shown that the relationship between the two densities is given by [5],

$$\begin{aligned} \rho = \frac{\rho _0}{\left( 1 - K \rho _0^{1/n}\right) ^n} . \end{aligned}$$
(23)

As it is well known from the general theory of polytropes, there is a bifurcation at the value \(\gamma =1\). Thus, the cases \(\gamma =1\) and \(\gamma \ne 1\) have to be considered separately.

Let us first consider the case \(\gamma \ne 1\). Now, defining the variable \(\psi \) by

$$\begin{aligned} \rho = \rho _c \psi ^n, \end{aligned}$$
(24)

where \(\rho _{c}\) denotes the energy density at the center (from now on the subscript c indicates that the variable is evaluated at the center), we may rewrite (22) as

$$\begin{aligned} P_{r} = K \rho ^{\gamma } = K \rho _c \psi ^{n+1} = P_{rc} \psi ^{n+1}, \end{aligned}$$
(25)

with \(P_{rc}=K\rho _{c}^{\gamma _{r}}\). Now, replacing (22) and (24) in (19) we obtain

$$\begin{aligned} (n+1) \psi '= & {} - \left( \frac{m + 4 \pi P_{rc} \psi ^{n+1} r^3}{r(r -2m)} \right) \frac{1}{\alpha } \left( 1 + \alpha \ \psi ^{n} \right) \nonumber \\&+ \frac{2 \varDelta }{r P_{rc}}, \end{aligned}$$
(26)

where \(\alpha =P_{rc}/\rho _{c}\). Let us now introduce the following dimensionless variables

$$\begin{aligned} r= & {} \frac{\xi }{A}, \quad A^2 = \frac{4 \pi \rho _c}{\alpha (n+1)}, \end{aligned}$$
(27)
$$\begin{aligned} \psi ^n= & {} \frac{\rho }{\rho _c}, \quad \eta (\xi ) = \frac{m(r)\ A^3}{4 \pi \rho _c}, \end{aligned}$$
(28)

from where (26) reads

$$\begin{aligned}&\xi ^2 \frac{d\psi }{d\xi } \left[ \frac{1 - 2 \alpha (n+1) \frac{\eta }{\xi }}{1 + \alpha \ \psi } \right] + \eta + \alpha \xi ^3 \psi ^{n+1}\nonumber \\&\qquad - \frac{2 \varDelta \ \xi }{P_{rc} \psi ^n (n+1)} \left[ \frac{1 - 2 \alpha (n+1) \frac{\eta }{\xi }}{1 + \alpha \ \psi } \right] = 0, \end{aligned}$$
(29)

which corresponds to the generalized Lane–Emden equation for this case.

Let us now consider the isothermal case: \(n=\pm \infty \), \(\gamma =1\). In this case, the definition of the variable \(\psi \) becomes,

$$\begin{aligned} \rho= & {} \rho _c e^{-\psi }, \end{aligned}$$
(30)

and we can write Eq. (22) as

$$\begin{aligned} P_{r}= & {} K \rho = K \rho _c e^{-\psi }=P_{rc}e^{-\psi }. \end{aligned}$$
(31)

Replacing (30) and (31) in TOV equation (19), we obtain

$$\begin{aligned} e^{-\psi } \psi ' \!=\! \left( \frac{m \!+\! 4 \pi P_{rc} e^{-\psi } r^3}{r(r -2m)} \right) \frac{1}{\alpha } \left( e^{-\psi } \!+\! \alpha \ e^{-\psi } \right) \!-\! \frac{2 \varDelta }{r P_{rc}}.\nonumber \\ \end{aligned}$$
(32)

Introducing dimensionless variables,

$$\begin{aligned} \alpha= & {} \frac{P_{rc}}{\rho _c}, \quad r =\frac{\xi }{A}, \quad A^2 = \frac{4 \pi \rho _c}{\alpha }, \end{aligned}$$
(33)
$$\begin{aligned} e^{-\psi }= & {} \frac{\rho }{\rho _c}, \quad \eta (\xi ) = \frac{m(r)\ A^3}{4 \pi \rho _c}, \end{aligned}$$
(34)

Eq. (32) becomes

$$\begin{aligned}&\xi ^2 \psi ' \left( \frac{1 -2 \frac{\alpha }{\xi } \eta }{ 1 + \alpha }\right) - \eta - \alpha e^{-\psi } \xi ^3\nonumber \\&\qquad + \frac{2 \varDelta e^{\psi }\xi }{P_{rc}}\left( \frac{1 -2 \frac{\alpha }{\xi } \eta }{ 1 + \alpha }\right) =0, \end{aligned}$$
(35)

which corresponds to the Lane–Emden equation for the isothermal case.

3 The class I condition

Embedding of four-dimensional spacetimes into higher dimensions is an invaluable tool in generating both cosmological and astrophysical models [41]. As it is well known, the Karmarkar condition is necessary and sufficient to ensure class one solutions [33] which for spherically symmetric space–times reads (\(R_{\theta \phi \theta \phi }\ne 0\)) [33]

$$\begin{aligned} R_{r t r t}R_{\theta \phi \theta \phi }=R_{r\theta r \theta }R_{t \phi t \phi }+R_{r\theta t \theta }R_{r\phi t\phi }, \end{aligned}$$
(36)

leading to

$$\begin{aligned} 2\frac{\nu ^{\prime \prime }}{\nu ^{\prime }}+\nu ^{\prime }=\frac{\lambda ^{\prime }e^{\lambda }}{e^{\lambda }-1}, \end{aligned}$$
(37)

with \(e^{\lambda }\ne 1\). Now, using (24), (25) and (37) in (20) we obtain

$$\begin{aligned} \varDelta = \frac{ \left( 4 \pi P_{rc} \psi ^{n+1} r^3 - m \right) \left( r m' - 3 m \right) }{16 \pi m\ r^3 }, \end{aligned}$$
(38)

from where, after using the set of dimensionless variables (27) and (28), we arrive at

$$\begin{aligned} \varDelta = \rho _c \frac{\left( \alpha \psi ^{n+1} \xi ^3 - \eta \right) \left( \xi \eta ' - 3 \eta \right) }{ 4 \xi ^3 \eta }. \end{aligned}$$
(39)

Finally, replacing (39) in (29), the class I generalized Lane–Emden equation for \(\gamma \ne 1\) reads

$$\begin{aligned}&\frac{ \left( \alpha \psi ^{n+1} \xi ^3 - \eta \right) \left( 3 \eta - \xi \eta ' \right) }{2 \alpha (n+1)\ \xi ^2 \psi ^n \eta } \left[ \frac{1 - 2 \alpha (n+1) \frac{\eta }{\xi }}{1 + \alpha \ \psi } \right] \nonumber \\&\qquad +\xi ^2 \psi ' \left[ \frac{1 - 2 \alpha (n+1) \frac{\eta }{\xi }}{1 + \alpha \ \psi } \right] + \eta + \alpha \xi ^3 \psi ^{n+1}= 0.\nonumber \\ \end{aligned}$$
(40)

We can repeat the same procedure for the \(\gamma =1\) (isothermal) case. Again, after using (30), (31) and (37) in (20) we obtain,

$$\begin{aligned} \varDelta = \frac{ \left( 4 \pi P_{rc} e^{-\psi } r^3 - m \right) \left( r m' - 3 m \right) }{16 \pi m\ r^3 }, \end{aligned}$$
(41)

from where, by means of the definitions (33) and (34) we have

$$\begin{aligned} \varDelta = \rho _c \frac{\left( \alpha e^{-\psi } \xi ^3 - \eta \right) \left( \xi \eta ' - 3 \eta \right) }{ 4 \xi ^3 \eta }. \end{aligned}$$
(42)

Finally, introducing (42) in (35) we arrive to the class I generalized Lane–Emden equation for \(\gamma =1\) (isothermal case),

$$\begin{aligned}&\xi ^2 \frac{d\psi }{d\xi }\left( \frac{1 -2 \frac{\alpha }{\xi } \eta }{ 1 + \alpha }\right) - \eta - \alpha e^{-\psi } \xi ^3 \nonumber \\&\qquad + e^{\psi } \frac{\left( \alpha e^{-\psi } \xi ^3 - \eta \right) \left( \xi \eta ' - 3 \eta \right) }{ 2 \alpha \xi ^2 \eta } \left( \frac{1 -2 \frac{\alpha }{\xi } \eta }{ 1 + \alpha }\right) = 0. \nonumber \\ \end{aligned}$$
(43)

To complement the discussion, we proceed to calculate the Tolman mass (for the \(\gamma \ne 1\) case) [56], defined by

$$\begin{aligned} m_{T}=\frac{1}{2}e^{(\nu -\lambda )/2} \nu ^\prime r^{2}, \end{aligned}$$
(44)

or, alternatively [24]

$$\begin{aligned} m_{T}=e^{(\nu +\lambda )/2} \left( m + 4 \pi r^3 P_r\right) . \end{aligned}$$
(45)

The functions \(\lambda \), m and \(P_r\) in the above expression, are obtained directly by integration of equation (40) for the \(\gamma \ne 1\) case. So, we only need an expression for \(\nu \), which can be obtained following the systematic procedure described in [5, 57]. Using the corresponding expressions (24) and (25), and the variables defined in (27), (28), we have

$$\begin{aligned} m_{T}= & {} e^{(\nu +\lambda )/2}\left( \alpha (n+1)\eta +\alpha ^2 (n+1) \psi ^{n+1} \xi ^3\right) \frac{1}{A}. \end{aligned}$$
(46)

Now, in order to obtain the metric variable \(\nu \), we proceed as follows. First, the TOV equation (19) can be written as

$$\begin{aligned} 2\alpha (n+1) d\psi= & {} -\left( \alpha \psi + 1 \right) d\nu + 4 \frac{ \varDelta }{r \rho _c \psi ^n}dr , \end{aligned}$$
(47)

from where

$$\begin{aligned}&2\alpha (n+1) \int _{\psi (r)}^{\psi (r_{\varSigma })} \frac{d\psi }{\alpha \psi + 1}\nonumber \\&\quad = -\int _{\nu (r)}^{\nu (r_{\varSigma })} d\nu + \frac{4}{\rho _c} \int _{r}^{r_{\varSigma }} \frac{ \varDelta }{\psi ^n \left( \alpha \psi + 1 \right) r}dr. \end{aligned}$$
(48)

Next, defining G(r) as,

$$\begin{aligned} G(r)\equiv \int _{r}^{r_{\varSigma }} \frac{ \varDelta }{\psi ^n \left( \alpha \psi + 1 \right) r}dr , \end{aligned}$$

the integration of (48) produces

$$\begin{aligned} -2\alpha (n+1) \log {(\alpha \psi +1)}=\nu (r)-\nu (r_{\varSigma })+\frac{4}{\rho _c}G(r),\nonumber \\ \end{aligned}$$
(49)

from where we obtain

$$\begin{aligned} e^{\nu (r)}= & {} \frac{e^{\nu (r_{\varSigma })}}{(\alpha \psi +1)^{2\alpha (1+n)} e^{\frac{4}{\rho _c}G(r)}}. \end{aligned}$$
(50)

Using (18) and (50) in (46) we arrive at

$$\begin{aligned} m_{T}= & {} \left( \frac{a_{\varSigma }}{a}\right) ^{1/2}(1+\alpha \psi )^{-\alpha (n+1)} e^{-\frac{2}{\rho _c}G(r)} \nonumber \\&\times \left[ \alpha (n+1)\eta \!+\!\alpha ^2 (n\!+\!1) \psi ^{n+1} \xi ^3\right] \left( \frac{\alpha (n+1)}{4\pi \rho _{c}}\right) ^{1/2}\nonumber \\ \end{aligned}$$
(51)

where

$$\begin{aligned} a=1-2\alpha (n+1)\frac{\eta (\xi )}{\xi }. \end{aligned}$$
(52)

For the numerical calculations it is convenient to change to the following dimensionless variables

$$\begin{aligned} x= & {} \frac{r}{r_\varSigma } = \frac{\xi }{r_\varSigma A}=\frac{\xi }{\xi _\varSigma }, \end{aligned}$$
(53)
$$\begin{aligned} y= & {} \frac{M}{r_\varSigma } = \alpha (n+1) \frac{\eta _\varSigma }{\xi _\varSigma } \end{aligned}$$
(54)
$$\begin{aligned} \eta _T= & {} \frac{m_T}{4 \pi \rho _c \alpha ^3}, \end{aligned}$$
(55)

in terms of which Eq. (51) reads,

$$\begin{aligned} \eta _{T}= & {} \left( \frac{1 - 2 y}{1 - 2 \alpha (n+1) \frac{\eta }{x \xi _\varSigma }}\right) ^{1/2}\nonumber \\&\times \frac{\left[ \alpha (n+1)\eta +\alpha ^2 (n+1) \psi ^{n+1} x^3 \xi _\varSigma ^3 \right] }{(1+\alpha \psi )^{\alpha (n+1)}e^{\frac{2}{\rho _c}G(x)}} \nonumber \\&\times \left( \frac{1}{4\pi \rho _{c} \alpha } \right) ^{3/2} (n+1)^{\frac{1}{2}}. \end{aligned}$$
(56)

where G(x) becomes,

$$\begin{aligned} G(x) = \int _{x}^1 \frac{\varDelta (x)}{\psi ^n (\alpha \psi +1 )x \xi _\varSigma } dx. \end{aligned}$$
(57)

This procedure, where the integration of the TOV equation is carried out, allows us to find the metric function \(\nu \) (using the appropriate boundary conditions) and finally Tolman’s mass, (56) and (57), is totally equivalent to the one developed in [57] for the different cases exposed.

Fig. 1
figure 1

\(e^{\nu }\) as function of x for \(\alpha = 0.2\) and different values of n

Fig. 2
figure 2

\(\psi \) as function of x ( \(\gamma = 1\) isothermal case) for different values of \(\alpha \)

Fig. 3
figure 3

\(\psi \) as function of x for \(\alpha = 0.1\) and different values of n

Now, the above results will be integrated numerically, with the corresponding boundary conditions, in order to obtain the solution for each case considered.

Figure 1 shows the behaviour of \(e^{\nu }\) as a function of x for different values of the parameters involved. Note that, the function is monotonously increasing as required. In Figs. 2 and 3 it is shown the integration of Eqs. (43) (isothermal case) and (40), respectively, for the values of the parameters indicated in the figure legend. Note that for the isothermal case (\(\gamma =1\)) the configurations are unbounded and as a consequence, it is meaningless to define a surface potential or the total mass. However, for the \(\gamma \ne 1\) case \(\psi \) is monotonously decreasing as expected, and the radial pressure \(P_r\) vanishes at the surface as required by the continuity of the second fundamental form. The parameter y (“the surface potential”) which measures the degree of compactness is plotted in Fig. 4 as function of the polytropic index n for different values of \(\alpha \). Note that the plots have discontinuities in some point \(n_d\), where we observed that for \(n < n_{d}\), the solution is well–behaved, and for \(n \ge n_{d}\), the numerical solution starts to have either imaginary components or strange oscillatory behavior.

Fig. 4
figure 4

y as function of n for different values of \(\alpha \)

Fig. 5
figure 5

Normalized Tolman–Whittaker Mass \(\eta _{T}/\eta _{\varSigma _{T}}\) as function of x for \(\alpha = 0.1\), \(n= 3\) and different values of y. Values of y are read off Fig. 4

Fig. 6
figure 6

Normalized Tolman–Whittaker Mass \(\eta _{T}/\eta _{\varSigma _{T}}\) as function of x for \(\alpha = 0.1\), \(n= 1\) and different values of y. Values of y are read off Fig. 4

Figures 5 and 6 display the Tolman mass (normalized by the total mass), for the case \(\gamma \ne 1\), as function of x for the selection of values of the parameters indicated in the legend. The behavior of the curves is qualitatively the same for a wide range of values of the parameters. We observe that as we move from the less compact configuration (curve a) to the more compact one (curve d), the Tolman mass tends to concentrate on the outer regions of the sphere. Therefore, it may be inferred from the Figs. 5 and 6 that more stable configurations correspond to smaller values of y since they are associated to a sharper reduction of the Tolman mass in the inner regions, as usually happens if the anisotropy is fixed by the imposed condition. This is the usual strategy adopted by the fluid distribution to keep the equilibrium; it tries to concentrate the Tolman mass in the outer regions. This behavior was already observed for different families of anisotropic polytropes discussed in [5]. The same result is obtained from the Fig. 7 where we plot the Tolman mass as a function of x for the selection of values of the parameters indicated in the legend.

For completeness, we plot the Tolman mass, as function of x, for several polytropic indexes and compactness parameters represented by y. The result i shown in Fig. 8 for the selection of values of the parameters indicated in the legend.

It is worth mentioning that all the numerical results show well-behaved solutions for small alpha values and a specific range of values for n.

Fig. 7
figure 7

Normalized Tolman–Whittaker Mass \(\eta _{T}/\eta _{\varSigma _{T}}\) as function of x for \(n = 0.5\) and different values of y \((\alpha )\). (Blue) y \((\alpha )\) = 0.131649 (0.3). (Red) y \((\alpha )\) = 0.114082 (0.2). (Green) y \((\alpha )\) = 0.0871126 (0.1). Values of y are read off Fig. 4

Fig. 8
figure 8

Normalized Tolman–Whittaker Mass \(\eta _{T}/\eta _{\varSigma _{T}}\) as function of x for \(\alpha = 0.1\) and different values of n. (Blue) \(n = 1 1.5\). (Red) \(n = 3\). (Green) \(n = 3.5\). Values of y are read off Fig. 4

4 Karmarkar condition and Tolman mass

In this section we would like to establish some relationships that may be useful to analyze the anisotropy inherited by the Karmarkar condition. In order to relate the influence of the Karmarkar condition with the mass function m and the Tolman mass, \(m_{T}\), we will take an instructive path to complete our analysis of the fluid distribution of the compact body. From (18) we obtain the usual definition of the mass function,

$$\begin{aligned} m = \frac{1}{2} r R^{3}_{232}. \end{aligned}$$
(58)

Note that, we can write condition (36), for our static and spherically symmetric case, in order to define a new variable, \({\mathbb {K}}\), in the following form,

$$\begin{aligned} {\mathbb {K}} = R_{rtrt} R_{\theta \phi \theta \phi } - R_{r \theta r \theta } R_{\phi t \phi t}, \end{aligned}$$
(59)

where the Karmarkar condition is satisfied when \({\mathbb {K}} = 0\). In this way we can keep track of how this condition influences our anisotropic distribution of fluid of the compact object. Using the components of the Riemann tensor appropriate to the symmetry we may obtain from (59) the following expression,

$$\begin{aligned} {\mathcal {K}}\equiv & {} - \frac{{\mathbb {K}}}{\sin ^2 \theta } = \nonumber \\&- e^{(\nu +\lambda )} \frac{1}{4} e^{-\lambda } \left( 2\nu ^{''} - \lambda ' \nu ' + \nu '^2 + 2\frac{\nu ' - \lambda '}{r} \right) 2 m r\nonumber \\&+ \left( e^{(\nu +\lambda )} e^{-\lambda } \frac{\nu ' - \lambda '}{2r} \right) 2 m r +\frac{r^2}{4} \lambda ' \nu ' e^{(\nu -\lambda )} , \end{aligned}$$
(60)

which, after using Einstein equations (8), (9) and (10), can be written as

$$\begin{aligned} {\mathcal {K}}= & {} - e^{(\nu +\lambda )} \left[ \left( 8 \pi \left( T^0_0 + T^1_1 - 2 T^2_2 \right) \right) + \frac{4 m}{r^3} \right] m r\nonumber \\&+\frac{r^2}{4} \lambda ' \nu ' e^{(\nu -\lambda )}. \end{aligned}$$
(61)

Now, we proceed in two different ways in order to interpret the influence of the Karmarkar condition over our interior solution. First, from (8) and (9), we obtain the derivatives of the metric functions \(\nu '\) and \(\lambda '\) in the form

$$\begin{aligned} - \lambda '= & {} \frac{2 m}{r^2} e^{\lambda } - 8 \pi r T^0_0 e^{\lambda }, \end{aligned}$$
(62)
$$\begin{aligned} e^{- \lambda } \nu '= & {} \frac{2m}{r^2} - 8 \pi r T^1_1 . \end{aligned}$$
(63)

Now, replacing these expressions in the last term of (61) we obtain

$$\begin{aligned}&\frac{3}{r^2} m^2 + 4 \pi r\left( 4 T^2_2 - T^1_1 - T^0_0 \right) m\nonumber \\&\qquad - 16 \pi ^2 r^4 T^0_0 T^1_1 = e^{-(\nu + \lambda )}\; {\mathcal {K}}, \end{aligned}$$
(64)

which relates the mass function m with the \({\mathcal {K}}\) condition, defined in (60). In contrast, if we use (44) and Einstein equation (8), we can write the last term of (61) in terms of the Tolman mass function, \(m_{T}\), as

$$\begin{aligned} {\mathcal {K}}= & {} - e^{(\nu +\lambda )} \left[ \left( 8 \pi \left( T^0_0 + T^1_1 - 2 T^2_2 \right) \right) + \frac{4 m}{r^3} \right] m r\nonumber \\&+ \left[ \frac{4\pi T^0_0 \, r^3 - m}{r(r-2m)}\right] e^{(\nu -\lambda )/2}\, m_{T}. \end{aligned}$$
(65)

Finally, using (45) in the previous equation we have

$$\begin{aligned} r {\mathcal {K}}= & {} - e^{(\nu +\lambda )} \left[ \left( 8 \pi r^2 \left( T^0_0 + T^1_1 - 2 T^2_2 \right) \right) + \frac{4 m}{r} \right] m \nonumber \\&+ \left[ \frac{4\pi r^3 (T^0_0- T^1_1 )- m_{T}e^{-(\nu +\lambda )/2}}{(r-2m)}\right] e^{(\nu -\lambda )/2} m_{T}, \nonumber \\ \end{aligned}$$
(66)

which constitutes a relation between the mass function, the Tolman mass and the \({\mathcal {K}}\) condition. So, we have been successful in relating the components of the energy–momentum tensor, the mass function and the Tolman mass with the defined \({\mathcal {K}}\) condition for the symmetry considered in our development. This could allow us to discover the influence over these mass functions by imposing the Karmarkar condition and then be able to find out how this metric (embedding) condition influences the distribution of our compact fluid.

In order to illustrate the effect of the Tolman mass on \({\mathcal {K}}\) we shall consider a simple example, namely, an anisotropic solution with vanishing radial pressure [58],

$$\begin{aligned} e^{\nu }= & {} B^{2}\left( 1+\frac{r^{2}}{A^{2}}\right) \end{aligned}$$
(67)
$$\begin{aligned} e^{-\lambda }= & {} \frac{A^{2}+r^{2}}{A^{2}+3r^{2}} \end{aligned}$$
(68)
$$\begin{aligned} \rho= & {} \frac{6(A^{2}+r^{2})}{8\pi (A^{2}+3r^{2})^{2}} \end{aligned}$$
(69)
$$\begin{aligned} p_{t}= & {} \frac{3r^{2}}{8\pi (A^{2}+3r^{2})^{2}} \end{aligned}$$
(70)
$$\begin{aligned} p_{r}= & {} 0, \end{aligned}$$
(71)

with

$$\begin{aligned} \frac{A^{2}}{r_{\varSigma }^{2}}= & {} \frac{r_{\varSigma }-3M}{M} \end{aligned}$$
(72)
$$\begin{aligned} B^{2}= & {} 1-\frac{3M}{r_{\varSigma }}, \end{aligned}$$
(73)

which ensure the fulfilling of the matching conditions (12), (13) and (14). Next, replacing (67), (68), (69), (70), (71), (72) and (73) in (66) and using (45) to express the mass function in terms of \(m_{T}\) we arrive at

$$\begin{aligned} {\mathcal {K}}= & {} -\frac{\eta }{\vartheta } \bigg ( -8 \varXi \eta ^2 \varLambda ^2+3 \varXi x^4 y \left( \varLambda ^2-24 \eta ^2 y\right) \nonumber \\&+24 \varXi \varLambda x^6 y^2-48 \varXi \eta ^2 \varLambda x^2 y+15 \eta \varTheta x^5 y^2\nonumber \\&+33 \varXi x^8 y^3+5 \eta \varTheta \varLambda ^2 x+16 \eta \varTheta \varLambda x^3 y\bigg ), \end{aligned}$$
(74)

where \(x=r/_{\varSigma }\), \(\eta =m_{T}/_{\varSigma }\), \(y=M/r_{\varSigma }\) and

$$\begin{aligned} \varXi= & {} \sqrt{\frac{\left( x^2-3\right) y+1}{3 \left( x^2-1\right) y+1}} \end{aligned}$$
(75)
$$\begin{aligned} \varTheta= & {} \sqrt{\left( x^2-3\right) y+1} \end{aligned}$$
(76)
$$\begin{aligned} \varLambda= & {} 1-3 y \end{aligned}$$
(77)
$$\begin{aligned} \vartheta= & {} \left( 3 \left( x^2-1\right) x y+x\right) ^2 (\varTheta x-2 \varXi \eta ) \end{aligned}$$
(78)

In Fig. 9, we show the parametric plot of \({\mathcal {K}}(x)\) as a function of the normalized Tolman mass, \(\eta (x)\) in the interval \(x\in (0,1)\) for different values of y.

Fig. 9
figure 9

Parametric plot of \({\mathcal {K}}\) as a function of \(\eta \) for \(y=0.2\) (black line), \(y=0.25\) (blue dashed line) and \(y=0.3\) (red dashed line)

Interestingly, the solution deviates from the \({\mathcal {K}}=0\) condition as y increases.

5 Conclusions

In this work, we have developed a general method to construct locally anisotropic polytropes, and we have applied it to the specific case of a class I solution for spherically symetric interior space-times. As it occurs in the specific case of conformally flat polytrope spheres [6], our models are necessarily anisotropic (principal stresses unequal) and therefore are not continuously linked to isotropic polytropes (just like it ocurres in other reported anisotropic distributions [59]). Since the inclusion of pressure anisotropy implies an additional degree of freedom, the integration of the ensuing Lane Emden equation, in the general case, requires additional information. Usually this information is provided through equations of state or other type of assumptions about the nature of the anisotropy. Here, we have supplied such additional information by assuming that the polytrope has the specific anisotropy derived from de Karmarkar condition. This represents an heuristic assumption whose validity will be confirmed (or not) from its application to specific problems. Then, the geometrical constraint, chosen to work with, produce a specific type of anisotropy leading to a Lane–Emden equation that required a numerical analysis, given the high nonlinearity of the equations.

We could differentiate two possible cases depending on whether \(\gamma \ne 1\) or \(\gamma = 1\). We have integrated the Lane Emden equations for these cases, for a very large set of values of the parameters, even though, only a very specific set for each case is exhibited, this because the qualitative behavior of the system does not change much for a wide range of the parameters. The main reason to present such models was not to describe any specific astrophysical scenario, but to illustrate the applications of our approach. However, the protocol here developed could be useful for dealing with several phenomena in which anisotropic polytropes appear, with special emphasis in the physics of compact objects and so on, the obtained models exhibit some interesting features which deserve to be commented. We do not know if distributions that are usually represented as polytropes, and that also constitute very compact objects, like neutron stars (that are described by a Fermi gas), or Super-Chandrasekhar white dwarfs could be adequately modeled in this way. For such configurations it is evident that general relativistic effects as well as the inclusion of pressure anisotropy are unavoidable, and therefore its study could be carried on using the approach presented here. Here too, care must be exercised with the fact that some of the physical phenomena present in such configurations (e.g. very strong magnetic fields) could break the spherical symmetry.

It is interesting to highlight that polytropes with \(\gamma =1\) are used to model systems with non-degenerate isothermal cores which play an important role in the analysis of the Schönberg–Chandrasekhar limit. Any distribution of pressure anisotropy would affect the Schönberg–Chandrasekhar limit not only by affecting the structure of the polytrope, but also by the modifications of the virial theorem, introduced by the anisotropy.

In the last section we have followed a similar strategy previously used to express the Tolman mass in terms of traces of the Riemann tensor (matter sector) and the only non-vanishing scalar associated to the electric part of the Weyl tensor in static and spherically symmetric space-times, E (see [60], for example). In this sense, it is clear how the different parts affect the Tolman mass. For example, for conformally flat solutions the Weyl condition reads \(E=0\) which leads to a geometric constraint which allows to close the system. Similarly, here we have obtained expressions relating the scalar \({\mathcal {K}}\) with the traces of the Riemann tensor, the mass function m (64) and the Tolman mass (66) and class one solutions are obtained when the Karmarkar condition is fulfilled, namely \({\mathcal {K}}=0\). In this sense, expressions (64) and (66) may be useful to investigate the role played by Karmarkar embedding condition in our fluid distribution corresponding to the compact object. These aspects must be approached with the necessary care and detail in future works.

We do not know if there are any real physical phenomena that can produce a distribution of local anisotropy similar to the one inherited through the metric Karmarkar condition described in our models. So, it could be interesting to be able to provide a physical meaningful picture for a source of the anisotropy that we have obtained (by means of magnetic field or charge distribution) of the type one could expect to find in some astrophysical settings. Although it is certainly an interesting question, the answer lies beyond the scope of this work. However, we believe that our approach provides a useful tool to carry out this and other investigations.