1 Introduction

Several methods can be found in the literature for computing the gravitational attraction of topographic masses defined by means of height information assigned on a regular grid. Basically, they differ in the search of an adequate compromise between computational efficiency and advanced modeling techniques of the topographic surface.

To this end analytical, numerical and mixed, i.e. both analytical and numerical, methods have been contributed so far. In the first category, the gravitational effect at an observation point \(P\) is evaluated by summing the separate contribution of constant-density bodies having a simple geometrical shape, usually a right rectangular parallelepiped (prism).

Actually, one can invoke well known (Kellogg 1929; MacMillan 1930; Mader 1951; Nagy 1966; Heiskanen and Moritz 1967; Banerjee and DasGupta 1977; Nagy et al. 2000; Tsoulis 2000) and recently established (Jiancheng and Wenbin 2010; D’Urso 2012) analytical formulas for the gravity effects.

A refinement of the classical prism with flat tops has been considered by Woodward (1997), Blais and Ferland (1983) and subsequently addressed by Smith (2000) by considering prisms with inclined top and bottom faces.

A significant improvement to the effective computation of terrain effects has been achieved in terms of programming efficiency and modeling of surface relief by developing formulas for the gravity effects of homogeneous polyhedral bodies, see, e.g., Paul (1974), Barnett (1976), Götze (1978), Okabe (1979), Waldvogel (1979), Pohanka (1988), Werner (1994), Petrović (1996), Werner and Scheeres (1997), Holstein (2002) and Benedek (2004).

Recently D’Urso (2014a) has developed additional formulas, expressed solely as function of the coordinates of the vertices of the polyhedron, on the basis of recent analytical results, (D’Urso 2012, 2013a), addressing the singularities affecting the computation of the gravity effects in a systematic manner.

Mixed methods for terrain correction computations have been contributed by Forsberg (1985) and Sideris (1985) on the basis of the Fast Fourier Transform (FFT). A further method exploiting multiple expansions has been proposed by Martinec et al. (1996). A numerical method based on quadrature formulas has been presented by Hwang et al. (2003).

To overcome some shortcomings of the FFT technique in the zones adjacent to the observation point, Tsoulis (2001) proposed to replace the FFT with an analytical method only in these zones and to exploit the efficiency of the FFT in the complementary parts of digital terrain models (DTM).

In a subsequent paper, Tsoulis et al. (2003) presented a new mixed method for the computation of the gravitational attraction of DTMs by adopting a bilinear surface for the representation of the terrain relief. By inserting the bilinear approximation into the analytical expression of the potential and its first-order derivatives, Tsoulis et al. (2003) proved that the new method was comparable or even faster than a terrain modeling using polyhedra.

However, in his analysis, no comparison was made by Tsoulis et al. (2003) with the previous contribution by Smith (2000) in which an analytical, though particularly involved, expression of the gravitational attraction had been derived. Conversely, the approach by Tsoulis et al. (2003) requires, besides some refined analytical manipulations, a numerical integration of the resulting 1D integrals for which they proposed to adopt the classical Simpson’s rule.

Taking also into account the recent contributions by the first author (D’Urso 2013a, 2014a) on the computation of gravity effects by polyhedral modeling, aim of this paper is to provide a comparison between the performances of the existing methods for terrain correction computations and a novel analytical method contributed in the paper.

To this end, the original approach by Smith (2000), in which it is provided a closed formula for computing the gravitational attraction of a vertical prism with inclined top and bottom faces, is enhanced in a two-fold manner:

  1. (i)

    By extending it to the computation of the potential;

  2. (ii)

    By proving that the potential and the gravitational attraction can be computed in a considerably simpler way.

Furthermore, a comparison with the results by Tsoulis et al. (2003) is carried out together with a Gauss numerical integration of the 2D integral pertaining to the bilinear surface proposed by them.

The paper is organized as follows. Section 2 contains a brief summary of the analytical formulas derived in (D’Urso 2013a, 2014a) and of the existing analytical approaches contributed thus far in the literature.

Section 3 presents the enhanced version of Smith’s approach by making reference to the Appendix 1 and 2 for details on the evaluation of the relevant integrals.

The approach by Tsoulis et al. (2003) is succinctly accounted for in Sect. 4 mainly to draw the reader’s attention on two typographical errors contained in the original paper.

Finally, numerical examples are presented and discussed in Sect. 5.

2 Theory

The potential and gravity vector induced at an arbitrary point \(P\) by a continuous distribution of mass, with constant density \(\delta \), occupying a bounded domain \(\varOmega \) are given by:

$$\begin{aligned} U(P)=G\delta \int \limits _{\Omega }\frac{dV}{({\mathbf r}\cdot {\mathbf r})^{1/2}} \end{aligned}$$
(1)

and

$$\begin{aligned} U_{,P}=-G\delta \int \limits _{\Omega }\frac{{\mathbf r}}{({\mathbf r}\cdot {\mathbf r})^{3/2}}dV \end{aligned}$$
(2)

where \(dV\) is the infinitesimal volume element belonging to \(\varOmega \) and \((\cdot )_{,P}\) denotes differentiation with respect to \(P\).

Furthermore, \(G\) is the gravitational constant and \({\mathbf r}\) is the position vector with respect to the observation point \(P\) of an arbitrary source point belonging to \(\varOmega \). For this reason it is convenient to consider a three-dimensional (3D) cartesian reference frame \((P,x,y,z)\) having origin at \(P\), see, e.g., Kellogg (1929), MacMillan (1930), Heiskanen and Moritz (1967).

The most general approach to the evaluation of (1) and (2) is based on the polyhedral approximation of \(\varOmega \). Denoting by \(N_F\), the number of faces belonging to the boundary \(\partial \varOmega \) and \(d_i\) the signed distance between \(P\) and the \(i\)-th face \(F_i \in \partial \varOmega \) it turns out, D’Urso (2014a):

$$\begin{aligned} U(P) = \frac{G\delta }{2}\sum \limits _{i=1}^{N_F} d_i\left\{ I_{F_i}- |d_i|\alpha _i \right\} \end{aligned}$$
(3)

and

$$\begin{aligned} U_{,P} = - G\delta \sum \limits _{i=1}^{N_F} ( I_{F_i}- |d_i|\alpha _i ){\mathbf n}_i \end{aligned}$$
(4)

where \(I_{F_i}\) can be computed analytically as function of the 3D position vectors of the vertices which define the polyhedron faces and \({\mathbf n}_i\) is the unit normal to the face \(F_i\), pointing outside \(\varOmega \).

The expression of the integral \(I_{F_i}\), which represents the main quantity to compute over each face \(F_i\) of the polyhedron, can be found in (D’Urso 2012, 2013a, 2014a).

The correction factor \(\alpha _i\) in formulas (3) and (4) accounts for the singularity of the field \(1/({\mathbf r}\cdot {\mathbf r})^{1/2}\) when \(P\in \varOmega \). It can be computed as shown in D’Urso and Russo (2002) and D’Urso (2014a).

Further applications of the same approach can be found in (D’Urso 2013b, 2014b) for bodies with linearly varying density, in D’Urso and Marmo (2013c), Sessa and D’Urso (2013) for geomechanics, in D’Urso and Marmo (2013d) for geosciences, in Rosati and Marmo (2014) for heat transfer.

Topographic masses represent an important source of gravity field information, e.g., for geoid determination, especially nowadays since global-detailed digital elevation models of the topography at the continents and of the bathymetry at the oceans are accessible.

For a digital terrain model, the arbitrary polyhedron considered thus far can be replaced by a simpler polyhedral shape in which \(N_F-1\) faces are parallel to the coordinate planes of a Cartesian reference frame, see, e.g., Fig. 1.

Fig. 1
figure 1

Surface modeling for a 2 \(\times \) 2 DTM by constant, linear and bilinear prisms (Tsoulis et al. 2003)

For simplicity, we shall denote such polyhedral shapes by linear or bilinear prisms depending on the fact that the bottom face of the polyhedron, usually in \(x-y\) plane, has a triangular or a rectangular shape. In this respect we remind that, from a rigorous point of view, only the first one is a real polyhedron since the top surface is a plane.

The particular shape of the prisms used in digital terrain modeling naturally suggests to compute the potential and the gravity vector by first integrating the relevant 3D expressions along the vertical (\(z\)) direction and, subsequently, performing the evaluation of the resulting 2D expression in the horizontal (\(x-y\)) plane.

