1 Introduction

Gravity exploration methods try to identify the anomalous mass bodies in the Earth (Blakely 1996). Gravity signals such as gravity fields and gravity gradient tensors are measured using gravimeters and gravity gradiometers, which can be located on the air–Earth interface, in boreholes, or be carried by marine ships and aircraft, and even by satellites (Nabighian et al. 2005). The amplitudes of the gravity field are inversely proportional to the square of the distance (R) between the observation site and the causative body, that is  \(O(R^{-2})\). As for the gravity gradient tensor, its amplitude is inversely proportional to the third power of distance, that is  \(O(R^{-3})\). Therefore, compared to the gravity field, gravity gradient tensor signals are more sensitive to the shallow anomalous structures in the Earth (Droujinine et al. 2007; Beiki and Pedersen 2010; Martinez et al. 2013; Beiki et al. 2014; Gutknecht et al. 2014; Li 2015; Ramillien 2017). Mathematically, both gravity field and gravity gradient tensor signals can be formulated as volume integrals over the causative body. When the observation site is located inside the mass body, a local spherical coordinate system can be introduced at the observation site, so that a factor of distance squared (\(R^{2}\)) would be introduced (such as \(\mathrm{d}v=R^2 \sin \theta \mathrm{d}r \mathrm{d}\theta \mathrm{d}\phi\), Blakely 1996), which can further weaken the singularity appearing in the integrands of the gravity signals (Jin 2002). Therefore, from the mathematical point of view, the gravity field can be evaluated without mathematical singularities, as \(O(R^{-2}\times R^{2})=O(1)\), but the mathematical singularities always remain in the gravity gradient tensor formulation, when observation sites approach the causative body, that is \(O(R^{-3}\times R^{2})=O(R^{-1})\).

Designing gravity gradiometers for measuring gravity gradient tensor signals is a difficult task. The gravity gradient tensor is a \(3\times 3\) symmetrical tensor with each entry being the second derivatives of the gravitational potential (or the first derivatives of the gravity field or the gravity acceleration). In terms of differential measurements, accelerations of at least two spatially separated masses were generally used to estimate the components of the gravity gradient tensor. Depending on the accuracies of the available gradiometers, gravity gradient tensor signals can be applied in geodesy (0.01 Eötvös to 0.1 Eötvös), autonomous navigation (0.1 Eötvös to 1 Eötvös) and oilfield and mineral exploration geophysics (1 Eötvös to 10 Eötvös) (Evstifeev 2017). In exploration geophysics, the cause of the increased interest in gravity gradiometers is that, compared to gravity anomalies measured by gravimeters, gravity gradient tensor signals contain more detailed information about the subsurface structures (Chapin 1998; Nabighian et al. 2005). Furthermore, compared to gravity field data, gravity gradient tensor anomaly maps generally provide more contrasting and clearer edge delineations, such as those arising from salt domes in oil and gas prospecting (Pedersen and Rasmussen 1990). Up to now, several gravity gradiometers have been adopted in realistic exploration geophysical problems, such as the 3D FTG (full tensor gradiometer) system by Bell Geospace (Bell and Hansen 1998; Bell et al. 1997; Brewster 2016; Abtahi et al. 2016) and the Falcon AGG airborne gravity gradiometer by BHP Billiton (Australia) (Lee 2001).

To invert measured gravity gradient tensor (GGT) signals, we need an accurate forward solver. In general, GGT forward modelling can be performed either numerically or analytically. Using numerical methods such as Gaussian quadrature approaches (Talwani and Ewing 1960), Fourier domain methods (Parker 1973; Wu and Chen 2016), finite-element methods and finite-difference methods (Cai and Wang 2005; Farquharson and Mosher 2009; Jahandari and Farquharson 2013), the GGT signals caused by a mass body can be straightforwardly evaluated. However, the accuracies of numerical GGT signals can be seriously reduced by these numerical methods. For instance, using finite-element and finite-difference methods, improper translation of the computed gravitational potential to its second-order derivatives can lead to serious numerical errors. These undesired precision loss issues can be completely avoided by analytic approaches, which offer highly accurate GGT signals in terms of exact solutions.

Due to early limitations in the considered model geometries, the simple rectangular prismatic element has been widely accepted as a basic element in gravity forward modelling. Using these prismatic elements, the mass distributions in the Earth were simply approximated conceding a certain loss of geometrical accuracy. As for this basic element, several exact solutions of the gravity gradient tensor signals were developed (Forsberg 1984; Li and Chouteau 1998; Montana et al. 1992; Nagy and Papp 2000; Holstein et al. 2013; De Stefano and Panepinto 2016). However, it is difficult to accurately approximate a complex body using prisms. Polyhedral elements are endowed with great flexibility in presentation of 3D mass sources with complex geometries. Compared to prismatic elements, discretisations in terms of polyhedrons need lower numbers of elements to represent complicated mass bodies (Petrović 1996). Several analytical solutions have been successfully derived for the gravity gradient tensor signals of a homogeneous polyhedral body (Okabe 1979; Götze and Lahmeyer 1988; Kwok 1991; Petrović 1996; Werner and Scheeres 1996; Tsoulis and Petrović 2001; Holstein 2002; Tsoulis 2012; Holstein et al. 2013; D’Urso 2014a). Closed-form solutions of the gravity gradient tensor were also derived for other homogeneous simple geometries, such as pyramids (Sastry and Gokula 2016) and cylinders (Rim and Li 2016).

Seeking simplicity, geophysicists often assume that the Earth is composed of 3D anomalies in a layered medium or a succession of strata with horizontally undulating interfaces (e.g., sedimentary basins and underlying bedrock). In each layer, the rock mass density predominantly exhibits depth-dependent variations. To approximate the density variations in sedimentary basins, several closed-form solutions of gravity signals were derived for depth-dependent mass contrast functions, such as exponential functions (Cordell 1973; Chai and Hinze 1988; Chappell and Kusznir 2008), hyperbolic functions (Litinsky 1989; Rao et al. 1995), parabolic functions (Chakravarthi et al. 2002), quadratic polynomials (Rao 1985, 1990; Gallardo-Delgado et al. 2003) and cubic polynomials (García-Abdeslem 2005). Compared to these depth-dependent functions, polynomials offer a more flexible way to approximate arbitrarily variable density distributions. Very recently, Jiang et al. (2017) have given a detailed performance comparison between polynomial mass contrast functions and depth-dependent mass contrast functions for the capability of approximating complicated density distributions in the Earth. The result clearly demonstrates the superiority of polynomial mass contrast functions over the depth-dependent mass contrast functions. As the real Earth has complicated mass density distributions, it is important to deal with a general polynomial mass contrast function, which not only varies in depth (vertical direction), but also varies in the horizontal direction.

For general polynomial functions, Pohánka (1998), Holstein (2003), Hansen (1999), D’Urso (2014b) and Ren et al. (2017a) have successfully derived closed-form solutions for the gravity field of a polyhedral body, in which the mass contrast linearly varies in both horizontal and vertical directions. Quite recently, analytical expressions for the gravity field of a polyhedral body with cubic polynomial density contrast in both horizontal and vertical directions were derived by D’Urso and Trotta (2017) and Ren et al. (2018). Nevertheless, only Holstein (2003) and D’Urso (2014b) have successfully derived closed-form solutions for gravity gradient tensor of a polyhedral body, in which the mass contrast varies linearly in both horizontal and vertical directions. To the best of our knowledge, closed-form solutions for gravity gradient tensor signals of a polygonal body with high-order polynomial mass contrasts (such as quadratic and cubic orders) varying in both horizontal and vertical directions have not been previously reported.

