1 Introduction

Gravitation is governed by the Einstein equations of general relativity in the simplest case. The Einstein–Maxwell equations are a system of highly non-linear differential second order equations in partial derivatives. In astrophysics spherical symmetry is usually used, which reduces in the static case the differential equations to ordinary ones and the derivatives are with respect to the radius. The metric is diagonal with just two components. In canonical commoving coordinates there are three Einstein equations for six unknowns – the two metric potentials and the four components of the energy-momentum tensor \(T_{ab}\), namely, the energy density \(\mu \), the radial and the tangential pressures \(p_{r}\) and \(p_{t}\) and the charge l. Thus the fluid is anisotropic, which is backed by arguments for compact objects with very high density [1] and by a number of other reasons [2, 3].

On one side these equations present expressions for the components of the energy-momentum tensor. On the other side the metric potentials enter in a rather involved way as they are obtained from the Ricci tensor and scalar. The equations remain non-linear for the metric. Durgapal and Banerjee [4] showed that in the perfect fluid case the Einstein equations are linear of first order for a function of \(g_{11}\) and the equations for \(p_{t}\) and the anisotropy factor \(\varDelta \) are linear of second order for a function of \(g_{00}\). Later, these findings were generalized for charged anisotropic fluid. The reason for this simplification was partly clarified in a previous paper [5] and is due to the fact that the Einstein equation for \( p_{t}\) is a Riccati equation. It was also shown there that the Einstein equations may serve as generating functions for stellar model solutions, similar to the case of \(\varDelta \) [6]. The existence of an EOS leads to a relation between the metric potentials.

Something more, there are common features between the generating functions based on the equations for \(p_t\) and \(\varDelta \) and other ways to generate a solution, like conformal flatness, conformal motion or the possibility to embed the spacetime in a flat five-dimensional spacetime, namely they are also linear or Riccati, which in the last case is truncated to a Bernoulli equation.

In the present paper we discuss the charged anisotropic case in a systematic way. Charged anisotropic fluid is the general type of fluid in the static case. All other characteristics like shear, expansion, two types of viscosity, two types of radiation depend on time and vanish for static solutions [7]. Like in [5], we shall not study the numerous conditions for physical viability of some new solution, but concentrate on the mathematical issues and classification schemes, backing them with plenty of concrete examples from the literature, where the hard and space consuming check of viability has already been done.

There are other methods to generate static solutions in the neutral case. One is for perfect (isotropic) fluids, where isotropic and canonical coordinates are used [8, 9]. Different theorems about linking the solutions were proven, or checking part of the viability conditions has been done [10, 11]. Generation procedures for finding anisotropic solutions out of known isotropic ones have also been given [12, 13].

In Sect. 2 the Einstein–Maxwell equations are given, as well as some characteristics of the model and the equations for the anisotropy factor, the existence of conformal motion or flatness in particular, and the Karmarkar condition. In Sect. 3 a generating function, based on the expression for the radial pressure is discussed. When an EOS is imposed, the expression for the energy density is also necessary. Section 4 gives generating function based on the expressions for the tangential pressure. The well-known generating function, based on the anisotropy factor, is generalized to the charged case. In Sect. 5 we discuss the metric potentials as generating functions, with or without a relation between them. Section 6 deals with generating solutions when the charge is not given beforehand. Section 7 provides some discussion.

2 Einstein–Maxwell equations and definitions

The interior of static spherically symmetric stars is described by the canonical line element

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

where \(\lambda \) and \(\nu \) depend only on the radial coordinate r. The energy-momentum tensor reads

$$\begin{aligned} T_{\alpha \beta }=\left( \mu +p_t\right) u_\alpha u_\beta +p_tg_{\alpha \beta }+\left( p_r-p_t\right) \chi _\alpha \chi _\beta +E_{\alpha \beta }. \nonumber \\ \end{aligned}$$
(2)

Here \(\mu \) is the energy density, \(p_r\) is the radial pressure, \(p_t\) is the tangential pressure, \(u^\alpha \) is the four-velocity of the fluid, \( \chi ^\alpha \) is a unit spacelike vector along the radial direction and \( E_{\alpha \beta }\) is the electromagnetic energy tensor.

We have