Unfortunately, only the gravitational attraction, i.e. the \(z\) component of the gravity vector, was amenable to exact integration (Woodward , 1997; Smith , 2000).

Conversely, we show in the sequel that also the potential can be exactly integrated and that its evaluation requires the analytical computation of the same 1D integral previously addressed in Woodward (1997) and Smith (2000). To this end, we prove in the Appendix that its evaluation can be considerably simplified with respect to the solution strategy proposed in Smith (2000).

Furthermore, numerical integration is proposed for the \(x\) and \(y\) component of the gravity vector since the relevant 1D integrals, which are arrived at by two consecutive integrations along \(z\) and \(y\), have turned out to be not analytically integrable.

For a bilinear prism, two different strategies can be exploited. The first one is the one contributed in Tsoulis et al. (2003) in which the original 3D expression of the potential and of the gravity vector is replaced by its 2D counterpart on the boundary surface of the prism while analytical integration is subsequently carried out for the integral extended to the bilinear surface.

This yields 1D integrals which, however, cannot be analytically integrated so that a Gauss-based numerical integration, different from the Simpson-based one adopted in Tsoulis et al. (2003), is carried out.

The impossibility of achieving a fully analytical integration of the 2D integral extended to the bilinear surface suggest to carry out its numerical integration, representing the second strategy for the bilinear prism.

To sum up, we shall compare the computational performances of four different approaches to the analytical evaluation of the potential and of the gravity vector of gridded data:

  1. (a)

    The approach by Smith (2000) enhanced as detailed below;

  2. (b)

    The approach by Tsoulis et al. (2003) in which a Gauss based rather than a Simpson-based numerical integration of the 1D integrals is carried out;

  3. (c)

    A Gauss-based numerical integration of the 2D integral extended to the bilinear surface according to the Tsoulis approach;

  4. (d)

    A fully polyhedral approach based on the use of formulas (3) and (4).

3 An enhanced version of Smith’s approach

Smith (2000) derived a closed formula for computing the gravitational attraction of a vertical prism with inclined top and bottom faces. Though conceptually elegant, the formula obtained by Smith is particularly involved.

For this reason, we provide hereafter a different derivation which leads to a considerably simpler expression not only for the gravitational attraction but also for the potential.

Although not contained in the original paper by Smith (2000), the computation of this last quantity is carried out to parallel the paper by Tsoulis et al. (2003) in which both the potential and the gravitation vector have been computed.

3.1 Evaluation of the potential for an element of a DTM

Let us consider an arbitrary element of a Digital Terrain Model (DTM), see, e.g., Fig. 2, typically assigned by means of gridded data.

Fig. 2
figure 2

Triangular sub-domains of an arbitrary element of a DTM

Supposing that the DTM is defined by \(N_x\) \((N_y)\) rectangular elements in the \(x\) \((y)\) direction, the potential \(U\) in (1) can be expressed as

$$\begin{aligned} U(P)=G\delta \sum \limits _{i=1}^{N_x *N_y} I_{\varTheta ^{(i)}} \end{aligned}$$
(5)

where it has been set

$$\begin{aligned} I_{\varTheta ^{(i)}}= \int \limits _{\varTheta ^{(i)}}\left[ \int \limits _0^{z_i(x,y)}\frac{dz}{(x^2+y^2+z^2)^{1/2}}\right] dx \, dy \end{aligned}$$
(6)

\(\varTheta ^{(i)}\) denotes the domain of the \(i\)-th element of the DTM and \(z_i\) the function which defines the height corresponding to the generic pair of values \(x,y\) belonging to \(\varTheta ^{(i)}\).

In the sequel, we shall concentrate on the computation of the generic integral in (6) so that the suffix \((\cdot )^{(i)}\) will be omitted for notational simplicity.

Assuming that the surface relief is represented by means of triangular prisms, the generic element of the DTM is divided in two sub-elements; accordingly, the generic integral in (6) becomes

$$\begin{aligned} I_{\varTheta }&= I_{\varLambda _1}+I_{\varLambda _2}\nonumber \\&= \displaystyle { \int \limits _{\varLambda _1}\left[ \int \limits _0^{z_1(x,y)}\frac{dz}{(x^2+y^2+z^2)^{1/2}}\right] dx \, dy } \nonumber \\&\quad + \displaystyle { \int \limits _{\varLambda _2}\left[ \int \limits _0^{z_2(x,y)}\frac{dz}{(x^2+y^2+z^2)^{1/2}}\right] dx \, dy } \end{aligned}$$
(7)

where \(z_1(x,y)=u_1x+v_1y+k_1\) and \(z_2(x,y)=u_2x+v_2y+k_2\) are the equations of the planes defined on the sub-domains \(\varLambda _1\) and \(\varLambda _2\) in Fig. 2, respectively.

Being the previous integrals substantially equivalent, we shall make reference in the sequel to the computation of the generic integral

$$\begin{aligned} I_{\varLambda }= \int \limits _{\varLambda }\left[ \int \limits _0^{ux+vy+k}\frac{dz}{(x^2+y^2+z^2)^{1/2}}\right] dx \, dy \end{aligned}$$
(8)

where \(\varLambda \) reminds of a triangular domain of integration.

Performing the integration with respect to \(z\) one has

$$\begin{aligned} I_{\varLambda }&= \displaystyle { \int \limits _{\varLambda }\Big [\ln \Big (z+\sqrt{x^2+y^2+z^2}\Big )\Big ]_{z=0}^{z=ux+vy+k} dx \, dy } \nonumber \\&= \displaystyle { \int \limits _{\varLambda }\ln \Bigl [ux+vy+k \Bigr . } \nonumber \\&\quad \displaystyle { \Bigl . +\,\sqrt{x^2+y^2+(ux+vy+k)^2}\Bigr ] dx \, dy } \nonumber \\&\quad - \displaystyle { \int \limits _{\varLambda }\ln \sqrt{x^2+y^2} dx \, dy } \end{aligned}$$
(9)

Unfortunately it has not been possible, even by employing the current version of symbolic mathematics softwares, to find the primitives of the two integrand functions above.

For this reason, we proceed in a different way by trying to transform the 2D integrals (9) into a 1D integral. To simplify the ensuing developments, we introduce the vectors \({\mathbf g}=(u,v)\) and \({\varvec{\rho }}=(x,y)\) so that

$$\begin{aligned} ux+vy+k = {\mathbf g}\cdot {\varvec{\rho }}+k \end{aligned}$$
(10)

Accordingly, setting

$$\begin{aligned} \chi ({\varvec{\rho }},k) = \sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}+ ({\mathbf g}\cdot {\varvec{\rho }}+k)^2} \end{aligned}$$
(11)

and

$$\begin{aligned} \psi ({\varvec{\rho }},k) = {\mathbf g}\cdot {\varvec{\rho }}+k +\chi ({\varvec{\rho }},k) \end{aligned}$$
(12)

we write (9) as

$$\begin{aligned} I_{\varLambda }&= \displaystyle { \int \limits _{\varLambda }\ln \psi ({\varvec{\rho }},k) dx \, dy } - \displaystyle { \int \limits _{\varLambda }\ln \sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}} \,dx \, dy } \nonumber \\&= I_{\varLambda a}-I_{\varLambda b}\end{aligned}$$
(13)

It is worth noting that the second integrand function in (13) is the specialization of the first one by setting in (11) and (12) \({\mathbf g}={\mathbf o}\), where \({\varvec{ o }}\) is the zero vector, and \(k=0\). Nevertheless, the computation of the two integrals is based on a completely different approach since the function \(\psi ({\varvec{\rho }},k)\) is non-singular; hence, by a suitable transformation of the original expression, analytical integration can be performed.

Conversely, the integrand function \(\ln \sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}}\) in the second integral of (13) can trivially exhibit a singularity at \({\varvec{\rho }}={\mathbf o}\); accordingly, a specifically devised integration technique needs to be invoked. For these reasons, the computation of the two integrals in (13) is illustrated separately in the fallowing two subsections.

3.1.1 Evaluation of the integral \(I_{\varLambda a}\) in (13)

The integral \(I_{\varLambda a}\) in (13) has been computed analytically by Smith (2000) but the final expression turned out to be lengthy and required special care in its programming. Actually, as pointed out by the author, there were two main complications in the application of Smith’s formula.

The first one was associated with singularities which can occur for special geometries while the second one prompted from the occasional occurrence of complex numbers what required special coding to get correct results.