To overcome this both theoretically and practically important issue, we have successfully derived closed-form solutions for modelling the gravity gradient tensor of the above cases in this study. Inside the polyhedral body, its density contrast is approximated by a general polynomial function (currently, a maximum order up to and including three is considered). The polynomial mass contrast function can vary in both horizontal and vertical directions. Therefore, it has the capability to approximate complicated mass contrasts in realistic Earth models. To begin with, we apply the Gaussian gradient theorem to transform the volume integrals of GGT signals into surface integrals over the faces of polyhedra. Then, we apply the surface divergence theorem to further transform these surface integrals into a sequence of line integrals along the edges of the polyhedra. In the process of reducing the integral dimension, several vector or dyadic identities are employed to reduce the orders of the density polynomials and of the singularities in R in the integrands. The line integrals along the edges of the polyhedra are evaluated in terms of known analytical expressions (e.g., Gradshteyn and Ryzhik 2007).

To verify the accuracies of our new analytical solutions, a right rectangular prism with depth-dependent density contrasts, an irregular polyhedron with linear density contrast and a tetrahedral element with horizontally and vertically varying density contrast are tested. For the prism model, its reference solution for the gravity gradient tensor is computed from the derivatives of García-Abdeslem’s (2005) analytical solution for the gravity field. The analytical solution derived by Holstein (2003) is used as reference for the irregular polyhedral model. Results from high-order Gaussian quadrature are used as reference solutions for the tetrahedron model.

2 Theory

Fig. 1
figure 1

Illustration of the geometry of a polyhedral body H and the associated geometric quantities on face \(\partial H_i\) with their definitions given in Table 5

For an arbitrary interior point \({\mathbf {r}}\) of the polyhedral body (see Fig. 1, Appendix A and Table 5), let \(\lambda ({\mathbf {r}})\) denote the density contrast in the polyhedral mass target at that point. The difference between two points denotes a vector, for example, the vector from a source point \({\mathbf {r}}\) to the observation point \({\mathbf {r}}'\) is denoted by \({\mathbf {r}}-{\mathbf {r}}'\). The gravitational acceleration field at the observation point \({\mathbf {r}}^\prime\) is (Ren et al. 2018)