$$\begin{aligned} E_{\alpha \beta }=\frac{1}{4\pi }\left( F_\alpha ^{\;\gamma }F_{\beta \gamma }-\frac{1}{4}g_{\alpha \beta }F^{\gamma \delta }F_{\gamma \delta }\right) , \end{aligned}$$
(3)

where \(F_{\alpha \beta }\) is the electromagnetic field tensor. Its only non-trivial component \(F_{01}=-F_{10}=-\varPhi ^{\prime }\) is expressed through the four-potential, which has only a time component \(\varPhi \). The prime stands for a radial derivative. The Maxwell equations yield

$$\begin{aligned} \varPhi ^{\prime }=\frac{e^{\nu /2+\lambda /2}l}{r^2},\quad l\left( r\right) =4\pi \int _0^r\sigma e^{\lambda /2}r^2dr, \end{aligned}$$
(4)

where \(\sigma \) is the charge density and \(l\left( r\right) \) is the total charge up to radius r. We use relativistic units with \(G=1,c=1,k=8\pi \).

The Einstein equations read

$$\begin{aligned} 8\pi \mu +\frac{l^2}{r^4}=\frac{1}{r^2}-\left( \frac{1}{r^2}-\frac{\lambda ^{\prime }}{r}\right) e^{-\lambda }, \end{aligned}$$
(5)
$$\begin{aligned} 8\pi p_r-\frac{l^2}{r^4}= & {} -\frac{1}{r^2} ( 1-e^{-\lambda } ) +\frac{ \nu ^{\prime }}{r}e^{-\lambda }, \end{aligned}$$
(6)
$$\begin{aligned} 8\pi p_t+\frac{l^2}{r^4}= & {} \frac{e^{-\lambda }}{4}\left( 2\nu ^{\prime \prime }+\nu ^{\prime 2}+\frac{2\nu ^{\prime }}{r}-\nu ^{\prime }\lambda ^{\prime }- \frac{2\lambda ^{\prime }}{r}\right) , \end{aligned}$$
(7)

where \(\mu \) is the matter density, \(p_r\) is the radial pressure and \(p_t\) is the tangential one.

The gravitational mass in a sphere of radius r is given by

$$\begin{aligned} \frac{2m}{r}=1-e^{-\lambda }+\frac{l^2}{r^2}. \end{aligned}$$
(8)

which may be written also as

$$\begin{aligned} e^{-\lambda }=1-\frac{2m}{r}+\frac{l^2}{r^2}. \end{aligned}$$
(9)

The field equations do not contain \(\nu \), but its first and second derivative. It is related to the four-acceleration \(a_1\), namely \(2a_1=\nu ^{\prime }\).

As a whole, we have three field equations for six unknown functions: \( \lambda ,\nu ,\mu ,p_r,\) \(p_t\) and l. We can choose freely three of them, but the model will be physically realistic if a number of regularity, matching and stability conditions are satisfied too. Choosing \(\lambda ,\nu ,l\) means to charge a neutral solution with the same \(\lambda \) and \(\nu \). Then \(p_r\) and m increase, but \(\mu \) and \(p_t\) decrease.

Different constraints may be imposed on the system of Einstein–Maxwell equations. One of them is the existence of an equation of state (EOS) \( p_r=f\left( \mu \right) \).

Let us introduce the anisotropic factor \(\varDelta =p_t-p_r\). It measures the anisotropy of the fluid. Equations (6, 7) give

$$\begin{aligned} -8\pi \varDelta -\frac{2l^2}{r^4}= & {} e^{-\lambda }\left( -\frac{\nu ^{\prime \prime }}{2}-\frac{\nu ^{\prime 2}}{4}+\frac{\nu ^{\prime }}{2r}+\frac{1}{r^2}\right) \nonumber \\&+e^{-\lambda }\frac{\lambda ^{\prime }}{2}\left( \frac{\nu ^{\prime }}{2}+\frac{1}{r}\right) -\frac{1}{r^2}. \end{aligned}$$
(10)

When \(\varDelta =0\) the fluid becomes perfect and all pressures are equal. Charging a neutral solution decreases its \(\varDelta \).

The following two requirements may be imposed on the spacetime.

