Computers & Geos~ten~e~ Vol 15, No 6, pp 889-903. 1989 0098-301M,89 $3 00 + 0 00 Pergamon Press plc Printed m Great Britain A COMPUTER PROGRAM TO PERFORM THE UPWARD CONTINUATION OF POTENTIAL FIELD DATA BETWEEN ARBITRARY SURFACES MARCELLOCIMI\~,LE* and MARIA"~OLODDO D~part~mento dl Geologm e Geofistca, Campus Unlvers~tarto. 70100 Bart, Italy (Received 27 January 1988, revtsed 10 4ugust 1988, recetved for publ, canon 26 January 1989) Abstract--A FORTRAN 77 computer program has been developed for performing the upward contmuatton of potenttal field data between general surfaces The mathemaucal background ~s based on an eqmvalent source algorithm and on the consequent Fredholm integral equation of the second kind. A graphical test to illustrate the performance of the program demonstrates the program's abthty to reduce s~gmficant topographic interference with the signal Key Words" Potential field data, Equwalent source d~stnbutton, Arbttrary surfaces, Upward contmuauon INTRODUCTION The upward continuaUon of potential field data Is used widely by geophysictsts for improved resoluuon of the magnetic or gravity signal associated with extended and deep bodies, especially when a masking effect of shallower sources is considerable. At present this transformation is performed by computer programs based on the solution of Dirichlet's problem (Baranov, 1975) with the condition that measurements are collected on a horizontal plane (Gibert and Galdeano, 1985). Gravity or magnetic data are acquired on an uneven topographic surface which requires a more complex solution. Moreover, if topography is characterized by a high relief or by abrupt variations in altitude, some spunous anomalies or s~gnificant distoruons ma~ be generated in the useful signal. Many authors have faced this problem following different approaches (Parker and Klitgord, 1972; Syberg, 1972; Courtillot, Ducruix, and Le Mouel, 1974; Le Mouel, Courtillot, and Ducrmx, 1975, Hansen and Myazaki, 1984). The computer program described here and based on the approach suggested by Bhattacharyya and Chart (1977) fully solves the problem and allows the execution of the upward continuation between arbttrary surfaces. MATHEMATICAL BACKGROUND In the article of Bhattacharyya and Chan (1977), the problem of reduction of potential field data observed on an arbitrary surface S is stud~ed with equivalent source representation at the points of observation. It is shown that the analytical relationship between the total magnetic field and the equivalent magnetization distribution on S is given by the following Fredholm integral equation of the second kind. *Present address. Dipartimento di Sclenze delia Terra, Unwerslt6 della Calabria, 87030 Cosenze, Italy CAOl~'O 15o6-D T~(~', fl', ~') = × 2n/~(~', if, ~') - ff I~(~, ~. ~,) -f,(zt' - ~ t ) - f , ( f l ' - fl) + (z' - z)~ ~,, : + + (< : ,71 o o. (1) where 7", is the observed total field over S, p is the spatial gradient of magneuzation m the direction of the magnetic field, S' is the arbitrary surface S without the point (~t', fl', z'), (~t, fl, 3) is a point on S'. By representing the vertical height ~ of these points by a functtonfso that z = f(~, fl),f, andf~ are the derivauves off(~t, fl) along :t and fl axes respectively. In a similar manner the Fredholm integral equation that relates the gravity field to the equivalent density is g,(zt', fl', ~') = 2nn'o'(~t, ' ' fl', r') - I I o'(zt, fl, 1:) T - T x [(~' _ a)" + (fl' -- fl)" + (z' - T)2]32dztdfl (2) where g, and a are the observed gravity field and the equivalent density distribution over S respectively and n = 11[1 + f2 + f~]l 2 is the direction cosine of the z axis w~th respect to the unit vector normal to the surface at the point (~t, fl, 3). After determining the value of/z or ~ by resolving Equations (1) or (2) respectively it is possible to compute the potential field T or g at points (x, y, z) on a surface external to S. The following double integrauon allows the upward continuation in the magnetic situation: TCx, y, z) = - f~ /~C~, fl, r) $ -f,(x ~ ~) - ' - ~) + (: - ~)~ ~ 890 M CIMINALEand M LODDO Inpu t da t a reading and ex tr aPol a rio n Derivatives dlrec and t/on compu cosines ta tton Equivalent MAIN sources computation PROGR AM ex trapol and a tlon Upward con ttnua Special tton CaSe Figure I. Simphfied structure chart of program UPWARD.F. If gravity data are processed the equivalent equation is: g(x, y , : ) = - ffJ a(~t, fl, 3) Z--'f × [(x - ~)2 + (y _ #), + (z - ~)2]3/2"d'~d/~" (4) It can be seen that in the special situation when the surface S is horizontal, Equations (3) and (4) can be reduced to the solution of Dirichlet's integral. This is easy to see if it is kept in mind that in this situation f , = fp -- 0 , 3" - r - - 0 and the quantities tt or o obtained from (1) or (2) are simply the observed field divived by the constant 2n. Finally, it should be noted that all the equations have been derived by assuming a rectangular Cartesian coordinate system (,,, p, 3) with ~ axis positive downward. NUMERICAL PROCEDURE It is assumed that potential field data collected over the surface S are distributed on a regular grid having square meshes. At the nodes of this grid the topographic level also is known. If not, the data must be gridded using an appropriate gridding algorithm. To solve Equations (1) or (2) the numerical iterative method of successive approximations has been adopted. At present, the program here proposed attains only the first-order approximation. It is easy to extend the iterations until the difference between two successive approximations lies within an acceptable limit; nevertheless, in many synthetic and practical situations the first-order approximation has been considered satisfactory. Considerations made by Bhattacharyya and Chan are useful for determining the limits of integration. Because of the particular properties of the kernel Upward continuation of potential field data 891 Figure 2 Topographic model. Vertical axis is posttwe dov,nward. Contour interval ts 100 m functions, it is possible to center on the fixed point (~', /~', 3') a rectangular window of dimensions (2, ideeal+ 1,2 .]deeal+ I) covering an area smaller than S in which the kernel functions rapidly converge. The double integrations (3) and (4) have been solved by a bicubic spline quadrature using as domain of integration the same rectangular window now centered on the fixed point (,,, ~, 3). To avoid a loss ofinformation at the edges of the surveyed area, a problem that is encountered whenever data are transformed, a suitable method for extrapolating has been employed. It is based on the recursive filters derived from Burg's Maximum Entropy Spectral Analysis algorithm (Burg, 1975) and it has been used by the authors (Ciminale and others, 1985) with good results. This algorithm has been examined by Gibert and Galdeano (1985) who also present the subroutines that perform the extrapolation. In addition to topography and potential field data, the matrix of equivalent sources must be extrapolated [see Eqs. (3) and (4)]. In order to obtain a matrix containing data of continued field with dimensions equal to those of the matrix with original data the extrapolated rows, both on the top and on the bottom of the matrix, will be equal to idecai, whereas jdecal will be the number of extrapolated columns both on the left and on the right of the matrix. In Equations (1)-(3) the derivatives of the vertical height r = f(~, fl,) occur along • and fl axes; they have been computed by evaluating the coefficients of a bicubic spline at the nodes of the regular grid where the topographic elevations are known. PROGRAM DESCRIPTION The program here presented is named UPWARD.F. It runs on an IBM 6150/25 microcomputer provided with a RAM memory of 4 Mbyte and with a VRM program which allows the usage, of 16 Mbyte as virtual memory. It is written in IBM RT PC FORT R A N 77 which differs slightly from ANSI Standard F O R T R A N 77. All the computauon is executed in double precision. Some IMSL Inc. routines have been used (IMSL, 1984). They are discussed briefly (see also the Appendix). More details about their purpose and usage and the description of their arguments are available in the IMSL's library manual (1984). 892 M CIMINALEand M Loooo N O 2 A 8km ~ J Figure 3. Total magnetm field resulting from three pnsmauc bodies computed on topographic surface shown m Figure 2. Outhncs of boches arc shown. Contour interval is 2 nT As shown in Figure 1 U P W A R D . F is divided in four parts: (i) input data reading and extrapolation; (ii) derivatives and direction cosines computation; (iii) equivalent sources computation and extrapolation, and (iv) upward continuation. The special situation referring to the upward continuation between horizontal planes is treated separately. Input data reading and extrapolation U P W A R D . F is not a conversational program. The input/output parameters required for the computatfon are placed in a file termed pilotupw which is easy to handle. Some of these parameters are explained briefly (for a full description see the Appendix. namel, name2, and name3 indicate the topographic data file, the potential field (gravity or magnetic) data file and the upward continued field (output file) respectively; deltaz is either the altitude of the horizontal plane where potential field data must be continued or the terrain clearance. All data are organized in a regular square grid and stored columnwise. In the special situation when the surface S is horizontal instead of namel, the uniform hetght of S qdepar must be introduced in pilotupw. If it ts required to compute the potential field on an uneven surface external to S, deitaz must be substituted by a file name4 containing this surface. Once piiotupw is closed, the actual reading of the input data (topography and potential field) and their extrapolation is executed by employing the subroutines lectur and jupe2 from Glbert and Galdeano (1985). They have been mo&fied slightly to allow reading in a formatted file using F O R T R A N 77 language and computation in double precision. Derivattves and direction cosines computatton This is the second part of the program UPWARD.F. In this section the derivatives off(,,, r) along :t and fl axes are calculated. This step is performed by the subroutine ealcder. In reality the actual computation ts carried out by the IMSL routine i k ccu. This subroutine allows the computation of the bicublc sphne two-dimensional coefficients. At the nodes of the grid, the values of the bicubic spline are equal to those of the topographm elevations and thus 893 Upward continuation of potential field data Table I Character~ of prtsm~ N T(km) 8(km) M(A m) De D; 1 2 3 20 30 15 70 70 60 I 2 I 45°W 5°E 10°E 30~'N 72°N 60°N N = prism numerahon, T = depth o f the top, B = depth o f the bottom, M = intensity o f magnetization, De ~ charactenshc dechnatlon. Dt = eharacterlst~c inclination some of its coefficients represent the f~ andf~ functions respectwely If gravity data are processed the subroutine ealcdir allows the computation of direction cosines n starting from the relationship which links n to the ~ and 13 derivatives (see section on mathematical background). of singular points ~s present m fredh (see the Appendix): it has been mtroduced because the double mtegrauon Is extended over S' which is the surface S wtthout the point (:c',/3', r') In order to avoid a loss of mformatmn at the edges of the continued field because of the double integration m Equations (3) and (4), the equivalent sources obtamed by fredh must be extrapolated. Instead of lectur the subroutine rtest is used to border the grid having actual values w~th fictitious values (test value); this operation Is required for prepanng the mput to jupe2. Upward contmuatwn The regular grid defining the surface over which the field will be continued has to be created or read before performing the upward continuation. Equivalent sources computation and extrapolatton Thts operation foresees three situations: (a) a horIn this third part, Equations (1) and (2) are solved tzontal plane having a level deltaz, created by the by the method of successive approximations; only the ' subroutine plane; (b) a surface parallel to S (in this first-order approximation ~s attained. s~tuatmn deltaz is the terrain clearance), created by The routine which performs this step ts termed the subroutine topar; and (c) a given topographic fredh; a nonexecutable statement for the eliminauon relief higher than S read by lectur. The upward con- / 0 2 A / \ 8; Figure 4 Upward continuation to le~,el of 4200 m abo~e mean seale~el of total magneuc field shown m Figure 3 Contour inter~,al ts 2 nT 894 M CIMINALEand M. LODDO / l'q ,t 0 ! 2 F~gure 5. Total magneuc field resulting from three pnsmat=c bodies shown m Figure 3 computed at level of 4200 m above mean sealevel. Contour interval ts 2 nT. tinuation ~s executed by the subroutine reduc; the integrating function is evaluated at every node of the grid and the limits of integration are determined. For the actual computation reduc calls the IMSL routine dbcqdu. This routine evaluates the approximate double integral for the given table of data using a natural bicubic spline interpolant. Once computed, the output matrix farr(i, j) is stored by the subroutine store. Special situation In the special situation when the surface S is horizontal the computation is faster. There is no reading of topography and therefore leetur, jupe2, calcder, or calcdir are not called. To evaluate the equivalent sources, it is not necessary to call fredh; this operation is performed easily by the subroutine dirieh. This subroutine first creates the matrix of the uniform topography, then reads potential field data using lectur and finally gives out the extrapolated matrix of equivalent sources by calling jupe2. In this situation there is no analytic difference m upward continuing gravity or magnetic data (see sec- tlon on mathematical background). Therefore, in order to avoid unnecessary calculations of matrices f, and f# (in this situation all the elements are equal 0) a control statement in the subroutine reduc directs the program to follow the gravity option. CONCLUSIONS The most interesting and practical situation ts the upward continuation to a horizontal plane of potential field data acquired on an uneven surface that has been processed for magnetic data. The magnetic data are stored in a 33 x 33 regular grid having a sampling interval equal to 1000m; topography is prepared in the same way. A window (21,21) has been used for extrapolating and therefore idecal ~ecal----10. Figure 2 shows the high topographic relief processed. It concerns the well known Mt Etna (Sicily). Figure 3 shows the total magnetic field (computed on the topographic surface) which is the result of three prismatic bodies. It was calculated by assuming a normal magnetic field having an inclination Io = 65°N and a declination Do = 20°E. The par- Upward continuation of potentml field data ameters which identify the prisms are reported in Table i. This synthetic field was upward continued to an altitude o f 4200m above mean sealevel (Fig. 4). Figure 5 shows the total field which is the result of the same three prismatic bodies computed at a horizontal plane 4200 m above mean sealevel. A comparison of Figures 4 a n d 5 confirms the high performance of program U P W A R D . F . Acknowledgments--This work was supported financially by MPI (40%/87) and CNR (Contract No, 87.1085.02) REFERENCES Baranov, W., 1975, Potential fields and their transformations in applied geophysics: Geoexploration Mono, Series 6, Gebruder Borntraeger, Stuttgart, 121 p. Bhattacharyya, B. K., and Chan, K. C., 1977, Reduction of magnetic and gravity data on an arbitrary surface acquired in a region of high topographic relief: Geophysics, v. 42, no. 7, p. 141 !-1430. Burg, J. P., 1975, Maximum entropy spectral analysis: unpubl doctoral dissertation, Stanford Univ., 168 p. Ciminale, M., Galdeano, A , Gibert, D., Loddo, M., Peeon- 895 m. G., and Zlto. G , 1985, Magnetic survey m the Campldano Graben (Sardinia, Italy) description and ,nterpretatton. Boll Geot'. Teor Appl, v 27 no 107, p. 221-235 Courtdlot. V, Ducrulx, J, and Le Mouel, J. L.. 1974. A solution of some reverse problems in geomagnetism and gravimetry Jour Geophys. Res., v. 79, no. 32, p. 49334940. GIbert, D., and Galdeano, A., 1985, A computer program to perform transformations ofgravimetnc and aeromagnettc survey. Computers & Geosctences, v I1, no. 5, p 553-588 Hansen, R. O . and Mlyazakl. Y, 1984, Continuauon of potentml fields between arbitrary surfaces: Geophysics, v. 49, no. 6, p. 787-795. IMSL's hbrary manual, 1984, FORTRAN subroutines for mathematics and statistics: IMSL Inc Houston, Texas, unpaginated. Le Mouel, J L, Courttllot, V., and Ducruix, J., 1975, A solution of some problems m potenual theory: Geophys. Jour. Roy Astr. Soc, v. 42, no. I, p. 251-272. Parker, R L.. and Khtgord, K. D., 1972, MagneUc upward continuation from an uneven track. Geophysics, v. 37, no 4, p 662-668. Syberg, F. J. R., 197l Potential field contmuauon between general surfaces: Geophys Prosp, v. 20, no I, p 267282 APPENDIX Program Listing C C C C C C C C C C C C C C C C C C C C C C C O C C C O O C C C O C C C C C O C U P W A R D . F This program, w r i t t e n on a IBM 6150/25 computer, p e r f o r m s the u p w a r d c o n t i n u a t i o n of p o t e n t i a l field d a t a b e t w e e n a r b i t r a r y s u r f a c e s Principal ..... ..... ..... parameters description: nlig ........ noel ........ idecal ...... number o f l i n e s number o f c o l u m n s number o f e x t r a p o l a t e d lines b o t h on t h e t o p and on the b o t t o m of the m a t r i x ..... Jdecal ...... n u m b e r of e x t r a p o l a t e d c o l u m n s b o t h on t h e left and on the right of the m a t r i x ..... ioptl - l . . . m a g n e t i c case - 2 . . . g r a v i t y case ..... iopt2 - l...the surface w h e r e p o t e n t i a l field d a t a are c o n t i n u e d is • h o r i z o n t a l p l a n s - 2.,.the surface where potential field data are continued is p a r a l l e l to t h e s u r f a c e w h e r e d a t a ere a c q u i r e d - 3 . . . t h e surface w h e r e p o t e n t i a l field d a t a are c o n t i n u e d is a g i v e n relief ..... iopt3 - l . . . t h s s u r f a c e w h e r e p o t e n t i a l field data ere a c q u i r e d is a h o r i z o n t a l plane - 2 . . . t h e surface w h e r e p o t e n t i a l field data are acquired is a g i v e n relief ..... step ........ s a m p l i n g interval b e t w e e n lines and c o l u m n s ..... d e l t a z ...... a l t i t u d e of the h o r i z o n t a l p l a n e w h e r e p o t e n t i a l field data are c o n t i n u e d ( if iopt2 - i ) .... t e r r a i n c l e a r a n c e ( if i o p t 2 - 2 ) . . . . . q d e p a r ...... a l t i t u d e of t h e h o r i z o n t a l p l a n s w h e r e p o t e n t i a l field data are acquired ..... p i l o t u p w .... p i l o t i n g filename ..... namel ....... t o p o g r a p h i c data filename ( if iopt3 - 2 ) 896 M CIMtNALEand M LODDO C C C C C C C c C C C C C C C C C C C C C c C C ..... name2 ....... magnetic or gravity data filename ..... name3 ....... output data filename ..... name4 ....... topographic data filename ( if iopt2 - 3 ) ..... iform ....... input output data format ..... lunit0 ...... FortTan unit number of the file - 'pilotupw' ..... lunitl ...... Fortran unit number of the file - name1 ..... lunit2 ...... Fortran unit number of the file - name2 ..... 1unit3 ...... Fortran unit number of the file - name3 ..... lunit4 ...... Fortran unit number of the file - name4 ..... lunit5 ...... Fortran unit number of the screen Remarks: a) In this program, a rectangular cartesian coordinate system with x and y axes along the geographic north and east directions respectlvely and the z axis pointing vertically downward was selected. b) Generally the dimensions of arrays are: top((nlig+2*idecal)*(ncol+2*jdecal)) f((nlig+2*idecal)*(ncol+2*Jdecal)) farr((nlig+2*idecal)*(ncol+2*Jdeoal)) cosdir((nlig+2*idecal)*(ncol+2*jdecal)) sigma((nlig+2*idecal)*(nool+2*Jdecal)) sigmal((nlig+2*idecal)*(ncol+2*Jdecal)) sigma2((nlig+2*idscal)*(ncol+2*Jdecal)) C c c C C C C C C c C C c C C C C zarr((nlig+2*idecal)*(ncol+2*jdecal)) derx((nlig+2*idecal)*(ncol+2*jdecal)) dery((nlig+2*idecal)*(ncol+2*Jdecal)) aux(ncol+2*Jdecal) x(nlig+2*idecal) y(ncol+2*jdecal) xx(2*idecal+l) yy(2*jdecal+l) wk(2*(nlig+2*idecal)*(ncol+2*Jdecal)+2*max(nlig+2*idecal,ncol+2 *Jdecal)) wkl((nlig+2*idecal)*(ncol+2*jdecal)) wk2((ncol+2*jdecal+5)*(nlig+2*idecal)+(ncol+2*Jdecal)-l+ max(5*(nlig+2*idecal)-4,(ncol+2*Jdecal)-2)) wk3((nlig+2*idecal)*(ncol+2*jdecal)) c(2*(nlig+2*idecal)*2*(ncol+2*Jdecal)) implicit double precision (a-h,o-z) dimension top(40000),f(4OO00),aux(200) dimension farr(40000),zarr(40000) dimension x(200),y(200),xx(200),yy(200) dimension sigma(40000),slgmai(40OO0),sigma2(40000) dimension c(160000),wk(804OO),wkl(40000),wk2(80000),wk3(40000) dimension derx(4OOOO),dery(40000),coedir(40000) character*80 namel,name2,name3,nams4 character*80 iform common /radl/idecal,Jdecal common /rad/test common /range/mi,mf,li,lf equivalence ( w k ( 1 ) , d e r x ( 1 ) ) , ( w k ( 4 0 0 0 1 ) , d e r y ( 1 ) ) equivalence (sigma(1),siqma2(1),c(1)) equivalence (sigmal(1),c(40001)) equivalence (cosdir(1),c(80001),wk1(1)) equivalence (zarr(1),c(120001)) equivalence (wk2(1),c(40001)) equivalence (f(1),farr(1)) data xmin/O.d0/ data ymin/0.d0/ data test/l.d+4/ lunitO-lO lunit1-11 lunit2-12 lunit3-13 lunit4-14 lunltS-6 *** piloting file reading open(lunit0,status-'old',file-'pilotupw') rewind(lunitO) read(lunitO,*)nlig,ncol,idecal,Jdecal,step,ioptl,iopt2,iopt3 if(iopt3.eq.1)then read(lunit0,*)qdepar Upward contmuauon of potenual field data else rsad(lunit0,100)namel endif read(lunit0,100)name2 read(lunit0,100)name3 rsad(lunit0,100)iform if(iopt2.sq.3)then read(lunit0,100)name4 else read(lunit0,*)dsltaz endif close(lunit0) i00 format(aSO) c c c npx-nlig+2*idscal npy-ncol+2*jdecal first order equivalent sources computation and extrapolation for the case iopt3 - 1 if(iept3.eq.l)then call dirich(npx,npy,lunit2,1unit5,name2,iform,qdepar, ltop,sigma2.wkl,aux) go to 130 else c c c c c c c c c c c c c c c c c c c c c o c c c c c c c c c c routines isctur and Jupe2 after Gibert and Galdeano (1985) slightly modified to allow reading in a formatted file and computation in double precision Usage: Purpose: call lectur(f,m,n,lunit,name,iform) this subroutine reads data in a formatted file and prepares the matrix for the extrapolation Parameters description: f m by n array containing data lunit Fortran unit number of the file containing data name data filename iform data format Usage Purpose: call Jupe2(a,m,n,aux,tsst,iterv,lunit) this subroutine extrapolates values with a maximum entropy prediction filter derived from Burg's algorithm Parameters description: a m by n matrix containing values to be extrapolated aux work vector test a(i,J)-test indicates that this value of matrix a must he extrapolated iterv work vector lunit Fortran unit number of the sreen *** topographic data reading call lectur(top,npx,npy,lunitl,namel,iform) endif *** topographic data extrapolation call Jupe2(top,npx,npy,aux,test,wkl,lunit5) *** field data reading call lectur(f,npx,npy,lunit2,name2,iform) c c c *** field data extrapolation call jupe2(f,npx,npy,aux,test,wkl,lunitS) 897 1X/[ CIMINALEand M LODOO 898 130 continue do 110 i=l,npx 110 x(i)=xmin+float(i-1)*step do 120 J=l,npy 120 y(j)-ymin+float(j-l)*step if(iopt3.eq.l)go to 140 ic:npx *** IMSL routine ibcccu Usage: call ibcccu(top,x,npx,y,npy,c, ic,wk, ier) Purpose: This subroutine computes the coefficients of a bicubic spllne Parameters description: top npx by npy matrix containing the topographic data x vector of length npx (abscissae) y vector of length npy (ordinates) c 2*npx*2*npy array of spline coefficients ic row dimension of matrix top and second dimension of array c exactly as specified in the dimension statement wk work vector of length 2*npx*npy+2*max(npx,npy) ier error parameter call ibcccu(top,x,npx,y,npy,c,ic,wk, ier) *** partlal derivatives computation call caloder(x,npx,y,npy,c,derx,dery) C C *** direction cosines computation C if(ioptl.eq.2)call calcdir(npx,npy,derx,dery,cosdir) *** 1 first order equivalent sources computation for the case iopt3 - 2 call fredh(f,top,x,y,derx,dery,coedir, eigma,sigmal,npx,npy,step, ioptl) *** first order equivalent sources extrapolation call rtest(sigma2,sigmal,npx,npy) call Jupe2(sigma2,npx,npy,aux,test,wkl,lunitS) C C C C C C *** reading or creation of the surface where potential field data are continued 140 continue If(iopt2.ne.3)then if(iopt2.eg.2)goto170 call plane(zarr,deltaz,npx,npy) goto 190 170 call topar(zarr,top,deltaz,npx, npy) 190 continue else call leotur(zarr,npx,npy,lunit4,name4,iform) endif *** upward continuation call reduc(top,farr,zarr,derx,dery,npx,npy,x,y,etep, lioptl,sigma2,iopt3,wk2,wk3,xx,yy) *** output file storage call store(farr,npx,npy,lunit3,name3,iform) stop end Upward c o n t m u a u o n o f p o t e n t l a l f i e l d data subroutine dirich(npx,npy,lunit2,1unitS,name2,iform,qdepar, ltop,sigma2,iterv,aux) This subroutine is called only if the surface where data are acquired is a horizontal plans having an altitude equal to qdepar. First it creates this plane, then it computes and extrapolates the first order equivalent sources. Parameters description: lunit2 see main program lunit5 s e e main program name2 s e e main program name5 s e e main program iform see main program qdepar s e e main program top horizontal surface at which data are acquired sigma2 first order equivalent sources double precision top(npx,npy),aux(1),iterv(1), isigma2(npx,npy),teet character*80 name2,iform common /radl/idecal,Jdecal common /rad/test do i0 J-l,npy do 10 i-l,npx i0 top(i,J)-qdepar dpi-8.d0*datan(l.d0) call lectur(sigma2,npx,npy,lunit2,name2,iform) il-idecal+l i2-npx-idecal Jl-Jdecal+l J2-npy-Jdecal do 20 J-Jl,J2 do 20 i-il,i2 20 sigma2(i,J)-sigma2(i,J)/dpi call Jupe2(sigma2,npx,npy,aux,test,iterv,lunit5) return end subroutine calcder(x,nx,y,ny,c,dsrx,dsry) C C O This subroutine draws out the x and y derivatives of topography from the array of spline coefficients C C C C C C C C C C C C Parameters description: x vector of length nx (abscissae) y vector of length ny (ordinates) c array of epline coefficients (output of ibcccu IMSL routine) derx matrix containing the x derivative of topography defy matrix containing the y derivative of topography implicit double precision(a-h,o-z) dimension x(nx),y(ny) dimension c(2,nx,2*ny) dimension derx(nx,ny),dery(nx,ny) nn-2*ny nny-2*ny-1 do 100 i-l,nx k-O do 100 J-l,nny,2 k'k+l I00 derx(i,k)-c(2,i,J) do 200 i-l,nx k-0 do 200 J~2,nn,2 k-k+l 200 dery(i,k)-c(l,i,J) return end 899 M CIMINALEand M LODDO g00 subroutine calcdir(nx,ny,derx,dery,cosdir) This subroutine, called only if gravity data are processed, computes the direction cosine of the z axis with respect to the unit vector normal to the topographic surface at the given point (i,k) Parameters description: derx x derivative of topography dery y derivative of topography cosdir matrix containing direction cosines 300 double precision derx(nx,ny),dery(nx,ny),cosdir(nx,ny) do 300 i-l,nx do 300 k-l,ny cosdir(i,k)-i/((l+derx(i,k)**2+dery(i,k)**2)**0.5) return end 1 C C C subroutine fredh(f,z,x,y,dx,dy,cosdir,sigma,sigmal,npx,npy,step, ioptl) This subroutine computes the matrix order equivalent sources of the first C C C C C C C C C C C C C C Parameters description: f extrapolated potential field data z extrapolated topographic data x abscissae y ordinates dx x derivative of topography dy y derivative of topography cosdir matrix containing direction cosines sigma zero order equivalent sources sigml first order eqluvalent sources step see main program ioptl see main program implicit double precision (a-h,o-z) dimension f(npx,npy),z(npx,npy),x(npx),y(npy) dimension sigma(npx,npy),sigmal(npx.npy) dimension dx(npx,npy),dy(npx,npy),cos~ir(npx,npy) common /radl/id,jd dpi-8.d0*datan(1.d0) dxdy-step*step nlig-npx-2*id ncol-npy-2*Jd if(ioptl.eq.2)goto 190 ...... zero order approximation for magnetic data ...... do 100 i-l,npx do 100 J-l,npy I00 slgma (i, J )-f (i, J )/dpi ...... first order approximation for magnetic dnta ..... do 140 J-Jd+l,npy-Jd do 140 i-id+1,npx-id somma-O.d0 do 130 1-i-ld,i+id do z~0 =-J-Jd,J+Jd ...... elimination of singular points ...... if(m.eq.J.and.l.eq.i)goto 130 siniz-(sigma(l,m)*(-dx(l,m)*(x(i)-x(1))-dy(l,m)*(y(J) 1-y(m))+(z(i,J)-z(l,m))))*dxdy/((x(i)-x(1))**2 l+(y(J)-y(m))**2+(z(i,J)-z(l,m))**2)**l.5 somma-aomma+siniz 130 continue frint-(1.d0/dpi)*somma sigmal(i,J)-sigma(i,J)+frint 140 continue do 150 i-l,nlig do 150 J-l,nool 150 sigmal (i, J )-sigmal (i+id, J+Jd) goto 299 Upward continuation of potenttal field data ...... zero order approximation for gravity data ....... 190 do 200 i-l,npx do 200 J-l,npy 200 sig~a(i,J)-f(i,J)/(dpi*(cosdir(i,j)**2)) C C C ...... first order approximation for gravity data ...... do 240 j-jd+l,npy-jd do 240 i-id+l,npx-id somma-0, dO do 230 l-i-id,i+id do 230 m-J-Jd,J+Jd ...... elimination of singular points ...... if(m.eq.J.and.l.eq.i)go to 230 siniz-(sigma(l,m)* (z (i,J)-z (l,m)) )*dxdy/( ((x(i)-x(1)) l**2+(y(J)-y(m) ) **2+ (z (i,J)-z (l,m))*,2)**i. 5) somma-somma+s inl z 230 continue frint- (l.dO/(dpi* (cosdir (i, j ) **2) ) )*somma sigmal (i, J )-sigma (i, J )+ frint 240 continue do 250 i-l,nlig do 250 J-l,ncol 250 sigmal (i, j )-sigmal (i+id, J+J d) 299 return end subroutine rtest(f,sigmal,m,n) This subroutine prepares the sigma1 matrix for the extrapolation using the subroutine Jupe2 Parameters description: f matrix containing both the actual and factitious (test) values of the first order equivalent sources sigmal matrix containing the actual values of the first order equivalent sources I0 implicit double precision (a-h,o-z) dimension f(m,n),sigmal(m,n) common /radl/id,Jd common /red/test do 10 J-l,n do I0 i-l,m f(i,J)-tsst il-id+l i2-m-id Jl=Ja+l J2=n-Jd do 20 J=J1,J2 20 do 20 i-il,i2 f(i,J)-sigmal(i-id,J-Jd) return end ********************************************************************* subroutine plene(zarr,dsltez,npx,npy) c o c c c c c c This subroutine creates the horizontal surface where data must be upward continued Parameters description: zarr matrix containing horizontal surface data dsltaz horizontal surface altitude c double precision zarr(npx,npy),dsltaz do i0 J-l,npy do 10 i-l,npx 901 M. CIMINALE and M 902 10 LODDO zarr(i,J)-deltaz continue return end subroutine topar(zarr,top,deltaz,npx,npy) C C This subroutine creates a surface parallel to the surface where potential field data are acquired C C C C C C C C Parameters description: zarr matrix containing the new surface top matrix containing the surface where potential field data are acquired deltaz terrain clearance I0 double precision zarr(npx,npy),top(npx,npy),deltaz do 10 j-l,npy do 10 i-l,npx zarr(i,J)-top(l,J)+dsltaz return end ********************************************************************* subroutine reduc(top,farr,zarr,derx,dery, npx,npy,x,y, &step,ioptl,eigma2,iopt3,wk2,f,xx,yy) This subroutine executes the upward continuation to an arbitrary surface Parameters description: top extrapolated topographic data farr upward continuated data zarr surface at which field data are continued x see fredh y see fredh step see main program ioptl see main program sigma2 extrapolated first order equivalent sources iopt3 see main program implicit double precision(a-h,o-z) dimension f(npx,npy),top(npx,npy),farr(npx,npy) dimension wk2(1),xx(1),yy(1) dimension x(npx),y(npy),sigma2(npx,npy),zarr(npx,npy) dimension derx(npx,npy),dery(npx,npy) common /radl/iwindi,iwindJ common /range/m1,m2,11,12 ml-iwindJ+1 m2-npy-iwindJ 11-iwindi+l 12-npx-iwindi nx-2*iwindi+l ny-2*iwindJ+l do 140 m-ml,m2 do 140 1-11,12 liml-l-iwindi lim2-iwindi+l lim3-m-iwindJ lim4-iwindJ+m k-0 do 130 J-lim3,1im4 k-k+1 n-0 do 130 i-liml,lim2 n-n+l if(iopt3.eq.1)go to 120 go to(l10,120),ioptl ii0 f(i,J)-(sigma2(i,J)*(-dsrx(i,J)*(x(1)-x(i))&dery(i,J)*(y(m)-y(J))+(zerr(l,m)-top(i,J))))/ &(((x(1)-x(i))**2+(y(m)-y(J))**2+(zarr(l,m)-top(i,J))**2)**l.5) f(n,k)-f(i,J) go to 130 120 f(i,J)-(sigma2(i,J)*(zarr(l,m)-top(i,J)))/ &(((x(1)-x(i))**2+(y(m)-y(J))**2+(zarr(l,m)-top(i,J))**2)**l.5) f(n,k)-f(i,J) 130 continue ifd-npx Upward continuation of potential field data xx(1)-x(liml) do 160 i-2,nx xx(i)-xx(i-l)+stsp ~y(1)'y(lim3) dO 170 i-2,ny yy(i)-yy(i-l)+step a-xx(1) 160 170 b,,xx(nx) c-~,(1) d-~(ny) C C C C C C *** IMSL routine abcgdu Usage: call dbcgdu(f,ifd,xx,nx,yy,ny,a,b,c,d,q,wk2,ier) Purpose: This subroutine executes a bicubic spline quadrature Parameters description: f nx by ny matrix containing the function values ifd row dimension of the matrix f exactly as specified in the dimension statement in the calling program xx vector of length nx (abscissae) yy vector of length ny (ordinates) a,b x-direction limits of integration c,d y-direction limits of integration q double integral from a to b and c to d wk2 work vector whose minimum length is (ny+5)*nx+ny-l+ max(5*nx-4,5*ny-2) ler error parameter C C C C ¢ C C C C C C ¢ C 140 call dbcqdu(f, ifd,xx,nx,yy,ny,a,b,c,d,q,wk2,ier) farr(l,m)--q continue return end ********************************************************************* subroutine store(farr,npx,npy,lunit3,name3,iform) C C C C C C C C C This subroutine stores the upward continued field Parameters description: farr matrix containing the upward continued field 1unit3 see main program name3 see main program Iform see main program double precision farr(npx,npy) character*80,name3,iform common /range/Jl,J2,il,i2 opsn(lunit3,status-'nsw',file-nams3) do 10 J-Jl,J2 I0 write(lunit3,iform)(farr(i,J),i-il,i2) close(lunit3) • return end 903