Skip to content

Commit

Permalink
Merge pull request #860 from danielpeter/devel
Browse files Browse the repository at this point in the history
code cleaning (fortran linter fortitude)
  • Loading branch information
danielpeter authored Jan 27, 2025
2 parents a6ca022 + d9a0019 commit 36f3715
Show file tree
Hide file tree
Showing 51 changed files with 247 additions and 184 deletions.
2 changes: 2 additions & 0 deletions src/meshfem3D/model_1066a.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

module model_1066a_par

implicit none

! number of layers in DATA/1066a/1066a.dat
integer, parameter :: NR_1066A = 160

Expand Down
2 changes: 1 addition & 1 deletion src/meshfem3D/model_1dberkeley.f90
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ subroutine determine_1dberkeley_moho_depth(moho_depth)

! local parameters
double precision :: moho_radius
double precision :: earthradius = 6371.d0
double precision, parameter :: earthradius = 6371.d0

! get moho radius (in km)
call determine_1dberkeley_moho_radius(moho_radius)
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_1dref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@

module model_1dref_par

implicit none

! number of layers in DATA/s362ani/REF
integer, parameter :: NR_REF = 750

Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_ak135.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

module model_ak135_par

implicit none

! number of layers in DATA/ak135/ak135.dat
integer, parameter :: NR_AK135F_NO_MUD = 136

Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_aniso_mantle.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

module model_aniso_mantle_par

implicit none

! model_aniso_mantle_variables
double precision,dimension(:,:,:,:),allocatable :: AMM_V_beta
double precision,dimension(:),allocatable :: AMM_V_pro
Expand Down
4 changes: 3 additions & 1 deletion src/meshfem3D/model_atten3D_QRFSI12.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

module model_atten3D_QRFSI12_par

implicit none

! QRFSI12 constants
integer,parameter :: NKQ = 8,MAXL_Q = 12
integer,parameter :: NSQ=(MAXL_Q+1)**2,NDEPTHS_REFQ = 913
Expand Down Expand Up @@ -110,7 +112,7 @@ subroutine model_atten3D_QRFSI12_broadcast()
if (ier /= 0) stop 'Error allocating helper array'
xlmvec(:) = 0.0

end subroutine
end subroutine model_atten3D_QRFSI12_broadcast

!
!-------------------------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_attenuation_gll.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module model_gll_qmu_par

use constants, only: CUSTOM_REAL

implicit none

! GLL model_variables
type model_gll_qmu_variables
!TODO: check if `sequence` is needed
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_case65TAY.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

module model_case65tay_par

implicit none

! number of layers in DATA/case65TAY/case65TAY.dat
integer, parameter :: NR_case65TAY = 681

Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_crust_1_0.f90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@

module model_crust_1_0_par

implicit none

! crustal_model_constants
! crustal model parameters for crust1.0
integer, parameter :: CRUST_NP = 9
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_crust_2_0.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

module model_crust_2_0_par

implicit none

! crustal_model_constants
! crustal model parameters for crust2.0
integer, parameter :: CRUST_NP = 8
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_crustmaps.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

module model_crustmaps_par

implicit none

! General Crustmaps parameters
integer, parameter :: NLAYERS_CRUSTMAP = 5

Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_epcrust.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

module model_epcrust_par

implicit none

! parameters for EPCRUST , from Molinari & Morelli model(2011)
! latitude : 9.0N - 89.5N
! longitude: 56.0W - 70.0E
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_eucrust.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

module model_eucrust_par

implicit none

! EUcrust
double precision, dimension(:),allocatable :: eucrust_lat,eucrust_lon, &
eucrust_vp_uppercrust,eucrust_vp_lowercrust,eucrust_mohodepth, &
Expand Down
8 changes: 6 additions & 2 deletions src/meshfem3D/model_full_sh.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

module model_full_sh_crust_par

implicit none