The first is conformally flat spacetime. It takes place when its Weyl tensor vanishes. This is a particular case of spacetimes with conformal motion when a Killing vector \({\mathbf {K}}\) exists. Then the following equation has to be satisfied

$$\begin{aligned} L_{{\mathbf {K}}}g_{ab}=2\psi g_{ab}, \end{aligned}$$
(11)

where \(L_{{\mathbf {K}}}\) is the Lie derivative operator and \(\psi \left( t,r\right) \) is the conformal factor. This implies the equation [14]

$$\begin{aligned} 2\nu ^{\prime \prime }+\nu ^{\prime 2}=\nu ^{\prime }\lambda ^{\prime }+ \frac{2\nu ^{\prime }}{r}-\frac{2\lambda ^{\prime }}{r}+\frac{4}{r^{2}} \left( 1+s\right) e^{\lambda }-\frac{4}{r^{2}}, \end{aligned}$$
(12)

where s is a constant of integration. The spacetime. is conformally flat when \(s=0\).

In recent years spacetimes, which are embeddings of class one, have been widely discussed. They can be embedded in a five-dimensional flat spacetime. This requires the Karmarkar relation between the components of the Riemann tensor [15]

$$\begin{aligned} R_{1010}R_{2323}-R_{1212}R_{3030}=R_{1220}R_{1330}. \end{aligned}$$
(13)

It transforms into a differential equation for \(\lambda \) and \(\nu \):

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

The charge does not enter Eqs. (12, 14), hence, the system (57) represents in these cases the charging of a neutral solution with conformal motion or an embedding of class one.

We have shown in the uncharged case [5] that Eqs. (5, 6, 7, 10, 12) are linear with respect to \(y=e^{-\lambda }\) while Eq. (14) is linear for \( y=e^{\lambda }\). Equation (5) does not contain \(a_{1}\), while Eq. (6) gives an expression for it. The others belong to two types of equations with respect to \(a_{1}\) – Bernoulli or Riccati. The last may be transformed into linear equation for \(u=e^{\nu /2}\). Now we shall show that charging of the fluid does not alter these properties.

The Riccati equation is given by

$$\begin{aligned} gy^{\prime }=f_2y^2+f_1y+f_0 \end{aligned}$$
(15)

and no general solution is known. In particular cases it reduces to integrable equations. Thus when \(f_2=0\) it turns into a linear equation, which has the general solution [16]

$$\begin{aligned} y=Ce^F+e^F\int e^{-F}\frac{f_0}{g}dr,\quad F=\int \frac{f_1}{g}dr. \end{aligned}$$
(16)

When \(f_0=0\) it becomes a Bernoulli equation with \(n=2\). Then 1/y satisfies a linear equation and is also integrable. Every Riccati equation may be transformed into a second-order homogenous linear equation for a function u [5, 16]. In the case \(f_2=-g\) we have

$$\begin{aligned} f_2u^{\prime \prime }+f_1u^{\prime }+f_0u=0,\quad u=\exp \int ydr. \end{aligned}$$
(17)

The substitution \(y=u^{\prime }/u\) leads back to Eq. (15).

3 The energy density and the radial pressure

In the following we consider l as known. Equation (5) for the energy density does not contain \(a_1\). It is linear with respect to \(y=e^{-\lambda }\) and can be written as

$$\begin{aligned} ry^{\prime }=-y+1-8\pi \mu r^2-\frac{l^2}{r^2}. \end{aligned}$$
(18)

Equation (9) may be written as

$$\begin{aligned} y=1-\frac{2m}{r}+\frac{l^2}{r^2}. \end{aligned}$$
(19)

Any equation, linear in y may be transformed into an equation, linear in m with the use of the above formula.

Equation (6) for the radial pressure may be written as

$$\begin{aligned} 8\pi p_rr^2=\left( 2a_1r+1\right) y-1+\frac{l^2}{r^2}. \end{aligned}$$
(20)

It may be regarded as an expression for \(p_r\) or y

$$\begin{aligned} y=\frac{8\pi p_rr^2+1-\frac{l^2}{r^2}}{2ra_1+1}, \end{aligned}$$
(21)

or \(a_1\)

$$\begin{aligned} 2a_1=\nu ^{\prime }=\frac{8\pi p_rr^2+1-y-\frac{l^2}{r^2}}{ry}. \end{aligned}$$
(22)

