I am trying to add the whole program in small chunks
!
! PROGRAM FA2Boug.f:
! Fortran 90 code to calculate Bouguer anomaly applying
! Bullard A, B and C corrections to a Free Air (FA)/slab-corrected
! Bouguer anomaly grid, provided an extra grid with elevation
! (topo/bathymetry)
! The program can calculate Bouguer anomaly in in either land or
! sea points
! Contributions to Bouguer anomaly are computed in different zones
! according the radial distance, R, to the calculation point:
! DISTANT ZONE: (R_d>R>R_i)
! INTERMEDIATE ZONE: (R_i>R>del_xi/2)
! INNER ZONE: (R<del_xi/2)
! Input files required by FA2Boug.f:
! *parameters.dat
! *topo_cart.xyz
! *gravi_cart.xyz
! Output files are:
! *bouguer.xyz
! *bouguer_slab.xyz
! Optionally a detailed topography file, *topo_cart_det.xyz,
! with a gridstep del_xdet(<del_xi) can be provided. In that
! case, a new calculation is performed in the
! DETAILED INTERMEDIATE ZONE (del_xi/2>R>del_xdet/2), and
! the INNER ZONE is redefined as (R<del_xdet/2)
! Also optionally, the program calculate the isostatic residual
! anomaly using an Airy compensation model for the crust
! Written by Javier Fullea Urchulutegui
! Instituto de Ciencias de la Tierra Jaume Almera (CSIC)
! Sept 2007
!
MODULE MOD_Precision
INTEGER, PARAMETER :: sp=SELECTED_REAL_KIND(6,30)
INTEGER, PARAMETER :: dp=SELECTED_REAL_KIND(12,100)
INTEGER, PARAMETER :: qp=SELECTED_REAL_KIND(18,500)
END MODULE MOD_Precision
MODULE MOD_PARAM
USE MOD_Precision
REAL(dp), PARAMETER :: R_t=6370,G=6.67D-11 ! ,pi=3.14159
REAL(dp) :: pi
REAL(qp) :: piq
REAL(sp) :: pis
END MODULE
MODULE MOD_EXPAN
USE MOD_Precision
REAL(dp) d_x,d_y,d_z,xc,yc,zc,Gp_as,d_rho
END MODULE
MODULE MOD_NEAR
USE MOD_Precision
REAL(dp) rad,d_h(2,2),G_cp,rho_w,rho_c,h
END MODULE
USE MOD_EXPAN
USE MOD_NEAR
USE MOD_PARAM
!
pi = 4.0_dp * ATAN (1.0_dp)
piq = 4.0_qp * ATAN (1.0_qp)
pis = 4.0_sp * ATAN (1.0_sp)
write (*,*) pis, kind(pis), precision(pis)
write (*,*) pi, kind(pi), precision(pi)
write (*,*) piq, kind(piq), precision(piq)
write (*,'(f27.19)') pis
write (*,'(f27.19)') pi
write (*,'(f27.19)') piq
!
END
REAL(dp) del_xd,del_xi,cx,cy,del_xBg,R_d,R_i,del_xdet,del_x_pr
REAL(dp) AB
REAL(dp) x,y,z,del_g,Gpr,x1,y1,x2,y2,z1,z2,zm,E_pr
REAL(dp) L_x,L_y,BS
REAL(dp) BB,nu,al
REAL(dp) l_i1,l_i2,l_j1,l_j2,dm
INTEGER N,M,k,l,IWIN_i,IWIN,rtio,rt,rt_i
INTEGER l_lst,l_fst,k_lst,k_fst,up_INT
INTEGER cont_x,cont_y,N_tot,N_nod,n_strg,slab_Boug
REAL(dp), ALLOCATABLE:: E(:,:),FA(:,:),E_det(:,:)
CHARACTER(10), ALLOCATABLE:: FA_strg(:,:),E_det_strg(:,:)
CHARACTER(10) COORD,land
REAL(dp) a(3,3),R_i_L,R_i_R,R_i_D,R_i_U
INTEGER det,N_det,M_det,IWIN_det
LOGICAL det_on
REAL(dp) d_rho_mho,t,ISOS,z_cref
!//////////////////INPUT/////////////////////////////