1 Introduction

It is important to investigate solutions to the Einstein–Maxwell field equations in order to describe physical properties and behaviour of different physical systems in relativistic astrophysics. The Einstein theory of general relativity which extends the Newtonian gravity theory is useful in describing compact stellar objects which have very strong gravitational fields and high densities. The first exact solution to the Einstein field equations was given by Schwarzschild [1] in 1916, describing a compact stellar object with constant density in hydrostatic equilibrium. Even though the solution was not realistic, it paved the way for other researchers to search for physically realistic solutions to these equations. A number of approaches have been used by researchers in searching for exact solutions to the Einstein–Maxwell field equations. Some of these approaches include finding an equation of state that relates the pressure and the matter density as indicated in Sunzu et al. [2, 3], Brassel et al. [4], Nillson and Uggla [5, 6], Varela et al. [7], and Mafa Takisa and Maharaj [8], choosing one form of the gravitational potential on physical grounds that can predict the behaviour of the other metric function and the matter variables as adopted in Thirukkanesh et al. [9], Komathiraj et al. [10], Hansraj [11], and Mafa Takisa et al. [12], utilizing embedding of dimensions on the spacetime manifold as adopted in Singh et al. [13], Maurya and Maharaj [14], and Maurya and Govender [15], utilizing the group theoretic approach discussed in Abebe et al. [16, 17], Govinder and Govender [18], Mohanlal et al. [19, 20], and the existence of symmetries on the spacetime manifold as adopted in Rahaman et al. [21, 22], Singh et al. [23], Ojako et al. [24], Hansraj et al. [25], Esculpi and Aloma [26], Maurya et al. [27], Kileba Matondo et al. [28], and Manjonjo et al. [29].

Pressure anisotropy is an important quantity which includes the difference in pressures that exist within relativistic bodies. Several situations happening in stellar bodies can cause pressure anisotropy. In development of neutron stars, the existence of variation in magnetic field intensity produces pressure anisotropy [30]. It has been found by Sawyer [31] and Sokolov [32] that pion condensation and phase transitions can cause anisotropic pressure as well. Usov [33] suggested that pressure anisotropy can be caused by the existence of electric fields in stellar bodies. The presence of pressure anisotropy has significant effects on the properties and behaviour of stellar objects. Dev and Gleiser [34], and Bowers and Liang [35] identified the variations in mass, surface red shift and mass–radius ratio with respect to different values of pressure anisotropy. Ruderman [36] observed that stellar bodies with pressure anisotropy may have higher density values (\(> 10^{15}\) g/cm\(^3\)). Herrera and Santos [37] provided a detailed physical analysis on the effects that anisotropic pressure has on properties of stellar objects. It was found that the stability of stellar objects is influenced by the presence of anisotropic pressure. Recent models that include the effect of anisotropic pressure on matter variables are found in Bhar et al. [38], Maurya et al. [27], Thirukkanesh and Ragel [39], Manjonjo et al. [29], and Sunzu et al. [40].

The approach of imposing conformal symmetry on the spacetime manifold is useful in finding exact solutions to the non-linear Einstein–Maxwell field equations. The conformal Killing vector preserves the metric of spacetime and it generates constants of the motion. The gravitational potentials are restricted if the conformal Killing vector is present. This helps in simplification of the field equations. Studies on spacetime geometry with conformal motions have useful applications in astrophysics and cosmology. Several authors have studied static spherically symmetric spacetimes with conformal motions. Early models that include the effect of conformal Killing vector in finding exact solutions to the Einstein field equations were generated in [41,42,43,44]. However many of these models have singularities at the stellar centre. Later on, Maartens and Maharaj [45] generated a conformal model for anisotropic spheres which was free from central singularities. Recently, spherical models that admit conformal Killing vector in static spacetime were generated by several researchers. Manjonjo et al. [29, 46, 47] found the relationship which exists between two gravitational potentials when a conformal Killing vector is present. Singh et al. [48], and Shee et al. [49] generated anisotropic exact solutions describing the interior of compact stars for spherically symmetric spacetimes that admit non-static conformal motion. Usman et al. [50], and Bhar [51] used the conformal Killing vector to generate exact models for charged gravastars. Other spherical models admitting conformal Killing vector are found in Mafa Takisa et al. [12, 52], Kileba Matondo et al. [28, 53], and Moopanar and Maharaj [54].

Here we utilize the existence of a conformal symmetry on the manifold to generate a stellar model. It is important to note that other approaches exist in stellar modelling that may be followed in studying stars. Stars composed entirely of dark matter have been analysed recently [55, 56]. Nonlinear equations of state may be used to model stellar interiors [57,58,59]. The approach of minimal geometric coupling has been a fruitful avenue in finding new models of anisotropic stars [60, 61]. Stellar models have been investigated in gravity theories other than general relativity. Some of these studies include \(R^2\) gravity [62], f(RT) gravity [63, 64], scale-dependent gravity [65], Rastall gravitational models [66], and also Lovelock gravity [67]. The approach followed in these papers may be treated as a complement to the symmetry approach.