The potential \(\nu \) is found by a simple quadrature.

Thus, Eq. (20), which contains \(p_r\), y and \(a_1\), is the simplest generating function for any of them, when the other two are known. Solutions with given y (or m) and \(p_r\) may be found in [17,18,19,20,21].

An EOS can be incorporated in this scheme, \(p_r=f\left( \mu \right) \) or

$$\begin{aligned} 2rya_1=1-\frac{l^2}{r^2}-y+8\pi r^2f\left( -\frac{ry^{\prime }+y-1+\frac{l^2 }{r^2}}{8\pi r^2}\right) , \nonumber \\ \end{aligned}$$
(23)

which follows from Eqs. (18, 20). Obviously, the resulting equation is not linear in y in general, but still may be solvable by choosing an ansatz for y. Anyway, it’s an expression for \(a_1\) in terms of y and is a relation between the metric potentials. Mainly EOS with ansatz for y were used. Thus quadratic EOS is discussed in [22,23,24], polytropic EOS in [25,26,27], and other EOS in [28,29,30].

A special case is the linear EOS (LEOS) \(p_r=a\mu -b\) with constant \(0\le a\le 1\) and the bag constant \(b\ge 0\), which includes also the case \(p_r=0\). Equation (23) becomes

$$\begin{aligned} 2rya_1=\left( a+1\right) \left( 1-\frac{l^2}{r^2}-y\right) -ary^{\prime }-8\pi br^2. \end{aligned}$$
(24)

This is an expression for \(a_1\) when y and l are given and was used for concrete ansatze in [31,32,33,34,35,36,37,38,39].

Equation (24) is also a linear equation for y

$$\begin{aligned} ary^{\prime }=-\left( 2ra_1+a+1\right) y+\left( a+1\right) \left( 1-\frac{l^2 }{r^2}\right) -8\pi br^2. \nonumber \\ \end{aligned}$$
(25)

It can be solved by Eq. (16) when \(a,b,a_1\) are known. The factor \(F=\int \frac{f_1}{g}dr\) is the same as in the uncharged case [5]. We have a singular \(e^F\) for \(r=0\), hence \(C=0\). Then the solution is

$$\begin{aligned} y=\frac{\int \left[ \left( a+1\right) \left( 1-\frac{l^2}{r^2}\right) -8\pi br^2\right] \left( re^\nu \right) ^{1/a}dr}{a\left( r^{a+1}e^\nu \right) ^{1/a}}. \end{aligned}$$
(26)

The relation between the energy density and the mass is more complicated for a charged fluid. Integrating Eq. (5) and using formula (9) we get

$$\begin{aligned} m=\frac{1}{2}\int \left( 8\pi \mu r^2+\frac{l^2}{r^2}\right) dr +\frac{l^2}{2r}. \end{aligned}$$
(27)

This expression reduces to the one in the neutral case when \(l=0\). It may be written also as

$$\begin{aligned} m^{\prime }=4\pi \mu r^2+\frac{ll^{\prime }}{r}. \end{aligned}$$
(28)

This formula shows that when we pass from y to m Eq. (18) simplifies.

4 The tangential pressure and the anisotropic factor

Equation (7) is an expression for \(p_t\) and can be written as a linear equation for y

$$\begin{aligned} \frac{1}{2}\left( a_1+\frac{1}{r}\right) y^{\prime }=-\left( a_1^{\prime }+a_1^2+ \frac{a_1}{r}\right) y+8\pi p_t+\frac{l^2}{r^4}. \end{aligned}$$
(29)

Its solution from Eq. (16) reads

$$\begin{aligned} y=e^F\left( C+\int ze^\nu e^{2\int \frac{dr}{r^2z}}\left( 16\pi p_t+\frac{l^2 }{r^4}\right) dr\right) , \end{aligned}$$
(30)

where

$$\begin{aligned} a_1+\frac{1}{r}= & {} \frac{\nu ^{\prime }}{2}+\frac{1}{r}\equiv z, \end{aligned}$$
(31)
$$\begin{aligned} e^F= & {} z^{-2}e^{-\nu }e^{-2\int \frac{dr}{r^2z}}. \end{aligned}$$
(32)