To simplify the computation of \(I_{\varLambda a}\) with respect to Smith’s approach we try to express \(I_{\varLambda a}\) as a line integral extended to the boundary of the triangle \(\varLambda \) in (13). in this respect we anticipate that this objective has been only partially fulfilled since our procedure actually leads to a simpler evaluation of \(I_{\varLambda a}\) with respect to Smith’s formulation although it still requires to compute a domain (2D) integral.

To illustrate the rationale of our approach we remind the differential identity

$$\begin{aligned} \text {div}(\varphi \,{\mathbf u})= \text {grad}\varphi \cdot {\mathbf u}+ \varphi \,\text {div}{\mathbf u} \end{aligned}$$
(14)

where \(\varphi \,\)(\({\mathbf u}\)) is a continuous scalar (vector) field while \(\text {div}\,\) (\(\text {grad}\)) denoted the divergence (gradient) operator Tang (2006).

Thus, being

$$\begin{aligned} \text {grad}[\ln \psi ({\varvec{\rho }},k)]= \frac{1}{\psi ({\varvec{\rho }},k)}\left[ {\mathbf g}+ \frac{{\varvec{\rho }}+ ({\mathbf g}\cdot {\varvec{\rho }}+k){\mathbf g}}{\sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}+ ({\mathbf g}\cdot {\varvec{\rho }}+k)^2}}\right] \nonumber \\ \end{aligned}$$
(15)

the identity (14) yields

$$\begin{aligned} \text {div}[\ln \psi ({\varvec{\rho }},k){\varvec{\rho }}]&= \displaystyle { \frac{{\mathbf g}\cdot {\varvec{\rho }}}{\psi ({\varvec{\rho }},k)} + \frac{{\varvec{\rho }}\cdot {\varvec{\rho }}+ ({\mathbf g}\cdot {\varvec{\rho }}+k)({\mathbf g}\cdot {\varvec{\rho }})}{\psi ({\varvec{\rho }},k)\chi ({\varvec{\rho }},k)} } \nonumber \\&\displaystyle +\,2\ln \psi ({\varvec{\rho }},k) \end{aligned}$$
(16)

on account of (11).

Grouping the terms, multiplying the quantity \(({\mathbf g}\cdot {\varvec{\rho }})\) in the previous expressions and recalling the definition of \(\psi \) in (12) one has

$$\begin{aligned} \text {div}[\ln \psi ({\varvec{\rho }},k){\varvec{\rho }}]&= \displaystyle { \frac{({\mathbf g}\cdot {\varvec{\rho }})\psi ({\varvec{\rho }},k) + {\varvec{\rho }}\cdot {\varvec{\rho }}}{\psi ({\varvec{\rho }},k)\chi ({\varvec{\rho }},k)} + 2\ln \psi ({\varvec{\rho }},k) } \nonumber \\ \!&= \! \displaystyle {\frac{{\mathbf g}\cdot {\varvec{\rho }}}{\chi ({\varvec{\rho }},k)} \!+\! \frac{{\varvec{\rho }}\cdot {\varvec{\rho }}}{\psi ({\varvec{\rho }},k)\chi ({\varvec{\rho }},k)} \!+\! 2\ln \psi ({\varvec{\rho }},k)}\nonumber \\ \end{aligned}$$
(17)

Let us now observe that

$$\begin{aligned} \displaystyle { \frac{{\varvec{\rho }}\cdot {\varvec{\rho }}}{\psi ({\varvec{\rho }},k)\chi ({\varvec{\rho }},k)} }&= \displaystyle { \frac{{\mathbf g}\cdot {\varvec{\rho }}+k - \chi ({\varvec{\rho }},k)}{({\mathbf g}\cdot {\varvec{\rho }}+k)^2-\chi ^2({\varvec{\rho }},k)} \frac{{\varvec{\rho }}\cdot {\varvec{\rho }}}{\chi ({\varvec{\rho }},k)} } \nonumber \\&= - \displaystyle { \frac{{\mathbf g}\cdot {\varvec{\rho }}+k}{\chi ({\varvec{\rho }},k)} + 1 } \end{aligned}$$
(18)

having multiplied the numerator and denominator of the ratio \({\varvec{\rho }}\cdot {\varvec{\rho }}/\psi ({\varvec{\rho }},k)\) by [\({\mathbf g}\cdot {\varvec{\rho }}+k - \chi ({\varvec{\rho }},k)\)].

Substituting the previous expression in (17) we finally get

$$\begin{aligned} \text {div}[\ln \psi ({\varvec{\rho }},k){\varvec{\rho }}] = \displaystyle { 1 - \frac{k}{\chi ({\varvec{\rho }},k)} + 2\ln \psi ({\varvec{\rho }},k) } \end{aligned}$$
(19)

Hence, according to Gauss theorem, Tang (2006), the first integral in (13) becomes

$$\begin{aligned} I_{\varLambda a}&= \displaystyle { -\frac{A_{\varLambda }}{2}+\frac{k}{2}J_{\varLambda a}+\frac{1}{2}K_{\varLambda a}} \nonumber \\&= \displaystyle { -\frac{A_{\varLambda }}{2}+\frac{k}{2}\int \limits _{\varLambda }\frac{dxdy}{\chi ({\varvec{\rho }},k)}+\frac{1}{2}\int \limits _{\partial \varLambda }[\ln \psi ({\varvec{\rho }},k)]({\varvec{\rho }}\cdot {\varvec{\nu }})ds } \end{aligned}$$
(20)

where \(A_{\varLambda }\) denotes the area of the triangle \(\varLambda \), \(\partial \varLambda \) the boundary of \(\varLambda \) and \({\varvec{\nu }}\) the relevant unit normal directed outwards.

The authors did not succeed in expressing the 2D integral on the right-hand side of the previous expression in terms of line integrals. For this reason we proceed to its analytical integration by making reference, to fix the ideas, to the integral associated with the triangular domain 1 in Fig. 2.

$$\begin{aligned} J_{\varLambda _1 a}=\int \limits _{\varLambda _1}\frac{dxdy}{\chi ({\varvec{\rho }},k)}= \int \limits _{x_1}^{x_2}\int \limits _{y_1}^{y(x)}\frac{dxdy}{\sqrt{x^2+y^2+(ux+vy+k)^2}} \end{aligned}$$
(21)

Performing the integration with respect to \(y\) and setting

$$\begin{aligned} G(x,y)= \frac{\ln [kv+uvx+y+v^2y+\sqrt{1+v^2}\chi ({\varvec{\rho }},k)]}{\sqrt{1+v^2}} \end{aligned}$$
(22)

one has:

$$\begin{aligned} J_{\varLambda _1 a}=\int \limits _{x_1}^{x_2}\Bigl .G(x,y)\Bigr |_{y={y_1}}^{y=mx+n} dx \end{aligned}$$
(23)

where \(y=mx+n\) is the equation of the line joining the points \(({x_1},{y_1})\) with \(({x_2},{y_2})\) in Fig. 2.

Setting

$$\begin{aligned} G_l(x)= G(x,mx+n) \end{aligned}$$
(24)

where the suffix \((\cdot )_l\) reminds of line, and

$$\begin{aligned} G_{y_1}(x)= G(x,{y_1}) \end{aligned}$$
(25)

one has

$$\begin{aligned} J_{\varLambda _1 a}=\int \limits _{x_1}^{x_2}G_l(x) dx - \int \limits _{x_1}^{x_2}G_{y_1}(x) dx = J_{\varLambda _1 a_1}-J_{\varLambda _1 a_2} \end{aligned}$$
(26)

The computation of the previous integrals hinges on the evaluation of \(I_{ln}\) in the Appendix 1 and turns out to be considerably simpler than the solution illustrated by Smith (2000).

The explicit expression of the integrands in (26) is reported hereafter for the reader’s convenience

$$\begin{aligned}&G_l(x)= \frac{1}{\sqrt{1+v^2}}\ln \left[ \frac{fx+g}{\sqrt{1+v^2}}+\sqrt{hx^2+2ix+j}\right] \nonumber \\ \end{aligned}$$
(27)
$$\begin{aligned}&G_{y_1}(x)= \frac{1}{\sqrt{1+v^2}}\ln \left[ \frac{px+q}{\sqrt{1+v^2}}+\sqrt{rx^2+2sx+t}\right] \nonumber \\ \end{aligned}$$
(28)

where it has been set

$$\begin{aligned}&f = uv+m(1+v^2) \nonumber \\&g = kv+n(1+v^2) \nonumber \\&h = m^2+1+(u+vm)^2 \nonumber \\&i = mn+(u+vm)(vn+k) \nonumber \\&j = n^2+(vn+k)^2 \end{aligned}$$
(29)