In this article, we follow the formalism of Manjonjo et al. [29]. We use the conformal Killing vector to restrict the gravitational potentials for the purpose of solving the Einstein–Maxwell field equations. We generate generalized regular conformal models for charged anisotropic stellar objects in spherically symmetric spacetime. The results found by Manjonjo et al. [29] are contained in our generalized solution. In the next section, we provide mathematical equations describing the Einstein–Maxwell field equations and the mass function. In Sect. 3, we give the connection between the conformal symmetry and the gravitational potentials. The transformed field equations are given in Sect. 4. A new generalized charged anisotropic exact solution is found in Sect. 5. Section 6 provides some well known solutions contained in our generalized exact solution. The physical features and analysis for the generated model are given in Sect. 7. Concluding remarks are outlined in Sect. 8.

2 Field equations

The interior line element describing the relativistic model in Schwarzschild coordinates for the matter distribution in static and spherically symmetric spacetimes takes the form

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

where \(\nu =\nu (r)\) and \(\uplambda =\uplambda (r)\) are functions defining the gravitational potentials. This spherical geometry is treated in the presence of charge and anisotropic pressure. The charged Reissner-Nordstrom line element for the exterior spacetime for gravitating objects is given by

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

where M stands for the total mass of the stellar object and Q is the electric charge. For the strong gravity regime and in the presence of charge, the highly non-linear Einstein–Maxwell field equations need to be discussed. These equations are considered for charged matter content with a comoving fluid four velocity vector \(u^{a}=\frac{1}{e^{v}}\delta ^{a}_{0}\). We describe the energy momentum tensor for the charged anisotropic stellar object in the form

$$\begin{aligned} T_{\alpha \beta }=\left( \rho +p_{t}\right) u_{\alpha }u_{\beta }+p_{t}g_{\alpha \beta }+\left( p_{t}-p_{r}\right) v_{\alpha }v_{\beta }+E_{\alpha \beta },\nonumber \\ \end{aligned}$$
(3)

where \(E_{\alpha \beta }\) is the electromagnetic field tensor. The physical quantities \(\rho \), \(p_{r}\), and \(p_{t}\) define the energy density, radial pressure, and the tangential pressure respectively.

Considering the line elements (1) and (2) together with equation (3), the Einstein–Maxwell field equations for the charged anisotropic matter distribution are given by

$$\begin{aligned} \frac{1}{e^{2\uplambda }}\left( \frac{2\uplambda ^\prime }{r}-\frac{1}{r^2}\right) +\frac{1}{r^{2}}= & {} 8\pi \rho +\frac{E^{2}}{2}, \end{aligned}$$
(4a)
$$\begin{aligned} \frac{1}{e^{2\uplambda }}\left( \frac{2\nu ^\prime }{r}+\frac{1}{r^2}\right) -\frac{1}{r^{2}}= & {} 8\pi p_{r}-\frac{E^{2}}{2}, \end{aligned}$$
(4b)
$$\begin{aligned} \frac{1}{e^{2\uplambda }}\left( \nu ^{\prime \prime }+\nu ^{\prime ^{2}}-\nu ^{\prime }\uplambda ^{\prime }+\frac{\nu ^{\prime }-\uplambda ^{\prime }}{r}\right)= & {} 8\pi p_{t}+\frac{E^{2}}{2}, \end{aligned}$$
(4c)
$$\begin{aligned} \frac{\left( Er^{2}\right) ^\prime }{4\pi r^{2}e^{\uplambda }}= & {} \sigma . \end{aligned}$$
(4d)

The quantities E and \(\sigma \) represent the electric field intensity and the proper charge density respectively. The primes \((^\prime )\) stand for differentiation with respect to radial coordinate r. For perfect fluids, the matter distribution becomes uncharged (\(E=0\)) and isotropic in nature (\(\varDelta =p_{t}-p_{r}=0\)). We are using geometrized units in which the speed of light is taken as unity (\(8 \pi G=c=1\)).

The mass contained within a sphere of radius r for charged matter distribution as given by Mak and Harko [68] is defined to be

$$\begin{aligned} M(r) = 4\pi \int _{0}^{R}\left( \rho (r)+E^{2}\right) r^{2} dr. \end{aligned}$$
(5)

3 The conformal symmetry

In general, the Einstein–Maxwell field equations (4) are difficult to integrate. The symmetry approach of using a conformal Killing vector helps to simplify these equations to obtain exact solutions. This approach restricts the gravitational potentials and preserves the metric of spacetime by a conformal factor. We define the conformal Killing equation by

$$\begin{aligned} L_\mathbf{{X}}g_{ab}= 2\varPhi g_{ab}, \end{aligned}$$
(6)

where \(g_{ab}\) is the metric tensor and \(L_\mathbf{{X}}\) is the Lie derivative operator applied to the metric. The quantity \(\varPhi \) is the conformal factor. The conformal Killing vector \(\mathbf {X}\) can be static or non-static with static or non-static conformal factor \(\varPhi \). In this work, we consider the case in which both the conformal Killing vector and conformal factor are non-static (that is, they are functions of time). Using the spherical symmetry assumption, the conformal Killing vector \(\mathbf {X}\) has the form