The term \(e^F\) is the same as in the uncharged case. Due to Eq (9), Eq. (29) is also linear with respect to the mass.

Equation (7) is also a Riccati equation for \(a_1\)

$$\begin{aligned} ya_1^{\prime }=-ya_1^2-\left( \frac{y}{r}+\frac{y^{\prime }}{2}\right) a_1-\frac{ y^{\prime }}{2r}+8\pi p_t+\frac{l^2}{r^4} \end{aligned}$$
(33)

and may be solved for particular choices of y and \(p_t\). It can be transformed into a linear second order homogenous differential equation following Eqs. (16, 17)

$$\begin{aligned} yu^{\prime \prime }+\left( \frac{y}{r}+\frac{y^{\prime }}{2}\right) u^{\prime }+\left( \frac{y^{\prime }}{2r}-8\pi p_t-\frac{l^2}{r^4}\right) u=0, \end{aligned}$$
(34)

where

$$\begin{aligned} u=e^{\nu /2} \end{aligned}$$
(35)

Sometimes it may be solved easier than the original Riccati equation, since many special functions are defined by such equations. It remains in the same time linear (and integrable) first order equation for \(y=e^{-\lambda }\) or m. It can be called a double linear equation. Thus, like \(p_r\), the expression (7) for \(p_t\) is a generating function for charged stellar models, when two of the quantities \(p_t\), y (or m) and \(a_1\) are known.

The generating functions based on \(\varDelta \) are found in a similar way. Eq (10) is linear with respect to y (or m) and may be rewritten as

$$\begin{aligned} \left( a_1+\frac{1}{r}\right) y^{\prime }= & {} -2\left( a_1^{\prime }+a_1^2-\frac{a_1 }{r}-\frac{1}{r^2}\right) y \nonumber \\&-2\left( \frac{1}{r^2}-8\pi \varDelta -\frac{2l^2}{r^4} \right) . \nonumber \\ \end{aligned}$$
(36)

After some transformations it becomes

$$\begin{aligned} y^{\prime }= & {} -2\left( \frac{z^{\prime }}{z}+z-\frac{3}{r}+\frac{2}{r^2z}\right) y \nonumber \\&-\frac{2}{z}\left( \frac{1}{r^2}-8\pi \varDelta -\frac{2l^2}{r^4}\right) . \end{aligned}$$
(37)

This is the generalisation of Eq. (8) [6] to the charged case when the different definition of their \(\varDelta \) is taken into account and is still integrable. The result is

$$\begin{aligned} y= & {} r^6z^{-2}e^{-\int \left( \frac{4}{r^2z}+2z\right) dr} \nonumber \\&\left[ C\!-\!2\int r^{-8}z\left( 1-8\pi \varDelta r^2-\frac{2l^2}{r^2}\right) e^{\int \left( \frac{4}{r^2z}+2z\right) dr}dr\right] . \nonumber \\ \end{aligned}$$
(38)

The generating potentials are \(\varDelta \), z and l, the second, due to Eq (31), is equivalent to \(a_1\). This generating function encompasses the important cases of charged perfect fluid when \(\varDelta =0\) [40] and neutral perfect fluid when \(\varDelta =0\), \(l=0\). Solutions with given \(\varDelta ,a_1\) and l are discussed [41,42,43], where the mass is used instead of y, [44,45,46,47,48,49,50]. There are also solutions with \(\varDelta =0\) [51, 52].

Equation (36) is also a Riccati one for \(a_{1}\), the Riccati structure \( a_{1}^{\prime }+a_{1}^{2}\) being brought in \(\varDelta \) by \(p_{t}\). It can be written as

$$\begin{aligned} 2ya_{1}^{\prime }= & {} -2ya_{1}^{2}+\left( \frac{2y}{r}-y^{\prime }\right) a_{1}+ \frac{2y-2-ry^{\prime }}{r^{2}} \nonumber \\&+16\pi \varDelta +\frac{4l^{2}}{r^{4}} \end{aligned}$$
(39)

and solved for particular \(\varDelta \), y and l. Finally, it can be linearized following Eq. (17) into

$$\begin{aligned}&-2yu^{\prime \prime }+\left( \frac{2y}{r}-y^{\prime }\right) u^{\prime }+\left( \frac{2y-2-ry^{\prime }}{r^{2}} \right. \nonumber \\&\qquad \left. +16\pi \varDelta +\frac{4l^{2}}{r^{4}} \right) u=0, \end{aligned}$$
(40)