and

$$\begin{aligned}&p = uv \nonumber \\&q = kv + y_1(1+v^2) \nonumber \\&r = u^2+1 \nonumber \\&s = u(vy_1+k) \nonumber \\&t = y_1^2+ (vy_1+k)^2 \end{aligned}$$
(30)

It is worth noting that, coherently with the definitions of \(G_l(x)\) and \(G_{y_1}(x)\) in (24) and (25), the last set of relations is obtained by specializing the set (29) to the case \(m=0\) and \(n={y_1}\).

In conclusion the integral \(I_{\varLambda }\) in (13) associated with the triangle 1 in Fig. 2, and denoted in accordance as \(I_{\varLambda _1 a}\) henceforth, is given by

$$\begin{aligned} I_{\varLambda _1 a}=-\frac{({x_2}-{x_1})({y_2}-{y_1})}{2}+\frac{k}{2}J_{\varLambda _1 a}+\frac{1}{2}K_{\varLambda _1 a} \end{aligned}$$
(31)

where \(J_{\varLambda _1 a}\) is defined in (26), provided that the coefficients in (29) and (30) are evaluated as function of the values \(u_1,\,v_1\), \(k_1\) which define, according to (10), the top surface defined on \(\varLambda _1\) as \(u_1x+v_1y+k_1={\mathbf g}_1\cdot {\varvec{\rho }}+k_1\).

Furthermore

$$\begin{aligned} K_{\varLambda _1 a}=\int \limits _{\partial \varLambda _1}\ln [{\mathbf g}_1\cdot {\varvec{\rho }}+k_1+\chi ({\varvec{\rho }},k_1)]({\varvec{\rho }}\cdot {\varvec{\nu }})ds \end{aligned}$$
(32)

is evaluated in the Appendix 2.

3.1.2 Evaluation of the integral \(I_{\varLambda b}\) in (13)

In line of principle, the evaluation of \(I_{\varLambda b}\) could be simply obtained by specializing the expression (20) of \(I_{\varLambda a}\) to the case \({\mathbf g}={\mathbf o}\) and \(k=0\); actually, this implies \(\psi =\chi \) in (12) and makes the integrand function of \(I_{\varLambda a}\) coincide with that of \(I_{\varLambda b}\).

However, the integrand function appearing in the expression of \(I_{\varLambda a}\) is always non-singular being \({\mathbf g}\not ={\mathbf o}\) and \(k\not =0\). Conversely, the integrand function \(\ln \sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}}\) in \(I_{\varLambda b}\) can exhibit a singularity at \({\varvec{\rho }}={\mathbf o}\), a situation which is not taken into account in the expression (20) of \(I_{\varLambda a}\).

For this reason, we have exploited a different approach which is based on the use of a formula proved in Rosati and Marmo (2014). It entails the replacement of the original 2D integral with a line integral extended to the boundary of \(\varLambda \).

to make the paper reasonably self-contained we report hereafter the expression which is obtained by setting \(z=0\) in formulas (27) and (28) of Rosati and Marmo (2014)

$$\begin{aligned} I_{\varLambda b}&= \displaystyle { -\frac{A_{\varLambda }}{2}+ \alpha ({\mathbf o})+\frac{1}{2}K_{\varLambda b}} \nonumber \\&= \displaystyle { -\frac{A_{\varLambda }}{2}+\alpha ({\mathbf o})+\frac{1}{2}\int \limits _{\partial \varLambda }[\ln \sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}}] ({\varvec{\rho }}\cdot {\varvec{\nu }})ds } \end{aligned}$$
(33)

where \(\alpha ({\mathbf o})\) represents the angular measure, expressed in radians, of the intersection between \(\varLambda \) and a circular neighborhood of the singularity point \({\varvec{\rho }}={\mathbf o}\). Hence:

$$\begin{aligned} \alpha ({\mathbf o}) =\left\{ \begin{array}{l@{\quad }l} 0 &{} if \quad {\mathbf o}\not \in \overset{\circ }{\varLambda }\\ \pi &{} if \quad {\mathbf o}\in \overline{\partial \varLambda } \\ f(\pi ) &{} if \quad {\mathbf o}\in \partial \varLambda \backslash \overline{\partial \varLambda } \\ 2\pi &{} if \quad {\mathbf o}\in \overset{\circ }{\varLambda } \end{array} \right. \end{aligned}$$
(34)

where \(\overset{\circ }{\varLambda }\) denotes the interior of \(\varLambda \) and \(\overline{\partial \varLambda }\) the set of the regular points of the boundary \(\partial \varLambda \), i.e. the points at which the tangent is defined. When \(\varLambda \) is polygonal and the origin coincides with a vertex of \(\varLambda \), \(\alpha ({\mathbf o})\) simply measures the angle formed by the two consecutive sides of \(\partial \varLambda \) intersecting at the origin. A general algorithm for computing \(\alpha ({\mathbf o})\) can be found in D’Urso and Russo (2002).

It is interesting to compare the expression (33) with (20) to realize that the first and the third term, apart from the integrand function, on the right-hand side of both expressions do coincide.

Conversely the quantity \(\alpha ({\mathbf o})\) in (33) replaces the second term on the right-hand side of (20) since this last one becomes singular at \({\varvec{\rho }}={\mathbf o}\) when \({\mathbf g}={\mathbf o}\) and \(k=0\).

The third integral in (33) can be computed as shown in the Appendix 2.

3.1.3 Total potential of a DTM

Collecting the results provided in (31) and (33) the final expression of the integral \(I_{\varLambda _1}\) in (7) is given by

$$\begin{aligned} I_{\varLambda _1}=I_{\varLambda _1 a}-I_{\varLambda _1 b} \end{aligned}$$
(35)

The integral \(I_{\varLambda _2}\) in (7) can be analogously expressed as

$$\begin{aligned} I_{\varLambda _2}=I_{\varLambda _2 a}-I_{\varLambda _2 b} \end{aligned}$$
(36)

where according to (31),

$$\begin{aligned} I_{\varLambda _2 a}=-\frac{({x_2}-{x_1})({y_2}-{y_1})}{2}+\frac{k}{2}J_{\varLambda _2 a}+\frac{1}{2}K_{\varLambda _2 a} \end{aligned}$$
(37)

and \(K_{\varLambda _2 a}\) is defined as in (32) provided that \(\varLambda _1\) is replaced by \(\varLambda _2\) and reference is made to the parameters \(u_2,\,v_2,\,k_2\) which define, according to (10), the top surface defined on \(\varLambda _2\) as \(u_2x+v_2y+k_2={\mathbf g}_2\cdot {\varvec{\rho }}+k_2\).

Furthermore, recalling (20) and (22), it turns out

$$\begin{aligned} J_{\varLambda _2 a}&= \displaystyle { \int \limits _{\varLambda _2}\frac{dxdy}{\chi ({\varvec{\rho }},k_2)} = \int \limits _{x_1}^{x_2}\Bigl .G(x,y)\Bigr |_{y=mx+n}^{y={y_2}} dx } \nonumber \\&= \displaystyle { \int \limits _{x_1}^{x_2}G_{y_2}(x) dx - \int \limits _{x_1}^{x_2}G_{l}(x) dx = J_{\varLambda _2 a_1}-J_{\varLambda _2 a_2}} \nonumber \\&= \displaystyle { J_{\varLambda _2 a_1}-J_{\varLambda _1 a_1}} \end{aligned}$$
(38)

where \(G_{y_2}(x)\) is given by (28) provided that \(y_1\) in the expressions (30) is replaced by \(y_2\).

Analogously, recalling (33)

$$\begin{aligned} I_{\varLambda _j b}=\displaystyle { -\frac{({x_2}-{x_1})({y_2}-{y_1})}{2}+ \alpha ({\mathbf o})+\frac{1}{2} K_{\varLambda _j b} \quad j=1,2 } \end{aligned}$$
(39)

where \(K_{\varLambda _j b}\) is defined in (33); it can be computed as shown in formula (101) of Appendix 2.

In conclusion, recalling (57) and (3536), we finally have

$$\begin{aligned} U(P)&= G\delta \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (I_{\varLambda _1}^{(i)}+I_{\varLambda _2}^{(i)})} \nonumber \\&= G\delta \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (I_{\varLambda _1 a}^{(i)}-I_{\varLambda _1 b}^{(i)}+I_{\varLambda _2 a}^{(i)}--I_{\varLambda _2 b}^{(i)}) } \end{aligned}$$
(40)