! three_d_mantle_model_constants
integer, parameter :: NS_40 = 40
integer, parameter :: NSH_40 = (NS_40+1)**2
Expand Down Expand Up @@ -380,6 +382,8 @@ end subroutine crust_sh

module model_full_sh_mantle_par

implicit none

! three_d_mantle_model_constants
integer, parameter :: NK_20 = 20
integer, parameter :: NS_20 = 20
Expand Down Expand Up @@ -1252,8 +1256,8 @@ subroutine add_topography_sh_cmb(xelm,yelm,zelm)
double precision,intent(inout) :: xelm(NGNOD),yelm(NGNOD),zelm(NGNOD)

! PREM reference values
double precision :: RTOPDDOUBLEPRIME_ = 3630000.d0
double precision :: RCMB_ = 3480000.d0
double precision, parameter :: RTOPDDOUBLEPRIME_ = 3630000.d0
double precision, parameter :: RCMB_ = 3480000.d0

! local parameters
integer :: ia
Expand Down
18 changes: 11 additions & 7 deletions src/meshfem3D/model_gapp2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@


module gapp2_mantle_model_constants
! data file resolution
integer, parameter :: ma = 288,mo = 576,mr = 32,mr1 = 64
integer :: no,na,nnr,nr1
real :: dela,delo
! allocatable model arrays
real,dimension(:),allocatable :: dep,dep1,vp1
real,dimension(:,:,:),allocatable :: vp3

implicit none

! data file resolution
integer, parameter :: ma = 288,mo = 576,mr = 32,mr1 = 64
integer :: no,na,nnr,nr1
real :: dela,delo
! allocatable model arrays
real,dimension(:),allocatable :: dep,dep1,vp1
real,dimension(:,:,:),allocatable :: vp3

end module gapp2_mantle_model_constants

!
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_gll.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module model_gll_par

use constants, only: CUSTOM_REAL

implicit none

! GLL model_variables
type model_gll_variables
!TODO: check if `sequence` is needed
Expand Down
20 changes: 11 additions & 9 deletions src/meshfem3D/model_jp3d.f90
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@

module model_jp3d_par

implicit none

! The meaningful range of Zhao et al. (1994) model is as follows:
! latitude : 32 - 45 N
! longitude: 130-145 E
Expand Down Expand Up @@ -435,7 +437,7 @@ subroutine INPUT2()
120 FORMAT(6(10F7.2/),3F7.2)
130 FORMAT(6(10F7.1/),3F7.1)

END
END subroutine INPUT2

!
!-------------------------------------------------------------------------------------------------
Expand All @@ -453,7 +455,7 @@ subroutine BLDMAP()
CALL LOCX(JP3DM_PNB,JP3DM_RNB,JP3DM_HNB,JP3DM_NPB,JP3DM_NRB,JP3DM_NHB,MKB, &
JP3DM_PLB,JP3DM_RLB,JP3DM_HLB,JP3DM_IPLOCB,JP3DM_IRLOCB,JP3DM_IHLOCB)

END
END subroutine BLDMAP