where u is given by Eq. (35). Thus, once again, Eq. (40) is doubly linear, like Eq. (34). Solutions of this equation were presented [53,54,55,56] and with \(\varDelta =0\) [57]. In total, Eq. (10) is a generating function for stellar models, when l and two of the quantities \(\varDelta \), y (or m) and \(a_{1}\) are known. The differential equations for y and u are linear.

5 The metric potentials as generating functions

The simplest way to generate solutions in the charged case is to choose independently the two generating potentials \(\lambda \) and \(\nu \) and add to them a third potential l. Thus any neutral solution may be charged [58, 59].

Some important stellar models require a relation between \(\lambda \) and \(\nu \), reducing the generating functions to two. For example this is the case of charged perfect fluid, when in Eq. (10) \(\varDelta =0\). Similar example are spacetimes admitting conformal motion. The metric potentials of such spacetimes satisfy Eq. (12). This equation is solved by a series of transformations [14]. Surprisingly, it is also a linear equation in y (or m) and a Riccati equation for \(a_1\). It can be written as [5]

$$\begin{aligned} \left( \frac{1}{r}-a_1\right) y^{\prime }=2\left( a_1^{\prime }+a_1^2-\frac{a_1}{r}+\frac{1}{r^2}\right) y-\frac{2\left( 1+s\right) }{r^2} \nonumber \\ \end{aligned}$$
(41)

or

$$\begin{aligned} 2ya_1^{\prime }=-2ya_1^2+\left( \frac{2y}{r}-y^{\prime }\right) a_1+\frac{ y^{\prime }}{r}+\frac{2\left( 1+s\right) -2y}{r^2}. \nonumber \\ \end{aligned}$$
(42)

Once again \(g=-f_2\) in Eq. (15), so it may be transformed into a linear equation, analogous to Eq. (17)

$$\begin{aligned} -2yu^{\prime \prime }\!+\!\left( \frac{2y}{r}-y^{\prime }\right) u^{\prime }\!+\!\left( \frac{y^{\prime }}{r}+\frac{2\left( 1+k\right) -2y}{r^2}\right) u\!=\!0,\nonumber \\ \end{aligned}$$
(43)

where u is given by Eq. (16). Its solution was found [14], possesses three branches

$$\begin{aligned} e^\nu= & {} Ar\exp \left( \sqrt{1+s}\int \frac{e^\lambda }{r}dr\right) \nonumber \\&+Br\exp \left( -\sqrt{1+s}\int \frac{e^\lambda }{r}dr\right) ,\quad 1+s>0, \end{aligned}$$
(44)
$$\begin{aligned} e^\nu= & {} Ar\int \frac{e^\lambda }{r}+Br,\quad 1+s=0, \end{aligned}$$
(45)
$$\begin{aligned} e^\nu= & {} Ar\exp \left( \sqrt{-\left( 1+s\right) }\int \frac{e^\lambda }{r}dr\right) \nonumber \\&+Br\exp \left( -\sqrt{-\left( 1+s\right) }\int \frac{e^\lambda }{r}dr\right) ,\quad 1+s<0. \nonumber \\ \end{aligned}$$
(46)

and do not depend on the charge. Solutions with conformal motion were discussed recently [60,61,62]. These expressions were put into Eq. (36) and another equation for y arises, which is simpler [63]. Solutions based on \(\psi \) in Eq. (12) were studied [64].

Another example is the Karmarkar condition for embedding of class one, Eq (14) [5]. It may be written as

$$\begin{aligned} a_1^{\prime }=-a_1^2+\left[ \ln \left( \frac{1-y}{y}\right) \right] ^{\prime } \frac{a_1}{2}. \end{aligned}$$
(47)

The would be Riccati equation becomes a Bernoulli one. It is also a Bernoulli equation for y

$$\begin{aligned} -\frac{a_1}{2}y^{\prime }=\left( a_1^{\prime }+a_1^2\right) y-\left( a_1^{\prime }+a_1^2\right) y^2. \end{aligned}$$
(48)