where the integrals \(I_{\varLambda _1 a}\),\(I_{\varLambda _2 a}\) [\(I_{\varLambda _1 b}\)-\(I_{\varLambda _2 b}\)] are provided by (31), (37), (39).

3.2 Evaluation of the gravitational attraction for an element of a DTM

For a generic element of a DTM see, e.g., Fig. 2, the gradient of the potential in (2) can be expressed as

$$\begin{aligned} U_{,P}=- G\delta \sum \limits _{i=1}^{N_x *N_y} \varvec{\Gamma }_{\varTheta ^{(i)}} \end{aligned}$$
(41)

where

$$\begin{aligned} \varvec{\Gamma }_{\varTheta ^{(i)}}= \int \limits _{\varTheta ^{(i)}}\left[ \int \limits _0^{z_i(x,y)}\frac{{\mathbf r}dz}{({\mathbf r}\cdot {\mathbf r})^{3/2}}\right] dx \, dy \end{aligned}$$
(42)

Splitting the domain of integration into the two triangular sub-domains of Fig. 2 and omitting the suffix \((\cdot )^{(i)}\) for notational simplicity, the previous integral becomes

$$\begin{aligned} \varvec{\Gamma }_{\varTheta }&= \varvec{\Gamma }_{\varLambda _1}+\varvec{\Gamma }_{\varLambda _2}\nonumber \\&= \displaystyle { \int \limits _{\varLambda _1}\left[ \int \limits _0^{z_1(x,y)}\frac{{\mathbf r}dz}{({\mathbf r}\cdot {\mathbf r})^{3/2}}\right] dx \, dy } \nonumber \\&\quad + \displaystyle { \int \limits _{\varLambda _2}\left[ \int \limits _0^{z_2(x,y)}\frac{{\mathbf r}dz}{({\mathbf r}\cdot {\mathbf r})^{3/2}}\right] dx \, dy } \end{aligned}$$
(43)

where \(z_1(x,y)\) and \(z_2(x,y)\) have been defined in (7).

The gravitational attraction \((U_{,z})_\varTheta \), which is used to correct gravity measurements, is represented by the third component of the previous expression and reads

$$\begin{aligned} (U_{,z})_\varTheta&= \varvec{\Gamma }^z_{\varTheta }= \varvec{\Gamma }^z_{\varLambda _1}+\varvec{\Gamma }^z_{\varLambda _2}\nonumber \\&= \displaystyle { \int \limits _{\varLambda _1}\left[ \int \limits _0^{z_1(x,y)}\frac{z dz}{(x^2+y^2+z^2)^{3/2}}\right] dx \, dy } \nonumber \\&\quad + \displaystyle { \int \limits _{\varLambda _2}\left[ \int \limits _0^{z_2(x,y)}\frac{z dz}{(x^2+y^2+z^2)^{3/2}}\right] dx \, dy } \end{aligned}$$
(44)

while \(\varvec{\Gamma }^x_{\varTheta }\) and \(\varvec{\Gamma }^y_{\varTheta }\), are obtained by replacing the numerator with \(x\) and \(y\), respectively.

Due to the similarity of the integrals appearing in the expressions of \(\varvec{\Gamma }^x_{\varTheta }\), \(\varvec{\Gamma }^y_{\varTheta }\) and \(\varvec{\Gamma }^z_{\varTheta }\) we shall make reference to the integrals

$$\begin{aligned} \varvec{\Gamma }^x_{\varLambda }= \int \limits _{\varLambda }\left[ \int \limits _0^{ux+vy+k}\frac{x dz}{(x^2+y^2+z^2)^{3/2}}\right] dx \, dy \end{aligned}$$
(45)
$$\begin{aligned} \varvec{\Gamma }^y_{\varLambda }= \int \limits _{\varLambda }\left[ \int \limits _0^{ux+vy+k}\frac{y dz}{(x^2+y^2+z^2)^{3/2}}\right] dx \, dy \end{aligned}$$
(46)

and

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda }= \int \limits _{\varLambda }\left[ \int \limits _0^{ux+vy+k}\frac{z dz}{(x^2+y^2+z^2)^{3/2}}\right] dx \, dy \end{aligned}$$
(47)

extended to a generic triangular domain \(\varLambda \).

Performing the integrations with respect to \(z\) one obtains

$$\begin{aligned} \varvec{\Gamma }^x_{\varLambda }= \int \limits _{\varLambda }\frac{x z}{(x^2+y^2+z^2)^{1/2}}\Big |_{z=0}^{z=ux+vy+k} dx \, dy \end{aligned}$$
(48)
$$\begin{aligned} \varvec{\Gamma }^y_{\varLambda }= \int \limits _{\varLambda }\frac{y z}{(x^2+y^2+z^2)^{1/2}}\Big |_{z=0}^{z=ux+vy+k} dx \, dy \end{aligned}$$
(49)

and

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda }= - \int \limits _{\varLambda }\left[ \frac{1}{(x^2+y^2+z^2)^{1/2}}\right] _{z=0}^{z=ux+vy+k} dx \, dy \end{aligned}$$
(50)

The first two integrals cannot be computed analytically and will not be considered in the sequel.

Conversely, on account of (11), \(\varvec{\Gamma }^z_{\varLambda }\) becomes

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda }&= - \displaystyle { \int \limits _{\varLambda }\frac{dx \, dy}{\chi ({\varvec{\rho }},k)}+ \int \limits _{\varLambda }\frac{dx \, dy}{\sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}}} } \nonumber \\&= \displaystyle { - \varvec{\Gamma }^z_{\varLambda a}+\varvec{\Gamma }^z_{\varLambda b}} \end{aligned}$$
(51)

A comparison with (20) shows that

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda a}= J_{\varLambda a} \end{aligned}$$
(52)

while \(\varvec{\Gamma }^z_{\varLambda b}\) can be computed by means of formula (18) of D’Urso (2013a) in which the original 2D integral is replaced by a line integral.

Such a formula specializes to the case of interest as follows

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda b}= \int \limits _{\varLambda }\frac{dx \, dy}{\sqrt{{\varvec{\rho }}\cdot {\varvec{\rho }}}} = \int \limits _{\partial \varLambda }\frac{{\varvec{\rho }}(s)\cdot {\varvec{\nu }}(s)}{\sqrt{{\varvec{\rho }}(s)\cdot {\varvec{\rho }}(s)}} ds \end{aligned}$$
(53)

or, equivalently,

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda b}=\displaystyle { \sum \limits _{j=1}^{3} ({\varvec{\rho }}_j\cdot {\varvec{\nu }}_j) \int \limits _{{l}_{j}}\frac{ds_j}{\sqrt{{\varvec{\rho }}(s_j)\cdot {\varvec{\rho }}(s_j)}} } \end{aligned}$$
(54)

where \(l_j\) denotes the length of the \(j\)-th edge of \(\varLambda \), \({\varvec{\nu }}_j\) is the relevant unit normal pointing outwards and \({\varvec{\rho }}_j\) is the vector containing the coordinates of the \(j\)-th vertex of \(\varLambda \).

The reader is warned on the slight abuse of notation associated with the fact that the same suffix, i.e. \(j\), is used both for \({\varvec{\rho }}_j\), which denotes the position vector of the \(j-\)th vertex of \(\varLambda \), and for \({\varvec{\nu }}_j\) which is the (constant) unit vector orthogonal to the \(j-\)th edge, i.e. the edge connecting the vertices \(j\) and \(j+1\).

The unit normal \({\varvec{\nu }}_j\) is related to the position vectors \({\varvec{\rho }}_j\) and \({\varvec{\rho }}_{j+1}\) of the end vertices of the \(j\)-th edge by the following expression

$$\begin{aligned} {\varvec{\nu }}_j=\frac{({\varvec{\rho }}_{j+1}-{\varvec{\rho }}_j)^\perp }{l_j}=\frac{{\varvec{\rho }}_{j+1}^\perp -{\varvec{\rho }}_j^\perp }{l_j} \end{aligned}$$
(55)

where \((\cdot )^\bot \) stands for a vector orthogonal to \((\cdot )\), hence having the same length as \((\cdot )\). In particular, assuming a counter-clockwise orientation of the boundary of \(\varLambda \), \((\cdot )^\bot \) denotes a clockwise rotation of the vector \((\cdot )\); for instance, making reference to \({\varvec{\rho }}_i=(x_i,\,y_i)\) as an example, \({\varvec{\rho }}_{i}^\bot =(y_i, -x_{i})\).

