7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
1/36
Gravity gradient tensor of a finite line
of mass of arbitrary orientation
Mark GettingsU.S. Geological Survey, 520 N. Park Ave. Rm 355
Tucson, AZ 85719, USA.([email protected])
1 Abstract
Analytical expressions for the gravitational attraction and gravity gradienttensor are given for a model consisting of a finite length line of mass of ar-bitrary orientation. The expressions are valid for all points outside the lineof mass. Expressions for the tensor magnitude and three standard invariantsof a 3x3 tensor are also given. Fortran code to evaluate the gravitational at-traction, the gravity gradient tensor, tensor magnitude, tensor invarients, andtensor eigenvalues and eigenvectors for an xyz grid of field points is listed in anappendix. For the example presented, the tensor magnitude and second tensorinvariant are essentially mirror images of each other, and the third tensor invari-ant is useful for defining the location of the line of mass. The model is useful for
studying the gravitational effects of approximately linear mass concentrations,tunnels, and off-axis gravitational effects of cylinders.
2 Introduction
There is a continuing interest in gravity gradiometry from several areas ofinterest, especially mineral exploration geophysics and tunnel detection. Con-tinuing efforts in airborne gravity gradiometry in mineral exploration has ledto steady improvements in instrumentation [Lee, 2001; Dransfield et al., 2001;Hinks et al., 2004; DiFrancesco et al., 2008] and analysis techniques [Mickus andHinojosa, 2001; Li, 2001; Heath et al., 2005; Saad, 2006; Murphy, 2007]. In-terest in tunnel and underground void detection [Romaides et al., 2001; Maier,2002] is increasing due to the renewed efforts at border security. Previous modelstudies have focused on a point source [Maier, 2002], a horizontal line of massof fixed or infinite length [Romaides et al., 2001], or using voxels computed fromthe gravitational effects of right rectangular prisms [Montana et al., 1992]. Thevoxel model is very flexible but requires computation of very large numbers ofvoxels for realistic models [Heath et al., 2005]. For some modeling problems, itwould be convenient to have an analytic model of a line of mass of arbitrary
1
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
2/36
orientation in order to model effects such as a dipping shaft, the off-axis gravity
field of a cylinder, or any approximately linear density contrast.
In this report, a model for the gravitational attraction and gravity gradi-ent tensor of a finite length line of mass of arbitrary orientation is presentedalong with computer code for routine calculation. Expressions for some invari-ant quantities of the gradient tensor (quantities that are constant regardless ofthe coordinate system) are also given in order to develop exploration schemesindependent of the orientation of the target body. As shown by both Romaideset al. [2001] and Maier [2002], the effects for typical underground tunnels orstructures is quite small and either very low level airborne or ground basedmeasurements are required for detection. Moreover, geologic noise due to localgeologic variations are of the same order or larger in amplitude [Heath et al.,2005; Dransfield et al., 2001; Murphy, 2007]. If a grid of observations is available,a pattern recognition algorithm would be the most reliable form of detection.In the case of profile only data, detection is more difficult, and is the subject ofongoing research.
3 The potential
The line of mass is taken along the x-axis extending from L to L in a right-handed coordinate system (Fig. 1). The body vector r0 is (, 0, 0) (along thex-axis) and the position vector for the observation point in the line of masssystem is r = (x,y,z). The line of mass has density/unit length of and G isthe universal constant of gravitation. The gravitational potential is then [Grantand West, 1965]
U(r ) =
LL
Gd(x )2 + y2 + z2
(1)
and thus
U(r )
G= ln[
L x +
(L x)2 + y2 + z2
L x +
(L + x)2 + y2 + z2] (2)
4 Gravity vector
The gravity vector components were calculated both manually and usingthe differentiation and simplification features of Mathematica 5.1 [Wolfram Re-search, 2004] in order to insure there were no errors.
1
G
U(r )
x=
1(L x)2 + y2 + z2
+1
(L + x)2 + y2 + z2(3)
2
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
3/36
Figure 1: Geometry of the finite line of mass in the body-centered system
1
G
U(r )
y=
y
y2 + z2(x(
1(L x)2 + y2 + z2
+1
(L + x)2 + y2 + z2)+
L(1
(L x)
2
+ y2
+ z2
+1
(L + x)
2
+ y2
+ z2
))
(4)
1
G
U(r )
z=
z
y2 + z2(x(
1(L x)2 + y2 + z2
+1
(L + x)2 + y2 + z2)+
L(1
(L x)2 + y2 + z2+
1(L + x)2 + y2 + z2
))
(5)
5 Gravity gradient tensor components
The algebra involved in calculating the tensor components is tedious thoughstraightforward; one component was calculated both manually and using Math-ematica 5.1. The remaining components were calculated with Mathematica 5.1and some final simplification and factoring was done manually.
1
G
2U(r )
xy=
y
((L x)2 + y2 + z2)3/2
y
((L + x)2 + y2 + z2)3/2(6)
3
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
4/36
1G
2U(r )xz
= z((L x)2 + y2 + z2)3/2
z((L + x)2 + y2 + z2)3/2
(7)
1
G
2U(r )
yz=
1
(y2 + z2)2(yz(
(L x)(y2 + z2)
((L x)2 + y2 + z2)3/2+
2(L x)(L x)2 + y2 + z2
+
(L + x)(y2 + z2)
((L + x)2 + y2 + z2)3/2+
2(L + x)(L + x)2 + y2 + z2
))
(8)
1
G
2U(r )
x2 =(L x)
((L x)2 + y2 + z2)3/2 (L + x)
((L + x)2 + y2 + z2)3/2 (9)
1
G
2U(r )
y2=
1
(y2 + z2)2(
(L x)y2(y2 + z2)
((L x)2 + y2 + z2)3/2+
(y2 z2)(L x)(L x)2 + y2 + z2
+
y2(y2 + z2)(L + x)
((L + x)2 + y2 + z2)3/2+
(L + x)(y2 z2)(L + x)2 + y2 + z2
)
(10)
1
G
2U(r )
z2
=1
(y2
+ z2
)2
(z2(y2 + z2)(L x)
((L x)2
+ y2
+ z2
)3/2
(L x)(z2 y2)(L x)
2
+ y2
+ z2
+
z2(y2 + z2)(L + x)
((L + x)2 + y2 + z2)3/2+
(L + x)(z2 y2)(L + x)2 + y2 + z2
)
(11)
6 Coordinate transformations
The above expressions were derived in the body-centered system with the lineof mass centered along the x-axis (Fig. 1). To use the formulae in general, weneed to define the coordinate transformation between the field or Earth systemand the body-centered system (Fig. 2). Right-handed coordinate systems wereassumed for this study. A north-east-down (positive x, y, and z directions) was
used for the field system, and the line of mass lies along the x axis centered atthe (x, y, z) body-centered system origin, as above. We have that
x = A(x x0) (12)
where x is the position vector ofP(x,y,z) in the field system, x0 is the positionvector in the field system of the origin of the (x, y, z) system (center of the
4
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
5/36
line of mass), andx is the position vector of the point P in the body-centered
system. The angle is the angle between the +x direction and the projection ofthe +x axis on the xy plane, measured counterclockwise from north (xaxis).The angle is the dip of the +x axis relative to the xy plane measured positivecounterclockwise in the xz plane (Fig. 2). Thus a horizontal line of mass wouldhave a of zero and a strike of , and a vertical line of mass would have a of 90. In the vertical case, is not defined and taken as zero. The rotationmatrix A thus defined is independent of the observation point and is unchangedfor all observations of a given source. It is given by
A =
cos cos cos sin sinsin cos 0
sin cos sin sin cos
(13)
and the inverse transformation matrix A1 is given by the transpose
A1 = At (14)
The calculation therefore proceeds with the following steps for each observa-tion (field) point:
1. Transform the field point coordinates P(x,y,z) to the body-centered sys-
tem (x, y, z) withx = A(x x0)
2. Calculate the three gravitation vector componentsg (equations 3-5 above)
and the six gradient tensor components (equations 6-11 above) and formthe gradient tensor g.
3. Transform back to the field system using [Butkov, 1968; Spiegel, 1959]g = Atg and g = AtgA to obtain the desired gravity vector and
gravity gradient tensor.
These formulae are exact outside the body for any geometry symmetric aboutthe x axis, for example a circular tunnel or rod, with the density per unit length appropriately calculated (R2 for a circular cross section of density andradius R, etc.) Example applications are a dipping tunnel and off-axis gravityeffects of a buried vertical cylinder or shaft.
The gravity gradient tensor components all depend on the coordinate systemand the orientation of the line of mass relative to it. It is thus useful to calculatequantities that are invariant with regard to the coordinate system for some stud-
ies. The quantities that are typically calculated include the tensor magnitude,the three tensor invariants, and the eigenvalues and associated eigenvectors ofthe tensor. The tensor magnitude for a tensor Tij is given by the square root ofhalf the tensor double dot product [Dutton, 2002; Anonymous, 2001]
| Tij |=
1
2
i
j
T2ij (15)
5
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
6/36
Figure 2: Geometry of the field (right-handed (x,y,z); e.g. north-east-down) andbody-centered coordinate systems (x,y,z). P(x,y,z) is the observation point,
and the blue line shows the finite line of mass. The orientation of the line ofmass is specified by a strike and a dip in the fieldpoint system. The symbol x means parallel to the x-axis.
6
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
7/36
The three standard invariants for a 33 tensor are [Wikipedia, 2008; Zhukov
et al., undated] Ig = gxx + gyy + gzz (16)
IIg = gxxgyy + gyygzz + gzzgxx g2
xy g2
yz g2
xz (17)
andIIIg = det (g) (18)
Ig is identically zero for a gravitational field in free space by virtue of Laplacesequation.
In addition, it is useful to compute the eigenvalues and eigenvectors whichcan be used for principal components analysis, trends analysis and other schemesin modeling. A computer code was written to compute the quantities defined
above and is given in the appendix. Eignvalues and eigenvectors were computedusing the open-source subroutine library described by Kopp [2008].
7 Example of a dipping line of mass
As an example, the vertical gravity component and gradient tensor magnitudeand invariants for a line of mass 30m long striking 60 east of north and dipping30 to the northeast are shown in figures 3-6. The model was computed atthe nodes of a 5 m grid extending 100m north-south and 150 m east west withmeasurements made at an altitude of 1m above the ground. The center of theline of mass is at 50 m north and 75 m east, at a depth of 7.5 m. The southwestend of the line of mass just reaches the surface. For this model, the linear
density was 6283 kg/m corresponding to a 1m radius line with a density of 2000kg/m3.
Examination of Fig. 4 and Fig. 5 shows that the tensor magnitude andsecond tensor invariant are essentially mirror images of each other; the tensormagnitude extends over the map to larger distances from the source line thanthe second tensor invariant resulting in a slightly larger map area of the tensormagnitude. The third tensor invariant (Fig.6) contains negative lobes off theends of the mass line that might be helpful in estimating the location of theends of the mass line, particularly the shallow end. This invariant is also morelocal in its positive signature near the mass line than the other two measures(Figs. 4 and 5), with steeper gradients and a more restricted map area about the
source. This sharper anomaly shape of the third tensor invariant could make itmore useful in identifying the mass line location in a noisy environment. Murphy[2007] has shown the utility of two invarients of the horizontal components of thegradient tensor in mineral and hydrocarbon exploration using airborne gravitygradiometer data.
7
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
8/36
Figure 3: Gravity effect (z-component of the gravity vector) of a finite line ofmass striking 60 east of north and dipping 30 to NE. Bold black line is theprojection of the line of mass on the surface. Line of mass is at the surface onthe southeast end and the observation plane is 1m above the surface. Contourinterval is 0.0002 mgal.
8
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
9/36
Figure 4: Tensor magnitude (equation 15) of a finite line of mass striking 60
east of north and dipping 30 to NE. Bold black line is the projection of theline of mass on the surface. Line of mass is at the surface on the southeast endand the observation plane is 1m above the surface. Contour inerval is 20 Eotvos
units
9
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
10/36
Figure 5: The second tensor invariant (equation 17) of a finite line of massstriking 60 east of north and dipping 30 to NE. Bold black line is the projectionof the line of mass on the surface. Line of mass is at the surface on the southeastend and the observation plane is 1m above the surface. Contour interval is 20,000
Eotvos2
.
10
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
11/36
Figure 6: Third tensor invariant (equation 18) of a finite line of mass striking60 east of north and dipping 30 to NE. Bold black line is the projection of theline of mass on the surface. Line of mass is at the surface on the southeast endand the observation plane is 1m above the surface. Contour interval is 100,000
Eotvos3
.
11
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
12/36
8 Acknowledgments
The author thanks Jeff Phillips and Jeff Wynn of the U.S. Geological Surveyfor helpful reviews of the manuscript. Publication of this report was approvedby the Director, U.S. Geological Survey.
References
Anonymous, Vector and tensor mathematics, [Onlinewww.polymerprocessing.com/notes/root92a.pdf; accessed 6-November-2008], 2001.
Butkov, E., Mathematical Physics, Addison Wesley Publishing Co., 735 p., 1968.
DiFrancesco, D., D. Kaputa, and T. Meyer, Gravity gradiometer systems; ad-vances and challenges, Preview, 133, 3036, 39, 2008.
Dransfield, M. H., A. N. Christensen, M. Rose, P. M. Stone, and P. Diorio, FAL-CON test results from the Bathurst Mining camp, Exploration Geophysics,32(3-4), 243246, 2001.
Dutton, J. A., The Ceaseless Wind: An Introduction to the Theory of Atmo-spheric Motion, Courier Dover Publications, 2002.
Grant, F. S., and G. F. West, Interpretation Theory in Applied Geophysics,McGraw-Hill Book Company, 583 pp., 1965.
Heath, P. J., S. Greenhalgh, and N. G. Direen, Modelling gravity and magnetic
gradient tensor responses for exploration within the regolith, Exploration Geo-physics, 36(4), 357364, 2005.
Hinks, D., S. McIntosh, and R. Lane, A comparison of the FALCON andAir-FTG airborne gravity gradiometer systems at the kokong test block,botswana, in Airborne gravity 2004- Abstracts from the ASEG-PESA air-borne gravity 2004 workshop, edited by R. Lane, pp. 125134, GeoscienceAustralia Record 2004/18, 2004.
Kopp, J., Efficient numerical diagonalization of hermitian 3x3 matrices, Inter-national Journal of Modern Physics C, 19, 523548, 2008.
Lee, J. B., FALCON gravity gradiometer technology, Exploration Geophysics,
32(3-4), 247250, 2001.Li, X., Vertical resolution; gravity versus vertical gravity gradient, The Leading
Edge, 20(8), 901904, 2001.
Maier, M. W., Underground structures and gravity gradiometry, Tech. Rep.ADA400252, AEROSPACE CORP EL SEGUNDO CA RECONNAISSANCESYSTEMS DIV, 2002.
12
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
13/36
Mickus, K. L., and J. H. Hinojosa, The complete gravity gradient tensor derived
from the vertical component of gravity; a fourier transform technique, Journalof Applied Geophysics, 46(3), 159174, 2001.
Montana, C. J., K. L. Mickus, and W. J. Peeples, Program to calculate thegravitational field and gravity gradient tensor resulting from a system of rightrectangular prisms, Computers and Geosciences, 18(5), 587602, 1992.
Murphy, C. A., Interpreting FTG gravity data using horizontal tensor compo-nents, EGM 2007 International Workshop - Innovation in EM, Grav and MagMethods: a new perspective for exploration, Capri, Italy, April 2007, 2007.
Romaides, A. J., J. C. Battis, R. W. Sands, A. Zorn, D. O. B. Jr., and D. J.DiFrancesco, A comparison of gravimetric techniques for measuring subsur-face void signals, J. Phys. D: Appl. Phys., 34, 433443, 2001.
Saad, A. H., Understanding gravity gradients; a tutorial, The Leading Edge,25(8), 942949, 2006.
Spiegel, M. R., Vector Analysis and an Introduction to Tensor Analysis,Schaums Outline Series, McGraw-Hill Book Co., 225 p., 1959.
Wikipedia, Invariants of tensors wikipedia, the free encyclopedia, [Online;accessed 20-November-2008], 2008.
Wolfram Research, Mathematica, version 5.1 ed., Wolfram Research, Inc.,Champaign, Illinois, 2004.
Zhukov, L., K. Museth, D. Breen, R. Whitaker, and A. H. Barr, Tensor invari-
ants for modeling and segmentation of diffusion weighted MRI data, depart-ment of Computer Science,California Institute of Technology, undated.
Appendix - Fortran computer code
c Main program module and all associated subroutines
c Calculate gravity vector and gravity gradient tensor
c for a finite line of mass of arbitrary orientation
c MEG/Sep08; Nov 08 add invariants and eigen vals/vecs;
c and output file single ascii lines
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may containc bugs that have not been identified
c
real*4 a(9),ai(9),x(3),xp(3),x0(3),theta,phi,hl,lamda
real*4 strike, dip, xin(3), g(3), gp(3), gmn(9), gmnp(9)
real*4 Gcons, tmag, tinvar(3), teval(3), tevec(3,3)
real*4 unitsg, unitst
13
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
14/36
character qu*80,qr*1,dflt1*1,fnam1*80,df80*80,fmt*80,fnam2*80
character(8) datecharacter(10) time
logical verify
ittin=5
ittout=6
io1 = 10
io2 = 11
verify=.false.
Gcons = 6.674e-11
call date_and_time(DATE=date,TIME=time)
c
c get line of mass parameters, filenames, set up transform matrices
c
write(ittout,200)200 format(Enter line of mass parameters, units m, degrees,,
1 kg/m**3)
qu=Enter x0:
call ttinr4(qu,x0(1),-999.,ittin,ittout,verify)
if(x(1).le.-999.) go to 900
qu=Enter y0:
call ttinr4(qu,x0(2),-999.,ittin,ittout,verify)
qu=Enter z0:
call ttinr4(qu,x0(3),-999.,ittin,ittout,verify)
qu=Enter strike(deg CL off N, 0-360)[0]:
call ttinr4(qu,strike,0.,ittin,ittout,verify)
theta = 360. - strikequ=Enter dip(deg, + down, -90 to 90)[0]:
call ttinr4(qu,dip,0.,ittin,ittout,verify)
phi = -dip
call matfrm(1,theta,phi,a)
call mattra(a,ai,3,3)
qu=Enter half length of line of mass(m)[10]:
call ttinr4(qu,hl,10.,ittin,ittout,verify)
qu=Enter lamda (density/unit length kg/m)[1000]:
call ttinr4(qu,lamda,1000.,ittin,ittout,verify)
qu=Enter 1 for mks, 2 for mgal,eotvos, 3 for gu,SI units[1]:
call ttini4(qu,iunit, 1, ittin, ittout, verify)
if(iunit.eq.1) then
unitsg=1.0
unitst=1.0
elseif(iunit.eq.2) then
unitsg=1.0e5
unitst=1.0e9
elseif(iunit.eq.3) then
unitsg=1.0e6
14
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
15/36
unitst=1.0e9
endifqu=Filename of field point coordinates (
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
16/36
220 format(body system:,0pf10.1,1p4e11.3)
cc transform g back to fieldpoint system
c
call matmul(ai,gp,g,3,3,1)
c
c gradient tensor transform to fieldpoint system
c use loop 52 to mult g by G*lamda
c
c write(io2,222) (g(k),k=1,3)
222 format(>>>,1p3e11.3)
do 52 jc=1,3
g(jc) = g(jc)*Gcons*lamda*unitsg
52 continue
call matmul(ai,gmnp,gmn,3,3,3)call matmul(gmn,a,gmnp,3,3,3)
do 58 jr=1,9
gmn(jr) = gmnp(jr)*Gcons*lamda*unitst
58 continue
c
c calculate tensor invariants, eigenvalues and eigenvectors
c
call tinvar3x3(gmn, tmag, tinvar, teval, tevec)
c
c output to io2
c
write(io2, 210) xin,g,gmn(1),gmn(5),gmn(9),gmn(4),gmn(7),1 gmn(8),tmag,tinvar,teval,((tevec(i,j),i=1,3),j=1,3)
210 format(1p28e11.3)
go to 500
900 close(io1)
close(io2)
stop
end
subroutine flinmass(xc,hl,gp,gmnp)
c
c Finite line of mass from -L to +L on x axis
c Calculate gravity vector and gradient tensor in body system
c vector xc contains (x,y,z) of field pointin body system
c on return g contains (gx,gy,gz) components of gravitation
c array gmn contains gradient tensor gmn(i), stored by column,
c so gmn(1)=gxx, gmn(3)=gzx, gmn(4)=gxy,gmn(7)=gxz, gmn(9)=gzz
c Units of G*lamda (gravconst, density/unit length)
c MEG/Aug2008
c
c Although this code has been tested and verified, it is not
16
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
17/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
18/36
c vectors tevec, store xyz by column - 1st vector is tevec(1,1)
c tevec(2,1),tevec(3,1), 2nd in col 2, 3rd in col3c uses Kopps routines for eigensolution
c arXiv:physics/0610206v3 [physics,comp-ph] 4 Jul 2008
c Efficient numerical diagonalization of hermitian 3 x 3 matrices
c Gettings Nov 2008
c
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may contain
c bugs that have not been identified
c
real*4 gmn(9), tmag, tinvar(3), teval(3), tevec(3,3)
real*8 sum, g(3,3), eval(3), evec(3,3)
c
c store tensor in 2D array, calculate tensor magnitude and invariantsc
sum = 0.0
do 50 j=1,3
do 50 i=1,3
k = (j-1)*3+i
g(i,j) = gmn(k)
sum = sum + gmn(k)*gmn(k)
50 continue
tmag = dsqrt(sum * 0.5)
tinvar(1) = g(1,1) + g(2,2) + g(3,3)
tinvar(2) = g(1,1)*g(2,2) + g(2,2)*g(3,3) + g(1,1)*g(3,3) -
1 g(1,2)*g(1,2) - g(2,3)*g(2,3) - g(1,3)*g(1,3)tinvar(3) = gmn(1)*gmn(5)*gmn(9) + gmn(4)*gmn(8)*gmn(3) +
1 gmn(7)*gmn(2)*gmn(6) - gmn(3)*gmn(5)*gmn(7) -
2 gmn(6)*gmn(8)*gmn(1) - gmn(9)*gmn(2)*gmn(4)
c
c calculate eigenvalues and eigenvectors
c
call dsyevh3(g,evec,eval)
do 60 i=1,3
teval(i) = eval(i)
do 60 j=1,3
tevec(i,j) = evec(i,j)
60 continue
return
end
function cosin(theta)
c ** computes cosine of any angle(in degrees) between 0 and 360.
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may contain
c bugs that have not been identified
18
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
19/36
c
tol=1.0e-8pi=acos(-1.0)
dgr=pi/180.0
if(abs(theta-90.0).le.tol.or.abs(theta-270.).le.tol) go to 50
if(theta.lt.0)theta=360.0+theta
thetar=theta*dgr
itheta=theta/90.0+1.
go to (10,20,30,40),itheta
10 cosin=cos(thetar)
return
20 thetar=pi-thetar
cosin=-cos(thetar)
return
30 thetar=thetar-picosin=-cos(thetar)
return
40 thetar=2*pi-thetar
cosin=cos(thetar)
return
50 cosin=0.0
return
end
function sine(theta)
c ** computes sine of any angle(in degrees) between 0 and 360.
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may containc bugs that have not been identified
c
tol=1.0e-8
pi=acos(-1.0)
dgr=pi/180.0
if(abs(theta).le.tol.or.abs(theta-180.0).le.tol) go to 50
if(abs(theta-360.0).le.tol) go to 50
if(theta.lt.0)theta=360.0+theta
thetar=theta*dgr
itheta=theta/90.+1
go to (10,20,30,40),itheta
10 sine=sin(thetar)
return
20 thetar=pi-thetar
sine=sin(thetar)
return
30 thetar=thetar-pi
sine=-sin(thetar)
return
19
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
20/36
40 thetar=2*pi-thetar
sine=-sin(thetar)return
50 sine=0.0
return
end
subroutine matfrm(k,theta,phi,a)
c**subroutine to set up rotation transformation matrices, using
c**right-handed systems;k=0 for 2-dimension,k=1 for 3-dimensions.
c**matrix stored by column (col1,col2, etc.)
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may contain
c bugs that have not been identified
c
dimension a(*)cst=cosin(theta)
snt=sine(theta)
if(k.eq.1)go to 10
a(1)=cst
a(2)=snt
a(3)=0.0
a(4)=-snt
a(5)=cst
a(6)=0.0
a(7)=0.0
a(8)=0.0
a(9)=1.0go to 20
10 csp=cosin(phi)
snp=sine(phi)
a(1)=csp*cst
a(2)= snt
a(3)= cst*snp
a(4)=-csp*snt
a(5)= cst
a(6)=-snt*snp
a(7)=-snp
a(8)=0.0
a(9)= csp
20 return
end
subroutine mattra(a,r,n,m)
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may contain
c bugs that have not been identified
c
20
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
21/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
22/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
23/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
24/36
c Terminal entry of integer*4 variable - F77 version
c qu - Character string prompt que,80 C long.c i4 - variable to be input
c defalt - default value if only given
c itin,itout - read, write LUNs of terminal
c verify - if true, asks for verification of input
c if false no verification
c typical call:
c call ttini4(que,k,16,itin,itout,verify)
c MEG/ Feb 86; SUN conversion Jul 89/ MEG
c
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may contain
c bugs that have not been identified
clogical verify
character ans*16, blank*16, qu*80
character que(80)*1, qr*1
integer*4 i4, defalt
blank =
read(unit=qu, fmt=200) que
200 format(80a1)
call lnnobl(que, nq, 80)
300 write(unit=itout, fmt=204)
204 format(1h ,$)
do 40 i = 1, nq
40 write(unit=itout, fmt=201) que(i)201 format(a,$)
read(unit=itin, fmt=101, err=300) ans
101 format(a)
if (ans .eq. blank) goto 910
read(unit=ans, fmt=100) i4
100 format(bn,i16)
if (.not. verify) goto 900
write(unit=itout, fmt=202) i4
202 format(1x,6hValue ,i16,5h ok? ,$)
read(unit=itin, fmt=101) qr
if ((qr .eq. n) .or. (qr .eq. N)) goto 300
900 return
910 i4 = defalt
goto 900
end
subroutine ttini2(qu, i2, defalt, itin,itout, verify)
c Terminal entry of integer*2 variable - F77 version
c qu - Character string prompt que,80 C long.
c i2 - variable to be input
24
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
25/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
26/36
c itin,itout - read, write LUNs of terminal
c verify - if true, asks for verification of inputc if false no verification
c typical call:
c call ttinaa(que,fnam,16,defalt,itin,itout,verify)
c MEG/ Dec 85; SUN conversion Jul 89/ MEG
c
c Although this code has been tested and verified, it is not
c guaranteed to perform correctly in all cases, and may contain
c bugs that have not been identified
c
logical verify
character css(80)
character qu*80
character que(80)*1, qr*1c character defalt(*), cs(*) replaced with following:
character*(*) cs,defalt
read(unit=qu, fmt=200) que
200 format(80a1)
call lnnobl(que, nq, 80)
300 write(unit=itout, fmt=204)
204 format( ,$)
do 40 i = 1, nq
40 write(unit=itout, fmt=201) que(i)
201 format(a1,$)
read(unit=itin, fmt=101, err=300) css
101 format(80a1)call lnnobl(css, kcss, 80)
c go to default
if (kcss .eq. 0) goto 910
write(cs,(80a))(css(i),i=1,ncs)
if (.not. verify) goto 900
write(unit=itout, fmt=202) (css(i),i = 1, ncs)
202 format(1x,17hCharacter string /1x,80a:)
write(unit=itout, fmt=203)
203 format(5h ok? ,$)
read(unit=itin, fmt=101) qr
if ((qr .eq. n) .or. (qr .eq. N)) goto 300
900 return
910 cs = defalt
goto 900
end
* ----------------------------------------------------------------------------
* Numerical diagonalization of 3x3 matrcies
* Copyright (C) 2006 Joachim Kopp
* ----------------------------------------------------------------------------
26
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
27/36
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ----------------------------------------------------------------------------
* ----------------------------------------------------------------------------
SUBROUTINE DSYEVH3(A, Q, W)
* ----------------------------------------------------------------------------
* Calculates the eigenvalues and normalized eigenvectors of a symmetric 3x3
* matrix A using Cardanos method for the eigenvalues and an analytical
* method based on vector cross products for the eigenvectors. However,
* if conditions are such that a large error in the results is to be
* expected, the routine falls back to using the slower, but more
* accurate QL algorithm. Only the diagonal and upper triangular parts of A need
* to contain meaningful values. Access to A is read-only.
* ----------------------------------------------------------------------------* Parameters:
* A: The symmetric input matrix
* Q: Storage buffer for eigenvectors
* W: Storage buffer for eigenvalues
* ----------------------------------------------------------------------------
* Dependencies:
* DSYEVC3(), DSYTRD3(), DSYEVQ3()
* ----------------------------------------------------------------------------
* .. Arguments ..
DOUBLE PRECISION A(3,3)
DOUBLE PRECISION Q(3,3)
DOUBLE PRECISION W(3)
* .. Parameters ..
DOUBLE PRECISION EPS
PARAMETER ( EPS = 2.2204460492503131D-16 )
* .. Local Variables ..
DOUBLE PRECISION NORM, N1, N2
27
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
28/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
29/36
* Calculate second eigenvector by the formula
* v[1] = (A - lambda[1]).e1 x (A - lambda[1]).e2Q(1, 2) = Q(1, 2) + A(1, 3) * W(2)
Q(2, 2) = Q(2, 2) + A(2, 3) * W(2)
Q(3, 2) = (A(1,1) - W(2)) * (A(2,2) - W(2)) - Q(3, 2)
NORM = Q(1, 2)**2 + Q(2, 2)**2 + Q(3, 2)**2
IF (NORM .LE. ERROR) THEN
CALL DSYEVQ3(A, Q, W)
RETURN
ELSE
NORM = SQRT(1.0D0 / NORM)
DO 40, J = 1, 3
Q(J, 2) = Q(J, 2) * NORM
40 CONTINUE
END IF
* Calculate third eigenvector according to
* v[2] = v[0] x v[1]
80 Q(1, 3) = Q(2, 1) * Q(3, 2) - Q(3, 1) * Q(2, 2)
Q(2, 3) = Q(3, 1) * Q(1, 2) - Q(1, 1) * Q(3, 2)
Q(3, 3) = Q(1, 1) * Q(2, 2) - Q(2, 1) * Q(1, 2)
END SUBROUTINE
* End of subroutine DSYEVH3
* ----------------------------------------------------------------------------
* Numerical diagonalization of 3x3 matrcies* Copyright (C) 2006 Joachim Kopp
* ----------------------------------------------------------------------------
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ----------------------------------------------------------------------------
* ----------------------------------------------------------------------------
29
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
30/36
SUBROUTINE DSYEVC3(A, W)
* ----------------------------------------------------------------------------* Calculates the eigenvalues of a symmetric 3x3 matrix A using Cardanos
* analytical algorithm.
* Only the diagonal and upper triangular parts of A are accessed. The access
* is read-only.
* ----------------------------------------------------------------------------
* Parameters:
* A: The symmetric input matrix
* W: Storage buffer for eigenvalues
* ----------------------------------------------------------------------------
* .. Arguments ..
DOUBLE PRECISION A(3,3)
DOUBLE PRECISION W(3)
* .. Parameters ..
DOUBLE PRECISION SQRT3
PARAMETER ( SQRT3 = 1.73205080756887729352744634151D0 )
* .. Local Variables ..
DOUBLE PRECISION M, C1, C0
DOUBLE PRECISION DE, DD, EE, FF
DOUBLE PRECISION P, SQRTP, Q, C, S, PHI
* Determine coefficients of characteristic poynomial. We write
* | A D F |
* A = | D* B E |* | F* E* C |
DE = A(1,2) * A(2,3)
DD = A(1,2)**2
EE = A(2,3)**2
FF = A(1,3)**2
M = A(1,1) + A(2,2) + A(3,3)
C1 = ( A(1,1)*A(2,2) + A(1,1)*A(3,3) + A(2,2)*A(3,3) )
$ - (DD + EE + FF)
C0 = A(3,3)*DD + A(1,1)*EE + A(2,2)*FF - A(1,1)*A(2,2)*A(3,3)
$ - 2.0D0 * A(1,3)*DE
P = M**2 - 3.0D0 * C1
Q = M*(P - (3.0D0/2.0D0)*C1) - (27.0D0/2.0D0)*C0
SQRTP = SQRT(ABS(P))
PHI = 27.0D0 * ( 0.25D0 * C1**2 * (P - C1)
$ + C0 * (Q + (27.0D0/4.0D0)*C0) )
PHI = (1.0D0/3.0D0) * ATAN2(SQRT(ABS(PHI)), Q)
30
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
31/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
32/36
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
33/36
P(I) = P(I) - K * U(I)
30 CONTINUE
D(1) = A(1,1)
D(2) = A(2,2) - 2.0D0 * P(2) * U(2)
D(3) = A(3,3) - 2.0D0 * P(3) * U(3)
* Store inverse Householder transformation in Q
* --- This loop can be omitted if only the eigenvalues are desired ---
DO 40, J = 2, N
F = OMEGA * U(J)
D O 4 1 I = 2 , N
Q(I,J) = Q(I,J) - F * U(I)
41 CONTINUE
40 CONTINUE
* Calculated updated A(2, 3) and store it in E(2)
E(2) = A(2, 3) - P(2) * U(3) - U(2) * P(3)
ELSE
D O 5 0 I = 1 , N
D(I) = A(I, I)
50 CONTINUE
E(2) = A(2, 3)
END IF
END SUBROUTINE
* End of subroutine DSYTRD3
* ----------------------------------------------------------------------------
* Numerical diagonalization of 3x3 matrcies
* Copyright (C) 2006 Joachim Kopp
* ----------------------------------------------------------------------------
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ----------------------------------------------------------------------------
33
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
34/36
* ----------------------------------------------------------------------------
SUBROUTINE DSYEVQ3(A, Q, W)
* ----------------------------------------------------------------------------
* Calculates the eigenvalues and normalized eigenvectors of a symmetric 3x3
* matrix A using the QL algorithm with implicit shifts, preceded by a
* Householder reduction to real tridiagonal form.
* The function accesses only the diagonal and upper triangular parts of
* A. The access is read-only.
* ----------------------------------------------------------------------------
* Parameters:
* A: The symmetric input matrix
* Q: Storage buffer for eigenvectors
* W: Storage buffer for eigenvalues* ----------------------------------------------------------------------------
* Dependencies:
* DSYTRD3()
* ----------------------------------------------------------------------------
* .. Arguments ..
DOUBLE PRECISION A(3,3)
DOUBLE PRECISION Q(3,3)
DOUBLE PRECISION W(3)
* .. Parameters ..
INTEGER N
PARAMETER ( N = 3 )
* .. Local Variables ..
DOUBLE PRECISION E(3)
DOUBLE PRECISION G, R, P, F, B, S, C, T
INTEGER NITER
INTEGER L, M, I, J, K
* .. External Functions ..
EXTERNAL DSYTRD3
* Transform A to real tridiagonal form by the Householder method
CALL DSYTRD3(A, Q, W, E)
* Calculate eigensystem of the remaining real symmetric tridiagonal
* matrix with the QL method
*
* Loop over all off-diagonal elements
DO 10 L = 1, N-1
NITER = 0
34
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
35/36
* Iteration loopDO 11 I = 1, 50
* Check for convergence and exit iteration loop if off-diagonal
* element E(L) is zero
DO 20 M = L, N-1
G = ABS(W(M)) + ABS(W(M+1))
IF (ABS(E(M)) + G .EQ. G) THEN
GO TO 30
END IF
20 CONTINUE
30 IF (M .EQ. L) THEN
GO TO 10
END IF
NITER = NITER + 1
IF (NITER >= 30) THEN
PRINT *, DSYEVQ3: No convergence.
RETURN
END IF
* Calculate G = D(M) - K
G = (W(L+1) - W(L)) / (2.0D0 * E(L))
R = SQRT(1.0D0 + G**2)
IF (G .GE. 0.0D0) THEN
G = W(M) - W(L) + E(L)/(G + R)
ELSEG = W(M) - W(L) + E(L)/(G - R)
END IF
S = 1.0D0
C = 1.0D0
P = 0.0D0
D O 4 0 J = M - 1 , L , - 1
F = S * E(J)
B = C * E(J)
IF (ABS(F) .GT. ABS(G)) THEN
C = G / F
R = SQRT(1.0D0 + C**2)
E(J+1) = F * R
S = 1.0D0 / R
C = C * S
ELSE
S = F / G
R = SQRT(1.0D0 + S**2)
E(J+1) = G * R
35
7/27/2019 Gravity gradient tensor of a finite line of mass of arbitrary orientation
36/36
C = 1.0D0 / R
S = S * CEND IF
G = W(J+1) - P
R = (W(J) - G) * S + 2.0D0 * C * B
P = S * R
W(J+1) = G + P
G = C * R - B
* Form eigenvectors
* --- This loop can be omitted if only the eigenvalues are desired ---
D O 5 0 K = 1 , N
T = Q(K, J+1)
Q(K, J+1) = S * Q(K, J) + C * TQ(K, J) = C * Q(K, J) - S * T
50 CONTINUE
40 CONTINUE
W(L) = W(L) - P
E(L) = G
E(M) = 0.0D0
11 CONTINUE
10 CONTINUE
END SUBROUTINE
* End of subroutine DSYEVQ3
36