All these equations are solvable. Their integration may be done directly, without using the general formulas and we obtain the well-known results

$$\begin{aligned} e^\lambda= & {} C\nu ^{\prime 2}e^\nu +1, \end{aligned}$$
(49)
$$\begin{aligned} e^\nu= & {} \left( A+B\int \sqrt{e^\lambda -1}dr\right) ^2. \end{aligned}$$
(50)

where ABC are integration constants. Thus when one of the metric coefficients is given, we can find the other. The solution may be charged by introducing a known l. It only changes the system of Einstein–Maxwell equations (57). Solutions with given \(\lambda \) and l were found [65,66,67]. Solutions with known \(\nu \) and l were also studied [68, 69].

6 Solutions when the charge is not given beforehand

Up to now we have discussed cases with given \(l^2\). However, solutions may be found when this is not so. It is clear that the LEOS Eq. (35) is also an expression for \(l^2\)

$$\begin{aligned} \left( a+1\right) \frac{l^2}{r^2}=-ary^{\prime }-\left( 2ra_1+a+1\right) y+a+1-8\pi br^2. \nonumber \\ \end{aligned}$$
(51)

We can find \(l^2\) when y and \(a_1\) are known, i.e. when \(\lambda \) and \( \nu \) are known and a LEOS is given [70].

Equation (36) can also serve as an expression for \(l^2\)

$$\begin{aligned} \frac{4l^2}{r^4}= & {} \left( a_1+\frac{1}{r}\right) y^{\prime }+2\left( a_1^{\prime }+a_1^2-\frac{a_1}{r}-\frac{1}{r^2}\right) y \nonumber \\&+2\left( \frac{1}{r^2}-8\pi \varDelta \right) \end{aligned}$$
(52)

when y, \(a_1\) and \(\varDelta \) are known. Thus, we can give an ansatz for \( \lambda \), add the Karmarkar condition to find \(\nu \) and set \(\varDelta =0\) [71,72,73,74,75]. The isotropic condition may be written also as Eq. (40), another expression for \( l^2\)

$$\begin{aligned} -\frac{4l^2}{r^4}= & {} -2y\frac{u^{\prime \prime }}{u}+\left( \frac{2y}{r}-y^{\prime }\right) \frac{u^{\prime }}{u}+\frac{2y-2-ry^{\prime }}{r^2} \nonumber \\&+16\pi \varDelta , \end{aligned}$$
(53)

where \(u=e^{\nu /2}\). Fixing y, setting \(\varDelta =0\) (perfect fluid) and with some simplifying assumption one can solve this equation [76].

Together, Eqs. (51, 52) give another linear equation for y which depends only on \(a_1\) and \(\varDelta \). Solving it, we find y and then \(l^2\) from any of Eqs. (51, 52). There are particular examples of this approach [77,78,79].

One can use another EOS, e.g. the Chaplygin EOS

$$\begin{aligned} p_r=\alpha _1\mu -\frac{\alpha _2}{\mu }, \end{aligned}$$
(54)

where \(\alpha _1,\alpha _2\) are positive constants. Summing Eqs. (5, 6) we obtain

$$\begin{aligned} p_r=G\left( \lambda ,\nu \right) -\mu , \end{aligned}$$
(55)

where G is some function. Replacing (55) into (54) yields a quadratic equation for \(\mu \), which is solvable

$$\begin{aligned} \left( \alpha _1+1\right) \mu ^2-G\mu -\alpha _2=0. \end{aligned}$$
(56)

The metric components \(\lambda \) and \(\nu \) may be supplied directly [80]. Another way is to fix one of them, e.g. \(\nu \) and impose the Karmarkar condition to find \(\lambda \) [81].

Similar is the situation with the quadratic EOS

$$\begin{aligned} p_r=\alpha _1\mu ^2+\alpha _2\mu +\alpha _3. \end{aligned}$$
(57)

Equation (55) shows that this is a quadratic equation for \(\mu \)

$$\begin{aligned} \alpha _1\mu ^2+\left( \alpha _2+1\right) \mu +\alpha _3-G=0 \end{aligned}$$
(58)

and may be solved too.

Another popular EOS is the modified Van der Vaals one

$$\begin{aligned} p_r=\alpha _1\mu ^2+\frac{\alpha _2\mu }{1+\alpha _3\mu }. \end{aligned}$$
(59)