For instance, for the triangle \(\varLambda _1\) in Fig. 2, it turns out

$$\begin{aligned} {\varvec{\rho }}_1 = \left[ \begin{array}{c} x_1\\ y_1 \end{array} \right] \quad {\varvec{\rho }}_2 = \left[ \begin{array}{c} x_2\\ y_1 \end{array} \right] \quad {\varvec{\rho }}_3 = \left[ \begin{array}{c} x_2\\ y_2 \end{array} \right] \end{aligned}$$
(56)

and

$$\begin{aligned} {\varvec{\rho }}_1^\perp = \left[ \begin{array}{c} y_1\\ -x_1 \end{array} \right] \quad {\varvec{\rho }}_2^\perp = \left[ \begin{array}{c} y_1\\ -x_2 \end{array} \right] \quad {\varvec{\rho }}_3^\perp = \left[ \begin{array}{c} y_2\\ -x_2 \end{array} \right] \end{aligned}$$
(57)

Introducing the adimensional abscissa \(\lambda _j=s_j/l_j\) along the \(j\)-th edge and adopting the following parameterization

$$\begin{aligned} {\varvec{\rho }}(\lambda _j) = {\varvec{\rho }}_j + \lambda _j({\varvec{\rho }}_{j+1}-{\varvec{\rho }}_j) \end{aligned}$$
(58)

the integral (54) becomes

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda b}&= \displaystyle { \sum \limits _{j=1}^{3} ({\varvec{\rho }}_j\cdot {\varvec{\rho }}_{j+1}^\perp ) \int _{0}^{1}\frac{d \lambda _j}{\sqrt{{\varvec{\rho }}(\lambda _j)\cdot {\varvec{\rho }}(\lambda _j)}} } \nonumber \\&= \displaystyle { \sum \limits _{j=1}^{3} ({\varvec{\rho }}_j\cdot {\varvec{\rho }}_{j+1}^\perp ) \int _{0}^{1}\frac{d \lambda _j}{\sqrt{\bar{a}\lambda _j^2 + 2 \bar{b}\lambda _j + \bar{c} }} } \end{aligned}$$
(59)

where

$$\begin{aligned}&\bar{a}_j= ({\varvec{\rho }}_{j+1}-{\varvec{\rho }}_j)\cdot ({\varvec{\rho }}_{j+1}-{\varvec{\rho }}_j) \nonumber \\&\bar{b}_j= {\varvec{\rho }}_j\cdot ({\varvec{\rho }}_{j+1}-{\varvec{\rho }}_j) \nonumber \\&\bar{c}_j= {\varvec{\rho }}_j\cdot {\varvec{\rho }}_j \end{aligned}$$
(60)

Being

$$\begin{aligned}&\displaystyle {\int {\frac{dx}{\sqrt{ax^2+2bx+c}}}} \nonumber \\&\quad =\displaystyle {\frac{1}{\sqrt{a}}\ln \Big [2\Big (ax+b+\sqrt{a}\sqrt{ax^2+2bx+c}\Big )\Big ]} \end{aligned}$$
(61)

and setting

$$\begin{aligned} LN^z_{jb}= \frac{1}{\sqrt{\bar{a}_j}}\ln \frac{\bar{a}_j +\bar{b}_j +\sqrt{\bar{a}_j}\sqrt{\bar{a}_j + 2\bar{b}_j +\bar{c}_j}}{\bar{b}_j +\sqrt{\bar{a_j}\bar{c}_j}} \end{aligned}$$
(62)

one finally has

$$\begin{aligned} \varvec{\Gamma }^z_{\varLambda b}=\displaystyle {\sum \limits _{j=1}^{3} ({\varvec{\rho }}_j\cdot {\varvec{\rho }}_{j+1}^\perp )LN^z_{jb}} \end{aligned}$$
(63)

The discussion on the well posedness of the previous expression can be carried out as in formulas (2426) of D’Urso (2014a). In particular, \(\bar{a}_j>0\) and

$$\begin{aligned} \bar{a}_j+2\bar{b}_j+\bar{c}_j= {\varvec{\rho }}_{j+1}\cdot {\varvec{\rho }}_{j+1} \end{aligned}$$
(64)

so that \(LN^z_{jb}\) becomes infinite if \({\varvec{\rho }}_{j+1}={\mathbf o}\) (\({\varvec{\rho }}_j={\mathbf o}\)) since \(\bar{a}_j+2\bar{b}_j+\bar{c}_j=0\) (\(\bar{b}_j=\bar{c}_j=0\)) in this case.

However, \(LN^z_{jb}\) is scaled by \({\varvec{\rho }}_j\cdot {\varvec{\rho }}_{j+1}^\perp \) in (63). Accordingly, denoting by \(\varepsilon \) either \(|{\varvec{\rho }}_i|\) or \(|{\varvec{\rho }}_{i+1}|\), the previous cases can be addressed by invoking the fundamental limit:

$$\begin{aligned} \lim _{\varepsilon \rightarrow 0} \varepsilon \ln \varepsilon =0 \end{aligned}$$
(65)

stemming from the property of the logarithm of being an infinite of arbitrarily low degree. Hence, the computation of \(LN^z_{jb}\) can be skipped when \({\varvec{\rho }}_j={\mathbf o}\) or \({\varvec{\rho }}_{j+1}={\mathbf o}\).

In conclusion, formulas (41), (44) and (51) yield

$$\begin{aligned} U_{,z}&= - G\delta \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (\varvec{\Gamma }_{\varLambda _1}^z+\varvec{\Gamma }_{\varLambda _2}^z)^{(i)} } \nonumber \\&= G\delta \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (\varvec{\Gamma }^z_{\varLambda _1 a}-\varvec{\Gamma }^z_{\varLambda _1 b}+\varvec{\Gamma }^z_{\varLambda _2 a}-\varvec{\Gamma }^z_{\varLambda _2 b})^{(i)} } \end{aligned}$$
(66)

where the suffix \((\cdot )^{(i)}\) means that the quantities in parentheses have to be computed for the \(i\)-th element of the DTM.

Recalling also (52) one finally has

$$\begin{aligned} U_{,z} = G\delta \sum \limits _{i=1}^{N_x *N_y} (J_{\varLambda _1 a}-\varvec{\Gamma }^z_{\varLambda _1 b}+J_{\varLambda _2 a}-\varvec{\Gamma }^z_{\varLambda _2 b})^{(i)} \end{aligned}$$
(67)

where \(J_{\varLambda _1 a}\) [\(J_{\varLambda _2 a}\)] are given by (26) [(38)] and \(\varvec{\Gamma }^z_{\varLambda _1 b}\) [\(\varvec{\Gamma }^z_{\varLambda _2 b}\)] are given by (63) provided that the coefficients \(\bar{a}_j\), \(\bar{b}_j\) and \(\bar{c}_j\) in the expression (62) of \(LN^z_{jb}\) are evaluated as function of the end vertices of \(\varLambda _1\) [\(\varLambda _2\)].

3.3 Hints for programming the enhanced Smith’s approach

According to the enhanced version of Smith’s approach formulated in the previous subsections, the potential and the gravitational attraction are obtained as sums extended to the rectangular elements of the DTM, see, e.g., formulas (40) and (67), respectively, of quantities related to the two triangles in which each rectangle is subdivided.

In turn, the quantities associated with each triangle are composed of two addends, one denoted by the suffix “\(a\)” and the other one by the suffix “\(b\)”.

It is apparent from formulas (13) and (51) that only quantities denoted by the suffix “\(a\)” depend upon the parameters \({\mathbf g}\) and \(k\) which define the top plane assigned over each triangle; actually, \({\mathbf g}\) and \(k\) enter the definition of the functions \(\chi \) in (11) and \(\psi \) in (12) which, in turn, appear in the expression of the first addend of (51) and (13), respectively.

Conversely, the second addend in (13) and (51) depend only upon the geometric quantity \({\varvec{\rho }}\) and both of them, as detailed in (33) and (54), are evaluated as function of boundary integrals.

This means that the contributions to the boundary integrals in \(I_{\varLambda b}\) and \(\varvec{\Gamma }_{\varLambda b}^z\), provided by the edge common to adjacent triangles, cancel out since the same edge is traversed in opposite directions when circulating along the boundary of the triangles sharing the edge, see, e.g., Fig. 3.