$$\begin{aligned} \mathbf{{X}}= & {} \alpha \left( t,r\right) \frac{\partial }{\partial {t}} + \beta \left( t,r\right) \frac{\partial }{\partial {r}}, \end{aligned}$$
(7a)
$$\begin{aligned} \varPhi= & {} \varPhi (t,r). \end{aligned}$$
(7b)

To solve Eq. (6) with conformal Killing vector (7a) and conformal factor (7b), we introduce the associated Weyl tensor integrability condition

$$\begin{aligned} L_\mathbf{{X}}C^{a}_{bcd}=0, \end{aligned}$$
(8)

where \(C^{a}_{bcd}\) represents the Weyl tensor. Using integrability condition (8), Eq. (6) yields

$$\begin{aligned} \nu ^{\prime \prime }+(\nu ^{\prime })^{2}-\nu ^{\prime }\uplambda ^{\prime }-\frac{\nu ^{\prime }-\uplambda ^{\prime }}{r}+r^{-2}=\frac{(1+k)}{r^{2}e^{-2\uplambda }}, \end{aligned}$$
(9)

k being a constant. The highly non-linear Eq. (9) has been integrated in general [47, 69, 70]. The solution is given by

$$\begin{aligned} e^{\nu }= {\left\{ \begin{array}{ll} Ar\exp \left( \sqrt{1+k}\int {\frac{e^\uplambda }{r}dr}\right) \\ \quad + Br\exp \left( -\sqrt{1+k}\int {\frac{e^\uplambda }{r}dr}\right) , \;\;\;\quad 1+k>0, \\ Ar\int {\frac{e^\uplambda }{r}dr} +Br, \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \qquad 1+k=0, \\ Ar\exp \left( \sqrt{-\left( 1+k\right) }\int {\frac{e^\uplambda }{r}dr}\right) \\ \quad + Br\exp \left( -\sqrt{-\left( 1+k\right) }\int {\frac{e^\uplambda }{r}dr}\right) ,\quad 1+k<0, \end{array}\right. }\nonumber \\ \end{aligned}$$
(10)

for constants A and B. When \(k=0\), the spacetime is conformally flat, otherwise \(k\ne 0\).

4 Transformed field equations

For convenience, to simplify the field equations (4), we introduce new transformation variables similar to those adopted by Durgapal and Bannerji [71], given by

$$\begin{aligned} x=r^{2},\;\;Z(x)=e^{-2\uplambda (r)},\;\;y^{2}(x)=e^{2\nu (r)}. \end{aligned}$$
(11)

Using transformations (11), the system of field equations in (4) is transformed to

$$\begin{aligned}&\frac{1-Z}{x}-2{\dot{Z}} = 8\pi \rho +\frac{E^{2}}{2}, \end{aligned}$$
(12a)
$$\begin{aligned}&4Z \left( \frac{{\dot{y}}}{y}\right) -\frac{1-Z}{x} = 8\pi p_{r}-\frac{E^{2}}{2}, \end{aligned}$$
(12b)
$$\begin{aligned}&4xZ \left( \frac{\ddot{y}}{y}\right) +\left( 4Z+2x{\dot{Z}}\right) \left( \frac{{\dot{y}}}{y}\right) +{\dot{Z}}= 8\pi p_{t}+\frac{E^{2}}{2},\nonumber \\ \end{aligned}$$
(12c)
$$\begin{aligned}&\frac{Z}{4\pi ^{2}x}\left( x{{\dot{E}}}+E\right) ^{2}=\sigma ^{2}, \end{aligned}$$
(12d)

where dots denote differentiation with respect to x. From (12b) and (12c), the pressure anisotropy \(\varDelta \) is given by

$$\begin{aligned} \varDelta =\frac{1}{8\pi }\left[ 4xZ\left( \frac{\ddot{y}}{y}\right) + 2x{\dot{Z}}\left( \frac{{\dot{y}}}{y}\right) +{\dot{Z}}-\frac{Z-1}{x}-E^{2}\right] .\nonumber \\ \end{aligned}$$
(13)

Using (11), the mass function of the star in (5) is transformed to

$$\begin{aligned} M(x)= 2\pi \int _{0}^{x}\left( \rho (\xi )+E^{2}\right) \sqrt{\xi } d \xi , \end{aligned}$$
(14)

for the new radial coordinate x.

5 New exact solution

Using transformations (11) with \(k=2(n-1)\) (Manjonjo et al. [29]), solution (10) becomes

$$\begin{aligned} y= {\left\{ \begin{array}{ll} A\sqrt{x}\exp \left( \frac{1}{2}\sqrt{2n-1}\int {\frac{dx}{x\sqrt{Z}}}\right) \\ \quad +B\sqrt{x}\exp \left( -\frac{1}{2}\sqrt{2n-1}\int {\frac{dx}{x\sqrt{Z}}}\right) , \;\;\quad {n}>\frac{1}{2}, \\ \frac{A}{2}\sqrt{x}\int {\frac{dx}{x\sqrt{Z}}} +B\sqrt{x}, \;\;\;\;\;\;\;\;\qquad \qquad \quad {n}=\frac{1}{2}, \\ A\sqrt{x}\exp \left( \frac{1}{2}\sqrt{-(2n-1)}\int {\frac{dx}{x\sqrt{Z}}}\right) \\ \quad +B\sqrt{x}\exp \left( -\frac{1}{2}\sqrt{-(2n-1)}\int {\frac{dx}{x\sqrt{Z}}}\right) , {n}<\frac{1}{2}. \end{array}\right. } \end{aligned}$$
(15)

Then, using (15) and (13) for all values of n, we obtain

$$\begin{aligned} {\dot{Z}}-\frac{Z}{x}+\frac{n}{x}=\frac{1}{2}(8\pi \varDelta +E^{2}). \end{aligned}$$
(16)

Integrating (16), we get

$$\begin{aligned} Z=x\int {\frac{8\pi \varDelta +E^{2}}{2x}dx}+mx+n, \end{aligned}$$
(17)

where m is a constant of integration. We can obtain the solution of (17) by specifying \(\varDelta \) and E on physical grounds. When \(n=1\), we describe the conformally flat geometry.

Suppose \(m=0\) with \(n=1\), and we choose new forms for the measure of anisotropy \(\varDelta \) and electric field intensity E as

$$\begin{aligned} \varDelta= & {} \frac{dx}{4\pi (b+cx)^{3}}, \end{aligned}$$
(18)
$$\begin{aligned} E^{2}= & {} \frac{2acx}{(b+cx)^{2}}. \end{aligned}$$
(19)

The anisotropy \(\varDelta \) increases, reaches a maximum, and is then a decreasing function; it will have small values close to the stellar boundary. The charge \(E^2\) is finite at the centre, a continuous function, and remains bounded in the interior. These are desirable physical features for a stellar model. Similar choices for \(\varDelta \) and \(E^2\) have been made in the treatments [72,73,74,75,76] leading to physically acceptable models. We observe that \(E=0\) and \(\varDelta =0\) at the centre of the stellar object (\(x=0\)) which is physical. This indicates that our choice for the measure of anisotropy \(\varDelta \) and the electric field intensity E can represent realistic stars. We note that when \(d=0\) and a or \(c=0\), the model becomes neutral and isotropic. When \(d\ne 0\), and a or \(c=0\) generates a neutral anisotropic model. The case \(d\ne 0\), and a, \(c\ne 0\) generates charged anisotropic models. Other particular choices for the electric field E were adopted by Manjonjo et al. [29] and Mafa Takisa et al. [12] in their conformal symmetry models. Our choice for the measure of anisotropy \(\varDelta \) has not been adopted before. These choices are made on physical grounds to ensure that all metric functions are regular at the centre. With these choices, the potential in (17) takes the form

$$\begin{aligned} Z=1-\frac{x(\frac{d}{c}+2a(b+cx))}{2(b+cx)^{2}}+xa_1, \end{aligned}$$
(20)

where \(a_1\) is the constant of integration.

Suppose \(a_1=0\), and using (20), Eq. (15) after integration reduces to

$$\begin{aligned} y = Ax\sqrt{\frac{a_2(F_1+F_2)^P}{{(F_3+F_4)}}} + \frac{B\sqrt{(F_3+F_4)}}{\sqrt{{a_2(F_1+F_2)^P}}}, \end{aligned}$$
(21)

where \(a_2\) is an integration constant. For simplicity in writing this equation, we have set

$$\begin{aligned} F_1= & {} 4bc^{2}-d+4c^{3}x-2ac\left( b+2cx\right) \\&+2\sqrt{2}bc^{3/2}\sqrt{-a+c} F_0,\\ F_2= & {} 2\sqrt{2}c^{5/2}x\sqrt{-a+c} F_0,\\ F_3= & {} -\sqrt{2}dx+4b^{2}c\left( \sqrt{2} + F_0\right) ,\\ F_4= & {} 2bcx\left[ -\sqrt{2}a+2c\left( \sqrt{2} + F_0\right) \right] ,\\ P= & {} \sqrt{\frac{c}{-a+c}}, \end{aligned}$$

with \(F_0\) given by

$$\begin{aligned} F_0= & {} \left( 2b^2c+2bcx\left( -a+2c\right) -x\left( d+2\left( a-c\right) c^2x\right) \right) ^{\frac{1}{2}} \\&\times \left( c\left( b+cx\right) ^2\right) ^{- {\frac{1}{2}}}. \end{aligned}$$

The metric functions (20) and (21) together with the system (12) can provide a realistic stellar model with astrophysical significance.

Using (20) and (21), the matter variables become

$$\begin{aligned} \rho= & {} \frac{d\left( 3b-cx\right) +6abc\left( b+cx\right) }{16\pi c\left( b+cx\right) ^3}, \end{aligned}$$
(22a)
$$\begin{aligned} \sigma ^{2}= & {} \frac{-a\left( 3b+cx\right) ^2}{16\pi ^2\left( b+cx\right) ^6} \left( -2b^2c+2b\left( a-2c\right) cx \right. \nonumber \\&\left. +x\left( d+2\left( a-c\right) c^2x\right) \right) , \end{aligned}$$
(22b)
$$\begin{aligned} p_r= & {} \frac{1}{8\pi }\left[ P_0+\left( P_1\left( A\sqrt{\frac{a_2(F_1+F_2)^P}{(F_3+F_4)}}\right. \right. \right. \nonumber \\&\left. \left. \left. -\left( B\left( -\left( \frac{\left( a_2\left( F_1+F_2\right) ^{P}\left( {F_5+F_6+F_7}\right) \right) }{(F_3+F_4)^2}\right) \right. \right. \right. \right. \right. \nonumber \\&\left. \left. \left. \left. \left. +\frac{\left( a_2P(F_1+F_2)^{P_2}(F_8+F_9+F_{10})\right) }{(F_3+F_4)} \right) \right) \right. \right. \right. \nonumber \\&\left. \left. \left. \times \left( 2\left( \frac{{a_2(F_1+F_2)}^{P}}{(F_3+F_4)}\right) ^{\frac{3}{2}}\right) ^{-1}+\left( Ax\left( -\left( \left( a_2(F_1 \right. \right. \right. \right. \right. \right. \right. \nonumber \\&\left. \left. \left. \left. \left. \left. \left. + F_2)^{P} \left( {F_5+F_6+F_7}\right) \right) \left( F_3+F_4\right) ^{-2} \right) \right. \right. \right. \right. \right. \nonumber \\&\left. \left. \left. \left. \left. +\left( a_2P(F_1+F_2)^{P_2} ({F_8+F_9+F_{10}})\right) \right. \right. \right. \right. \right. \nonumber \\&\left. \left. \left. \left. \left. \times \left( F_3+F_4\right) ^{-1}\right) \right) \left( 2\sqrt{\frac{a_2(F_1+F_2)^P}{(F_3+F_4)}}\right) ^{-1}\right) \right) \right. \nonumber \\&\left. \times \left( B\left( \sqrt{\frac{a_2(F_1+F_2)^P}{(F_3+F_4)}}\right) ^{-1} \right. \right. \nonumber \\&\left. \left. +Ax\sqrt{\frac{a_2(F_1+F_2)^P}{(F_3+F_4)}}\right) ^{-1}\right] , \end{aligned}$$
(22c)
$$\begin{aligned} p_t= & {} \varDelta + p_r, \end{aligned}$$
(22d)

where

$$\begin{aligned} P_0= & {} \frac{acx}{\left( b+cx\right) ^2}-\frac{\frac{d}{c}+2a\left( b+cx\right) }{2\left( b+cx\right) ^2},\\ P_1= & {} 4\left( 1-\frac{x\left( \frac{d}{c}+2a\left( b+cx\right) \right) }{2\left( b+cx\right) ^2}\right) , \\ P_2= & {} -1+\sqrt{\frac{c}{-a+c}},\\ F_5= & {} -\sqrt{2}d+\frac{2b^2c\left( P_3-P_4\right) }{F_0},\\ F_6= & {} \frac{2bc^2x\left( P_3-P_4\right) }{F_0},\\ F_7= & {} \frac{F_4}{x}, \\ F_8= & {} -4ac^2+4c^3+2\sqrt{2}c^{5/2}\sqrt{-a+c}F_0, \\ F_9= & {} \frac{\sqrt{2}bc^{3/2}\sqrt{-a+c}\left( P_3-P_4\right) }{F_0},\\ F_{10}= & {} \frac{\sqrt{2}c^{5/2}x\sqrt{-a+c}\left( P_3-P_4\right) }{F_0}, \end{aligned}$$

with \(P_3\) and \(P_4\) given by

$$\begin{aligned} P_3= & {} \frac{2bc\left( -a+2c\right) -d-4\left( a-c\right) c^2x}{c\left( b+cx\right) ^2}, \\ P_4= & {} \frac{4\left( b^2c+bc\left( -a+2c\right) x\right) }{\left( b+cx\right) ^3} -\frac{2x\left( d+2\left( a-c\right) c^2x\right) }{\left( b+cx\right) ^3}. \end{aligned}$$

Using (19) and (22a), the mass equation (14) becomes

$$\begin{aligned} M(x)= & {} \frac{\sqrt{x}\left( ab+acx\right) \left( 48\pi b +32\pi cx-3b\right) }{4c\left( b+cx\right) ^{2}}\nonumber \\&-\left( \frac{3a\sqrt{b}(16\pi -1)\arctan {\left( \sqrt{{cx/b}}\right) }}{4c\sqrt{c}}\right) \nonumber \\&+\frac{\sqrt{x}dx}{4c\left( b+cx\right) ^{2}}. \end{aligned}$$
(23)

6 Some well known solutions

It is important to generate stellar models that reduce to well known solutions found in the literature. Our generalized conformal symmetry class of exact solution contains compact star models with astrophysical significance. The Finch–Skea, Vaidya–Tikekar and interior Schwarzschild models are regained as special cases. We also observe from (20) that when \(a=0\), \(d=0\) and \(a_1=0\), our metric reduces to Minkowski spacetime with \(Z=1\). The class of exact solution found in this work generalizes several spherical conformal models generated by other researchers as indicated in Tables 1, 2 and 3.

6.1 Finch–Skea model form

The case \(a=b=c=1\) and \(a_1=d=0\) generates the Finch–Skea [77] model with the form \(Z=\frac{1}{1+x}\). For this case, the gravitational potential y becomes

$$\begin{aligned} y= & {} A\left( \sqrt{x+1}-1\right) e^{\sqrt{x+1}}\nonumber \\&+ B\left( \sqrt{x+1}+1\right) e^{-\sqrt{x+1}}. \end{aligned}$$
(24)

We observe from (18) that, \(\varDelta =0\) when \(d=0\), which means isotropic pressure. From (19), the electric field equation reduces to \(E^2=\frac{2x}{\left( 1+x\right) ^2}\). This special case was generated by Manjonjo et al. [29].

6.2 Schwarzschild metric

When \(a=d=0\) and \(a_1=1\), our gravitational potential in Eq. (20) reduces to the interior Schwarzschild potential \(Z=1+x\). For these settings, we observe from (18) and (19) that the pressure anisotropy \(\varDelta \) and electric field E vanish, and the model becomes isotropic and neutral. The gravitational potential y for this case takes the form

$$\begin{aligned} y= A\sqrt{\frac{xc_1\left( 1-\sqrt{1+x}\right) }{\left( 1+\sqrt{1+x}\right) }}+B\sqrt{\frac{x\left( 1+\sqrt{1+x}\right) }{c_1\left( 1-\sqrt{1+x}\right) }}, \end{aligned}$$
(25)

where \(c_1\) is the constant of integration. The solution of Schwarzschild metric in Einstein gravity is important, and also in other gravity theories including the Lovelock gravity [78].

Table 1 Exact charged isotropic conformal symmetry solutions contained in our model
Table 2 Exact charged anisotropic conformal symmetry solutions contained in our model
Table 3 Exact neutral anisotropic conformal symmetry solutions contained in our model

6.3 Vaidya–Tikekar case

The case \(a=-1\), \(b=c=1\) and \(a_1=d=0\) reduces the potential in equation (20) to \(Z=\frac{1+2x}{1+x}\). This case was investigated by Vaidya–Tikekar [79] in their study on uncharged perfect fluid configuration. In our case, the metric function y takes the form

$$\begin{aligned} y= & {} Ax\left( \frac{c_2\left( 3+4x+2\sqrt{2\left( 1+x\right) }\sqrt{1+2x}\right) ^{\frac{1}{\sqrt{2}}}}{\left( 2+3x+2\sqrt{1+x}\sqrt{1+2x}\right) }\right) ^{\frac{1}{2}}\nonumber \\&+B\left( 2+3x+2\sqrt{1+x}\sqrt{1+2x}\right) ^{\frac{1}{2}}\nonumber \\&\times \left( c_2\left( 3+4x+2\sqrt{2\left( 1+x\right) }\sqrt{1+2x}\right) ^{\frac{1}{\sqrt{2}}}\right) ^{-\frac{1}{2}},\nonumber \\ \end{aligned}$$
(26)

where \(c_2\) is the constant of integration.

7 Physical conditions

We present a detailed physical analysis on the behaviour and properties of the gravitational potentials and the matter variables. Analysis on the realistic physical conditions such as regularity, stability, equilibrium, limits on the surface red shift and the compactness factor, and the energy conditions is given in detail for physical acceptability. The graphical representations of the gravitational potentials and the matter variables for the generated model were obtained using the Python Programming Language. The following values were chosen for the constants: \(a=\pm 0.525\), \(a_2=0.0000088\), \(b=20\), \(c=40\), \(d=285\), \(A=2.05\), and \(B=1.15\). In sketching the graph for the behaviour of the physical forces, the value of \(a_2\) was changed to 0.088. [The various mathematical equations were checked using the Mathematica software.]

7.1 Matching conditions

It is important to match the interior exact solution found with that of the exterior at the boundary of the stellar object. This is done by utilizing the first and second fundamental forms. Matching the line elements given by (1) and (2) at the boundary \(r=R\) with \(x=R^2\) gives

$$\begin{aligned} e^{2\nu (R)}= & {} y^{2}({R^2})=\left( 1-\frac{2M}{R}+\frac{Q^{2}}{R^{2}}\right) , \end{aligned}$$
(27a)
$$\begin{aligned} e^{2\uplambda (R)}= & {} Z^{-1}(R^2)=\left( 1-\frac{2M}{R}+\frac{Q^{2}}{R^{2}}\right) ^{-1}. \end{aligned}$$
(27b)

Also we have the requirement that the radial pressure of the star at the surface must vanish (\(p_{r}(r=R)=0\)). This condition is satisfied which is clearly seen from Fig. 1. The quantity \({Q^{2}}/{R^{2}}=E^2R^2\). Using the mass function (23), the potentials in (20) and (21) together with the electric field equation (19), the matching conditions in (27) become

$$\begin{aligned} 0= & {} R^{5}\left( \frac{2ac}{\left( {b+cR^2}\right) ^2}-\frac{A^2a_2\left( F_1+F_2\right) ^P}{\left( F_3+F_4\right) }\right. \nonumber \\&\left. -\frac{16\pi ac}{\left( b+cR^2\right) ^2}\right) - R^{3}\left( -\frac{3ab}{2\left( b+cR^2\right) ^2}\right. \nonumber \\&\left. +\frac{40\pi ab}{\left( b+cR^2\right) ^2} + \frac{d}{2c\left( b+cR^2\right) ^2}+2AB\right) \nonumber \\&+ R\left( \frac{3ab^2}{2c\left( {b+cR^2}\right) ^2}-\frac{24\pi ab^2}{c\left( b+cR^2\right) ^2}\right. \nonumber \\&\left. -\frac{B^2\left( F_3+F_4\right) }{a_2\left( F_1+F_2\right) ^P}+1\right) \nonumber \\&+\frac{3a\sqrt{b}\left( 16\pi -1\right) \arctan {\left( R\sqrt{{c/b}}\right) }}{2c\sqrt{c}}, \end{aligned}$$
(28a)
$$\begin{aligned} 0= & {} R^{4}\left( \frac{16\pi ac}{\left( b+cR^2\right) ^2}-\frac{3ac}{\left( b+cR^2\right) ^2}\right) \nonumber \\&+R^{2}\left( \frac{40\pi ab}{\left( b+cR^2\right) ^2}-\frac{5ab}{2\left( b+cR^2\right) ^2}\right) \nonumber \\&-\frac{3a\sqrt{b}\left( 16\pi -1\right) \arctan {\left( R\sqrt{{c/b}}\right) }}{2cR\sqrt{c}}\nonumber \\&+ \frac{ab^2\left( 48\pi -3\right) }{ (b+cR^2)^2}, \end{aligned}$$
(28b)
$$\begin{aligned} 0= & {} p_r\left( r=R\right) . \end{aligned}$$
(28c)

The system of equations in (28) provides the matching conditions for our generated exact solution given in system (22). This has been done explicitly by expressing the matching conditions in (28) in terms of the constants a, \(a_2\), b, c, d, R, A, and B. We observe that there are sufficient free parameters to satisfy the matching conditions (28).

Fig. 1
figure 1

Radial pressure \(p_r\) against radial distance r

Fig. 2
figure 2

Pressure anisotropy \(\varDelta \) against radial distance r

7.2 Pressure anisotropy, electric field and proper charge density

In our generalized charged anisotropic conformal model, we observe that the pressure anisotropy \(\varDelta \) and the electric field E are zero at the stellar centre. These quantities increase sharply near the centre to the maximum and then start to decrease towards the boundary (Figs. 2, 3). The proper charge density is positive, maximum at the centre and decreasing towards the surface (Fig. 4). These behaviours represent realistic relativistic bodies.

Fig. 3
figure 3

Electric field \(E^2\) against radial distance r

Fig. 4
figure 4

Proper charge density \(\sigma ^2\) against radial distance r

7.3 Regularity conditions

We observe from Figs. 5 and 6 that the metric functions \(e^{2\uplambda }=1\), and \(e^{2\nu }\) is positive at the stellar centre (\(r=0\)) and monotonically increasing towards the boundary. This indicates that these potentials are free from a central singularity.

It is also required that the matter density (\(\rho \)) be positive and maximum at the stellar centre while decreasing towards the boundary. This is also satisfied as indicated in Fig. 7.

The regularity condition also requires the radial (\(p_r\)) and tangential (\(p_t\)) pressures to be equal, maximum at the stellar centre and decreasing towards the surface of the sphere as shown from Figs. 1 and 8. Importantly, the radial pressure vanishes at the stellar boundary (\(r=R\)).

7.4 Energy conditions

For an admissible charged fluid solution, the energy momentum tensor should satisfy the null energy condition (N.E.C), the weak energy condition (W.E.C), the weak dominant energy condition (W.D.E.C) and the strong energy condition (S.E.C) inside the sphere. These conditions are described by the following inequalities:

$$\begin{aligned} N.E.C : \rho \ge {0}, \end{aligned}$$
(29a)
$$\begin{aligned} W.E.C :\rho -p_r, \rho -p_t \ge {0}, \end{aligned}$$
(29b)
$$\begin{aligned} W.D.E.C :\rho -3p_r, \rho -3p_t \ge {0}, \end{aligned}$$
(29c)
$$\begin{aligned} S.E.C :\rho -p_r-2p_t\ge {0}. \end{aligned}$$
(29d)

Our generalized conformal model satisfies all these conditions throughout the stellar interior as required in Figs. 7, 9, 10 and 11 respectively.

Fig. 5
figure 5

Potential \(e^{2\uplambda }\) against radial distance r

Fig. 6
figure 6

Potential \(e^{2\nu }\) against radial distance r

Fig. 7
figure 7

Energy density \(\rho \) against radial distance r

Fig. 8
figure 8

Tangential pressure \(p_t\) against radial distance r

Fig. 9
figure 9

Weak energy condition against radial distance r

Fig. 10
figure 10

Weak dominant energy condition against radial distance r

Fig. 11
figure 11

Strong energy condition against radial distance r

7.5 Stability via adiabatic index

The model stability is investigated using the adiabatic index \(\varGamma \), describing the ratio between two specific heats. This value is required to be greater than \(\frac{4}{3}\) [37, 81]. For realistic anisotropic relativistic spheres the adiabatic index is defined to be

$$\begin{aligned} \varGamma > \frac{4}{3}+\left( \frac{4\left( p_t-p_r\right) }{3rp'_r}\right) _{max.} \end{aligned}$$
(30)

[81, 82]. As pointed out before the charged fluid spheres are anisotropic with unequal pressures in radial and tangential directions \((p_t\ne p_r)\). From Fig. 12, we observe that the adiabatic index values agree with the existing literature.

7.6 Equilibrium condition

The equilibrium condition requires the sum of the physical forces within the star to balance. For charged matter configuration, this requirement is described in the Tolman-Oppenheimer-Volkoff (TOV) equation given by

$$\begin{aligned} \frac{-M_g \left( \rho +p_r\right) }{r^2}e^{\uplambda -\nu }-\frac{dp_r}{dr}+\sigma \frac{q}{r^2} e^{\uplambda } +\frac{2\varDelta }{r}=0, \end{aligned}$$
(31)

[35, 84, 85], where \(M_g=\frac{r^2v'e^{\nu -\uplambda }}{2}\) is the effective gravitational mass and \(\frac{q}{r^2}=E\) is the electric field intensity. Equation (31) simplifies to

$$\begin{aligned} \frac{-\nu ' \left( \rho +p_r\right) }{2}-\frac{dp_r}{dr}+\sigma E e^{\uplambda } +\frac{2\varDelta }{r}=0. \end{aligned}$$
(32)

The terms \(\frac{-\nu ' \left( \rho +p_r\right) }{2}\), \(-\frac{dp_r}{dr}\), \(\sigma E e^{\uplambda }\) and \(\frac{2\varDelta }{r}\) define the gravitational force \((F_g)\), hydrostatic force \((F_h)\), electric force \((F_e)\) and anisotropic force \((F_a)\) respectively. From (32), the TOV equation reduces to

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

This condition is satisfied as illustrated in Fig. 13.

Fig. 12
figure 12

Adiabatic index \(\varGamma \) against radial distance r

7.7 Mass, surface red shift and compactness factor

We observe that the surface red shift increases with increase in radial coordinate r (Fig. 14). Its maximum value is attained at \(z_s=0.5024\). For realistic anisotropic charged compact stars, the surface red shift is required not to exceed 5.211 [86, 87]. It is clear that the red shift value in this model satisfies this requirement, indicating that our charged anisotropic model is physical and realistic. It is also observed that the mass–radius ratio (compactness factor \(\mu \)) increases with the increase in radial coordinate (Fig. 15) with maximum value at \(\mu =0.5573\). This value is within the required limit for anisotropic matter distribution, that is, \(\frac{2M}{r}=\mu \le \frac{8}{9}\) [86]. The surface red shift and the mass–radius ratio are defined by

$$\begin{aligned} z_s= & {} \frac{1}{\sqrt{1-\frac{2M(r)}{r}}}-1, \end{aligned}$$
(34)
$$\begin{aligned} \mu (r)= & {} \frac{2M(r)}{r}, \end{aligned}$$
(35)

respectively [35, 86, 87]. In Fig. 16, the \(M-R\) plot is generated for three values of the parameter a. For these values we obtain a maximum mass of approximately \(1.835 M_{\odot }\). This result is compatible with several observations [12, 28, 52, 55, 88, 89]. Other maximum mass values are possible depending on the value of the parameter chosen.

Fig. 13
figure 13

Behaviour of forces against radial distance r

Fig. 14
figure 14

Surface red shift \(z_s\) against radial distance r

Fig. 15
figure 15

Mass radius ratio (compactness factor \(\mu \)) against radial distance r

Fig. 16
figure 16

\(M-R\) plot

8 Conclusion

In this work, we incorporated the conformal Killing vector into the Einstein–Maxwell equations to generate realistic generalized exact models with charge and pressure anisotropy. The conformal Killing vector provided a relationship between the gravitational potential functions which resulted in a new generalized solution. The detailed physical analysis for the new generated class of exact solution was undertaken to examine its physical acceptability. It has been found that the matter variables and the gravitational potentials are regular at the stellar centre, the energy conditions are satisfied, the stability is obeyed via. adiabatic index, the physical forces balance at equilibrium, the surface red shift and the compactness factor describing the mass–radius ratio are in acceptable ranges for realistic stellar bodies. Our generalized class of exact solution extend the earlier investigations of Manjonjo et al. [29]. We regained the charged isotropic exact models generated by Manjonjo et al. [29], Usmani et al. [50], and Mak and Harko [80] as special cases (Table 1). The charged anisotropic models regained are those found by Singh et al. [48], and Esculpi and Aloma [26] as outlined in Table 2. We also regained neutral anisotropic models generated by Rahaman et al. [21, 83], Shee et al. [49], and Mafa Takisa et al. [52] as given in Table 3. Our generalized exact model also reduce to some well known metrics such as interior Schwarzschild, Vaidya–Tikekar and Finch–Skea. Many of these solutions have been found in the past using an ad hoc approach. Here we have shown that they are contained in a generalized class characterized geometrically by a conformal symmetry. Other models can be obtained for other different choices of electric field E and pressure anisotropy \(\varDelta \) made on physical grounds. This study shows that it is important to identify such cases when a conformal symmetry is present.