It becomes

$$\begin{aligned} \alpha _1\alpha _3\mu ^3+\left( \alpha _1+\alpha _3\right) \mu ^2+\left( \alpha _2+1-\alpha _3G\right) \mu -G=0. \nonumber \\ \end{aligned}$$
(60)

This is a cubic equation for \(\mu \) and is still solvable.

Finally, let us discuss the polytropic EOS

$$\begin{aligned} p_r=\alpha \mu ^{1+\frac{1}{N}}, \end{aligned}$$
(61)

where \(\alpha \) is a constant and N is the polytropic index. It can be written with the help of Eq. (55) as

$$\begin{aligned} \alpha ^N\mu ^{N+1}-\left( G-\mu \right) ^N=0. \end{aligned}$$
(62)

This equation is quadratic for \(N=1\), cubic for \(N=2\) and quartic for \(N=3\) and therefore solvable for \(\mu \) for these values of N.

7 Discussion

In a previous paper [5] we have studied the existence of generating functions, giving solutions for uncharged stellar models. In the present one we do the same for charged models. The addition of charge does not alter the general scheme of using the Einstein equations as generating functions. Now three of the four characteristics of the model should be given – \( y=e^{-\lambda },a_1=\nu ^{\prime }/2,\) l and either \(p_r\), \(p_t\) or \( \varDelta \). This approach is greatly simplified, because the Einstein equations with charge are still linear first order differential equations for y and linear or Riccati equations for the four-acceleration \(a_1\). The linear equations are always integrable in quadratures, while the Riccati equations are integrable in many particular cases. There is a standard mathematical procedure to transform them into linear homogenous differential equations of second order for \(u=e^{\nu /2}\) [16]. They are the ”missing link” between the original form of the Einstein equations and their linear version, which appears out of nowhere in [4] for neutral perfect fluids. It holds also for anisotropic and charged fluids. The source of the Riccati structure \(a_1^{\prime }+a_1^2\) still comes from the component \(R_{0101}\) of the Riemann tensor, whose expression is the same in the charged case. Equation (8) shows that the mass m still satisfies a linear equation and may replace y.

There are two main ways of generating solutions. The first one accepts that l is a given function. Then the stellar models for neutral fluids are just charged. If the initial model is physically realistic this is rather probable for its charged generalization. The simplest generating function is Eq. (6) for \(p_{r}\), which is an expression for \(p_{r}\), \(a_{1}\), y or \( l^{2}\) without solving any equations. Equation (5) for the energy density cannot be used as a generating function, because it does not contain \(\nu \). However, when the model has an EOS, the combination of Eqs. (5) and (6) works as a generating function, producing a relation between the two metric potentials and \(l^{2}\). The equation for \(\varDelta \) was used [6] to obtain \(\lambda \) when \(\nu \) and \(\varDelta \) are given. It becomes a generating function for perfect fluid models when \(\varDelta =0\). We have generalized it to the charged case. Equation (7) for \(p_{t}\) can play a similar role but is rarely used.

Of course, the simplest generating potentials are \(\lambda \) and \(\nu \) and l. There are physical reasons that sometimes impose a relation between the metric components. This happens when an EOS exists.

A second important case is that of spacetimes admitting conformal motion (conformal flatness in particular). The surprising fact is that this relation is also a linear differential equation for y or u and a Riccati one for \(a_1\). It does not depend on the charge.

A third well-known example are spacetimes of embedding class one, obeying the Karmarkar condition. Here there is a minor difference – the relation is a linear equation for 1/y and a Bernoulli equation for y, which is also integrable. Furthermore, it is a Bernoulli equation with quadratic term for \( a_1\). The Riccati structure, discussed above, is still present but there is no free term. It is charge independent too.

The second way of generating solutions is when l is not given beforehand. In the previous section we have outlined the different ways to solve the Einstein equations in this case. One of them relies on the existence of an EOS. It leads to algebraic equations for most of the popular EOS, which are soluble up to fourth order included. This second way more often produces models with unphysical features. However, the numerous examples of physically realistic stellar models given in Sect. 6 show that this problem may be solved successfully.

It is interesting whether in some of the alternative theories of gravitation similar simplifications occur.