Accordingly, the boundary integrals appearing in the expression of \(I_{\varLambda b}\) and \(\varvec{\Gamma }_{\varLambda b}^z\) have to be computed only along the perimetrical edges of the DTM domain. In particular, the boundary integrals associated with edges characterized by the same normal, such those lying along the segments AB, BC, CD and DA can be grouped in a unique expression.

Fig. 3
figure 3

Outward unit normals to internal and perimetrical domains of the DTM

Thus, writing formulas (40) and (67) as

$$\begin{aligned} U(P) = G\delta \left[ \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (I_{\varLambda _1 a}^{(i)}+I_{\varLambda _2 a}^{(i)}) } \!-\! \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (I_{\varLambda _1 b}^{(i)}\!+\!I_{\varLambda _2 b}^{(i)}) } \right] \nonumber \\ \end{aligned}$$
(68)

and

$$\begin{aligned} U_{,z} \!=\! G\delta \left[ \sum \limits _{i=1}^{N_x *N_y} (J_{\varLambda _1 a}\!+\!J_{\varLambda _2 a})^{(i)} \!-\! \sum \limits _{i=1}^{N_x *N_y} (\varvec{\Gamma }^z_{\varLambda _1 b}\!+\!\varvec{\Gamma }^z_{\varLambda _2 b})^{(i)} \right] \nonumber \\ \end{aligned}$$
(69)

the second addend in the previous formulas can be specialized as follows.

Recalling (39) and (101) one has

$$\begin{aligned} \displaystyle { \sum \limits _{i=1}^{N_x *N_y} (I_{\varLambda _1 b}^{(i)}+I_{\varLambda _2 b}^{(i)}) }&= - \displaystyle { \frac{A_{ABCD}}{2} + \alpha ({\mathbf o}) } \nonumber \\&+\,\displaystyle {\frac{1}{2} \sum \limits _{j=1}^{4} ({\varvec{\rho }}_j\cdot {\varvec{\rho }}_{j+1}^\perp ) LN_{jb} } \end{aligned}$$
(70)

where \(LN_{jb}\) is defined in (102) and \(j\) refers to the four edges AB, BC, CD and DA in Fig. 3. Hence \({\varvec{\rho }}_1={\varvec{\rho }}_A\), \({\varvec{\rho }}_2={\varvec{\rho }}_B\), \({\varvec{\rho }}_3={\varvec{\rho }}_C\), \({\varvec{\rho }}_4={\varvec{\rho }}_D\).

The singularity correction \(\alpha ({\mathbf o})\) is now evaluated, according to D’Urso and Russo (2002), by checking the relative position of the point \({\varvec{\rho }}={\mathbf o}\) with respect to the bottom face of the DTM considered as a whole, rather than applying the algorithm for each triangle separately.

Furthermore, on account of (63), the second sum in (69) specializes as

$$\begin{aligned} \sum \limits _{i=1}^{N_x *N_y} (\varvec{\Gamma }^z_{\varLambda _1 b}+\varvec{\Gamma }^z_{\varLambda _2 b})^{(i)}= \displaystyle {\sum \limits _{j=1}^{4} ({\varvec{\rho }}_j\cdot {\varvec{\rho }}_{j+1}^\perp )LN^z_{jb}} \end{aligned}$$
(71)

where \(LN^z_{jb}\) is defined in (62) and the vectors \({\varvec{\rho }}_j\) have the same meaning as in (70).

Clearly, use of the last two formulas results in significant savings in computing time.

4 The approach by Tsoulis et al. (2003)

In a recent paper Tsoulis et al. (2003) have presented a modeling method of the surface relief which is particularly useful for DTMs since height data are assigned on a regularly sampled grid, usually of rectangular shape.

In a sense the approach by Tsoulis et al. (2003) represents an extension of the polyhedral one. Actually, the potential and its gradient are evaluated by means of surface integrals extended to the faces of each rectangular prism of the DTM.

All faces, apart from the top one, are polygonal and planar so that they have been addressed by Tsoulis et al. (2003) as boundary elements of a standard polyhedron.

Furthermore, to directly interpolate the height values assigned at the vertices of the rectangular base of the prism, see, e.g., Fig. 1, Tsoulis et al. (2003) have adopted a bilinear polynomial for the top surface.

Being non-planar, hence characterized by a non-constant unit normal, the integral extended to the top surface has been evaluated by Tsoulis et al. (2003) by performing a change of variables from the original surface to the \(x-y\) plane.

We report hereafter the basic elements of the paper by Tsoulis et al. (2003), using the same terminology, since two typographical errors were detected.

The bilinear surface defined on the rectangular base of the generic prism is assigned in the form

$$\begin{aligned} z=a_{00}+a_{10}x + a_{01}y + a_{11}xy \end{aligned}$$
(72)

where the coefficients \(a_{00},a_{10}, a_{01}, a_{11}\), which interpolate the known height values \(z_i\), \((i=1\ldots 4)\), assigned at the vertices of the rectangular base, are detailed in formula (8) of the paper by Tsoulis et al. (2003).

The contribution to the potential and to the gravitational attraction provided by the bilinear surface is given by

$$\begin{aligned} U_b=\frac{G\delta }{2}\int \limits _{x_1}^{x_2}\int \limits _{y_1}^{y_2}\frac{a_{00}- a_{11}xy}{l(x,y)}dydx \end{aligned}$$
(73)

and

$$\begin{aligned} (U_b)_{,z}=G\delta \int \limits _{x_1}^{x_2}\int \limits _{y_1}^{y_2}\frac{1}{l(x,y)}dydx \end{aligned}$$
(74)

where

$$\begin{aligned} l(x,y)=\sqrt{\alpha (x)+\beta (x)y+\gamma (x)y^2} \end{aligned}$$
(75)

and

$$\begin{aligned}&\alpha (x) = x^2+(a_{00}+a_{10}x)^2 \nonumber \\&\beta (x)= 2(a_{00}+a_{10}x)(a_{01}+a_{11}x) \\&\gamma (x) = 1 + (a_{01}+a_{11}x)^2\nonumber \end{aligned}$$
(76)

A first integration with respect to \(y\) yields in (73) and (74)

$$\begin{aligned} U_b&= \displaystyle { \frac{G\delta }{2}\int \limits _{x_1}^{x_2}\Big [\Bigl (a_{00}+ a_{11}x \frac{\beta (x)}{2\gamma (x)}\Bigr )F_1(x) } \nonumber \\&\qquad \qquad \quad \quad -a_{11}x F_2(x)\Big ] dx \end{aligned}$$
(77)

and

$$\begin{aligned} (U_b)_{,z}=G\delta \int \limits _{x_1}^{x_2}F_1(x)dx \end{aligned}$$
(78)

where

$$\begin{aligned} F_1(x)=\frac{1}{\sqrt{\gamma (x)}}\ln \frac{2\sqrt{\gamma (x)}\sqrt{l(x,{y_2})}+2\gamma (x){y_2}+\beta (x)}{2\sqrt{\gamma (x)}\sqrt{l(x,{y_1})}+2\gamma (x){y_1}+\beta (x)} \end{aligned}$$
(79)

and

$$\begin{aligned} F_2(x)=\frac{l(x,{y_2})-l(x,{y_1})}{\gamma (x)} \end{aligned}$$
(80)
Fig. 4
figure 4

DTM of an area near Cassino (Italy)

The reader is warned on the square root appearing in the factor \(1/\sqrt{\gamma (x)}\) multiplying the \(\ln \) function in (79). Actually, due to typographical errors, it was missing in two formulas of the original paper by Tsoulis et al. (2003).

Differently from the quoted paper where it is adopted a numerical integration based on a Simpson’s rule, the integrals (77) and (78) are evaluated here by a Gauss quadrature rule. Numerical experiments have shown that a 4-point rule is sufficient for accuracy.

To provide a further element of validation for the computational burden of the procedures illustrated thus far, the integrals in (73) and (74) have been numerically evaluated by means of a 2D Gauss quadrature scheme. In this case, \(9\times 9\) sampling points have been used for the bilinear surface while the polyhedral approach has been adopted for the additional faces of the prism. The results are reported in the following section.

5 Numerical examples

The formulas presented in the previous sections have been implemented in Matlab\(^{\circledR }\) (2012) to comparatively assess the effectiveness of the different approaches for computing the potential and the gravitational attraction of the mass distribution originated by a DTM.

