[cig-commits] [commit] devel: Use specfem modules to reduce subroutine arguments. (672b5e6)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Apr 30 16:39:54 PDT 2014


Repository : ssh://geoshell/specfem3d_globe

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d_globe/compare/811ae11b80604736d2845c4e5a062755069fc9a6...fedf291c8257de6ffc3151362afcb814578beb7e

>---------------------------------------------------------------

commit 672b5e6ee0f43ae52d23669b49a1a3338a34db81
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Wed Apr 30 18:29:16 2014 -0400

    Use specfem modules to reduce subroutine arguments.


>---------------------------------------------------------------

672b5e6ee0f43ae52d23669b49a1a3338a34db81
 src/specfem3D/locate_regular_points.f90 | 25 +++++++++++++------------
 src/specfem3D/read_mesh_databases.F90   | 15 +++++++--------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/specfem3D/locate_regular_points.f90 b/src/specfem3D/locate_regular_points.f90
index 1353f67..da322ee 100644
--- a/src/specfem3D/locate_regular_points.f90
+++ b/src/specfem3D/locate_regular_points.f90
@@ -25,9 +25,10 @@
 !
 !=====================================================================
 
-  subroutine read_kl_regular_grid(myrank, GRID)
+  subroutine read_kl_regular_grid(GRID)
 
   use constants
+  use specfem_par, only: myrank
 
   implicit none
 
@@ -46,7 +47,7 @@
 
   type (kl_reg_grid_variables), intent(inout) :: GRID
 
-  integer :: myrank,ios,nlayer,i,nlat,nlon,npts_this_layer
+  integer :: ios,nlayer,i,nlat,nlon,npts_this_layer
   real :: r
 
   ! improvements to make: read-in by master and broadcast to all slaves
@@ -90,10 +91,11 @@
 
 !==============================================================
 
-  subroutine find_regular_grid_slice_number(slice_number, GRID, &
-                                          NCHUNKS, NPROC_XI, NPROC_ETA)
+  subroutine find_regular_grid_slice_number(slice_number, GRID)
 
   use constants
+  use specfem_par, only: myrank, &
+                         NCHUNKS_VAL, NPROC_XI_VAL, NPROC_ETA_VAL
 
   implicit none
 
@@ -113,19 +115,17 @@
   end type kl_reg_grid_variables
   type (kl_reg_grid_variables), intent(in) :: GRID
 
-  integer, intent(in) :: NCHUNKS,NPROC_XI,NPROC_ETA
-
   real(kind=CUSTOM_REAL) :: xi_width, eta_width
   integer :: nproc, ilayer, isp, ilat, ilon, k, chunk_isp
   integer :: iproc_xi, iproc_eta
   real :: lat,lon,th,ph,x,y,z,xik,etak,xi_isp,eta_isp,xi1,eta1
 
   ! assuming 6 chunks full global simulations right now
-  if (NCHUNKS /= 6 .or. NPROC_XI /= NPROC_ETA) then
-    call exit_MPI(0, 'Only deal with 6 chunks at this moment')
+  if (NCHUNKS_VAL /= 6 .or. NPROC_XI_VAL /= NPROC_ETA_VAL) then
+    call exit_MPI(myrank, 'Only deal with 6 chunks at this moment')
   endif
 
-  xi_width=PI/2; eta_width=PI/2; nproc=NPROC_XI
+  xi_width=PI/2; eta_width=PI/2; nproc=NPROC_XI_VAL
   ilayer=0
 
   do isp = 1,GRID%npts_total
@@ -142,7 +142,7 @@
 
     ! figure out slice number
     chunk_isp = 1; xi_isp = 0; eta_isp = 0
-    do k = 1, NCHUNKS
+    do k = 1, NCHUNKS_VAL
       call chunk_map(k, x, y, z, xik, etak)
       if (abs(xik) <= PI/4 .and. abs(etak) <= PI/4) then
         chunk_isp = k;  xi_isp = xik; eta_isp = etak; exit
@@ -160,11 +160,12 @@
 
 ! how about using single precision for the iterations?
   subroutine locate_regular_points(npoints_slice,points_slice,GRID, &
-                                   NEX_XI,nspec,xstore,ystore,zstore,ibool, &
+                                   nspec,xstore,ystore,zstore,ibool, &
                                    xigll,yigll,zigll,ispec_reg, &
                                    hxir_reg,hetar_reg,hgammar_reg)
 
   use constants_solver
+  use specfem_par, only: NEX_XI
 
   implicit none
 
@@ -187,7 +188,7 @@
   type (kl_reg_grid_variables), intent(in) :: GRID
 
   ! simulation geometry
-  integer, intent(in) :: NEX_XI, nspec
+  integer, intent(in) :: nspec
   real(kind=CUSTOM_REAL), dimension(*), intent(in) :: xstore,ystore,zstore
   integer, dimension(NGLLX,NGLLY,NGLLZ,*), intent(in) :: ibool
 
diff --git a/src/specfem3D/read_mesh_databases.F90 b/src/specfem3D/read_mesh_databases.F90
index 845c4e5..d02af74 100644
--- a/src/specfem3D/read_mesh_databases.F90
+++ b/src/specfem3D/read_mesh_databases.F90
@@ -1329,7 +1329,7 @@
   end type kl_reg_grid_variables
   type (kl_reg_grid_variables) KL_REG_GRID
 
-  call read_kl_regular_grid(myrank, KL_REG_GRID)
+  call read_kl_regular_grid(KL_REG_GRID)
 
   if( myrank == 0 ) then
     ! master process
@@ -1337,8 +1337,7 @@
     if( ier /= 0 ) call exit_MPI(myrank,'error allocating slice_number array')
 
     ! print *, 'slice npts =', KL_REG_GRID%npts_total
-    call find_regular_grid_slice_number(slice_number, KL_REG_GRID, NCHUNKS_VAL, &
-                                        NPROC_XI_VAL, NPROC_ETA_VAL)
+    call find_regular_grid_slice_number(slice_number, KL_REG_GRID)
 
     do i = NPROCTOT_VAL-1,0,-1
       npoints_slice = 0
@@ -1376,11 +1375,11 @@
   ! and presumably the more processors involved the faster.
   if (npoints_slice > 0) then
     call locate_regular_points(npoints_slice, points_slice, KL_REG_GRID, &
-                           NEX_XI, NSPEC_CRUST_MANTLE, &
-                           xstore_crust_mantle, ystore_crust_mantle, zstore_crust_mantle, &
-                           ibool_crust_mantle, &
-                           xigll, yigll, zigll, &
-                           ispec_reg, hxir_reg, hetar_reg, hgammar_reg)
+                               NSPEC_CRUST_MANTLE, &
+                               xstore_crust_mantle, ystore_crust_mantle, zstore_crust_mantle, &
+                               ibool_crust_mantle, &
+                               xigll, yigll, zigll, &
+                               ispec_reg, hxir_reg, hetar_reg, hgammar_reg)
   endif
 
   ! user output



More information about the CIG-COMMITS mailing list