$$\begin{aligned} \begin{aligned} {\mathbf {g}}\left( \mathbf {r'} \right) = G\left[ -{\sum \limits _{i = 1}^N {{{\hat{\mathbf {n}}}_i}\iint \limits _{\partial {H_i}} {\frac{\lambda ({\mathbf {r}}) }{R}{\mathrm{d}}s}} + \iiint \limits _H {\frac{{{\nabla _{{\mathbf {r}}}}\lambda ({\mathbf {r}}) }}{R}\mathrm{d}v}} \right] , \end{aligned} \end{aligned}$$
(1)

where \(G=6.673\times 10^{-11}\, {\text {m}}^3\,{\text {kg}}^{-1}\,{\text {s}}^{-2}\) is Newton’s gravitational constant, \(\nabla _{\mathbf {r}}\) is the gradient operator on point \({\mathbf {r}}\), \(R=|{\mathbf {r}}-{\mathbf {r}}'|\) is the distance from the observation site to the running integral point in the source polyhedral body H, and the gradient theorem (Tai 1997) is applied.

Using Eq. (1) for the gravity field, the gravity gradient tensor \({\mathbf {T}}\) can be derived as follows:

$$\begin{aligned} \begin{aligned} {{\mathbf {T}}} = {\nabla _{\mathbf {r'}}}{\mathbf {g}}\left( \mathbf {r'} \right)&= G{\nabla _{\mathbf {r'}}}\left[ -{\sum \limits _{i = 1}^N {{{\hat{\mathbf {n}}}_i}\iint \limits _{\partial {H_i}} \frac{\lambda }{R}{\mathrm{d}}s} + \iiint \limits _H \frac{{\nabla _{{\mathbf {r}}}}\lambda }{R}\mathrm{d}v} \right] \\&= G\left[ - {\sum \limits _{i = 1}^N {\left( {\iint \limits _{\partial {H_i}} {\lambda {\nabla _{\mathbf {r'}}}\frac{1}{R}{\mathrm{d}}s}} \right) \,{\hat{\mathbf {n}}}_i + \iiint \limits _H {\left( {\nabla _{\mathbf {r'}}}\frac{1}{R}\right) ({\nabla _{{\mathbf {r}}}}\lambda ) \mathrm{d}v}} } \right] \\&= G\left[ { \sum \limits _{i = 1}^N {\left( {\iint \limits _{\partial {H_i}} {\lambda {\nabla _{{\mathbf {r}}}}\frac{1}{R}{\mathrm{d}}s}} \right)\, {\hat{\mathbf {n}}}_i - \iiint \limits _H {\left( {\nabla _{{\mathbf {r}}}}\frac{1}{R}\right) ({\nabla _{{\mathbf {r}}}}\lambda ) \mathrm{d}v}} } \right] , \\ \end{aligned} \end{aligned}$$
(2)

where \(\nabla _{{\mathbf {r}}^\prime }\) denotes the gradient operator on point \({\mathbf {r}}^\prime\) and the relation \({\nabla _{{\mathbf {r}}}}\frac{1}{R} = -{\nabla _{\mathbf {r'}}}\frac{1}{R}\) is used.

Using the following vector identity (Tai 1997):

$$\begin{aligned} \nabla \left( \varphi \mathbf {A}\right) =\varphi \nabla \mathbf {A}+(\nabla \varphi )\mathbf {A}, \end{aligned}$$
(3)

where \(\mathbf {A}\) can be a scalar or a vector, setting \(\varphi = \frac{1}{R}\) and \(\mathbf {A}= \nabla \lambda\) and using the gradient theorem (Tai 1997), the volume integral term \(\iiint _H {({\nabla _{{\mathbf {r}}}}\frac{1}{R})({\nabla _{{\mathbf {r}}}}\lambda ) \mathrm{d}v}\) in Eq. (2) can be further transformed as

$$\begin{aligned} \begin{aligned} \iiint \limits _H { \left( \nabla _{{\mathbf {r}}}\frac{1}{R}\right) \left( {{\nabla _{{\mathbf {r}}}}\lambda } \right) \mathrm{d}v}&= \iiint \limits _H {\left( {{\nabla _{{\mathbf {r}}}}\frac{{{\nabla _{{\mathbf {r}}}}\lambda }}{R} - \frac{{{\nabla _{{\mathbf {r}}}}{\nabla _{{\mathbf {r}}}}\lambda }}{R}} \right) \mathrm{d}v} \\&= \sum \limits _{i = 1}^N {{{\hat{\mathbf {n}}}_i}\iint \limits _{\partial {H_i}} {\frac{{\nabla _{{\mathbf {r}}}}\lambda }{R}{\mathrm{d}}s}} - \iiint \limits _H {\frac{{{\nabla _{{\mathbf {r}}}}{\nabla _{{\mathbf {r}}}}\lambda }}{R}\mathrm{d}v} . \end{aligned} \end{aligned}$$
(4)

Setting \(\varphi = \frac{1}{R}\) and \(\mathbf {A} = \lambda\) in Eq. (3), the surface integral \(\iint _{\partial {H_i}} {\lambda {\nabla _{{\mathbf {r}}}}\frac{1}{R}{\mathrm{d}}s}\) in Eq. (2) can be transformed as

$$\begin{aligned} \begin{aligned} \iint \limits _{\partial {H_i}} {\lambda {\nabla _{{\mathbf {r}}}}\frac{1}{R}{\mathrm{d}}s}&= \iint \limits _{\partial {H_i}} {{\nabla _{{\mathbf {r}}}}\frac{\lambda }{R}{\mathrm{d}}s} - \iint \limits _{\partial {H_i}} {\frac{{{\nabla _{{\mathbf {r}}}}\lambda }}{R}{\mathrm{d}}s} \\&= \iint \limits _{\partial {H_i}} {{\nabla _s}\frac{\lambda }{R}{\mathrm{d}}s} + \iint \limits _{\partial {H_i}} {{{{{\hat{\mathbf {n}}}}}_i}{{{{\hat{\mathbf {n}}}}}_i} \cdot {\nabla _{{\mathbf {r}}}}\frac{\lambda }{R}{\mathrm{d}}s} - \iint \limits _{\partial {H_i}} {\frac{{{\nabla _{{\mathbf {r}}}}\lambda }}{R}{\mathrm{d}}s} \\&= \sum \limits _{j = 1}^{M_i} {{{{{\hat{\mathbf {m}}}}}_{ij}}\int \limits _{{C_{ij}}} {\frac{\lambda }{R}{\mathrm{d}}l} } + {{{{\hat{\mathbf {n}}}}}_i}\iint \limits _{\partial {H_i}} {{{{{\hat{\mathbf {n}}}}}_i} \cdot \left[ {\frac{{\left( {{\mathbf {r'}} - {{\mathbf {r}}}} \right) \lambda }}{{{R^3}}} + \frac{{{\nabla _{{\mathbf {r}}}}\lambda }}{R}} \right] {\mathrm{d}}s} - \iint \limits _{\partial {H_i}} {\frac{{{\nabla _{{\mathbf {r}}}}\lambda }}{R}{\mathrm{d}}s} \\&= \sum \limits _{j = 1}^{M_i} {{{{{\hat{\mathbf {m}}}}}_{ij}}\int \limits _{{C_{ij}}} {\frac{\lambda }{R}{\mathrm{d}}l} } {-} {{{{\hat{\mathbf {n}}}}}_i}{h_i}\iint \limits _{\partial {H_i}} {\frac{\lambda }{{{R^3}}}{\mathrm{d}}s} + \iint \limits _{\partial {H_i}} {\frac{{\left( {{{{{\hat{\mathbf {n}}}}}_i} \cdot {\nabla _{{\mathbf {r}}}}\lambda } \right) {{{{\hat{\mathbf {n}}}}}_i} - {\nabla _{{\mathbf {r}}}}\lambda }}{R}{\mathrm{d}}s}, \end{aligned} \end{aligned}$$
(5)

where the surface gradient theorem (Tai 1997) is used. The symbol \(\nabla _{s}\) denotes the surface gradient operator, where the subscript s means it is an operator on a 2D surface. In the above, the definition (A.3) of the number \(h_i\), constant over facet plane i, as the projection onto the facet normal \(\mathbf {n}_i\) of the position vector of a planar point \({\mathbf {r}}\) relative to the observation point \({\mathbf {r}}'\) and the following vector identity were used:

$$\begin{aligned} \nabla _{{\mathbf {r}}} f = {(}\nabla _{s} + {\hat{\mathbf {n}}} {\hat{\mathbf {n}}}\cdot \nabla _{{\mathbf {r}}}{)} f, \end{aligned}$$
(6)

where f is an arbitrary scalar function and \({\hat{\mathbf {n}}}\) is the outward pointing normal unit vector of the considered surface. In Eq. (5), we set \(f=\frac{\lambda }{R}\).

Substituting Eqs. (4) and (5) into Eq. (2), we obtain the following expression for the gravity gradient tensor of a polyhedral body H with arbitrary mass contrast function \(\lambda ({\mathbf {r}})\):

$$\begin{aligned} \begin{aligned} {{\mathbf {T}}} = G&\left\{ {\sum \limits _{i = 1}^N {\left[ {\sum \limits _{j = 1}^{M_i} {{{{{\hat{\mathbf {m}}}}}_{ij}}\int \limits _{{C_{ij}}} {\frac{\lambda }{R}{\mathrm{d}}l} } {-} {{{{\hat{\mathbf {n}}}}}_i}{h_i}\iint \limits _{\partial {H_i}} {\frac{\lambda }{{{R^3}}}{\mathrm{d}}s} + \iint \limits _{\partial {H_i}} {\frac{{\left( {{{{{\hat{\mathbf {n}}}}}_i} \cdot {\nabla _{{\mathbf {r}}}}\lambda } \right) {{{{\hat{\mathbf {n}}}}}_i} - {\nabla _{{\mathbf {r}}}}\lambda }}{R}{\mathrm{d}}s}} \right] } } \right. {{{{\hat{\mathbf {n}}}}}_i} \\&\;\;\;\left. { - \sum \limits _{i = 1}^N {{{{{\hat{\mathbf {n}}}}}_i}\iint \limits _{\partial {H_i}} {\frac{{{\nabla _{{\mathbf {r}}}}\lambda }}{R}{\mathrm{d}}s}} + \iiint \limits _H {\frac{{{\nabla _{{\mathbf {r}}}}{\nabla _{{\mathbf {r}}}}\lambda }}{R}\mathrm{d}v}} \right\} \\ \end{aligned} \end{aligned}$$
(7)

The density function \(\lambda\) is defined as a general polynomial function. It allows for the density variations in both horizontal and vertical directions, which is defined as:

$$\begin{aligned} \begin{aligned} \lambda \left( {{\mathbf {r}}} \right) = \sum \limits _{k\,=\,0}^P {\sum \limits _{l\,=\,0}^{P - k} \sum \limits _{m\,=\,0}^{P - k - l} {a_{klm}{x^k}{y^l}{z^m}} } = \sum _{d\,=\,0}^{P} {\lambda _{d}}\left( {{\mathbf {r}}} \right) \end{aligned} \end{aligned}$$
(8)

where P is the maximum polynomial order, and \(\lambda _{d}\) are the d-th order density terms. For instance, the zero (constant), first (linear), quadratic and cubic order density terms are given as:

$$\begin{aligned} \lambda _0= {a_{000}} \end{aligned}$$
(9)
$$\begin{aligned} \lambda _1= {{a_{100}}x + {a_{010}}y + {a_{001}}z} \end{aligned}$$
(10)
$$\begin{aligned} \lambda _2= {{a_{002}}{z^2} + {a_{011}}yz + {a_{020}}{y^2} + {a_{101}}xz + {a_{110}}xy + {a_{200}}{x^2}} \end{aligned}$$
(11)
$$\begin{aligned} \lambda _3 & = {{a_{003}}{z^3} + {a_{012}}y{z^2} + {a_{021}}{y^2}z + {a_{030}}{y^3} + {a_{102}}x{z^2} + {a_{111}}xyz} \nonumber \\&\quad { +\, {a_{120}}x{y^2} + {a_{201}}{x^2}z + {a_{210}}{x^2}y + {a_{300}}{x^3}} \end{aligned}$$
(12)

where \(a_{klm}\) are known coefficients which can be estimated by fitting measured gravity field data (Blakely 1996). The total gravity signal is the sum of the individual contributions from different mass densities, such as \(\lambda _0\), \(\lambda _1\), \(\lambda _2\) and \(\lambda _3\).

Substituting the density contrast in Eqs. (8) into (7), we get the final gravity gradient tensor:

$$\begin{aligned} {\mathbf {T}} = \sum _{d=0}^{P} {\mathbf {T}}_{d}, \end{aligned}$$
(13)

where \({\mathbf {T}}_{d}\) denotes the individual contribution from the d-th order density contrast. In this study, we only consider the cases \(0 \le P \le 3\). For simplicity, we denote x, y and z by \(x_p (p=1, 2, 3)\) in the following sections, that is

$$\begin{aligned} \left\{ {\begin{array}{*{20}{l}} {{x_1} = x},\;\;{{{{{\hat{\mathbf {x}}}}}_1} = {{\hat{\mathbf {x}}}}} \\ {{x_2} = y},\;\;{{{{{\hat{\mathbf {x}}}}}_2} = {{\hat{\mathbf {y}}}}} \\ {{x_3} = z},\;\;{{{{{\hat{\mathbf {x}}}}}_3} = {{\hat{\mathbf {z}}}}} \end{array} } \right. \end{aligned}$$
(14)

2.1 Constant Density Contrast

For the constant term, substituting \(\lambda _0=a_{000}\) and \(\nabla _{{\mathbf {r}}}\lambda _0=0\) into Eq. (7), we get \({\mathbf {T}}_0\) as follows:

$$\begin{aligned} {{\mathbf {T}}_0} = Ga_{000}{ \sum \limits _{i = 1}^N {\left( \sum \limits _{j = 1}^{M_i} {{{\hat{\mathbf {m}}}_{ij}}\int \limits _{{C_{ij}}} {\frac{1 }{R}{\mathrm{d}}l} } {-} {{{{\hat{\mathbf {n}}}}}_i}{h_i}\iint \limits _{\partial {H_i}} {\frac{1}{{{R^3}}}{\mathrm{d}}s} \right)\, {{{{\hat{\mathbf {n}}}}}_i}} }. \end{aligned}$$
(15)

Detailed derivations of expressions for the line integral \(\int\nolimits _{C_{ij}} \frac{1}{R}{\mathrm{d}}l\) and the surface integral \(\iint \nolimits _{\partial {H_i}} {\frac{1}{{{R^3}}}{\mathrm{d}}s}\) are given in Appendix B.

2.2 Linear Density Contrast

As for the linear terms in the polynomial density contrast, we set \(\lambda _1=\mathbf {a}\cdot {\mathbf {r}}\), where \(\mathbf {a}=(a_{100}, a_{010}, a_{001})\) and \({\mathbf {r}}=(x,y,z)\). Substituting \(\lambda =\lambda _1=\mathbf {a}\cdot {\mathbf {r}}\) and \(\nabla _{\mathbf {r}}\lambda =\nabla _{\mathbf {r}}\lambda _1=\mathbf {a}\) and \(\nabla _{\mathbf {r}}\nabla _{\mathbf {r}}\lambda _1=\mathbf {0}\) into Eq. (7), we get

$$\begin{aligned} \begin{aligned} {\mathbf {T}}_1 = G&\sum \limits _{i = 1}^N \left\{ \,{\left[ {\sum \limits _{j = 1}^{M_i} {{{\hat{\mathbf {m}}}_{ij}}{\mathbf {a}} \cdot \int \limits _{C_{ij}} {\frac{{\mathbf {r}}}{R}{\mathrm{d}}l} } - {{\hat{\mathbf {n}}}_i}{h_i}{\mathbf {a}} \cdot \iint \limits _{\partial {H_i}} \frac{{\mathbf {r}}}{R^3}{\mathrm{d}}s + \left( \left( \mathbf {a}\cdot {\hat{\mathbf {n}}}_i\right) {\hat{\mathbf {n}}}_i - \mathbf {a} \right) \iint \limits _{\partial {H_i}} {\frac{1}{R}{\mathrm{d}}s}} \right] {{\hat{\mathbf {n}}}_i}} \right. \\&\;\;\;\;\;\;\;\;\;\; - \left. {\hat{\mathbf {n}}}_i\mathbf {a}\iint \limits _{\partial {H_i}} \frac{1}{R}{\mathrm{d}}s \right\} . \end{aligned} \end{aligned}$$
(16)

The above equation consists of one kind of line integral, i.e., \(\int _{C_{ij}} {\frac{{\mathbf {r}}}{R}{\mathrm{d}}l}\) and two kinds of surface integrals, i.e., \(\iint _{\partial {H_i}}\) \({\frac{{\mathbf {r}}}{R^3}{\mathrm{d}}s}\) and \(\iint _{\partial H_i}\frac{1}{R}{\mathrm{d}}s\), with their detailed derivations given in Appendix C.

2.3 Quadratic Density Contrast

As for the quadratic term in the polynomial density contrast in Eq. (11), its gradient is

$$\begin{aligned} \begin{aligned} {\nabla _{{\mathbf {r}}}}{\lambda _2}&= \left( {2{a_{200}}x + {a_{110}}y + {a_{101}}z} \right) {{\hat{\mathbf {x}}}} + \left( {{a_{110}}x + 2{a_{020}}y + {a_{011}}z} \right) {{\hat{\mathbf {y}}}}\\&\quad +\, \left( {{a_{101}}x + {a_{011}}y + 2{a_{002}}z} \right) {{\hat{\mathbf {z}}}}. \end{aligned} \end{aligned}$$
(17)

The second derivative of \(\lambda _2\) is

$$\begin{aligned} \begin{aligned} {\nabla _{{\mathbf {r}}}}{\nabla _{{\mathbf {r}}}}\lambda _2&= 2{a_{200}}{\hat{\mathbf {x}}}{\hat{\mathbf {x}}} + {a_{110}}{\hat{\mathbf {y}}}{\hat{\mathbf {x}}} + {a_{101}}{\hat{\mathbf {z}}}{\hat{\mathbf {x}}} \\&\quad +\, {a_{110}}{\hat{\mathbf {x}}}{\hat{\mathbf {y}}} + 2{a_{020}}{{\hat{\mathbf {y}}\hat{\mathbf {{y}}}}} + {a_{011}}{\hat{\mathbf {z}}}{\hat{\mathbf {y}}} \\&\quad +\, {a_{101}}{\hat{\mathbf {x}}}{\hat{\mathbf {z}}} + {a_{011}}{\hat{\mathbf {y}} \hat{\mathbf {z}}} + 2{a_{002}}{\hat{\mathbf {z}}}{\hat{\mathbf {z}}}. \end{aligned} \end{aligned}$$
(18)

Substituting \(\lambda _2\) and its derivatives \(\nabla _{{\mathbf {r}}}\lambda _2\) and \(\nabla _{{\mathbf {r}}}\nabla _{{\mathbf {r}}}\lambda _2\) into the general expression of the gravity gradient tensor in Eq. (7), four kinds of integrals need to be considered (their detailed derivations are given in Appendix D), which are the line integral term \(\int _{C_{ij}}\frac{x_px_q}{R}{\mathrm{d}}l\), the surface integral term \(\iint _{\partial H_i}\frac{x_px_q}{R^3}{\mathrm{d}}s\), the surface integral term \(\iint _{\partial H_i}\frac{x_p}{R}{\mathrm{d}}s\) and the volume integral term \(\iiint _H\frac{1}{R}\mathrm{d}v\), where, using \(p, q=1,2,3\), the notations in Eq. (14) are adopted, and the product \(x_px_q\) represents an arbitrary quadratic monomial.

2.4 Cubic Density Contrast

Finally, we discuss the gravity gradient tensor due to the cubic density terms given in Eq. (12). For the first- and second-order derivatives in Eq. (7), we have

$$\begin{aligned} \begin{aligned} {\nabla _{{\mathbf {r}}}}{\lambda _3}\left( {{\mathbf {r}}} \right)&= \left( {{a_{102}}{z^2} + {a_{111}}yz + {a_{120}}{y^2} + 2{a_{201}}xz + 2{a_{210}}xy + 3{a_{300}}{x^2}} \right) {{\hat{\mathbf {x}}}} \\&\quad+ \left( {{a_{012}}{z^2} + 2{a_{021}}yz + 3{a_{030}}{y^2} + {a_{111}}xz + 2{a_{120}}xy + {a_{210}}{x^2}} \right) {{\hat{\mathbf {y}}}} \\&\quad+ \left( {3{a_{003}}{z^2} + 2{a_{012}}yz + {a_{021}}{y^2} + 2{a_{102}}xz + {a_{111}}xy + {a_{201}}{x^2}} \right) {\hat{\mathbf {z}}} \end{aligned} \end{aligned}$$
(19)

and

$$\begin{aligned} \begin{aligned}&{\nabla _{{\mathbf {r}}}}{\nabla _{{\mathbf {r}}}}{\lambda _3}\left( {{\mathbf {r}}} \right) \\&= \left( {6{a_{300}}x + 2{a_{210}}y + 2{a_{201}}z} \right) {\hat{\mathbf {x}}}{\hat{\mathbf {x}}} + \left( {2{a_{210}}x + 2{a_{120}}y + {a_{111}}z} \right) {\hat{\mathbf {y}}}{\hat{\mathbf {x}}} + \left( {2{a_{201}}x + {a_{111}}y + 2{a_{102}}z} \right) {\hat{\mathbf {z}}}{\hat{\mathbf {x}}} \\&\quad + \left( {2{a_{210}}x + 2{a_{120}}y + {a_{111}}z} \right) {\hat{\mathbf {x}}}{\hat{\mathbf {y}}} + \left( {2{a_{120}}x + 6{a_{030}}y + 2{a_{021}}z} \right) {\hat{\mathbf {y}}}{\hat{\mathbf {y}}} + \left( {{a_{111}}x + 2{a_{021}}y + 2{a_{012}}z} \right) {\hat{\mathbf {z}}}{\hat{\mathbf {y}}} \\&\quad + \left( {2{a_{201}}x + {a_{111}}y + 2{a_{102}}z} \right) {\hat{\mathbf {x}}}{\hat{\mathbf {z}}} + \left( {{a_{111}}x + 2{a_{021}}y + 2{a_{012}}z} \right) {\hat{\mathbf {y}}}{\hat{\mathbf {z}}} + \left( {2{a_{102}}x + 2{a_{012}}y + 6{a_{003}}z} \right) {\hat{\mathbf {z}}}{\hat{\mathbf {z}}} . \end{aligned} \end{aligned}$$
(20)

Substituting \(\lambda _3\), \(\nabla _{\mathbf {r}}\lambda _3\) and \(\nabla _{\mathbf {r}}\nabla _{\mathbf {r}}\lambda _3\) into the expression of the gravity gradient tensor in Eq. (7), we find that we only need to deal with four types of integrals (their detailed derivations are given in Appendix E) to get the final closed-form solutions of \({\mathbf {T}}_{3}\) in Eq. (13). These four types of integrals are the line integral \(\int _{C_{ij}}\frac{x_px_qx_t}{R}{\mathrm{d}}l\), the surface integral \(\iint _{\partial H_i}\frac{x_px_qx_t}{R^3}{\mathrm{d}}s\), the surface integral \(\iint _{\partial H_i}\frac{x_px_q}{R}{\mathrm{d}}s\) and the volume integral \(\iiint _H\frac{x_p}{R}\mathrm{d}v\), with \(p,q,t=1,2,3\). Here, the notations in Eq. (14) are used, such that \(x_px_q\) and \(x_px_qx_t\) represent arbitrary quadratic and cubic monomials, respectively.

2.5 Comparison with Other Solutions

The previously published analytical solutions of gravity gradient tensors for different geometries and mass density contrasts are listed in Table 1. Most of these solutions were designed for rectangular prisms with constant density contrasts (Forsberg 1984; Montana et al. 1992; Li and Chouteau 1998; Nagy and Papp 2000; Rim and Li 2016) and for polyhedra (or cylinders) with constant density contrasts (Okabe 1979; Götze and Lahmeyer 1988; Kwok 1991; Werner and Scheeres 1996; Holstein 2002; Holstein et al. 2007a, b; Tsoulis and Petrović 2001; Tsoulis 2012; D’Urso 2014a). Only a few studies have been carried out for linear mass density contrasts (Holstein 2003; D’Urso 2014b; Sastry and Gokula 2016). Using our new findings, we successfully derive a set of analytical expressions of the gravity gradient tensor signals for a general polyhedron with constant, linear, quadratic and cubic polynomial mass functions. Our closed-form solutions for constant and linear polynomial mass functions may have different forms from the previously published solutions, but they should produce the same results. In addition, we were not only the first to find the exact solutions for the quadratic and cubic cases, but also our solutions allow for mass contrasts varying simultaneously in both horizontal and vertical directions. However, it is difficult to derive closed-form solutions of the GGT for higher-order polynomial density contrasts, simply because analytical expressions cannot be found for 1D edge integrals in terms of the existing integral tables (Gradshteyn and Ryzhik 2007).

Table 1 A list of available analytical solutions of the gravity gradient tensor for different geometries and different orders of polynomial mass contrasts

3 Verification

Three models were used to validate our closed-form solutions. The first one is a rectangular prism model (Fig. 2), for which the derivatives of closed-form solutions for the gravity field in García-Abdeslem (2005) were taken as references. The second model is an irregular polyhedron with linear density contrast, taken from Holstein (2003), for which a comparison with Holstein’s (2003) solution is given. The third model is a relatively complicated tetrahedral body (Fig. 5). As there are no reference solutions for the GGT of polyhedral mass bodies with quadratic and cubic density contrasts, we have used high-order Gaussian quadrature rules (such as 512 × 512 × 512 = 124,217,728 quadrature points) to calculate GGT reference solutions. Additionally, we allowed the density in the tetrahedral body to vary in both horizontal and vertical directions. We should mention that because our formulae require the observation site to be located at the origin of the Cartesian coordinate system, for each observation site, a coordinate translation must be performed to move the observation site to the origin.

3.1 A Prismatic Body with Depth-Dependent Density Contrast

The prism is located in a Cartesian coordinate system with the z-axis downward. In Fig. 2a, the coordinate ranges of the prismatic body are \(x=[10,20]\) km, \(y=[10,20]\) km and \(z=[0,8]\) km. The density function is a depth-dependent cubic polynomial which is taken from García-Abdeslem (2005):

$$\begin{aligned} \lambda ({{\mathbf {r}}}) = -\,747.7+203.435z-26.764z^{2}+1.4247z^{3}, \end{aligned}$$
(21)

where the density contrast is in \({\text {kg}}/{\text {m}}^{3}\) and z is in km.

Fig. 2
figure 2

a García-Abdeslem’s (2005) prism model. b The prism in the left panel is decomposed into two polyhedral bodies

In the García-Abdeslem’s (2005) work, an analytic formula for the vertical gravity field caused by a rectangular prism with density contrast varying as a depth-dependent cubic polynomial was derived. Therefore, we took the derivatives of García-Abdeslem’s solution (i.e., \(T_{xz}\), \(T_{yz}\), \(T_{zz}\)) as references to verify our solution for the gravity gradient tensor. Furthermore, to verify our solution for an arbitrary polyhedral body, we decomposed the original rectangular prism into two polyhedra (as shown in Fig. 2b). These two polyhedra share the plane with vertices 1, 3, 8 and 9. Note, this test requires points 1, 3, 8 and 9 to be co-planar. If they were not co-planar, the surface (1, 3, 8, 9) would need to be divided into two triangles (1, 3, 8) and (3, 8, 9). The values of \(T_{xz}\), \(T_{yz}\) and \(T_{zz}\) were computed at two observation sites. One is located at point (12, 12, − 0.001) km with a 1-m offset right above the top face of the prismatic body, whereas the other one is located at point (20, 10, − 0.001) km, that is near a corner of the rectangular prism.

The results computed by our closed-form solution and by derivatives of García-Abdeslem’s (2005) gravity field solution are compared in Table 2. We compare GGT elements \(T_{xz}\), \(T_{yz}\), \(T_{zz}\), because only \(g_z\) is given in García-Abdeslem (2005). Excellent agreement is obtained between these two approaches, with relative errors on the order of \(10^{-13}\%\) at site (12, 12, − 0.001) km and relative errors \(10^{-6}\)\(10^{-7}\%\) at site (20, 10, − 0.001) km. The tensor trace \(T_{xx}+T_{yy}+T_{zz}=\nabla ^{2}_{{\mathbf {r}}'}U\) is a useful tool for indicating numerical error. Using the Poisson equation \(\nabla ^2_{{\mathbf {r}}'}U=-4\pi G\lambda\) for the gravitational potential U, the tensor trace vanishes outside the source body and is \(-4\pi G\lambda\) inside the source body. Since our observation points are outside the source body, we have calculated the relative errors shown in Table 2 as \(|T_{xx}+T_{yy}+T_{zz}|/(|T_{xx}|+|T_{yy}|+|T_{zz}|)\). The relative error of the tensor trace is \(2.74\times 10^{-13}\%\) at the location above the top face and \(3.77\times 10^{-11}\%\) above the corner. Both our solution and García-Abdeslem’s (2005) solution for the GGT are singular, when observation sites are located on edges and corners. When the observation site gets close to the corner, the mathematical singularity becomes stronger, and this is, why the relative error is larger at site (20, 10, − 0.001) km.

In summary, the excellent agreement of the different solutions has successfully verified the accuracy of our new closed-form solutions for a polyhedral body with depth-dependent polynomials up to and including cubic order.

Table 2 Comparison of gravity gradient tensors calculated by our new closed-form solution and derivatives of García-Abdeslem’s (2005) gravity field solution for the prismatic body given in Fig. 2

3.2 An Irregular Polyhedron with Linear Density Contrast

An irregular polyhedron is tested to compare our solution with Holstein’s (2003) solution for linear media. The target model is composed of 8 faces and 10 points (Fig. 3), originally designed by Holstein et al. (1999, Appendix A). The linear density contrast inside the target body is taken from Holstein (2003, Appendix C), that is

$$\begin{aligned} G\lambda =-\frac{80}{645}+\frac{4(x+2y-10z)}{645} \end{aligned}$$
(22)

where the density \(\lambda\) is in \(\mathrm {kg}/\mathrm {m}^3\), coordinates are given in km. First, we compute the gravity gradient tensor at two test points, an outer point with coordinates of (0, 0, 0) km and an interior point at the centroid \(\bar{\mathbf {R}}=\frac{1}{88}(40,250,-1541)\) km. The results are shown in Table 3. An excellent agreement is obtained between our closed-form solution and Holstein (2003)’s solution.

Fig. 3
figure 3

Irregular polyhedral model described in Holstein et al. (1999, Appendix A). \((x,\;y,\;z)\) coordinates of the vertices are 1 \((10, 10, -12)\) km, 2 \((10, -10, -12)\) km, 3 \((-10, -10, -12)\) km, 4 \((-10, 10, -12)\) km, 5 \((-20, 30, -12)\) km, 6 \((30, 30, -12)\) km, 7 \((20, 20, -22)\) km, 8 \((20, -30, -22)\) km, 9 \((-20, -30, -22)\) km and 10 \((-20, 20, -22)\) km. Two test points for comparison with Holstein’s (2003) solution are marked by blue stars. A vertical profile is marked by a red dotted line

Second, the gravity gradient anomalies are evaluated on a vertical profile passing through the target body, in order to validate our formulas by the well-known Poisson equation \(\nabla ^2_{{\mathbf {r}}'}U=-4\pi G\lambda\), where U is the gravitational potential. The vertical profile is from a point with coordinates of \((0, 0, -\,34)\) km to a point with coordinates of (0, 0, 0) km, with observation points placed at a uniform vertical (z) spacing of 1 km. Due to the discontinuity of the gradient tensor signals on the boundary, we only perform tests at two points which are very close to the boundary (with a small distance of \(\pm \,10^{-10}\) km). The value of \(-4\pi G\lambda\) is used as the reference. The relative errors are calculated using the formula \(\frac{(T_{xx}+T_{yy}+T_{zz})+4\pi G\lambda }{|T_{xx}|+|T_{yy}|+|T_{zz}|}\) and shown in Fig. 4. The maximum absolute relative error is \(3.08389\times 10^{-13}\%\).

Table 3 Values of the gravity gradient tensors for the irregular polyhedron and the observation points marked by blue stars in Fig. 3
Fig. 4
figure 4

a Comparison of the Laplacian term \(T_{xx}+T_{yy}+T_{zz}\) calculated by our new closed-form solution to the reference value of \(-4\pi G \lambda\) for the causative body in Fig. 3. b Relative errors calculated as \(\frac{(T_{xx}+T_{yy}+T_{zz})+4\pi G\lambda }{|T_{xx}|+|T_{yy}|+|T_{zz}|}\)

3.3 A Tetrahedral Mass Body with Horizontal and Vertical Density Contrasts

In practical gravity exploration, the underground mass bodies can have complicated shapes. To calculate their GGT signals, we generally need to discretise the underground mass bodies into sets of disjoint elements with different shapes, such as structured hexahedral or prismatic elements and unstructured tetrahedral elements. Compared to regular prismatic elements, unstructured tetrahedral elements can well approximate arbitrarily complicated anomalies. Using recent Delaunay triangulation techniques (e.g., Si 2015), geophysicists can easily set up discretised triangulated grids to represent complicated anomalous targets. Therefore, unstructured grid techniques have been widely used in the geophysical community, not only in gravity exploration (Jahandari and Farquharson 2013; Ren et al. 2017c), but also in the electromagnetic induction community (Li and Key 2007; Schwarzbach et al. 2011; Ren et al. 2013) and the seismic imaging field (Lelièvre et al. 2011). Testing a single tetrahedral mass body not only aims to test the performance of our new closed-from solutions for complicated density contrasts (horizontal and vertical density contrasts), but also demonstrates its compatibility with other codes developed for unstructured grids. This verification is an important step towards joint inversion for multiple parameters, such as magnetisation vector, conductivity, velocity and mass density on the same unstructured gird.

The geometry of the tetrahedron is shown in Fig. 5. We used the density contrast as given in D’Urso and Trotta (2017, equation 166), which includes horizontal variation of the density contrast

$$\begin{aligned} \lambda =-\,747.7+203.435z-26.764z^2+1.4247z^3{-23.205x-23.205y}, \end{aligned}$$
(23)

where the unit of the density is kg /m\(^3\) and the units of the coordinates are km.

Fig. 5
figure 5

A tetrahedron with cubic polynomial density contrast. The coordinates of the vertices are (0, 0, 0.02) km for vertex 1, \((-\,0.05,0.01,0.1)\) km for vertex 2, (0.05, 0.05, 0.08) km for vertex 3 and \((0.05,-0.05,0.05)\) km for vertex 4. The measuring plane is marked by red colour and located at \(x=[-0.16, 0.16]\) km, \(y=[-0.16, 0.16]\) km and \(z=0\) km. The red dashed line marks a profile passing through the interior

A measuring plane is located above the tetrahedron in a range of \(x=[-\,0.16, 0.16]\) km, \(y=[-\,0.16, 0.16]\) km and \(z=0\,\)km. On the measuring plane, the gravity gradient tensors were computed using our closed-form solution and a Gaussian quadrature rule with \(512\times 512\times 512\) points. The high-order Gaussian quadrature rule was built by projecting the tetrahedral element into a hexahedral element (Rathod et al. 2006) and then applying the standard Gauss Legendre Quadrature rule (Golub and Welsch 1969). Since there are no published results of GGTs for high-order polynomial density contrasts, we compare to results computed by high-order Gaussian quadrature as the reference solutions. The six components of the gravity gradient tensor are shown in Fig. 6 for our analytical solutions and in Fig. 7 for Gaussian quadrature solutions. The relative errors with regard to the Gaussian quadrature solution are shown in Fig. 8. Clearly, the results from our analytical solution agree quite well with those computed by the Gaussian quadrature rule, with absolute relative errors less than \(2\times 10^{-7}\%\). The computation time for the analytical solution is about 0.9 s, and the computation time for \(512\times 512\times 512\) points Gaussian quadrature is about 3.7194 h.

Fig. 6
figure 6

Gravity gradient tensor of the tetrahedron model on the measuring plane (cf. Fig. 5) calculated by our analytical method. The mass contrast is given in Eq. (23)

Fig. 7
figure 7

Similar to Fig. 6, but for solutions calculated by Gaussian quadrature with \(512\times 512\times 512\) points

Fig. 8
figure 8

Relative errors of gravity gradient tensors computed by our methods for the tetrahedron model (Fig. 5) with respect to the Gaussian quadrature solution (using \(512\times 512\times 512\) points). The mass contrast is given in Eq. (23)

Furthermore, the sums of the diagonal entries \(T_{xx}+T_{yy}+T_{zz}\) were computed using the analytical solution. When the observation site is outside the source region, as in our example, these three diagonal entries satisfy the Laplace equation, that is \(\nabla ^2U=T_{xx}+T_{yy}+T_{zz}=0\), thus providing an independent means of verification of our closed-form solutions. As shown in Fig. 9, the relative error \(|T_{xx}+T_{yy}+T_{zz}|/(|T_{xx}|+|T_{yy}|+|T_{zz}|)\) has a maximum value of \(3.26\times 10^{-12}\%\). Therefore, the condition of \(\nabla ^2U=T_{xx}+T_{yy}+T_{zz}=0\) is satisfied by our solutions.

Fig. 9
figure 9

a Absolute values of tensor traces \(T_{xx} +T_{yy} +T_{zz}\) of our closed-form solution for a tetrahedral anomaly and observation sites distributed on a plane (Fig. 5). The density contrast is given in Eq. (23). b Relative errors of tensor traces \(T_{xx} +T_{yy} +T_{zz}\) calculated as \(|T_{xx}+T_{yy}+T_{zz}|/(|T_{xx}|+|T_{yy}|+|T_{zz}|)\)

Next, with the aim of testing the case of cross-varying mass contrasts, the following density contrast and the same tetrahedral body as shown in Fig. 5 were used:

$$\begin{aligned} \lambda = 6\times 10^{4}xy+2\times 10^5xz^2+9\times 10^5xyz, \end{aligned}$$
(24)

where the unit of density is kg /m\(^3\) and the units of the coordinates are km. This density contrast function simultaneously varies in both horizontal and vertical directions, ranging from about \(-300\) to 400 kg/m\(^3\). A measurement profile is positioned at \(x=[-0.2, 0.2]\) km, \(y=0\) km and \(z=0\) km. The six components of the gravity gradient tensor were calculated by our analytical formulae and Gaussian quadrature with \(512\times 512\times 512\) points as shown in Fig. 10. The relative errors of our solutions with respect to the Gaussian quadrature solutions are shown in Fig. 11. Note, that the maximum absolute relative errors are less than \(5\times 10^{-8}\)%. Therefore, the results computed by our analytical solution have excellent agreement with those computed by high-order Gaussian quadrature, for this case where the density contrast simultaneously varies in both horizontal and vertical directions. Furthermore, a test was conducted with observations sites located on a path at \(x=[-0.05,0.05]\) km, \(y=0\) km, \(z=0.04\) km crossing the interior. For this setup, the tensor elements and traces \(T_{xx}+T_{yy}+T_{zz}\) were calculated. An excellent agreement between the computed traces of the gravity gradient tensor and the reference value of \(-4\pi G\lambda\) (see Fig. 12) is obtained, which clearly verifies our closed-form solution.

Fig. 10
figure 10

Gravity gradient tensors of the tetrahedron model (Fig. 5) along the profile at \(x=[-0.2, 0.2]\) km, \(y=0\) km and \(z=0\) km calculated by our analytical method (solid lines) and the high-order Gaussian quadrature rule with \(512\times 512\times 512\) points (circles). The mass contrast is given in Eq. (24)

Fig. 11
figure 11

Relative errors of the analytical solutions with respect to the high-order Gaussian quadrature solutions for tensor elements of the tetrahedral model (Fig. 5), with density contrast given in Eq. (24)

Fig. 12
figure 12

a Comparison of the Laplacian term \(T_{xx}+T_{yy}+T_{zz}\) calculated by our new closed-form solution to the reference value of \(-4\pi G \lambda\) for the tetrahedral body in Fig. 5. b Relative errors calculated as \(\frac{(T_{xx}+T_{yy}+T_{zz})+4\pi G\lambda }{|T_{xx}|+|T_{yy}|+|T_{zz}|}\). As shown in Fig. 5, the measuring profile passes through the interior with coordinates of \(x=[-0.05, 0.05]\) km, \(y=0\) km and \(z=0.04\) km

3.4 Numerical Stability

Theoretically, closed-form solutions should be accurate. However, due to the limitations of floating point arithmetics, these solutions contain inevitable rounding errors, when the amplitudes of the gravity signals approach zero. This phenomenon has been observed in previous studies (Holstein and Ketteridge 1996; Holstein 2003; Holstein et al. 2007a), which shows that the relative error of the gravity field will grow, when the distance between the mass target and the observation site approaches infinity. We use relative error here to avoid discussion of anomaly magnitude and instrument-dependent measurement accuracy. Beyond a certain distance, gravity anomalies can even be totally corrupted by floating point errors. Assuming that the mass body has a size of \(\alpha\) and the site-to-target distance is denoted by \(\delta\), the growth of the relative error \(\eta\) satisfies the following formula (Holstein and Ketteridge 1996; Holstein 2003; Holstein et al. 2007a):

$$\begin{aligned} \eta =\varepsilon \left( \frac{1}{\gamma }\right) ^\kappa =\varepsilon \left( \frac{\delta }{\alpha }\right) ^\kappa , \end{aligned}$$
(25)

where \(\gamma\) is defined as \(\gamma =\alpha /\delta\), \(\gamma ^{-1}\) is referred to as the dimensionless target distance, the exponent \(\kappa\) indicates the speed of error growth, and \(\varepsilon\) is the relative error when \(\frac{1}{\gamma }=1\), identified in these papers as the floating point machine precision constant. On a log–log scale plot, Eq. (25) is a linear error growth curve \(\lg (\eta )=\kappa \lg \left( \frac{1}{\gamma }\right) +\lg (\varepsilon )\).

We present an experiment, in which the tetrahedron shown in Fig. 5 was used to recover the above linear error growth curve. The size of the tetrahedron was set to the diameter of its circumscribed sphere, that is \(\alpha =0.134\) km. The starting point for the profile is located at the centre of the circumscribed sphere of the tetrahedral model. The measuring profile is formulated as \(x=y, z=0\) km.

Following Holstein et al. (2007a), the equivalent mass point approach was adopted as the reference solution, by which the tetrahedral body is approximated by a point source located at the centre of the circumscribed sphere. The anomalies calculated by our new closed-form expressions and by the equivalent point-mass approach are denoted by T and \({T}_{\mathrm{point}}\), respectively. In addition, the relative errors \(\eta =\left| {T}-{T}_{\mathrm{point}}\right| /\left| {T}_{\mathrm{point}}\right|\) were computed. Four polynomial density contrasts of different orders were used for the stability test:

$$\begin{aligned} \lambda _0= 1000, \end{aligned}$$
(26)
$$\begin{aligned} \lambda _1= 10{,}000(x+y+z), \end{aligned}$$
(27)
$$\begin{aligned} \lambda _2= 100{,}000(x^2+y^2+z^2+xz+yz+xy), \end{aligned}$$
(28)
$$\begin{aligned} \lambda _3= 1{,}000{,}000(z^3+yz^2+y^2z+y^3+xz^2+xyz+xy^2+x^2z+x^2y+x^3), \end{aligned}$$
(29)

where the unit of the density contrast is kg/m\(^3\) and the units of the coordinates are km. The ranges of density contrasts are about 200–1800 kg/m\(^3\) for the linear case, about 40–2200 kg/m\(^3\) for the quadratic case and about 10–2250 kg/m\(^3\) for the cubic case.

Fig. 13
figure 13

Error growth curves for constant density contrast a, linear density contrast b, quadratic density contrast c and cubic density contrast d

The relative error curves are shown in Fig. 13 for the above four density contrasts. In Fig. 13, at low dimensionless target distances \(\gamma ^{-1}\), the relative errors decrease with increasing \(\gamma ^{-1}\), because the tetrahedron is better approximated as a mass point with increasing distance. However, the gravity anomalies are progressively corrupted with increasing target distance, and when the dimensionless target distance (\(\gamma ^{-1}\)) is beyond a critical value, the rounding error in the unstable calculations exceeds the solution difference, resulting in a rising trend of the relative errors (cf. Holstein 2003). We reconstructed the entire error growth curves by extrapolating the ascending parts back to \((\gamma ^{-1}=1,\;\eta =\varepsilon )\). In Fig. 13, the reconstructed curves are denoted by blue dashed lines. We observe that there are two linear error growth trends for each polynomial density contrast, that is \(T_{zx}\) and \(T_{zy}\) share the same error growth behaviour, and \(T_{xx}\), \(T_{yy}\), \(T_{zz}\) and \(T_{yx}\) share the same error growth behaviour. The estimated values of \(\kappa\) are shown in Table 4. Using the estimated \(\kappa\), the critical dimensionless target distances were calculated from that value of \(\gamma ^{-1}\) where the rising part of the error curve indicates a relative error of 1 (Holstein and Ketteridge 1996; Holstein 2003; Zhou 2010) in Eq. (25), which are also shown in Table 4.

As shown in Table 4, for the linear density case, \(\kappa\) is about 4.31 for \(T_{xx}\), \(T_{yy}\), \(T_{zz}\) and \(T_{xy}\) and about 5.28 for \(T_{xz}\) and \(T_{yz}\), which agrees with previously estimated values of 4 and 5 given by Holstein (2003), respectively. As \(\kappa\) indicates the error growth speed, Table 4 and Fig. 13 also show that the higher the order of the density contrast polynomial is, the faster the errors accumulate. At the critical dimensionless target distance, the accumulated rounding error has the same amplitude as the true anomaly. Therefore, to safely use our exact solution, we should require our observation sites to be located in a range, which is less than the critical value \(\frac{1}{\gamma _{\mathrm{crit}}}\). Finally, interested readers are referred to Table 4 for the specific dimensionless site-target distances for the constant, linear, quadratic and cubic density cases.

Table 4 Experimental values of \(\kappa\) and \(1/\gamma _{\mathrm{crit}}\) for polynomial density contrasts of different orders. All experiments were performed on a computer with an Intel Core i5-4590 processor using double precision arithmetics

4 Conclusions

In the presented work, we have derived a set of closed-form solutions for the gravity gradient tensor of an arbitrary polyhedral body. The density contrast of the polyhedral body is represented as a polynomial function of up to and including third order. The polynomial function allows density contrasts to simultaneously vary in both horizontal and vertical directions. To our best knowledge, this is the first time that analytical solutions of the gravity gradient tensor are derived for an arbitrary polyhedral body with polynomial orders up to three. Three synthetic models (a prismatic body, an irregular polyhedron and a tetrahedral body) were used to test the correctness and the efficiency of our newly developed closed-form solutions. By comparing to published closed-form solutions and high-order Gaussian quadrature solutions, the high accuracies of our solutions with deviations of less than \(2\times 10^{-7}\)% from the Gaussian quadrature solutions were demonstrated. The computation time used by our analytical solution is significantly less than that of the high-order Gaussian quadrature.

The numerical stability tests show that, when dealing with cubic density contrast, our closed-form solutions would generate inaccurate solutions, if the dimensionless target distance, which is defined as the ratio of the distance between the observation site and the causative body to the dimension of the causative body, is larger than about 282 for \(T_{xx}\), \(T_{yy}\), \(T_{zz}\), \(T_{yx}\) components, and 137 for \(T_{zx}\), \(T_{zy}\) components, on a profile with \(x=y\) and \(z=0\,{\text {m}}\). This inaccuracy problem is caused by the limited precision of floating point operations, when the amplitudes of the gravity gradient tensors are very close to zero. However, since most applications of gravity gradient tensors aim at detecting anomalous bodies in the very shallow subsurface of the Earth, this problem of precision loss should not cause a serious problem in practical situations, and our closed-form solutions are very safe to be applied in exploration geophysics.

For the cases of constant, linear, second and cubic polynomial order, there are systematic recurrences of previously evaluated integrals as well as occurrences of new types of integrals, when going to higher polynomial order. We assume that this is a trend even for higher polynomial orders (\(P>3\)). However, extending our work to higher polynomial orders will be a nontrivial task as more and more complicated integrals need to be considered. By contrast, using the analytical expressions presented in this study, closed-form solutions for the magnetic field can be derived easily.