Several numerical examples were carried out on different DTMs to thoroughly check the robustness of the computer code. In particular for each DTM, we have compared the values of the potential and of the gravitational attraction by adopting the enhanced version of Smith’s approach illustrated in Sect. 3, the polyhedral approach presented in (D’Urso 2013a, 2014a), the approach by Tsoulis et al. (2003) and the numerical evaluation of integrals (73) and (74) based on a 2D Gauss quadrature rule.

With reference to the polyhedral approach, which has not been explicitly dealt with in the previous sections, the following considerations are in order.

The evaluation of the surface integrals has to be extended to the top and to the bottom triangular domains as well as to the vertical quadrilateral element lying only along the outer boundary of the DTM.

However, the vertical faces lying along the boundary common to internal domains give an overall null contribution both to the potential and to the gravitational attraction since, for each internal boundary, the same vertical quadrilateral element, belonging to two adjacent prisms, is characterized by outward unit normals opposite in sign.

The same does happen for the bottom face of the DTM with reference to the internal common boundary of the triangular domains. This is schematically illustrated in Fig. 3.

The same considerations do apply to the approach detailed in Tsoulis et al. (2003) apart from the obvious modifications that integrals pertaining to the top and bottom surface of the DTM refer to rectangular domains.

For each DTM considered in the validation tests which have been carried out, the position of the observation point has been considered in a two-fold manner. First, the point has been placed arbitrarily within the domain; second, it has been assumed to coincide with the vertices of a regular grid obtained by dividing the edges of the DTM by multiples of two.

Independently from the position of the observation point, the same accuracy of the numerical results was achieved for all the examined DTM’s. For this reason, we have decided to summarize in Table 1 the computational features of the results which have been obtained with reference to a generic DTM, namely the densely sampled one illustrated in Figs. 4 and 5.

Fig. 5
figure 5

3D view of the DTM

Table 1 Values of the potential and of the gravitational attraction for the DTM in Fig. 4

The DTM is composed of 500 \(\times \) 500 compartments, each having a dimension of 20 \(\times \) 20 m, or, equivalently, by 501 \(\times \) 501 points. It has been purchased by the IGM, i.e. the Italian organization for Military Geographical Institute.

The results reported in Table 1 refer to the points \(P_1\ldots P_5\) in Fig. 4 and have been obtained by running the Matlab program on a INTEL CORE2 PC with 16Gb of RAM and a i7-4700HQ CPU having clock speed of 2,40 GHz. Points \(P_1\ldots P_5\) have zero vertical height while the values of the constants are \(G = 6.67259 \, 10^{-11}\, \mathrm{m^3 \, kg^{-1} \, s^{-2}}\) and \(\delta =2{,}670\) \(\mathrm{kg\, m}^{-3}\).

It is worth noting that the first two columns in Table 1 refer to analytical methods based on linear (triangular) surfaces while the last two columns report, in turn, the results of a mixed (analytical/numerical) and a purely numerical method which adopt bilinear (rectangular) surfaces.

This means that the mass distribution is similar for the first two methods, which are both rigorous, and slightly different from that adopted in the last two methods.

Accordingly, the results of the first two methods do coincide to within round-off errors which are in the order of \(10^{-11}\) for the potential and \(10^{-15}\) for the gravitational attraction. For this reason decimal digits common to the results in the first two columns have been printed in boldface.

Both for \(U\) and \(U_{,z}\) the analytical results exhibit a greater accuracy with respect to mixed or purely numerical values. In particular the results by Tsoulis et al. (2003) exhibit differences to the first two columns in an order ranging from \(10^{-6}\) to \(10^{-8}\) in geoid height and from \(10^{-9}\) to \(10^{-11}\) in gravity. This has been emphasized by printing in bold italic the digits in the third column which are equal to the corresponding result in the first two columns.

In any case the results of all methods exhibit very high accuracy as they agree within the micrometer geoid level or sub-microgal gravity level. Even the differences between linear (triangular) and bilinear (rectangular) surfaces are negligible.

Times associated with each analysis have been reported in Table 1. Clearly they have to be intended in a relative sense, i.e. just to give a comparative idea of the computational cost of each approach by taking also into account that, for some of them, the computational burden depends on the way in which they have been coded.

For instance, computing times associated with the polyhedral approach and that by Tsoulis et al. (2003) depend on how the code handles each polyhedron of the DTM in terms of unit normals, common faces to adjacent polyhedrons and so on.

In particular, to conveniently account for the high number of polyhedrons which typically constitute a DTM, each polyhedron has been processed singularly. Consequently, several logical tests need to be performed on the faces of each polyhedron to avoid useless computations on the vertical faces common to adjacent polyhedrons and on the faces belonging to the base.

The converse approach in polyhedral modeling of the DTM has also been exploited, i.e. each face of the polyhedron has been processed in the same way independently from the fact that it is shared by two adjacent polyhedrons. However, this considerably increases computing times and deteriorates accuracy due to accumulation of round-off errors.

The necessity of processing two top surfaces for each compartment of the DTM in the linear surface representation of the polyhedral approach justifies computing times which are almost twice as the ones which characterize the method by Tsoulis et al. (2003) in which one bilinear surface for each compartment is considered.

In conclusion, times reported in Table 1 should be considered as preliminary results also on account of the fact that they have been obtained using Matlab, i.e. an interpreted programming language.

Nevertheless, we remark that the substantial difference in terms of computing times between analytical and numerical methods has been already experienced by Smith (2000), see comments after formula (27) of this paper.

To provide a further insight on the computational burden of the approaches which have been implemented, we provide hereafter some additional information which can be useful for future comparisons with alternative procedures.

First, we remind once more that a 1D numerical integration is required in the approach contributed by Tsoulis et al. (2003) and that the results reported in the third column of Table 1 have been obtained by adopting a 4-point Gauss quadrature. Actually, the adoption of the Simpson’s rule, advocated by Tsoulis et al. (2003), resulted in computer times three times greater than those pertaining to the enhanced Smith’s approach contributed in the present paper.

The number of Gauss points adopted to derive the results reported in the third column of Table 1 has been chosen as a reasonable compromise between computational cost and numerical accuracy of the final result. Actually, numerical experiments, not documented here for brevity, have shown that, apart from exceptional cases, the use of 3 or 2 Gauss points does not substantially modify the final result and the computational burden.

Finally, 2D numerical integration has been adopted to derive the results reported in the last column of Table 1. The high number of Gauss points, i.e. 9 \(\times \) 9, has been motivated by the will of obtaining results with a numerical accuracy comparable with that which characterizes the approach by Tsoulis et al. (2003). However, if comparison is made with the present approach and with the polyhedral one, a 3 \(\times \) 3 quadrature rule suffices and the computational burden halves.

As a final remark it is not superfluous to point out that, besides the algorithm, the accuracy and efficiency of approaches for modeling the potential and gravitational attraction depend on grid resolution and extent, available terrain data and how the chosen interpolation surface, either linear or bilinear, fits the real topography.

6 Conclusions

The analytical formula contributed by Smith (2000) for computing the gravitational attraction of a general vertical prism with \(N+1\) faces, \(N\) being the number of bottom and vertical faces, has been enhanced in this paper by proposing a more efficient evaluation of the 2D integral considered by Smith.

It has been obtained by substituting Smith’s integral with a line integral, for which closed-form evaluation has been contributed elsewhere, and a new 2D integral for which analytical integration is carried in a considerably simpler way than that proposed in Smith (2000).

The same approach has been also applied to evaluate the potential of vertical prisms with included top surface, an issue not addressed by Smith (2000).

The formulas derived in the paper have been coded in a Matlab\(^{\textregistered }\) program, which is available upon request, to compare their computational burden with that pertaining to alternative analytical methods, namely the fully polyhedral approach contributed in (D’Urso 2013a, 2014a), the analytical–numerical method proposed by Tsoulis et al. (2003) and an alternative one in which the surface integral extended to the bilinear surface assumed in Tsoulis et al. (2003) is evaluated by a 2D Gauss quadrature rule.

Numerical tests carried out on several DTMs, and only partly documented in the paper, have shown that, assuming the same level of accuracy in the final result, the proposed approach is, on a average, 20 \(\%\) faster than the method proposed by Tsoulis et al. (2003), three times faster than the polyhedral approach by (D’Urso 2013a, 2014a) and five times faster than the method which adopt a Gauss quadrature rule for the bilinear top surface of the prism.

However, it has to be pointed out that the previous percentages in terms of computing times strongly depend on the hardware specifications and programming skill, notwithstanding that, in any case, the enhanced version of Smith’s approach contributed in the paper is always faster with respect to the alternative approaches.