Fortran Program for Regional-Residual Separation by Finite Element Method

Fortran Program for Regional-Residual Separation by Finite Element Method

Appendix I 259 Appendix I Fortran Program for Regional-Residual Separation by Finite Element Method C AG-BOUGUER,GN-REGIONAL,D-RESIDUAL C PROGRAM FOR SEPARATION OF REGIONAL & RESIDUAL USING FEM METHOD C PROGRAM NEEDS THE GRAVITY VALUES ALSO IN ADDITION TO THE A(I)& B(I)VALUES DIMENSION G(12),X(12),Y(12) DIMENSION A(200000),B(200000),GN(200000),AG(200000),D(200000) OPEN(UNIT=3,FILE=‘F1-8.DAT’, STATUS=‘OLD’) OPEN(UNIT=4,FILE=‘A1.DAT’, STATUS=‘NEW’) OPEN(UNIT=11,FILE=‘A2.DAT’, STATUS=‘NEW’) OPEN(UNIT=12,FILE=‘A3.DAT’, STATUS=‘NEW’) OPEN(UNIT=13,FILE=‘A4.DAT’, STATUS=‘NEW’) READ (3,*) N,NN WRITE (*,*)‘GIVE OUTPUT DATA FILE NAME AS UNIT 4’ WRITE (4,*)‘NUMBER OF NODES{A(I)& B(I)} AND DATA(8 or 12) POINTS’ WRITE (4,*)N,NN WRITE (4,*)‘INPUT VALUES X,Y,AND GRAVITY DATA’ DO 10 I=1,NN READ (3,*) X(I),Y(I),G(I) 10 WRITE (4,*) X(I),Y(I),G(I) WRITE (4,*)‘INPUT VALUES OF A(I) & B(I)’ DO 20 I=1,N READ (3,*) A(I),B(I),AG(I) 20 WRITE (4,*)A(I),B(I),AG(I) WRITE (4,*)‘OUTPUT X , Y , REGIONAL GRAVITY & RESIDUAL VALUES’ DO 100 I=1,N A1=1+A(I) A2=1-A(I) AA=1-A(I)*A(I) K. Mallick et al., Bouguer Gravity Regional and Residual Separation: Application to Geology 259 and Environment, DOI 10.1007/978-94-007-0406-0, © Capital Publishing Company 2012 260 Bouguer Gravity Regional and Residual Separation B1=1+B(I) B2=1-B(I) BB=1-B(I)*B(I) C1=(9*AA)/32 C2=(9*BB)/32 C3=(-10+9*(2-AA-BB))/32 AN1=0.25*A2*B2*(A2+B2-3) AN3=0.25*A1*B2*(B2-A2-1) AN5=0.25*A1*B1*(1-A2-B2) AN7=0.25*A2*B1*(A2-B2-1) AN2=0.5*AA*B2 AN6=0.5*AA*B1 AN4=0.5*BB*A1 AN8=0.5*BB*A2 T1=AN1*G(1)+AN2*G(2)+AN3*G(3)+AN4*G(4) GN(I)=T1+AN5*G(5)+AN6*G(6)+AN7*G(7)+AN8*G(8) T2=AN1*X(1)+AN2*X(2)+AN3*X(3)+AN4*X(4) A(I)=T2+AN5*X(5)+AN6*X(6)+AN7*X(7)+AN8*X(8) T3=AN1*Y(1)+AN2*Y(2)+AN3*Y(3)+AN4*Y(4) B(I)=T3+AN5*Y(5)+AN6*Y(6)+AN7*Y(7)+AN8*Y(8) D(I)=AG(I)-GN(I) WRITE (4,*) A(I),B(I),GN(I),D(I) 100 CONTINUE WRITE (*,*)‘GIVE THE FILE NAME FOR STORING GRAVITY VALUES’ WRITE (11,*)‘VALUES FOR X,Y AND THE MEASURED GRAVITY VALUES’ DO 101 I=1,N 101 WRITE (11,*)A(I),B(I),AG(I) WRITE (*,*)‘GIVE FILE NAME FOR STORING REGIONAL GRAVITY VALUES’ WRITE (12,*)‘VALUES FOR X,Y AND THE CALCULATED REGIONAL VALUES’ DO 102 I=1,N 102 WRITE (12,*)A(I),B(I),GN(I) WRITE (*,*)‘GIVE FILE NAME FOR STORING RESIDUAL GRAVITY VALUES’ WRITE (13,*)‘VALUES FOR X,Y AND THE RESIDUAL VALUES’ DO 103 I=1,N 103 WRITE (13,*)A(I),B(I),D(I) SUMAG2=0.0 SUMDAG=0.0 SUMGNAG=0.0 SUMAG=0.0 SUMDGN=0.0 Appendix I 261 SUMD2=0.0 SUMGN2=0.0 SUMD=0.0 SUMGN=0.0 DO 110 I=1,N SUMAG2=SUMAG2+AG(I)*AG(I) SUMDAG=SUMDAG+D(I)*AG(I) SUMGNAG=SUMGNAG+GN(I)*AG(I) SUMAG=SUMAG+AG(I) SUMDGN=SUMDGN+D(I)*GN(I) SUMD2=SUMD2+D(I)*D(I) SUMGN2=SUMGN2+GN(I)*GN(I) SUMD=SUMD+D(I) SUMGN=SUMGN+GN(I) 110 CONTINUE NR1=SUMGNAG-(SUMAG*SUMGN/N) DR1=(SUMGN2-(SUMGN*SUMGN/N))*(SUMAG2-(SUMAG*SUMAG/ N)) DR1=SQRT(DR1) R1=NR1/DR1 NR2=SUMDAG-(SUMD*SUMAG/N) DR2=(SUMD2-(SUMD*SUMD/N))*(SUMAG2-(SUMAG*SUMAG/N)) DR2=SQRT(DR2) R2=NR2/DR2 NR3=SUMDGN-(SUMD*SUMGN/N) DR3=(SUMD2-(SUMD*SUMD/N))*(SUMGN2-(SUMGN*SUMGN/N)) DR3=SQRT(DR3) R3=NR3/DR3 WRITE (*,*) ‘R BET. BOU-REG,BOU-RES, REG-RES=’ WRITE (*,*)R1,R2,R3 WRITE (4,*)‘R BET. BOU-REG,BOU-RES,REG-RES’ WRITE (4,*)R1,R2,R3 WRITE (4,*)‘VALUES OF BOUGUER REGIONAL RESIDUAL’ DO 111 I=1,N 111 WRITE (4,*)AG(I),GN(I),D(I) STOP END 262 Bouguer Gravity Regional and Residual Separation Appendix II C++ Program for Regional-Residual Separation by Finite Element Method /* C++ Program for separation of regional and residual using FEM method */ /* Program needs Gravity values in addition to A[i] & B[i] values */ #include<iostream.h> #include<fstream.h> #include<stdlib.h> #include<conio.h> #include<math.h> class gravity { int i,N,NN; float A1,A2,AA,B1,B2,BB,NR1,NR2,NR3; float AN1,AN2,AN3,AN4,AN5,AN6,AN7,AN8,T1,T2,T3; float X[8],Y[8],G[8],A[800],B[800],AG[800],GN[800],D[800]; float SUMDAG,SUMAG,SUMGN2,SUMGNAG,SUMGN,SUMAG2,SUMD,SUMD2,SUMDGN; double DR1,DR2,DR3,R1,R2,R3; public: void gcalc(); }; void gravity::gcalc() { ifstream fin; ofstream fout,fout1,fout2,fout3; /* Opening the file for reading */ 262 AppendixAppendix III 263 fin.open(“f1-8.DAT”); if(!fin) { cout<<“\n Cannot Open File!!!!”; } /* Creating output files A1,A2,A3,A4 */ fout.open(“8A1.DAT”); if(!fout) { cout<<“\n Cannot open [A1.DAT] File!!!!”; } fout1.open(“8A2.DAT”); if(!fout1) { cout<<“\n Cannot open [A2.DAT] File!!!!”; } fout2.open(“8A3.DAT”); if(!fout2) { cout<<“\n Cannot open [A3.DAT] File!!!!”; } fout3.open(“8A4.DAT”); if(!fout3) { cout<<“\n Cannot open [A4.DAT] File!!!!”; } fin>>N>>NN; cout<<“\n GIVE OUTPUT DATA FILE NAME AS UNIT 4”; fout<<“ NO OF NODES {A[i] & B[i]} AND DATA (8 OR 12) POINTS”; fout<<N<<“\t”<<NN; fout<<“\n INPUT VALUES X, Y AND GRAVITY DATA”; for(i=0;i<NN;i++) { fin>>X[i]>>Y[i]>>G[i]; fout<<“\n”<<X[i]<<“\t”<<Y[i]<<“\t”<<G[i]; } fout<<“\n INPUT VALUES OF A[i] AND B[i] and AG[i]”; for(i=0;i<N;i++) 264 Bouguer Gravity Regional and Residual Separation { fin>>A[i]>>B[i]>>AG[i]; fout<<“\n”<<A[i]<<“\t”<<B[i]<<“\t”<<AG[i]; } fout<<“\n OUTPUT X,Y, REGIONAL GRAVITY AND RESIDUAL VALUES”; /* Calculating Zeeta , Eeta Coefficients */ for(i=0;i<N;i++) { A1=1+A[i]; A2=1-A[i]; AA=1-A[i]*A[i]; B1=1+B[i]; B2=1-B[i]; BB=1-B[i]*B[i]; AN1=0.25*A2*B2*(A2+B2-3); AN3=0.25*A1*B2*(B2-A2-1); AN5=0.25*A1*B1*(1-A2-B2); AN7=0.25*A2*B1*(A2-B2-1); AN2=0.5*AA*B2; AN6=0.5*AA*B1; AN4=0.5*BB*A1; AN8=0.5*BB*A2; T1=AN1*G[0]+AN2*G[1]+AN3*G[2]+AN4*G[3]; GN[i]=T1+AN5*G[4]+AN6*G[5]+AN7*G[6]+AN8*G[7]; T2=AN1*X[0]+AN2*X[1]+AN3*X[2]+AN4*X[3]; A[i]=T2+AN5*X[4]+AN6*X[5]+AN7*X[6]+AN8*X[7]; T3=AN1*Y[0]+AN2*Y[1]+AN3*Y[2]+AN4*Y[3]; B[i]=T3+AN5*Y[4]+AN6*Y[5]+AN7*Y[6]+AN8*Y[7]; D[i]=AG[i]-GN[i]; // Calculating Residual values fout<<“\n”<<A[i]<<“\t”<<B[i]<<“\t”<<GN[i]<<“\t”<<D[i]; } cout<<“\n GIVE THE FILE NAME FOR STORING GRAVITY VALUES”; fout1<<“\n VALUES FOR X,Y AND MEASURED GRAVITY VALUES”; for(i=0;i<N;i++) { fout1<<“\n”<<A[i]<<“\t”<<B[i]<<“\t”<<AG[i]; } AppendixAppendix III 265 cout<<“\n GIVE FILE NAME FOR STORING REGIONAL GRAVITY VALUES”; fout2<<“\n VALUES FOR X,Y AND CALCULATED REGIONAL VALUES”; for(i=0;i<N;i++) { fout2<<“\n”<<A[i]<<“\t”<<B[i]<<“\t”<<GN[i]; } cout<<“\n GIVE FILE NAME FOR STORING RESIDUAL GRAVITY VALUES”; fout3<<“\n VALUES FOR X,Y AND RESIDUAL VALUES”; for(i=0;i<N;i++) { fout3<<“\n”<<A[i]<<“\t”<<B[i]<<“\t”<<D[i]; } /* Calculating the correlation coefficients */ SUMAG2=0.0; SUMDAG=0.0; SUMGNAG=0.0; SUMAG=0.0; SUMDGN=0.0; SUMD2=0.0; SUMGN2=0.0; SUMD=0.0; SUMGN=0.0; for(i=0;i<N;i++) { SUMAG2=SUMAG2+AG[i]*AG[i]; SUMDAG=SUMDAG+D[i]*AG[i]; SUMGNAG=SUMGNAG+GN[i]*AG[i]; SUMAG=SUMAG+AG[i]; SUMDGN=SUMDGN+D[i]*GN[i]; SUMD2=SUMD2+D[i]*D[i]; SUMGN2=SUMGN2+GN[i]*GN[i]; SUMD=SUMD+D[i]; SUMGN=SUMGN+GN[i]; } NR1=SUMGNAG-(SUMAG*SUMGN/N); DR1=(SUMGN2-(SUMGN*SUMGN/N))*(SUMAG2-(SUMAG*SUMAG/ 266 Bouguer Gravity Regional and Residual Separation N)); DR1=sqrt(DR1); R1=NR1/DR1; NR2=SUMDAG-(SUMD*SUMAG/N); DR2=(SUMD2-(SUMD*SUMD/N))*(SUMAG2-(SUMAG*SUMAG/N)); DR2=sqrt(DR2); R2=NR2/DR2; NR3=SUMDGN-(SUMD*SUMGN/N); DR3=(SUMD2-(SUMD*SUMD/N))*(SUMGN2-(SUMGN*SUMGN/N)); DR3=sqrt(DR3); R3=NR3/DR3; cout<<“\n”<<“ R BET, BOU-REG, BOU-RES, REG-RES”; cout<<“\n”<<R1<<“\t”<<R2<<“\t”<<R3; fout<<“\n R BET, BOU-REG, BOU-RES, REG-RES”; fout<<“\n”<<R1<<“\t”<<R2<<“\t”<<R3; fout<<“\n VALUES OF BOUGUER REGIONAL RESIDUAL”; for(i=0;i<=N;i++) { fout<<“\n”<<AG[i]<<“\t”<<GN[i]<<“\t”<<D[i]; } cout<<“\n PROGRAM TERMINATED”; getch(); fin.close(); fout.close(); fout1.close(); fout2.close(); fout3.close(); } /* end function gcalc*/ void main() { clrscr(); gravity gr; /* Creating Object of the class gravity */ gr.gcalc(); /* Calling the Calc function of the class gravity */ } /* end main */ References 267 References Abdoh, A., Cowan, D.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    29 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us