!
!-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -499,7 +501,7 @@ subroutine LOCX(PNX,RNX,HNX,NPX,NRX,NHX,MKX, &
IHLOCX(I)= IH
30 continue

END
END subroutine LOCX

!
!-------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -566,7 +568,7 @@ subroutine VABPS(MP,MR,MH,V,VEL)
+ JP3DM_WV(5)*V(JP3DM_IP,JP3DM_JP,JP3DM_KP1) + JP3DM_WV(6)*V(JP3DM_IP1,JP3DM_JP,JP3DM_KP1) &
+ JP3DM_WV(7)*V(JP3DM_IP,JP3DM_JP1,JP3DM_KP1)+ JP3DM_WV(8)*V(JP3DM_IP1,JP3DM_JP1,JP3DM_KP1)

END
END subroutine VABPS

!
!-------------------------------------------------------------------------------------------------
Expand All @@ -582,7 +584,7 @@ subroutine INTMAP(R,IRLOC,NNR,RL,IR)
IS = IDNINT(R+RL)
IR = IRLOC(IS)

END
END subroutine INTMAP

!
!------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -619,7 +621,7 @@ subroutine PRHF(IPLOCX,IRLOCX,IHLOCX,PLX,RLX,HLX, &
JP3DM_RF1 = 1.0-JP3DM_RF
JP3DM_HF1 = 1.0-JP3DM_HF

END
END subroutine PRHF

!
!----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -720,7 +722,7 @@ subroutine VEL1D(HE,V,LAY,IPS)
ELSE
endif

END
END subroutine VEL1D

!
!-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -755,7 +757,7 @@ subroutine INPUTJP()
JP3DM_DEPJ(L) = 40.0+6325.59*(1.0-RA1(L))
enddo

END
END subroutine INPUTJP

!
!-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -785,5 +787,5 @@ subroutine JPMODEL(IPS,H,V)
V = (JP3DM_VS(K1)-JP3DM_VS(K))*H12+JP3DM_VS(K)
endif

END
END subroutine JPMODEL

8 changes: 5 additions & 3 deletions src/meshfem3D/model_ppm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

module model_ppm_par

implicit none

! ----------------------

! scale perturbations in shear speed to perturbations in density and vp
Expand Down Expand Up @@ -477,7 +479,7 @@ subroutine get_PPMmodel_value(lat,lon,depth,dvs)
! endif
! enddo

end subroutine
end subroutine get_PPMmodel_value

!
!--------------------------------------------------------------------------------------------------
Expand All @@ -499,7 +501,7 @@ subroutine get_Gaussianweight(x,sigma,weight)
! only exponential
weight = exp(-0.5*x*x/(sigma*sigma))

end subroutine
end subroutine get_Gaussianweight

!
!--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1056,6 +1058,6 @@ subroutine smooth_model(nproc_xi,nproc_eta, &
!endif
!call synchronize_all()

end subroutine
end subroutine smooth_model


2 changes: 2 additions & 0 deletions src/meshfem3D/model_s20rts.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

module model_s20rts_par

implicit none

! three_d_mantle_model_constants
integer, parameter :: NK_20 = 20
integer, parameter :: NS_20 = 20
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_s362ani.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

module model_s362ani_par

implicit none

! used for 3D Harvard models s362ani, s362wmani, s362ani_prem and s2.9ea
integer, parameter :: maxker = 200
integer, parameter :: maxl = 72
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_s40rts.f90
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

module model_s40rts_par

implicit none

! three_d_mantle_model_constants
integer, parameter :: NK_20 = 20
integer, parameter :: NS_40 = 40
Expand Down
6 changes: 3 additions & 3 deletions src/meshfem3D/model_scattering.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ real function rlog2(x)

rlog2 = log(x) / log(2.0)

end function
end function rlog2

!---------------------------------------------------
! logarithm base 2 (double precision)
Expand All @@ -87,7 +87,7 @@ double precision function dlog2(x)

dlog2 = log(x) / log(2.d0)

end function
end function dlog2

end module model_scattering_par

Expand Down Expand Up @@ -175,7 +175,7 @@ real function psd_vonKarman_3D(a_in,kx,ky,kz)
psd_vonKarman_3D = psd
return

end function
end function psd_vonKarman_3D

!
!--------------------------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_sea1d.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

module model_sea1d_par

implicit none

! number of layers in DATA/Lebedev_sea99 1D model
integer, parameter :: NR_SEA1D = 163

Expand Down
2 changes: 2 additions & 0 deletions src/meshfem3D/model_sea99_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

module model_sea99_s_par

implicit none

double precision,dimension(:,:,:), allocatable :: sea99_vs
double precision,dimension(:), allocatable :: sea99_depth
double precision :: sea99_ddeg
Expand Down
Loading

0 comments on commit 36f3715

Please sign in to comment.