[cig-commits] r18286 - in seismo/2D/SPECFEM2D/trunk/src: meshfem2D specfem2D

danielpeter at geodynamics.org danielpeter at geodynamics.org
Fri Apr 22 18:23:55 PDT 2011


Author: danielpeter
Date: 2011-04-22 18:23:54 -0700 (Fri, 22 Apr 2011)
New Revision: 18286

Added:
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_global.f90
Modified:
   seismo/2D/SPECFEM2D/trunk/src/meshfem2D/meshfem2D.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/Makefile.in
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/check_stability.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/checkgrid.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_Bielak_conditions.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_curl_one_element.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_energy.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_acoustic.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_fluid.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_solid.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_gradient_attenuation.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_pressure.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_vector_field.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_fast.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_slow.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/enforce_acoustic_free_surface.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_MPI.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/initialize_simulation.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/invert_mass_matrix.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_force.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_moment_tensor.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/paco_beyond_critical.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotgll.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotpost.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_assemble_MPI.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_initialfield.F90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_external_model.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/setup_sources_receivers.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
Log:
adds file get_global.f90; renames npoin to nglob; fixes allocation problem in meshfem2D

Modified: seismo/2D/SPECFEM2D/trunk/src/meshfem2D/meshfem2D.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/meshfem2D/meshfem2D.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/meshfem2D/meshfem2D.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -908,6 +908,11 @@
      endif
      allocate(my_interfaces(0:ninterfaces-1))
      allocate(my_nb_interfaces(0:ninterfaces-1))
+  else
+     ! dummy allocation
+     ninterfaces=0
+     allocate(my_interfaces(0:ninterfaces-1))
+     allocate(my_nb_interfaces(0:ninterfaces-1))
   endif
 
   ! setting absorbing boundaries by elements instead of edges

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/Makefile.in
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/Makefile.in	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/Makefile.in	2011-04-23 01:23:54 UTC (rev 18286)
@@ -125,6 +125,7 @@
 	$O/define_shape_functions.o \
 	$O/enforce_acoustic_free_surface.o \
 	$O/exit_mpi.o \
+	$O/get_global.o \
 	$O/get_MPI.o \
 	$O/get_perm_cuthill_mckee.o \
 	$O/get_poroelastic_velocities.o \
@@ -284,6 +285,9 @@
 $O/exit_mpi.o: ${S}/exit_mpi.F90 ${SETUP}/constants.h
 	${F90} $(FLAGS_CHECK) -c -o $O/exit_mpi.o ${S}/exit_mpi.F90
 
+$O/get_global.o: ${S}/get_global.f90 ${SETUP}/constants.h
+	${F90} $(FLAGS_CHECK) -c -o $O/get_global.o ${S}/get_global.f90
+
 $O/get_MPI.o: ${S}/get_MPI.F90 ${SETUP}/constants.h
 	${F90} $(FLAGS_CHECK) -c -o $O/get_MPI.o ${S}/get_MPI.F90
 
@@ -422,7 +426,7 @@
 
 ##
 ## shared
-## 
+##
 $O/read_value_parameters.o: ${SHARED}/read_value_parameters.f90
 	${F90} $(FLAGS_CHECK) -c -o $O/read_value_parameters.o ${SHARED}/read_value_parameters.f90
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/check_stability.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/check_stability.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/check_stability.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
 
 
   subroutine check_stability(myrank,time,it,NSTEP, &
-                        npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         any_elastic_glob,any_elastic,displ_elastic, &
                         any_poroelastic_glob,any_poroelastic, &
                         displs_poroelastic,displw_poroelastic, &
@@ -64,16 +64,16 @@
   double precision :: time
 
   logical :: any_elastic_glob,any_elastic
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: displ_elastic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: displ_elastic
 
   logical :: any_poroelastic_glob,any_poroelastic
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: displs_poroelastic,displw_poroelastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: displs_poroelastic,displw_poroelastic
 
   logical :: any_acoustic_glob,any_acoustic
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: potential_acoustic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: potential_acoustic
 
   double precision :: time_start
   integer :: year_start,month_start

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/checkgrid.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/checkgrid.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/checkgrid.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
 
   subroutine checkgrid(vpext,vsext,rhoext,density,poroelastcoef, &
                       porosity,tortuosity,permeability,ibool,kmato, &
-                      coord,npoin,vpImin,vpImax,vpIImin,vpIImax, &
+                      coord,nglob,vpImin,vpImax,vpIImin,vpIImax, &
                       assign_external_model,nspec,UPPER_LIMIT_DISPLAY,numat,deltat, &
                       f0,initialfield,time_function_type, &
                       coorg,xinterp,zinterp,shapeint,knods,simulation_title, &
@@ -65,7 +65,7 @@
 ! for instance to analyze Cuthill-McKee mesh partitioning etc.
   integer :: UPPER_LIMIT_DISPLAY
 
-  integer :: npoin,nspec,numat
+  integer :: nglob,nspec,numat
   integer, dimension(nspec) :: kmato
   logical, dimension(nspec) :: poroelastic
   integer, dimension(NGLLX,NGLLX,nspec) :: ibool
@@ -76,7 +76,7 @@
   double precision, dimension(3,numat) :: permeability
   double precision, dimension(NGLLX,NGLLX,nspec) :: vpext,vsext,rhoext
 
-  double precision coord(NDIM,npoin)
+  double precision coord(NDIM,nglob)
 
   integer :: NSOURCES
   integer, dimension(NSOURCES) :: time_function_type

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_Bielak_conditions.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_Bielak_conditions.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_Bielak_conditions.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
 
 ! compute analytical initial plane wave for Bielak's conditions
 
-subroutine compute_Bielak_conditions(coord,iglob,npoin,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
+subroutine compute_Bielak_conditions(coord,iglob,nglob,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
      x0_source, z0_source, A_plane, B_plane, C_plane, angleforce, angleforce_refl, &
      c_inc, c_refl, time_offset,f0)
 
@@ -52,13 +52,13 @@
 
   include "constants.h"
 
-  integer, intent(in) :: iglob,npoin,it
+  integer, intent(in) :: iglob,nglob,it
 
   double precision, intent(in) :: deltat
 
   double precision, intent(out) :: dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert
 
-  double precision, dimension(NDIM,npoin), intent(in) :: coord
+  double precision, dimension(NDIM,nglob), intent(in) :: coord
 
   double precision :: time_veloc,time_traction,t,x,z
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_curl_one_element.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_curl_one_element.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_curl_one_element.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
   subroutine compute_curl_one_element(curl_element,displ_elastic, &
                               displs_poroelastic,elastic,poroelastic, &
                               xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                              nspec,npoin_elastic,npoin_poroelastic,ispec)
+                              nspec,nglob_elastic,nglob_poroelastic,ispec)
 
   ! compute curl in (poro)elastic elements (for rotational study)
 
@@ -63,10 +63,10 @@
 
   logical, dimension(nspec) :: elastic,poroelastic
 
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: displ_elastic
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: displs_poroelastic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: displ_elastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: displs_poroelastic
 
   ! array with derivatives of Lagrange polynomials
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_energy.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_energy.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_energy.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -47,7 +47,7 @@
                             displw_poroelastic,velocw_poroelastic, &
                             xix,xiz,gammax,gammaz,jacobian,ibool, &
                             elastic,poroelastic,hprime_xx,hprime_zz, &
-                            nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                            nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                             assign_external_model,it,deltat,t0,kmato,poroelastcoef,density, &
                             porosity,tortuosity, &
                             vpext,vsext,rhoext,c11ext,c13ext,c15ext,c33ext,c35ext,c55ext, &
@@ -74,8 +74,8 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec,N_SLS) :: e1,e11
   double precision, dimension(NGLLX,NGLLZ,nspec) :: Mu_nu1,Mu_nu2
 
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: &
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: &
     potential_dot_acoustic,potential_dot_dot_acoustic
 
   logical :: TURN_ATTENUATION_ON,p_sv
@@ -98,12 +98,12 @@
   double precision, dimension(NGLLX,NGLLZ,nspec) ::  c11ext,c15ext,c13ext, &
     c33ext,c35ext,c55ext
 
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: displ_elastic,veloc_elastic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: displ_elastic,veloc_elastic
 
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: displs_poroelastic,velocs_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: displw_poroelastic,velocw_poroelastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: displs_poroelastic,velocs_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: displw_poroelastic,velocw_poroelastic
 
 ! Gauss-Lobatto-Legendre points and weights
   real(kind=CUSTOM_REAL), dimension(NGLLX) :: wxgll
@@ -347,7 +347,7 @@
       call compute_pressure_one_element(pressure_element,potential_dot_dot_acoustic,displ_elastic, &
                   displs_poroelastic,displw_poroelastic,elastic,poroelastic, &
                   xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz,nspec, &
-                  npoin_acoustic,npoin_elastic,npoin_poroelastic,assign_external_model, &
+                  nglob_acoustic,nglob_elastic,nglob_poroelastic,assign_external_model, &
                   numat,kmato,density,porosity,tortuosity,poroelastcoef,vpext,vsext,rhoext, &
                   c11ext,c13ext,c15ext,c33ext,c35ext,c55ext,anisotropic,anisotropy,ispec,e1,e11, &
                   TURN_ATTENUATION_ON,Mu_nu1,Mu_nu2,N_SLS)
@@ -357,7 +357,7 @@
                   veloc_elastic,velocs_poroelastic, &
                   elastic,poroelastic,xix,xiz,gammax,gammaz, &
                   ibool,hprime_xx,hprime_zz, &
-                  nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                  nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                   ispec,numat,kmato,density,rhoext,assign_external_model)
 
       ! get density of current spectral element

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_acoustic.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_acoustic.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_acoustic.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -42,7 +42,7 @@
 !
 !========================================================================
 
-  subroutine compute_forces_acoustic(npoin,nspec,nelemabs,numat,it,NSTEP, &
+  subroutine compute_forces_acoustic(nglob,nspec,nelemabs,numat,it,NSTEP, &
                anyabs,assign_external_model,ibool,kmato,numabs, &
                elastic,poroelastic,codeabs,potential_dot_dot_acoustic,potential_dot_acoustic, &
                potential_acoustic,b_potential_dot_dot_acoustic,b_potential_acoustic, &
@@ -61,7 +61,7 @@
 
   include "constants.h"
 
-  integer :: npoin,nspec,nelemabs,numat,it,NSTEP,SIMULATION_TYPE
+  integer :: nglob,nspec,nelemabs,numat,it,NSTEP,SIMULATION_TYPE
 
   integer :: nspec_left,nspec_right,nspec_bottom,nspec_top
   integer, dimension(nelemabs) :: ib_left
@@ -80,9 +80,9 @@
   logical, dimension(nspec) :: elastic,poroelastic
   logical, dimension(4,nelemabs)  :: codeabs
 
-  real(kind=CUSTOM_REAL), dimension(npoin) :: &
+  real(kind=CUSTOM_REAL), dimension(nglob) :: &
     potential_dot_dot_acoustic,potential_dot_acoustic,potential_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin) :: &
+  real(kind=CUSTOM_REAL), dimension(nglob) :: &
     b_potential_dot_dot_acoustic,b_potential_acoustic
   double precision, dimension(2,numat) :: density
   double precision, dimension(4,3,numat) :: poroelastcoef
@@ -432,7 +432,7 @@
 !
 
 
-  subroutine compute_forces_acoustic_2(npoin,nspec,nelemabs,numat,it,NSTEP, &
+  subroutine compute_forces_acoustic_2(nglob,nspec,nelemabs,numat,it,NSTEP, &
                anyabs,assign_external_model,ibool,kmato,numabs, &
                elastic,poroelastic,codeabs,potential_dot_dot_acoustic,potential_dot_acoustic, &
                potential_acoustic, &
@@ -452,7 +452,7 @@
 
   include "constants.h"
 
-  integer :: npoin,nspec,nelemabs,numat,it,NSTEP,SIMULATION_TYPE
+  integer :: nglob,nspec,nelemabs,numat,it,NSTEP,SIMULATION_TYPE
 
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
   integer, dimension(nspec) :: kmato
@@ -462,7 +462,7 @@
   logical, dimension(nspec) :: elastic,poroelastic
   logical, dimension(4,nelemabs)  :: codeabs
 
-  real(kind=CUSTOM_REAL), dimension(npoin) :: &
+  real(kind=CUSTOM_REAL), dimension(nglob) :: &
     potential_dot_dot_acoustic,potential_dot_acoustic,potential_acoustic
 
   double precision, dimension(2,numat) :: density

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_fluid.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_fluid.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_fluid.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -41,7 +41,7 @@
 !
 !========================================================================
 
-  subroutine compute_forces_poro_fluid(npoin,nspec,myrank,nelemabs,numat, &
+  subroutine compute_forces_poro_fluid(nglob,nspec,myrank,nelemabs,numat, &
                ispec_selected_source,ispec_selected_rec,is_proc_source,which_proc_receiver,&
                source_type,it,NSTEP,anyabs, &
                initialfield,TURN_ATTENUATION_ON,TURN_VISCATTENUATION_ON,deltatcube, &
@@ -69,7 +69,7 @@
   include "constants.h"
   integer :: NSOURCES, i_source
   integer, dimension(NSOURCES) ::ispec_selected_source,source_type,is_proc_source
-  integer :: npoin,nspec,nelemabs,numat,it,NSTEP
+  integer :: nglob,nspec,nelemabs,numat,it,NSTEP
   integer :: nrec,SIMULATION_TYPE,myrank
   integer, dimension(nrec) :: ispec_selected_rec,which_proc_receiver
   integer :: nspec_left,nspec_right,nspec_bottom,nspec_top
@@ -91,9 +91,9 @@
   logical, dimension(nspec) :: poroelastic
   logical, dimension(4,nelemabs)  :: codeabs
 
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin) :: accelw_poroelastic,velocw_poroelastic,displw_poroelastic,&
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob) :: accelw_poroelastic,velocw_poroelastic,displw_poroelastic,&
                                             displs_poroelastic,velocs_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin) :: b_accelw_poroelastic,b_displw_poroelastic,b_displs_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob) :: b_accelw_poroelastic,b_displw_poroelastic,b_displs_poroelastic
   double precision, dimension(2,numat) :: density
   double precision, dimension(3,numat) :: permeability
   double precision, dimension(numat) :: porosity,tortuosity
@@ -102,12 +102,12 @@
   real(kind=CUSTOM_REAL), dimension(NSOURCES,NSTEP) :: source_time_function
   real(kind=CUSTOM_REAL), dimension(NSOURCES,NDIM,NGLLX,NGLLZ) :: sourcearray
   real(kind=CUSTOM_REAL), dimension(nrec,NSTEP,3,NGLLX,NGLLZ) :: adj_sourcearrays
-  real(kind=CUSTOM_REAL), dimension(npoin) :: C_k,M_k
+  real(kind=CUSTOM_REAL), dimension(nglob) :: C_k,M_k
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLZ,nspec_left,NSTEP) :: b_absorb_poro_w_left
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLZ,nspec_right,NSTEP) :: b_absorb_poro_w_right
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,nspec_top,NSTEP) :: b_absorb_poro_w_top
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,nspec_bottom,NSTEP) :: b_absorb_poro_w_bottom
-  real(kind=CUSTOM_REAL), dimension(npoin) :: b_viscodampx,b_viscodampz
+  real(kind=CUSTOM_REAL), dimension(nglob) :: b_viscodampx,b_viscodampz
 
   integer :: N_SLS
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec,N_SLS) :: e11,e13
@@ -184,7 +184,7 @@
 
 ! compute Grad(displs_poroelastic) at time step n for attenuation
   if(TURN_ATTENUATION_ON) call compute_gradient_attenuation(displs_poroelastic,dux_dxl_n,duz_dxl_n, &
-      dux_dzl_n,duz_dzl_n,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,npoin)
+      dux_dzl_n,duz_dzl_n,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,nglob)
 
 ! loop over spectral elements
   do ispec = 1,nspec
@@ -868,7 +868,7 @@
 
 ! compute Grad(displs_poroelastic) at time step n+1 for attenuation
     call compute_gradient_attenuation(displs_poroelastic,dux_dxl_np1,duz_dxl_np1, &
-      dux_dzl_np1,duz_dzl_np1,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,npoin)
+      dux_dzl_np1,duz_dzl_np1,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,nglob)
 
 ! update memory variables with fourth-order Runge-Kutta time scheme for attenuation
 ! loop over spectral elements

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_solid.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_solid.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_poro_solid.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -41,7 +41,7 @@
 !
 !========================================================================
 
-  subroutine compute_forces_poro_solid(npoin,nspec,myrank,nelemabs,numat, &
+  subroutine compute_forces_poro_solid(nglob,nspec,myrank,nelemabs,numat, &
                ispec_selected_source,ispec_selected_rec,is_proc_source,which_proc_receiver,&
                source_type,it,NSTEP,anyabs, &
                initialfield,TURN_ATTENUATION_ON,TURN_VISCATTENUATION_ON,deltatcube, &
@@ -69,7 +69,7 @@
   include "constants.h"
   integer :: NSOURCES, i_source
   integer, dimension(NSOURCES) :: ispec_selected_source,source_type,is_proc_source
-  integer :: npoin,nspec,nelemabs,numat,it,NSTEP
+  integer :: nglob,nspec,nelemabs,numat,it,NSTEP
   integer :: nrec,SIMULATION_TYPE,myrank
   integer, dimension(nrec) :: ispec_selected_rec,which_proc_receiver
   integer :: nspec_xmin,nspec_xmax,nspec_zmin,nspec_zmax
@@ -91,9 +91,9 @@
   logical, dimension(nspec) :: poroelastic
   logical, dimension(4,nelemabs)  :: codeabs
 
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin) :: accels_poroelastic,velocs_poroelastic,displs_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin) :: velocw_poroelastic,displw_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin) :: b_accels_poroelastic,b_displs_poroelastic,b_displw_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob) :: accels_poroelastic,velocs_poroelastic,displs_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob) :: velocw_poroelastic,displw_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob) :: b_accels_poroelastic,b_displs_poroelastic,b_displw_poroelastic
   double precision, dimension(2,numat) :: density
   double precision, dimension(3,numat) :: permeability
   double precision, dimension(numat) :: porosity,tortuosity
@@ -102,12 +102,12 @@
   real(kind=CUSTOM_REAL), dimension(NSOURCES,NSTEP) :: source_time_function
   real(kind=CUSTOM_REAL), dimension(NSOURCES,NDIM,NGLLX,NGLLZ) :: sourcearray
   real(kind=CUSTOM_REAL), dimension(nrec,NSTEP,3,NGLLX,NGLLZ) :: adj_sourcearrays
-  real(kind=CUSTOM_REAL), dimension(npoin) :: mufr_k,B_k
+  real(kind=CUSTOM_REAL), dimension(nglob) :: mufr_k,B_k
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLZ,nspec_xmin,NSTEP) :: b_absorb_poro_s_left
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLZ,nspec_xmax,NSTEP) :: b_absorb_poro_s_right
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,nspec_zmax,NSTEP) :: b_absorb_poro_s_top
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,nspec_zmin,NSTEP) :: b_absorb_poro_s_bottom
-  real(kind=CUSTOM_REAL), dimension(npoin) :: b_viscodampx,b_viscodampz
+  real(kind=CUSTOM_REAL), dimension(nglob) :: b_viscodampx,b_viscodampz
 
   integer :: N_SLS
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec,N_SLS) :: e11,e13
@@ -186,7 +186,7 @@
 
 ! compute Grad(displs_poroelastic) at time step n for attenuation
   if(TURN_ATTENUATION_ON) call compute_gradient_attenuation(displs_poroelastic,dux_dxl_n,duz_dxl_n, &
-      dux_dzl_n,duz_dzl_n,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,npoin)
+      dux_dzl_n,duz_dzl_n,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,nglob)
 
 ! loop over spectral elements
   do ispec = 1,nspec
@@ -884,7 +884,7 @@
 
 ! compute Grad(displs_poroelastic) at time step n+1 for attenuation
     call compute_gradient_attenuation(displs_poroelastic,dux_dxl_np1,duz_dxl_np1, &
-      dux_dzl_np1,duz_dzl_np1,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,npoin)
+      dux_dzl_np1,duz_dzl_np1,xix,xiz,gammax,gammaz,ibool,poroelastic,hprime_xx,hprime_zz,nspec,nglob)
 
 ! update memory variables with fourth-order Runge-Kutta time scheme for attenuation
 ! loop over spectral elements

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -42,7 +42,7 @@
 !
 !========================================================================
 
-subroutine compute_forces_viscoelastic(p_sv,npoin,nspec,myrank,nelemabs,numat, &
+subroutine compute_forces_viscoelastic(p_sv,nglob,nspec,myrank,nelemabs,numat, &
      ispec_selected_source,ispec_selected_rec,is_proc_source,which_proc_receiver, &
      source_type,it,NSTEP,anyabs,assign_external_model, &
      initialfield,TURN_ATTENUATION_ON,angleforce,deltatcube, &
@@ -69,7 +69,7 @@
 
   logical :: p_sv
   integer :: NSOURCES, i_source
-  integer :: npoin,nspec,myrank,nelemabs,numat,it,NSTEP
+  integer :: nglob,nspec,myrank,nelemabs,numat,it,NSTEP
   integer, dimension(NSOURCES) :: ispec_selected_source,is_proc_source,source_type
 
   integer :: nrec,SIMULATION_TYPE
@@ -94,7 +94,7 @@
   logical, dimension(nspec) :: elastic,anisotropic
   logical, dimension(4,nelemabs)  :: codeabs
 
-  real(kind=CUSTOM_REAL), dimension(3,npoin) :: accel_elastic,veloc_elastic,displ_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob) :: accel_elastic,veloc_elastic,displ_elastic
   double precision, dimension(2,numat) :: density
   double precision, dimension(4,3,numat) :: poroelastcoef
   double precision, dimension(6,numat) :: anisotropy
@@ -105,9 +105,9 @@
   real(kind=CUSTOM_REAL), dimension(NSOURCES,NSTEP) :: source_time_function
   real(kind=CUSTOM_REAL), dimension(NSOURCES,NDIM,NGLLX,NGLLZ) :: sourcearray
 
-  real(kind=CUSTOM_REAL), dimension(3,npoin) :: b_accel_elastic,b_displ_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob) :: b_accel_elastic,b_displ_elastic
   real(kind=CUSTOM_REAL), dimension(nrec,NSTEP,3,NGLLX,NGLLZ) :: adj_sourcearrays
-  real(kind=CUSTOM_REAL), dimension(npoin) :: mu_k,kappa_k
+  real(kind=CUSTOM_REAL), dimension(nglob) :: mu_k,kappa_k
   real(kind=CUSTOM_REAL), dimension(3,NGLLZ,nspec_left,NSTEP) :: b_absorb_elastic_left
   real(kind=CUSTOM_REAL), dimension(3,NGLLZ,nspec_right,NSTEP) :: b_absorb_elastic_right
   real(kind=CUSTOM_REAL), dimension(3,NGLLX,nspec_top,NSTEP) :: b_absorb_elastic_top
@@ -167,7 +167,7 @@
 
   ! for analytical initial plane wave for Bielak's conditions
   double precision :: veloc_horiz,veloc_vert,dxUx,dzUx,dxUz,dzUz,traction_x_t0,traction_z_t0,deltat
-  double precision, dimension(NDIM,npoin), intent(in) :: coord
+  double precision, dimension(NDIM,nglob), intent(in) :: coord
   double precision x0_source, z0_source, angleforce_refl, c_inc, c_refl, time_offset, f0
   double precision, dimension(NDIM) :: A_plane, B_plane, C_plane
   !over critical angle
@@ -183,7 +183,7 @@
   ! compute Grad(displ_elastic) at time step n for attenuation
   if(TURN_ATTENUATION_ON) then
      call compute_gradient_attenuation(displ_elastic,dux_dxl_n,duz_dxl_n, &
-          dux_dzl_n,duz_dzl_n,xix,xiz,gammax,gammaz,ibool,elastic,hprime_xx,hprime_zz,nspec,npoin)
+          dux_dzl_n,duz_dzl_n,xix,xiz,gammax,gammaz,ibool,elastic,hprime_xx,hprime_zz,nspec,nglob)
   endif
 
   ifirstelem = 1
@@ -488,7 +488,7 @@
               ! left or right edge, horizontal normal vector
               if(add_Bielak_conditions .and. initialfield) then
                  if (.not.over_critical_angle) then
-                    call compute_Bielak_conditions(coord,iglob,npoin,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
+                    call compute_Bielak_conditions(coord,iglob,nglob,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
                          x0_source, z0_source, A_plane, B_plane, C_plane, angleforce, angleforce_refl, &
                          c_inc, c_refl, time_offset,f0)
                     traction_x_t0 = (lambdal_relaxed+2*mul_relaxed)*dxUx + lambdal_relaxed*dzUz
@@ -579,7 +579,7 @@
               ! left or right edge, horizontal normal vector
               if(add_Bielak_conditions .and. initialfield) then
                  if (.not.over_critical_angle) then
-                    call compute_Bielak_conditions(coord,iglob,npoin,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
+                    call compute_Bielak_conditions(coord,iglob,nglob,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
                          x0_source, z0_source, A_plane, B_plane, C_plane, angleforce, angleforce_refl, &
                          c_inc, c_refl, time_offset,f0)
                     traction_x_t0 = (lambdal_relaxed+2*mul_relaxed)*dxUx + lambdal_relaxed*dzUz
@@ -676,7 +676,7 @@
               ! top or bottom edge, vertical normal vector
               if(add_Bielak_conditions .and. initialfield) then
                  if (.not.over_critical_angle) then
-                    call compute_Bielak_conditions(coord,iglob,npoin,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
+                    call compute_Bielak_conditions(coord,iglob,nglob,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
                          x0_source, z0_source, A_plane, B_plane, C_plane, angleforce, angleforce_refl, &
                          c_inc, c_refl, time_offset,f0)
                     traction_x_t0 = mul_relaxed*(dxUz + dzUx)
@@ -772,7 +772,7 @@
               ! for analytical initial plane wave for Bielak's conditions
               ! top or bottom edge, vertical normal vector
               if(add_Bielak_conditions .and. initialfield) then
-                 call compute_Bielak_conditions(coord,iglob,npoin,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
+                 call compute_Bielak_conditions(coord,iglob,nglob,it,deltat,dxUx,dxUz,dzUx,dzUz,veloc_horiz,veloc_vert, &
                       x0_source, z0_source, A_plane, B_plane, C_plane, angleforce, angleforce_refl, &
                       c_inc, c_refl, time_offset,f0)
                  traction_x_t0 = mul_relaxed*(dxUz + dzUx)
@@ -919,7 +919,7 @@
 
      ! compute Grad(displ_elastic) at time step n+1 for attenuation
      call compute_gradient_attenuation(displ_elastic,dux_dxl_np1,duz_dxl_np1, &
-          dux_dzl_np1,duz_dzl_np1,xix,xiz,gammax,gammaz,ibool,elastic,hprime_xx,hprime_zz,nspec,npoin)
+          dux_dzl_np1,duz_dzl_np1,xix,xiz,gammax,gammaz,ibool,elastic,hprime_xx,hprime_zz,nspec,nglob)
 
      ! update memory variables with fourth-order Runge-Kutta time scheme for attenuation
      ! loop over spectral elements

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_gradient_attenuation.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_gradient_attenuation.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_gradient_attenuation.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -43,7 +43,7 @@
 !========================================================================
 
   subroutine compute_gradient_attenuation(displ_elastic,dux_dxl,duz_dxl,dux_dzl,duz_dzl, &
-         xix,xiz,gammax,gammaz,ibool,elastic,hprime_xx,hprime_zz,nspec,npoin)
+         xix,xiz,gammax,gammaz,ibool,elastic,hprime_xx,hprime_zz,nspec,nglob)
 
 ! compute Grad(displ_elastic) for attenuation
 
@@ -51,7 +51,7 @@
 
   include "constants.h"
 
-  integer :: nspec,npoin
+  integer :: nspec,nglob
 
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
 
@@ -60,7 +60,7 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec) :: dux_dxl,duz_dxl,dux_dzl,duz_dzl
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec)  :: xix,xiz,gammax,gammaz
 
-  real(kind=CUSTOM_REAL), dimension(3,npoin) :: displ_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob) :: displ_elastic
 
 ! array with derivatives of Lagrange polynomials
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_pressure.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_pressure.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_pressure.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -45,7 +45,7 @@
   subroutine compute_pressure_whole_medium(potential_dot_dot_acoustic,displ_elastic,&
                   displs_poroelastic,displw_poroelastic,elastic,poroelastic,vector_field_display, &
                   xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz,nspec, &
-                  npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic,assign_external_model, &
+                  nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic,assign_external_model, &
                   numat,kmato,density,porosity,tortuosity,poroelastcoef,vpext,vsext,rhoext, &
                   c11ext,c13ext,c15ext,c33ext,c35ext,c55ext,anisotropic,anisotropy,e1,e11, &
                   TURN_ATTENUATION_ON,Mu_nu1,Mu_nu2,N_SLS)
@@ -56,7 +56,7 @@
 
   include "constants.h"
 
-  integer :: nspec,npoin,numat
+  integer :: nspec,nglob,numat
 
 
   integer, dimension(nspec) :: kmato
@@ -72,14 +72,14 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec) :: xix,xiz,gammax,gammaz
 
   logical, dimension(nspec) :: elastic,poroelastic,anisotropic
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: potential_dot_dot_acoustic
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: displ_elastic
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: displs_poroelastic,displw_poroelastic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: potential_dot_dot_acoustic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: displ_elastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: displs_poroelastic,displw_poroelastic
 
-  double precision, dimension(3,npoin) :: vector_field_display
+  double precision, dimension(3,nglob) :: vector_field_display
 
 ! array with derivatives of Lagrange polynomials
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx
@@ -104,7 +104,7 @@
     call compute_pressure_one_element(pressure_element,potential_dot_dot_acoustic,displ_elastic,&
          displs_poroelastic,displw_poroelastic,elastic,poroelastic,&
          xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz,nspec, &
-         npoin_acoustic,npoin_elastic,npoin_poroelastic,assign_external_model, &
+         nglob_acoustic,nglob_elastic,nglob_poroelastic,assign_external_model, &
          numat,kmato,density,porosity,tortuosity,poroelastcoef,vpext,vsext,rhoext, &
          c11ext,c13ext,c15ext,c33ext,c35ext,c55ext,anisotropic,anisotropy,ispec,e1,e11, &
          TURN_ATTENUATION_ON,Mu_nu1,Mu_nu2,N_SLS)
@@ -128,7 +128,7 @@
   subroutine compute_pressure_one_element(pressure_element,potential_dot_dot_acoustic,displ_elastic,&
          displs_poroelastic,displw_poroelastic,elastic,poroelastic,&
          xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz,nspec, &
-         npoin_acoustic,npoin_elastic,npoin_poroelastic,assign_external_model, &
+         nglob_acoustic,nglob_elastic,nglob_poroelastic,assign_external_model, &
          numat,kmato,density,porosity,tortuosity,poroelastcoef,vpext,vsext,rhoext, &
          c11ext,c13ext,c15ext,c33ext,c35ext,c55ext,anisotropic,anisotropy,ispec,e1,e11, &
          TURN_ATTENUATION_ON,Mu_nu1,Mu_nu2,N_SLS)
@@ -157,12 +157,12 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: pressure_element
 
   logical, dimension(nspec) :: elastic,poroelastic,anisotropic
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: potential_dot_dot_acoustic
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: displ_elastic
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: displs_poroelastic,displw_poroelastic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: potential_dot_dot_acoustic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: displ_elastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: displs_poroelastic,displw_poroelastic
 
 ! array with derivatives of Lagrange polynomials
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_vector_field.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_vector_field.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_vector_field.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -45,7 +45,7 @@
   subroutine compute_vector_whole_medium(potential_acoustic,veloc_elastic,velocs_poroelastic,&
                             elastic,poroelastic,vector_field_display, &
                             xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                            nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                            nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                             numat,kmato,density,rhoext,assign_external_model)
 
 ! compute Grad(potential) in acoustic elements
@@ -55,7 +55,7 @@
 
   include "constants.h"
 
-  integer nspec,npoin,numat
+  integer nspec,nglob,numat
 
   logical :: assign_external_model
   integer, dimension(nspec) :: kmato
@@ -65,14 +65,14 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec) :: xix,xiz,gammax,gammaz
 
   logical, dimension(nspec) :: elastic,poroelastic
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: potential_acoustic
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: veloc_elastic
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: velocs_poroelastic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: potential_acoustic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: veloc_elastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: velocs_poroelastic
 
-  double precision, dimension(3,npoin) :: vector_field_display
+  double precision, dimension(3,nglob) :: vector_field_display
 
 ! array with derivatives of Lagrange polynomials
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx
@@ -92,7 +92,7 @@
                                 veloc_elastic,velocs_poroelastic, &
                                 elastic,poroelastic,xix,xiz,gammax,gammaz, &
                                 ibool,hprime_xx,hprime_zz, &
-                                nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                                nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                                 ispec,numat,kmato,density,rhoext,assign_external_model)
 
 ! store the result
@@ -115,7 +115,7 @@
                                     veloc_elastic,velocs_poroelastic,&
                                     elastic,poroelastic,xix,xiz,gammax,gammaz, &
                                     ibool,hprime_xx,hprime_zz, &
-                                    nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                                    nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                                     ispec,numat,kmato,density,rhoext,assign_external_model)
 
 ! compute Grad(potential) if acoustic element or copy existing vector if elastic element
@@ -142,12 +142,12 @@
   real(kind=CUSTOM_REAL), dimension(3,NGLLX,NGLLX) :: vector_field_element
 
   logical, dimension(nspec) :: elastic,poroelastic
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: potential_acoustic
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(3,npoin_elastic) :: veloc_elastic
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin_poroelastic) :: velocs_poroelastic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: potential_acoustic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob_elastic) :: veloc_elastic
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(NDIM,nglob_poroelastic) :: velocs_poroelastic
 
 ! array with derivatives of Lagrange polynomials
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_fast.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_fast.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_fast.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -42,7 +42,7 @@
 !
 !========================================================================
 
-  subroutine createnum_fast(knods,ibool,shape,coorg,npoin,npgeo,nspec,ngnod,myrank,ipass)
+  subroutine createnum_fast(knods,ibool,shape,coorg,nglob,npgeo,nspec,ngnod,myrank,ipass)
 
 ! same as subroutine "createnum_slow" but with a faster algorithm
 
@@ -50,7 +50,7 @@
 
   include "constants.h"
 
-  integer npoin,npgeo,nspec,ngnod,myrank,ipass
+  integer nglob,npgeo,nspec,ngnod,myrank,ipass
   integer knods(ngnod,nspec),ibool(NGLLX,NGLLZ,nspec)
   double precision shape(ngnod,NGLLX,NGLLX)
   double precision coorg(NDIM,npgeo)
@@ -202,7 +202,7 @@
    iglob(loc(i)) = ig
   enddo
 
-  npoin = ig
+  nglob = ig
 
 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -229,11 +229,11 @@
   deallocate(iwork)
 
 ! check the numbering obtained
-  if(minval(ibool) /= 1 .or. maxval(ibool) /= npoin) call exit_MPI('Error while generating global numbering')
+  if(minval(ibool) /= 1 .or. maxval(ibool) /= nglob) call exit_MPI('Error while generating global numbering')
 
   if(myrank == 0 .and. ipass == 1) then
     write(IOUT,*)
-    write(IOUT,*) 'Total number of points of the global mesh: ',npoin
+    write(IOUT,*) 'Total number of points of the global mesh: ',nglob
     write(IOUT,*)
   endif
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_slow.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_slow.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/createnum_slow.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -42,7 +42,7 @@
 !
 !========================================================================
 
-  subroutine createnum_slow(knods,ibool,npoin,nspec,ngnod,myrank,ipass)
+  subroutine createnum_slow(knods,ibool,nglob,nspec,ngnod,myrank,ipass)
 
 ! generate the global numbering
 
@@ -50,7 +50,7 @@
 
   include "constants.h"
 
-  integer npoin,nspec,ngnod,myrank,ipass
+  integer nglob,nspec,ngnod,myrank,ipass
 
   integer knods(ngnod,nspec),ibool(NGLLX,NGLLZ,nspec)
 
@@ -69,7 +69,7 @@
     write(IOUT,*)
   endif
 
-  npoin = 0
+  nglob = 0
   npedge = 0
   npcorn = 0
 
@@ -107,8 +107,8 @@
 !
   if(i /= 1 .and. i /= NGLLX .and. j /= 1 .and. j /= NGLLZ) then
 
-    npoin = npoin + 1
-    ibool(i,j,numelem) = npoin
+    nglob = nglob + 1
+    ibool(i,j,numelem) = nglob
 
 !
 !---- point au coin d'un element, rechercher les coins des autres elements
@@ -176,8 +176,8 @@
 ! si un ancien point n'a pas ete trouve, en generer un nouveau
   if(.not. alreadyexist) then
     npcorn = npcorn + 1
-    npoin = npoin + 1
-    ibool(i,j,numelem) = npoin
+    nglob = nglob + 1
+    ibool(i,j,numelem) = nglob
   endif
 
 !
@@ -296,8 +296,8 @@
 ! si un ancien point n'a pas ete trouve, en generer un nouveau
   if(.not. alreadyexist) then
     npedge = npedge + 1
-    npoin = npoin + 1
-    ibool(i,j,numelem) = npoin
+    nglob = nglob + 1
+    ibool(i,j,numelem) = nglob
   endif
 
   endif
@@ -309,12 +309,12 @@
   enddo
 
 ! verification de la coherence de la numerotation generee
-  if(minval(ibool) /= 1 .or. maxval(ibool) /= npoin) call exit_MPI('Error while generating global numbering')
+  if(minval(ibool) /= 1 .or. maxval(ibool) /= nglob) call exit_MPI('Error while generating global numbering')
 
   if(myrank == 0 .and. ipass == 1) then
-    write(IOUT,*) 'Total number of points of the global mesh: ',npoin,' distributed as follows:'
+    write(IOUT,*) 'Total number of points of the global mesh: ',nglob,' distributed as follows:'
     write(IOUT,*)
-    write(IOUT,*) 'Number of interior points: ',npoin-npedge-npcorn
+    write(IOUT,*) 'Number of interior points: ',nglob-npedge-npcorn
     write(IOUT,*) 'Number of edge points (without corners): ',npedge
     write(IOUT,*) 'Number of corner points: ',npcorn
     write(IOUT,*)

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/enforce_acoustic_free_surface.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/enforce_acoustic_free_surface.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/enforce_acoustic_free_surface.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
 
   subroutine enforce_acoustic_free_surface(potential_dot_dot_acoustic,potential_dot_acoustic, &
                                           potential_acoustic,acoustic_surface, &
-                                          ibool,nelem_acoustic_surface,npoin,nspec)
+                                          ibool,nelem_acoustic_surface,nglob,nspec)
 
 ! free surface for an acoustic medium
 ! if acoustic, the free surface condition is a Dirichlet condition for the potential,
@@ -54,13 +54,13 @@
 
   include "constants.h"
 
-  integer :: nelem_acoustic_surface,npoin,nspec
+  integer :: nelem_acoustic_surface,nglob,nspec
 
   integer, dimension(5,nelem_acoustic_surface) :: acoustic_surface
 
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
 
-  real(kind=CUSTOM_REAL), dimension(npoin) :: &
+  real(kind=CUSTOM_REAL), dimension(nglob) :: &
     potential_dot_dot_acoustic,potential_dot_acoustic,potential_acoustic
 
 !---

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_MPI.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_MPI.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_MPI.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
 
 #ifdef USE_MPI
 
-  subroutine get_MPI(nspec,ibool,knods,ngnod,npoin,elastic,poroelastic, &
+  subroutine get_MPI(nspec,ibool,knods,ngnod,nglob,elastic,poroelastic, &
                     ninterface, max_interface_size, &
                     my_nelmnts_neighbours,my_interfaces,my_neighbours, &
                     ibool_interfaces_acoustic, ibool_interfaces_elastic, &
@@ -64,7 +64,7 @@
   include "constants.h"
   include 'mpif.h'
 
-  integer, intent(in)  :: nspec, npoin, ngnod
+  integer, intent(in)  :: nspec, nglob, ngnod
   logical, dimension(nspec), intent(in)  :: elastic, poroelastic
   integer, dimension(ngnod,nspec), intent(in)  :: knods
   integer, dimension(NGLLX,NGLLZ,nspec), intent(in)  :: ibool
@@ -85,7 +85,7 @@
   logical, dimension(nspec), intent(inout)  :: mask_ispec_inner_outer
 
   integer :: myrank,ipass
-  double precision, dimension(NDIM,npoin) :: coord
+  double precision, dimension(NDIM,nglob) :: coord
 
   !local parameters
   double precision, dimension(:), allocatable :: xp,zp
@@ -110,7 +110,7 @@
   ! gets global indices for points on MPI interfaces
   ! (defined by my_interfaces) between different partitions
   ! and stores them in ibool_interfaces*** & nibool_interfaces*** (number of total points)
-  call prepare_assemble_MPI(nspec,ibool,knods, ngnod,npoin, elastic, poroelastic, &
+  call prepare_assemble_MPI(nspec,ibool,knods, ngnod,nglob, elastic, poroelastic, &
                                 ninterface, max_interface_size, &
                                 my_nelmnts_neighbours, my_interfaces, &
                                 ibool_interfaces_acoustic, ibool_interfaces_elastic, &
@@ -240,7 +240,7 @@
   if ( ninterface_acoustic > 0) then
 
     ! checks with assembly of test fields
-    allocate(test_flag_cr(npoin))
+    allocate(test_flag_cr(nglob))
     test_flag_cr(:) = 0._CUSTOM_REAL
     count = 0
     do ispec = 1, nspec
@@ -284,7 +284,7 @@
   if( ninterface_acoustic > 0 ) then
     ! adds contributions from different partitions to flag arrays
     ! custom_real arrays
-    call assemble_MPI_vector_ac(test_flag_cr,npoin, &
+    call assemble_MPI_vector_ac(test_flag_cr,nglob, &
                     ninterface, ninterface_acoustic,inum_interfaces_acoustic, &
                     max_interface_size, max_nibool_interfaces,&
                     ibool_interfaces_acoustic, nibool_interfaces_acoustic, &
@@ -293,7 +293,7 @@
 
     ! checks number of interface points
     inum = 0
-    do iglob=1,npoin
+    do iglob=1,nglob
       ! only counts flags with MPI contributions
       if( nint(test_flag_cr(iglob)) > myrank+1 ) inum = inum + 1
     enddo

Added: seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_global.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_global.f90	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/get_global.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -0,0 +1,186 @@
+
+!========================================================================
+!
+!                   S P E C F E M 2 D  Version 6.1
+!                   ------------------------------
+!
+! Copyright Universite de Pau, CNRS and INRIA, France,
+! and Princeton University / California Institute of Technology, USA.
+! Contributors: Dimitri Komatitsch, dimitri DOT komatitsch aT univ-pau DOT fr
+!               Nicolas Le Goff, nicolas DOT legoff aT univ-pau DOT fr
+!               Roland Martin, roland DOT martin aT univ-pau DOT fr
+!               Christina Morency, cmorency aT princeton DOT edu
+!
+! This software is a computer program whose purpose is to solve
+! the two-dimensional viscoelastic anisotropic or poroelastic wave equation
+! using a spectral-element method (SEM).
+!
+! This software is governed by the CeCILL license under French law and
+! abiding by the rules of distribution of free software. You can use,
+! modify and/or redistribute the software under the terms of the CeCILL
+! license as circulated by CEA, CNRS and INRIA at the following URL
+! "http://www.cecill.info".
+!
+! As a counterpart to the access to the source code and rights to copy,
+! modify and redistribute granted by the license, users are provided only
+! with a limited warranty and the software's author, the holder of the
+! economic rights, and the successive licensors have only limited
+! liability.
+!
+! In this respect, the user's attention is drawn to the risks associated
+! with loading, using, modifying and/or developing or reproducing the
+! software by the user in light of its specific status of free software,
+! that may mean that it is complicated to manipulate, and that also
+! therefore means that it is reserved for developers and experienced
+! professionals having in-depth computer knowledge. Users are therefore
+! encouraged to load and test the software's suitability as regards their
+! requirements in conditions enabling the security of their systems and/or
+! data to be ensured and, more generally, to use and operate it in the
+! same conditions as regards security.
+!
+! The full text of the license is available in file "LICENSE".
+!
+!========================================================================
+
+
+  subroutine get_global(nspec_outer,nspec,nglob,ibool)
+
+  implicit none
+  include "constants.h"
+
+  integer :: nspec_outer,nspec,nglob
+
+  integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
+
+  ! local parameters
+  integer, dimension(:,:,:), allocatable :: copy_ibool_ori
+  integer, dimension(:), allocatable :: mask_ibool
+  integer :: inumber,ispec,i,j,ier
+
+  ! allocates temporary arrays
+  allocate(mask_ibool(nglob),stat=ier)
+  if( ier /= 0 ) stop 'error allocating mask_ibool'
+  allocate(copy_ibool_ori(NGLLX,NGLLZ,nspec),stat=ier)
+  if( ier /= 0 ) stop 'error allocating copy_ibool_ori'
+
+  ! initializes temporary arrays
+  mask_ibool(:) = -1
+  copy_ibool_ori(:,:,:) = ibool(:,:,:)
+
+  inumber = 0
+
+  if(.not. ACTUALLY_IMPLEMENT_PERM_WHOLE) then
+
+  ! first reduce cache misses in outer elements, since they are taken first
+  ! loop over spectral elements
+    do ispec = 1,nspec_outer
+      do j=1,NGLLZ
+        do i=1,NGLLX
+          if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
+            ! create a new point
+            inumber = inumber + 1
+            ibool(i,j,ispec) = inumber
+            mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
+          else
+            ! use an existing point created previously
+            ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
+          endif
+        enddo
+      enddo
+    enddo
+
+  ! then reduce cache misses in inner elements, since they are taken second
+  ! loop over spectral elements
+    do ispec = nspec_outer+1,nspec
+      do j=1,NGLLZ
+        do i=1,NGLLX
+          if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
+            ! create a new point
+            inumber = inumber + 1
+            ibool(i,j,ispec) = inumber
+            mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
+          else
+            ! use an existing point created previously
+            ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
+          endif
+        enddo
+      enddo
+    enddo
+
+  else ! if ACTUALLY_IMPLEMENT_PERM_WHOLE
+
+  ! reduce cache misses in all the elements
+  ! loop over spectral elements
+    do ispec = 1,nspec
+      do j=1,NGLLZ
+        do i=1,NGLLX
+          if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
+            ! create a new point
+            inumber = inumber + 1
+            ibool(i,j,ispec) = inumber
+            mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
+          else
+            ! use an existing point created previously
+            ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
+          endif
+        enddo
+      enddo
+    enddo
+
+  endif
+
+  deallocate(mask_ibool,copy_ibool_ori)
+
+  end subroutine get_global
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine get_global_indirect_addressing(nspec,nglob,ibool)
+
+!- we can create a new indirect addressing to reduce cache misses
+
+  implicit none
+  include "constants.h"
+
+  integer :: nspec,nglob
+  integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
+
+  ! local parameters
+  integer, dimension(:,:,:), allocatable :: copy_ibool_ori
+  integer, dimension(:), allocatable :: mask_ibool
+  integer :: inumber,ispec,i,j,ier
+
+  ! allocates temporary arrays
+  allocate(mask_ibool(nglob),stat=ier)
+  if( ier /= 0 ) stop 'error allocating mask_ibool'
+  allocate(copy_ibool_ori(NGLLX,NGLLZ,nspec),stat=ier)
+  if( ier /= 0 ) stop 'error allocating copy_ibool_ori'
+
+  ! initializes temporary arrays
+  mask_ibool(:) = -1
+  copy_ibool_ori(:,:,:) = ibool(:,:,:)
+
+  inumber = 0
+
+  do ispec = 1,nspec
+    do j=1,NGLLZ
+      do i=1,NGLLX
+        if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
+          ! create a new point
+          inumber = inumber + 1
+          ibool(i,j,ispec) = inumber
+          mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
+        else
+          ! use an existing point created previously
+          ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
+        endif
+      enddo
+    enddo
+  enddo
+
+  deallocate(mask_ibool,copy_ibool_ori)
+
+  end subroutine get_global_indirect_addressing

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/initialize_simulation.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/initialize_simulation.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/initialize_simulation.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -118,3 +118,90 @@
   endif
 
   end subroutine initialize_simulation
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+
+  subroutine initialize_simulation_domains(any_acoustic,any_elastic,any_poroelastic, &
+                                anisotropic,elastic,poroelastic,porosity,anisotropy,kmato,numat, &
+                                nspec,nspec_allocate,p_sv,TURN_ATTENUATION_ON)
+
+  implicit none
+  include "constants.h"
+
+  integer :: nspec,nspec_allocate
+
+  logical, dimension(nspec) :: anisotropic
+  logical, dimension(nspec) :: elastic
+  logical, dimension(nspec) :: poroelastic
+
+  integer :: numat
+  double precision, dimension(numat) :: porosity
+  double precision, dimension(6,numat) :: anisotropy
+  integer, dimension(nspec) :: kmato
+
+  logical :: any_acoustic,any_elastic,any_poroelastic
+  logical :: p_sv,TURN_ATTENUATION_ON
+
+  ! local parameters
+  integer :: ispec
+
+  ! initializes
+  any_acoustic = .false.
+  any_elastic = .false.
+  any_poroelastic = .false.
+
+  anisotropic(:) = .false.
+  elastic(:) = .false.
+  poroelastic(:) = .false.
+
+  ! loops over all elements
+  do ispec = 1,nspec
+
+    if( nint(porosity(kmato(ispec))) == 1 ) then
+      ! acoustic domain
+      elastic(ispec) = .false.
+      poroelastic(ispec) = .false.
+      any_acoustic = .true.
+    elseif( porosity(kmato(ispec)) < TINYVAL) then
+      ! elastic domain
+      elastic(ispec) = .true.
+      poroelastic(ispec) = .false.
+      any_elastic = .true.
+      if(any(anisotropy(:,kmato(ispec)) /= 0)) then
+         anisotropic(ispec) = .true.
+      end if
+    else
+      ! poroelastic domain
+      elastic(ispec) = .false.
+      poroelastic(ispec) = .true.
+      any_poroelastic = .true.
+    endif
+
+  enddo !do ispec = 1,nspec
+
+
+  if(.not. p_sv .and. .not. any_elastic) then
+    print*, '*************** WARNING ***************'
+    print*, 'Surface (membrane) waves calculation needs an elastic medium'
+    print*, '*************** WARNING ***************'
+    stop
+  endif
+  if(.not. p_sv .and. (TURN_ATTENUATION_ON)) then
+    print*, '*************** WARNING ***************'
+    print*, 'Attenuation and anisotropy are not implemented for surface (membrane) waves calculation'
+    print*, '*************** WARNING ***************'
+    stop
+  endif
+
+
+  if(TURN_ATTENUATION_ON) then
+    nspec_allocate = nspec
+  else
+    nspec_allocate = 1
+  endif
+
+  end subroutine initialize_simulation_domains

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/invert_mass_matrix.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/invert_mass_matrix.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/invert_mass_matrix.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,10 +44,10 @@
 !========================================================================
 
   subroutine invert_mass_matrix_init(any_elastic,any_acoustic,any_poroelastic, &
-                                rmass_inverse_elastic,npoin_elastic, &
-                                rmass_inverse_acoustic,npoin_acoustic, &
+                                rmass_inverse_elastic,nglob_elastic, &
+                                rmass_inverse_acoustic,nglob_acoustic, &
                                 rmass_s_inverse_poroelastic, &
-                                rmass_w_inverse_poroelastic,npoin_poroelastic, &
+                                rmass_w_inverse_poroelastic,nglob_poroelastic, &
                                 nspec,ibool,kmato,wxgll,wzgll,jacobian, &
                                 elastic,poroelastic, &
                                 assign_external_model,numat, &
@@ -62,14 +62,14 @@
   logical any_elastic,any_acoustic,any_poroelastic
 
   ! inverse mass matrices
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(npoin_elastic) :: rmass_inverse_elastic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(nglob_elastic) :: rmass_inverse_elastic
 
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: rmass_inverse_acoustic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: rmass_inverse_acoustic
 
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(npoin_poroelastic) :: &
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(nglob_poroelastic) :: &
     rmass_s_inverse_poroelastic,rmass_w_inverse_poroelastic
 
   integer :: nspec
@@ -159,10 +159,10 @@
 !
 
   subroutine invert_mass_matrix(any_elastic,any_acoustic,any_poroelastic, &
-                                rmass_inverse_elastic,npoin_elastic, &
-                                rmass_inverse_acoustic,npoin_acoustic, &
+                                rmass_inverse_elastic,nglob_elastic, &
+                                rmass_inverse_acoustic,nglob_acoustic, &
                                 rmass_s_inverse_poroelastic, &
-                                rmass_w_inverse_poroelastic,npoin_poroelastic)
+                                rmass_w_inverse_poroelastic,nglob_poroelastic)
 
 ! inverts the global mass matrix
 
@@ -172,14 +172,14 @@
   logical any_elastic,any_acoustic,any_poroelastic
 
 ! inverse mass matrices
-  integer :: npoin_elastic
-  real(kind=CUSTOM_REAL), dimension(npoin_elastic) :: rmass_inverse_elastic
+  integer :: nglob_elastic
+  real(kind=CUSTOM_REAL), dimension(nglob_elastic) :: rmass_inverse_elastic
 
-  integer :: npoin_acoustic
-  real(kind=CUSTOM_REAL), dimension(npoin_acoustic) :: rmass_inverse_acoustic
+  integer :: nglob_acoustic
+  real(kind=CUSTOM_REAL), dimension(nglob_acoustic) :: rmass_inverse_acoustic
 
-  integer :: npoin_poroelastic
-  real(kind=CUSTOM_REAL), dimension(npoin_poroelastic) :: &
+  integer :: nglob_poroelastic
+  real(kind=CUSTOM_REAL), dimension(nglob_poroelastic) :: &
     rmass_s_inverse_poroelastic,rmass_w_inverse_poroelastic
 
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -46,7 +46,7 @@
 !---- locate_receivers finds the correct position of the receivers
 !----
 
-  subroutine locate_receivers(ibool,coord,nspec,npoin,xigll,zigll, &
+  subroutine locate_receivers(ibool,coord,nspec,nglob,xigll,zigll, &
                           nrec,nrecloc,recloc,which_proc_receiver,nproc,myrank, &
                           st_xval,st_zval,ispec_selected_rec, &
                           xi_receiver,gamma_receiver,station_name,network_name, &
@@ -61,7 +61,7 @@
   include "mpif.h"
 #endif
 
-  integer nrec,nspec,npoin,ngnod,npgeo,ipass
+  integer nrec,nspec,nglob,ngnod,npgeo,ipass
   integer, intent(in)  :: nproc, myrank
 
   integer knods(ngnod,nspec)
@@ -70,7 +70,7 @@
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
 
 ! array containing coordinates of the points
-  double precision coord(NDIM,npoin)
+  double precision coord(NDIM,nglob)
 
   integer irec,i,j,ispec,iglob,iter_loop,ix_initial_guess,iz_initial_guess
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_force.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_force.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_force.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -46,7 +46,7 @@
 !---- locate_source_force finds the correct position of the point force source
 !----
 
-  subroutine locate_source_force(ibool,coord,nspec,npoin,xigll,zigll,x_source,z_source, &
+  subroutine locate_source_force(ibool,coord,nspec,nglob,xigll,zigll,x_source,z_source, &
                ispec_selected_source,is_proc_source,nb_proc_source,nproc,myrank, &
                xi_source,gamma_source,coorg,knods,ngnod,npgeo,ipass,iglob_source)
 
@@ -57,7 +57,7 @@
   include "mpif.h"
 #endif
 
-  integer nspec,npoin,ngnod,npgeo,ipass
+  integer nspec,nglob,ngnod,npgeo,ipass
 
   integer knods(ngnod,nspec)
   double precision coorg(NDIM,npgeo)
@@ -65,7 +65,7 @@
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
 
 ! array containing coordinates of the points
-  double precision coord(NDIM,npoin)
+  double precision coord(NDIM,nglob)
 
   integer i,j,ispec,iglob,iter_loop,ix_initial_guess,iz_initial_guess
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_moment_tensor.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_moment_tensor.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_source_moment_tensor.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -46,7 +46,7 @@
 !---- locate_source_moment_tensor finds the correct position of the moment-tensor source
 !----
 
-  subroutine locate_source_moment_tensor(ibool,coord,nspec,npoin, &
+  subroutine locate_source_moment_tensor(ibool,coord,nspec,nglob, &
                xigll,zigll,x_source,z_source, &
                ispec_selected_source,is_proc_source,nb_proc_source,nproc,myrank, &
                xi_source,gamma_source,coorg,knods,ngnod,npgeo,ipass)
@@ -58,7 +58,7 @@
   include "mpif.h"
 #endif
 
-  integer nspec,npoin,ngnod,npgeo,ipass
+  integer nspec,nglob,ngnod,npgeo,ipass
 
   integer knods(ngnod,nspec)
   double precision coorg(NDIM,npgeo)
@@ -66,7 +66,7 @@
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
 
 ! array containing coordinates of the points
-  double precision coord(NDIM,npoin)
+  double precision coord(NDIM,nglob)
 
   integer i,j,ispec,iglob,iter_loop,ix_initial_guess,iz_initial_guess
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/paco_beyond_critical.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/paco_beyond_critical.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/paco_beyond_critical.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -14,7 +14,7 @@
 ! modified by Dimitri Komatitsch and Ronan Madec in March 2008
 ! in particular, converted to Fortran90 and to double precision
 
-subroutine paco_beyond_critical(coord,npoin,deltat,NSTEP_global,angleforce,&
+subroutine paco_beyond_critical(coord,nglob,deltat,NSTEP_global,angleforce,&
      f0,cp_local,cs_local,INCLUDE_ATTENUATION,QD,source_type,v0x_left,v0z_left,v0x_right,v0z_right,&
      v0x_bot,v0z_bot,t0x_left,t0z_left,t0x_right,t0z_right,t0x_bot,t0z_bot,left_bound,right_bound,&
      bot_bound,nleft,nright,nbot,displ_elastic,veloc_elastic,accel_elastic)
@@ -25,7 +25,7 @@
 
   double precision :: f0,cp_local,cs_local,deltat,dt,TP,angleforce,QD,delta_in_period
   logical :: INCLUDE_ATTENUATION
-  integer :: npt,NSTEP_global,source_type,nleft,nright,nbot,npoin
+  integer :: npt,NSTEP_global,source_type,nleft,nright,nbot,nglob
 
   integer, dimension(nleft) :: left_bound
   integer, dimension(nright) :: right_bound
@@ -35,10 +35,10 @@
   double precision, dimension(nright,NSTEP_global) :: v0x_right,v0z_right, t0x_right,t0z_right
   double precision, dimension(nbot,NSTEP_global) :: v0x_bot,v0z_bot, t0x_bot,t0z_bot
 
-  double precision, dimension(2,npoin) :: coord
-  double precision, dimension(2,npoin) :: displ_elastic
-  double precision, dimension(2,npoin) :: veloc_elastic
-  double precision, dimension(2,npoin) :: accel_elastic
+  double precision, dimension(2,nglob) :: coord
+  double precision, dimension(2,nglob) :: displ_elastic
+  double precision, dimension(2,nglob) :: veloc_elastic
+  double precision, dimension(2,nglob) :: accel_elastic
 
   integer, dimension(:),allocatable :: local_pt
 
@@ -139,7 +139,7 @@
 
      if (FLAG==0) then
         print *, "calcul of the initial field for every point of the mesh"
-        npt=npoin
+        npt=nglob
         allocate(local_pt(npt))
         do inode=1,npt
            local_pt(inode)=inode

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotgll.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotgll.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotgll.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -42,7 +42,7 @@
 !
 !========================================================================
 
-  subroutine plotgll(knods,ibool,coorg,coord,npoin,npgeo,ngnod,nspec)
+  subroutine plotgll(knods,ibool,coorg,coord,nglob,npgeo,ngnod,nspec)
 
 ! output the Gauss-Lobatto-Legendre mesh in a gnuplot file
 
@@ -50,11 +50,11 @@
 
   include "constants.h"
 
-  integer ispec,iy,ix,iglobnum,iglobnum2,ibloc,inode,npoin,npgeo,ngnod,nspec
+  integer ispec,iy,ix,iglobnum,iglobnum2,ibloc,inode,nglob,npgeo,ngnod,nspec
 
   integer knods(ngnod,nspec),ibool(NGLLX,NGLLX,nspec)
 
-  double precision coorg(NDIM,npgeo),coord(NDIM,npoin)
+  double precision coorg(NDIM,npgeo),coord(NDIM,nglob)
 
 ! coordinates of the nodes for Gnuplot file
   integer, parameter :: MAXNGNOD = 9

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotpost.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotpost.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/plotpost.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -46,7 +46,7 @@
           xinterp,zinterp,shapeint,Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
           poroelastcoef,knods,kmato,ibool, &
           numabs,codeabs,anyabs,nelem_acoustic_surface, acoustic_edges, &
-          simulation_title,npoin,npgeo,vpmin,vpmax,nrec,NSOURCES, &
+          simulation_title,nglob,npgeo,vpmin,vpmax,nrec,NSOURCES, &
           colors,numbers,subsamp,imagetype,interpol,meshvect,modelvect, &
           boundvect,assign_external_model,cutsnaps,sizemax_arrows,nelemabs,numat,pointsdisp, &
           nspec,ngnod,coupled_acoustic_elastic,coupled_acoustic_poro,coupled_elastic_poro, &
@@ -92,7 +92,7 @@
   double precision, dimension(NUM_COLORS) :: red,green,blue
 
   integer it,nrec,nelemabs,numat,pointsdisp,pointsdisp_loop,nspec
-  integer i,npoin,npgeo,ngnod,NSOURCES
+  integer i,nglob,npgeo,ngnod,NSOURCES
 
   integer kmato(nspec),knods(ngnod,nspec)
   integer ibool(NGLLX,NGLLZ,nspec)
@@ -106,7 +106,7 @@
 
   double precision dt,timeval
   double precision, dimension(NSOURCES) :: x_source,z_source
-  double precision displ(3,npoin),coord(NDIM,npoin)
+  double precision displ(3,nglob),coord(NDIM,nglob)
   double precision vpext(NGLLX,NGLLZ,nspec)
 
   double precision coorg(NDIM,npgeo)
@@ -2872,7 +2872,7 @@
 
   buffer_offset = 0
 
-  do ipoin=1,npoin
+  do ipoin=1,nglob
 
   x1 =(coord(1,ipoin)-xmin)*ratio_page
   z1 =(coord(2,ipoin)-zmin)*ratio_page

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_assemble_MPI.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_assemble_MPI.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_assemble_MPI.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -58,7 +58,7 @@
 ! We have both acoustic and (poro)elastic buffers, for coupling between acoustic and (poro)elastic elements
 ! led us to have two sets of communications.
 !-----------------------------------------------
-  subroutine prepare_assemble_MPI(nspec,ibool,knods, ngnod,npoin, elastic, poroelastic, &
+  subroutine prepare_assemble_MPI(nspec,ibool,knods, ngnod,nglob, elastic, poroelastic, &
                                 ninterface, max_interface_size, &
                                 my_nelmnts_neighbours, my_interfaces, &
                                 ibool_interfaces_acoustic, ibool_interfaces_elastic, &
@@ -74,7 +74,7 @@
 
   include 'constants.h'
 
-  integer, intent(in)  :: nspec, npoin, ngnod
+  integer, intent(in)  :: nspec, nglob, ngnod
   logical, dimension(nspec), intent(in)  :: elastic, poroelastic
   integer, dimension(ngnod,nspec), intent(in)  :: knods
   integer, dimension(NGLLX,NGLLZ,nspec), intent(in)  :: ibool
@@ -97,15 +97,15 @@
   ! local parameters
   integer  :: num_interface
   integer  :: ispec_interface
-  logical, dimension(npoin)  :: mask_ibool_acoustic
-  logical, dimension(npoin)  :: mask_ibool_elastic
-  logical, dimension(npoin)  :: mask_ibool_poroelastic
+  logical, dimension(nglob)  :: mask_ibool_acoustic
+  logical, dimension(nglob)  :: mask_ibool_elastic
+  logical, dimension(nglob)  :: mask_ibool_poroelastic
   integer  :: ixmin, ixmax, izmin, izmax, ix, iz
   integer, dimension(ngnod)  :: n
   integer  :: e1, e2, itype, ispec, k, sens, iglob
-  integer  :: npoin_interface_acoustic
-  integer  :: npoin_interface_elastic
-  integer  :: npoin_interface_poroelastic
+  integer  :: nglob_interface_acoustic
+  integer  :: nglob_interface_elastic
+  integer  :: nglob_interface_poroelastic
 
   ! initializes
   ibool_interfaces_acoustic(:,:) = 0
@@ -117,9 +117,9 @@
 
   do num_interface = 1, ninterface
     ! initializes interface point counters
-    npoin_interface_acoustic = 0
-    npoin_interface_elastic = 0
-    npoin_interface_poroelastic = 0
+    nglob_interface_acoustic = 0
+    nglob_interface_elastic = 0
+    nglob_interface_poroelastic = 0
     mask_ibool_acoustic(:) = .false.
     mask_ibool_elastic(:) = .false.
     mask_ibool_poroelastic(:) = .false.
@@ -149,22 +149,22 @@
             ! elastic element
             if(.not. mask_ibool_elastic(iglob)) then
               mask_ibool_elastic(iglob) = .true.
-              npoin_interface_elastic = npoin_interface_elastic + 1
-              ibool_interfaces_elastic(npoin_interface_elastic,num_interface) = iglob
+              nglob_interface_elastic = nglob_interface_elastic + 1
+              ibool_interfaces_elastic(nglob_interface_elastic,num_interface) = iglob
             end if
           else if ( poroelastic(ispec) ) then
             ! poroelastic element
             if(.not. mask_ibool_poroelastic(iglob)) then
               mask_ibool_poroelastic(iglob) = .true.
-              npoin_interface_poroelastic = npoin_interface_poroelastic + 1
-              ibool_interfaces_poroelastic(npoin_interface_poroelastic,num_interface) = iglob
+              nglob_interface_poroelastic = nglob_interface_poroelastic + 1
+              ibool_interfaces_poroelastic(nglob_interface_poroelastic,num_interface) = iglob
             end if
           else
             ! acoustic element
             if(.not. mask_ibool_acoustic(iglob)) then
               mask_ibool_acoustic(iglob) = .true.
-              npoin_interface_acoustic = npoin_interface_acoustic + 1
-              ibool_interfaces_acoustic(npoin_interface_acoustic,num_interface) = iglob
+              nglob_interface_acoustic = nglob_interface_acoustic + 1
+              ibool_interfaces_acoustic(nglob_interface_acoustic,num_interface) = iglob
             end if
           end if
         end do
@@ -173,9 +173,9 @@
     end do
 
     ! stores counters for interface points
-    nibool_interfaces_acoustic(num_interface) = npoin_interface_acoustic
-    nibool_interfaces_elastic(num_interface) = npoin_interface_elastic
-    nibool_interfaces_poroelastic(num_interface) = npoin_interface_poroelastic
+    nibool_interfaces_acoustic(num_interface) = nglob_interface_acoustic
+    nibool_interfaces_elastic(num_interface) = nglob_interface_elastic
+    nibool_interfaces_poroelastic(num_interface) = nglob_interface_poroelastic
 
     ! sets inner/outer element flags
     do ispec = 1, nspec

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -47,7 +47,7 @@
   subroutine prepare_color_image_init(NX_IMAGE_color,NZ_IMAGE_color, &
                             xmin_color_image,xmax_color_image, &
                             zmin_color_image,zmax_color_image, &
-                            coord,npoin,npgeo)
+                            coord,nglob,npgeo)
 
   implicit none
   include "constants.h"
@@ -57,8 +57,8 @@
 
   integer :: NX_IMAGE_color,NZ_IMAGE_color
 
-  integer :: npoin,npgeo
-  double precision, dimension(NDIM,npoin) :: coord
+  integer :: nglob,npgeo
+  double precision, dimension(NDIM,nglob) :: coord
 
   double precision :: xmin_color_image,xmax_color_image, &
     zmin_color_image,zmax_color_image
@@ -123,7 +123,7 @@
   subroutine prepare_color_image_pixels(myrank,NX_IMAGE_color,NZ_IMAGE_color, &
                             xmin_color_image,xmax_color_image, &
                             zmin_color_image,zmax_color_image, &
-                            coord,npoin,coorg,npgeo,nspec,ngnod,knods,ibool, &
+                            coord,nglob,coorg,npgeo,nspec,ngnod,knods,ibool, &
                             nb_pixel_loc,iglob_image_color)
 
   implicit none
@@ -134,8 +134,8 @@
   double precision :: xmin_color_image,xmax_color_image, &
     zmin_color_image,zmax_color_image
 
-  integer :: npoin,nspec,npgeo,ngnod
-  double precision, dimension(NDIM,npoin) :: coord
+  integer :: nglob,nspec,npgeo,ngnod
+  double precision, dimension(NDIM,nglob) :: coord
   double precision, dimension(NDIM,npgeo) :: coorg
 
   integer, dimension(ngnod,nspec) :: knods
@@ -230,7 +230,7 @@
 !
 
 
-  subroutine prepare_color_image_vp(npoin,image_color_vp_display,iglob_image_color, &
+  subroutine prepare_color_image_vp(nglob,image_color_vp_display,iglob_image_color, &
                             NX_IMAGE_color,NZ_IMAGE_color,nb_pixel_loc, &
                             num_pixel_loc,nspec,poroelastic,ibool,kmato, &
                             numat,density,poroelastcoef,porosity,tortuosity, &
@@ -244,7 +244,7 @@
   include "mpif.h"
 #endif
 
-  integer :: npoin,nspec
+  integer :: nglob,nspec
   integer :: NX_IMAGE_color,NZ_IMAGE_color
   double precision, dimension(NX_IMAGE_color,NZ_IMAGE_color) :: image_color_vp_display
   integer, dimension(NX_IMAGE_color,NZ_IMAGE_color) :: iglob_image_color
@@ -286,7 +286,7 @@
 #endif
 
   ! to display the P-velocity model in background on color images
-  allocate(vp_display(npoin))
+  allocate(vp_display(nglob))
 
   do ispec = 1,nspec
 

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_initialfield.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_initialfield.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_initialfield.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -46,7 +46,7 @@
 
   subroutine prepare_initialfield(myrank,any_acoustic,any_poroelastic,over_critical_angle, &
                         NSOURCES,source_type,angleforce,x_source,z_source,f0, &
-                        npoin,numat,poroelastcoef,density,coord, &
+                        nglob,numat,poroelastcoef,density,coord, &
                         angleforce_refl,c_inc,c_refl,cploc,csloc,time_offset, &
                         A_plane, B_plane, C_plane, &
                         accel_elastic,veloc_elastic,displ_elastic)
@@ -64,16 +64,16 @@
   integer, dimension(NSOURCES) :: source_type
   double precision, dimension(NSOURCES) :: angleforce,x_source,z_source,f0
 
-  integer :: npoin,numat
+  integer :: nglob,numat
   double precision, dimension(4,3,numat) :: poroelastcoef
   double precision, dimension(2,numat) :: density
-  double precision, dimension(NDIM,npoin) :: coord
+  double precision, dimension(NDIM,nglob) :: coord
 
   double precision :: angleforce_refl,c_inc,c_refl,cploc,csloc
   double precision :: time_offset,x0_source,z0_source
   double precision, dimension(2) :: A_plane, B_plane, C_plane
 
-  real(kind=CUSTOM_REAL), dimension(3,npoin) :: accel_elastic,veloc_elastic,displ_elastic
+  real(kind=CUSTOM_REAL), dimension(3,nglob) :: accel_elastic,veloc_elastic,displ_elastic
 
   logical :: over_critical_angle
 
@@ -108,7 +108,7 @@
   !=======================================================================
 
   if (myrank == 0) then
-    write(IOUT,*) 'Number of grid points: ',npoin
+    write(IOUT,*) 'Number of grid points: ',nglob
     write(IOUT,*)
     write(IOUT,*) '*** calculation of the initial plane wave ***'
     write(IOUT,*)
@@ -264,7 +264,7 @@
 
   if (.not. over_critical_angle) then
 
-    do i = 1,npoin
+    do i = 1,nglob
 
       x = coord(1,i)
       z = coord(2,i)

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_external_model.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_external_model.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_external_model.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -45,7 +45,7 @@
 
 
   subroutine read_external_model(any_acoustic,any_elastic,any_poroelastic, &
-                elastic,poroelastic,anisotropic,nspec,npoin,N_SLS,ibool, &
+                elastic,poroelastic,anisotropic,nspec,nglob,N_SLS,ibool, &
                 f0_attenuation,inv_tau_sigma_nu1_sent,phi_nu1_sent, &
                 inv_tau_sigma_nu2_sent,phi_nu2_sent,Mu_nu1_sent,Mu_nu2_sent, &
                 inv_tau_sigma_nu1,inv_tau_sigma_nu2,phi_nu1,phi_nu2,Mu_nu1,Mu_nu2,&
@@ -56,12 +56,12 @@
   implicit none
   include "constants.h"
 
-  integer :: nspec,myrank,npoin
+  integer :: nspec,myrank,nglob
   double precision  :: f0_attenuation
 
   ! Mesh
   integer, dimension(NGLLX,NGLLZ,nspec) :: ibool
-  double precision, dimension(NDIM,npoin) :: coord
+  double precision, dimension(NDIM,nglob) :: coord
 
   ! Material properties
   logical :: any_acoustic,any_elastic,any_poroelastic,READ_EXTERNAL_SEP_FILE

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/setup_sources_receivers.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/setup_sources_receivers.f90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/setup_sources_receivers.f90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -44,7 +44,7 @@
 !========================================================================
 
   subroutine setup_sources_receivers(NSOURCES,initialfield,source_type,&
-     coord,ibool,npoin,nspec,nelem_acoustic_surface,acoustic_surface,elastic,poroelastic, &
+     coord,ibool,nglob,nspec,nelem_acoustic_surface,acoustic_surface,elastic,poroelastic, &
      x_source,z_source,ispec_selected_source,ispec_selected_rec, &
      is_proc_source,nb_proc_source,ipass,&
      sourcearray,Mxx,Mzz,Mxz,xix,xiz,gammax,gammaz,xigll,zigll,npgeo,&
@@ -59,7 +59,7 @@
   logical :: initialfield
   integer :: NSOURCES
   integer :: npgeo,ngnod,myrank,ipass,nproc
-  integer :: npoin,nspec,nelem_acoustic_surface
+  integer :: nglob,nspec,nelem_acoustic_surface
 
   ! Gauss-Lobatto-Legendre points
   double precision, dimension(NGLLX) :: xigll
@@ -88,7 +88,7 @@
   integer, dimension(NGLLX,NGLLZ,nspec)  :: ibool
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ,nspec)  :: xix,xiz,gammax,gammaz
   double precision, dimension(NDIM,npgeo) :: coorg
-  double precision, dimension(NDIM,npoin) :: coord
+  double precision, dimension(NDIM,nglob) :: coord
 
   integer  :: ixmin, ixmax, izmin, izmax
 
@@ -100,7 +100,7 @@
     if(source_type(i_source) == 1) then
 
       ! collocated force source
-      call locate_source_force(ibool,coord,nspec,npoin,xigll,zigll,x_source(i_source),z_source(i_source), &
+      call locate_source_force(ibool,coord,nspec,nglob,xigll,zigll,x_source(i_source),z_source(i_source), &
           ispec_selected_source(i_source),is_proc_source(i_source),nb_proc_source(i_source),&
           nproc,myrank,xi_source(i_source),gamma_source(i_source),coorg,knods,ngnod,npgeo,ipass,&
           iglob_source(i_source))
@@ -140,7 +140,7 @@
 
     else if(source_type(i_source) == 2) then
       ! moment-tensor source
-      call locate_source_moment_tensor(ibool,coord,nspec,npoin,xigll,zigll,x_source(i_source),z_source(i_source), &
+      call locate_source_moment_tensor(ibool,coord,nspec,nglob,xigll,zigll,x_source(i_source),z_source(i_source), &
              ispec_selected_source(i_source),is_proc_source(i_source),nb_proc_source(i_source),&
              nproc,myrank,xi_source(i_source),gamma_source(i_source),coorg,knods,ngnod,npgeo,ipass)
 
@@ -158,7 +158,7 @@
   enddo ! do i_source=1,NSOURCES
 
   ! locate receivers in the mesh
-  call locate_receivers(ibool,coord,nspec,npoin,xigll,zigll, &
+  call locate_receivers(ibool,coord,nspec,nglob,xigll,zigll, &
                       nrec,nrecloc,recloc,which_proc_receiver,nproc,myrank, &
                       st_xval,st_zval,ispec_selected_rec, &
                       xi_receiver,gamma_receiver,station_name,network_name, &

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90	2011-04-23 00:47:08 UTC (rev 18285)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90	2011-04-23 01:23:54 UTC (rev 18286)
@@ -365,10 +365,10 @@
 ! curl in an element
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: curl_element
 
-  integer :: i,j,k,it,irec,id,n,ispec,npoin,npgeo,iglob
-  integer :: npoin_acoustic
-  integer :: npoin_elastic
-  integer :: npoin_poroelastic
+  integer :: i,j,k,it,irec,id,n,ispec,nglob,npgeo,iglob
+  integer :: nglob_acoustic
+  integer :: nglob_elastic
+  integer :: nglob_poroelastic
   logical :: anyabs
   double precision :: dxd,dyd,dzd,dcurld,valux,valuy,valuz,valcurl,hlagrange,rhol,xi,gamma,x,z
 
@@ -679,11 +679,6 @@
   integer  :: nrecloc, irecloc
   integer, dimension(:), allocatable :: recloc, which_proc_receiver
 
-! mask to sort ibool
-  integer, dimension(:), allocatable :: mask_ibool
-  integer, dimension(:,:,:), allocatable :: copy_ibool_ori
-  integer :: inumber
-
 ! to compute analytical initial plane wave field
   double precision :: angleforce_refl, c_inc, c_refl, cploc, csloc
   double precision, dimension(2) :: A_plane, B_plane, C_plane
@@ -699,7 +694,7 @@
 
 ! further reduce cache misses inner/outer in two passes in the case of an MPI simulation
   integer :: ipass,ispec_inner,ispec_outer,NUMBER_OF_PASSES
-  integer :: npoin_outer,npoin_inner
+  integer :: nglob_outer,nglob_inner
   integer, dimension(:), allocatable :: perm,antecedent_list,check_perm
 
 ! arrays for plotpost
@@ -933,62 +928,11 @@
 !-------------------------------------------------------------------------------
 !----  determine if each spectral element is elastic, poroelastic, or acoustic
 !-------------------------------------------------------------------------------
-  ! initializes
-  any_acoustic = .false.
-  any_elastic = .false.
-  any_poroelastic = .false.
+  call initialize_simulation_domains(any_acoustic,any_elastic,any_poroelastic, &
+                                anisotropic,elastic,poroelastic,porosity,anisotropy,kmato,numat, &
+                                nspec,nspec_allocate,p_sv,TURN_ATTENUATION_ON)
 
-  anisotropic(:) = .false.
-  elastic(:) = .false.
-  poroelastic(:) = .false.
-
-  ! loops over all elements
-  do ispec = 1,nspec
-
-    if( nint(porosity(kmato(ispec))) == 1 ) then
-      ! acoustic domain
-      elastic(ispec) = .false.
-      poroelastic(ispec) = .false.
-      any_acoustic = .true.
-    elseif( porosity(kmato(ispec)) < TINYVAL) then
-      ! elastic domain
-      elastic(ispec) = .true.
-      poroelastic(ispec) = .false.
-      any_elastic = .true.
-      if(any(anisotropy(:,kmato(ispec)) /= 0)) then
-         anisotropic(ispec) = .true.
-      end if
-    else
-      ! poroelastic domain
-      elastic(ispec) = .false.
-      poroelastic(ispec) = .true.
-      any_poroelastic = .true.
-    endif
-
-  enddo !do ispec = 1,nspec
-
-
-  if(.not. p_sv .and. .not. any_elastic) then
-    print*, '*************** WARNING ***************'
-    print*, 'Surface (membrane) waves calculation needs an elastic medium'
-    print*, '*************** WARNING ***************'
-    stop
-  endif
-  if(.not. p_sv .and. (TURN_ATTENUATION_ON)) then
-    print*, '*************** WARNING ***************'
-    print*, 'Attenuation and anisotropy are not implemented for surface (membrane) waves calculation'
-    print*, '*************** WARNING ***************'
-    stop
-  endif
-
-
-  if(TURN_ATTENUATION_ON) then
-    nspec_allocate = nspec
-  else
-    nspec_allocate = 1
-  endif
-
-! allocate memory variables for attenuation
+  ! allocate memory variables for attenuation
   if(ipass == 1) then
     allocate(e1(NGLLX,NGLLZ,nspec_allocate,N_SLS))
     allocate(e11(NGLLX,NGLLZ,nspec_allocate,N_SLS))
@@ -1317,9 +1261,9 @@
 
 ! "slow and clean" or "quick and dirty" version
   if(FAST_NUMBERING) then
-    call createnum_fast(knods,ibool,shape2D,coorg,npoin,npgeo,nspec,ngnod,myrank,ipass)
+    call createnum_fast(knods,ibool,shape2D,coorg,nglob,npgeo,nspec,ngnod,myrank,ipass)
   else
-    call createnum_slow(knods,ibool,npoin,nspec,ngnod,myrank,ipass)
+    call createnum_slow(knods,ibool,nglob,nspec,ngnod,myrank,ipass)
   endif
 
 ! create a new indirect addressing array to reduce cache misses in memory access in the solver
@@ -1327,9 +1271,6 @@
 
     deallocate(perm)
 
-    allocate(copy_ibool_ori(NGLLX,NGLLZ,nspec))
-    allocate(mask_ibool(npoin))
-
     print *
     print *,'Xmin,Xmax of the whole mesh = ',minval(coord(1,:)),maxval(coord(1,:))
     print *,'Zmin,Zmax of the whole mesh = ',minval(coord(2,:)),maxval(coord(2,:))
@@ -1468,74 +1409,9 @@
 
 !! DK DK Feb 2010 end of periodic conditions: detect common points between left and right edges
 
-    mask_ibool(:) = -1
-    copy_ibool_ori(:,:,:) = ibool(:,:,:)
+    ! reduces cache misses
+    call get_global(nspec_outer,nspec,nglob,ibool)
 
-    inumber = 0
-
-    if(.not. ACTUALLY_IMPLEMENT_PERM_WHOLE) then
-
-! first reduce cache misses in outer elements, since they are taken first
-! loop over spectral elements
-      do ispec = 1,nspec_outer
-        do j=1,NGLLZ
-          do i=1,NGLLX
-            if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
-              ! create a new point
-              inumber = inumber + 1
-              ibool(i,j,ispec) = inumber
-              mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
-            else
-              ! use an existing point created previously
-              ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
-            endif
-          enddo
-        enddo
-      enddo
-
-! then reduce cache misses in inner elements, since they are taken second
-! loop over spectral elements
-      do ispec = nspec_outer+1,nspec
-        do j=1,NGLLZ
-          do i=1,NGLLX
-            if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
-              ! create a new point
-              inumber = inumber + 1
-              ibool(i,j,ispec) = inumber
-              mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
-            else
-              ! use an existing point created previously
-              ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
-            endif
-          enddo
-        enddo
-      enddo
-
-    else ! if ACTUALLY_IMPLEMENT_PERM_WHOLE
-
-! reduce cache misses in all the elements
-! loop over spectral elements
-      do ispec = 1,nspec
-        do j=1,NGLLZ
-          do i=1,NGLLX
-            if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
-              ! create a new point
-              inumber = inumber + 1
-              ibool(i,j,ispec) = inumber
-              mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
-            else
-              ! use an existing point created previously
-              ibool(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
-            endif
-          enddo
-        enddo
-      enddo
-
-    endif
-
-    deallocate(copy_ibool_ori)
-    deallocate(mask_ibool)
-
   else if(ipass /= 1) then
 
     stop 'incorrect pass number for reduction of cache misses'
@@ -1611,10 +1487,10 @@
     allocate(hgammas_store(NSOURCES,NGLLZ))
 
 ! allocate other global arrays
-    allocate(coord(NDIM,npoin))
+    allocate(coord(NDIM,nglob))
 
 ! to display acoustic elements
-    allocate(vector_field_display(3,npoin))
+    allocate(vector_field_display(3,nglob))
 
 !    if(assign_external_model) then
 
@@ -1708,11 +1584,11 @@
 !!$!xix(NGLLX,NGLLZ,nspec),xiz,gammax,gammaz,jacobian
 !!$!recompute_jacobian(xi,gamma,x,z,xixl,xizl,gammaxl,gammazl,jacobianl,coorg,knods,ispec,ngnod,nspec,npgeo, &
 !!$!          .true.)
-!!$  allocate(weight_line_x(npoin))
-!!$  allocate(weight_line_z(npoin))
-!!$  allocate(weight_surface(npoin))
-!!$  allocate(weight_jacobian(npoin))
-!!$  allocate(weight_gll(npoin))
+!!$  allocate(weight_line_x(nglob))
+!!$  allocate(weight_line_z(nglob))
+!!$  allocate(weight_surface(nglob))
+!!$  allocate(weight_jacobian(nglob))
+!!$  allocate(weight_gll(nglob))
 !!$  weight_line_x=0.0
 !!$  weight_line_z=0.0
 !!$  weight_surface=0.0
@@ -1739,7 +1615,7 @@
 !!$  enddo
 !!$  if( myrank == 0 ) then
 !!$    open(unit=55,file='OUTPUT_FILES/x_z_weightLineX_weightLineZ_weightSurface',status='unknown')
-!!$    do n = 1,npoin
+!!$    do n = 1,nglob
 !!$      write(55,*) coord(1,n), coord(2,n), weight_line_x(n), weight_line_z(n), weight_surface(n),weight_jacobian(n),weight_gll(n)
 !!$    enddo
 !!$    close(55)
@@ -1758,8 +1634,8 @@
      write(IOUT,*) 'Saving the grid in a text file...'
      write(IOUT,*)
      open(unit=55,file='OUTPUT_FILES/grid_points_and_model.txt',status='unknown')
-     write(55,*) npoin
-     do n = 1,npoin
+     write(55,*) nglob
+     do n = 1,nglob
         write(55,*) (coord(i,n), i=1,NDIM)
      enddo
      close(55)
@@ -1769,7 +1645,7 @@
 !-----   plot the GLL mesh in a Gnuplot file
 !
   if(gnuplot .and. myrank == 0 .and. ipass == 1)  &
-    call plotgll(knods,ibool,coorg,coord,npoin,npgeo,ngnod,nspec)
+    call plotgll(knods,ibool,coorg,coord,nglob,npgeo,ngnod,nspec)
 
   if(myrank == 0 .and. ipass == 1)  &
     write(IOUT,*) 'assign_external_model = ', assign_external_model
@@ -1777,7 +1653,7 @@
 !if ( assign_external_model .and. ipass == 1) then
   if ( assign_external_model) then
     call read_external_model(any_acoustic,any_elastic,any_poroelastic, &
-                elastic,poroelastic,anisotropic,nspec,npoin,N_SLS,ibool, &
+                elastic,poroelastic,anisotropic,nspec,nglob,N_SLS,ibool, &
                 f0_attenuation,inv_tau_sigma_nu1_sent,phi_nu1_sent, &
                 inv_tau_sigma_nu2_sent,phi_nu2_sent,Mu_nu1_sent,Mu_nu2_sent, &
                 inv_tau_sigma_nu1,inv_tau_sigma_nu2,phi_nu1,phi_nu2,Mu_nu1,Mu_nu2,&
@@ -1838,7 +1714,7 @@
 !---- define actual location of source and receivers
 
   call setup_sources_receivers(NSOURCES,initialfield,source_type,&
-     coord,ibool,npoin,nspec,nelem_acoustic_surface,acoustic_surface,elastic,poroelastic, &
+     coord,ibool,nglob,nspec,nelem_acoustic_surface,acoustic_surface,elastic,poroelastic, &
      x_source,z_source,ispec_selected_source,ispec_selected_rec, &
      is_proc_source,nb_proc_source,ipass,&
      sourcearray,Mxx,Mzz,Mxz,xix,xiz,gammax,gammaz,xigll,zigll,npgeo,&
@@ -2167,37 +2043,37 @@
   if(ipass == 1) then
 
     if(any_elastic) then
-      npoin_elastic = npoin
+      nglob_elastic = nglob
     else
       ! allocate unused arrays with fictitious size
-      npoin_elastic = 1
+      nglob_elastic = 1
     endif
-    allocate(displ_elastic(3,npoin_elastic))
-    allocate(veloc_elastic(3,npoin_elastic))
-    allocate(accel_elastic(3,npoin_elastic))
-    allocate(rmass_inverse_elastic(npoin_elastic))
+    allocate(displ_elastic(3,nglob_elastic))
+    allocate(veloc_elastic(3,nglob_elastic))
+    allocate(accel_elastic(3,nglob_elastic))
+    allocate(rmass_inverse_elastic(nglob_elastic))
 
     ! extra array if adjoint and kernels calculation
     if(SIMULATION_TYPE == 2 .and. any_elastic) then
-      allocate(b_displ_elastic(3,npoin))
-      allocate(b_veloc_elastic(3,npoin))
-      allocate(b_accel_elastic(3,npoin))
+      allocate(b_displ_elastic(3,nglob))
+      allocate(b_veloc_elastic(3,nglob))
+      allocate(b_accel_elastic(3,nglob))
       allocate(rho_kl(NGLLX,NGLLZ,nspec))
-      allocate(rho_k(npoin))
-      allocate(rhol_global(npoin))
+      allocate(rho_k(nglob))
+      allocate(rhol_global(nglob))
       allocate(mu_kl(NGLLX,NGLLZ,nspec))
-      allocate(mu_k(npoin))
-      allocate(mul_global(npoin))
+      allocate(mu_k(nglob))
+      allocate(mul_global(nglob))
       allocate(kappa_kl(NGLLX,NGLLZ,nspec))
-      allocate(kappa_k(npoin))
-      allocate(kappal_global(npoin))
+      allocate(kappa_k(nglob))
+      allocate(kappal_global(nglob))
       allocate(rhop_kl(NGLLX,NGLLZ,nspec))
       allocate(alpha_kl(NGLLX,NGLLZ,nspec))
       allocate(beta_kl(NGLLX,NGLLZ,nspec))
       allocate(rhorho_el_hessian_final2(NGLLX,NGLLZ,nspec))
-      allocate(rhorho_el_hessian_temp2(npoin))
+      allocate(rhorho_el_hessian_temp2(nglob))
       allocate(rhorho_el_hessian_final1(NGLLX,NGLLZ,nspec))
-      allocate(rhorho_el_hessian_temp1(npoin))
+      allocate(rhorho_el_hessian_temp1(nglob))
     else
       allocate(b_displ_elastic(1,1))
       allocate(b_veloc_elastic(1,1))
@@ -2221,44 +2097,44 @@
     endif
 
     if(any_poroelastic) then
-      npoin_poroelastic = npoin
+      nglob_poroelastic = nglob
     else
       ! allocate unused arrays with fictitious size
-      npoin_poroelastic = 1
+      nglob_poroelastic = 1
     endif
-    allocate(displs_poroelastic(NDIM,npoin_poroelastic))
-    allocate(velocs_poroelastic(NDIM,npoin_poroelastic))
-    allocate(accels_poroelastic(NDIM,npoin_poroelastic))
-    allocate(rmass_s_inverse_poroelastic(npoin_poroelastic))
-    allocate(displw_poroelastic(NDIM,npoin_poroelastic))
-    allocate(velocw_poroelastic(NDIM,npoin_poroelastic))
-    allocate(accelw_poroelastic(NDIM,npoin_poroelastic))
-    allocate(rmass_w_inverse_poroelastic(npoin_poroelastic))
+    allocate(displs_poroelastic(NDIM,nglob_poroelastic))
+    allocate(velocs_poroelastic(NDIM,nglob_poroelastic))
+    allocate(accels_poroelastic(NDIM,nglob_poroelastic))
+    allocate(rmass_s_inverse_poroelastic(nglob_poroelastic))
+    allocate(displw_poroelastic(NDIM,nglob_poroelastic))
+    allocate(velocw_poroelastic(NDIM,nglob_poroelastic))
+    allocate(accelw_poroelastic(NDIM,nglob_poroelastic))
+    allocate(rmass_w_inverse_poroelastic(nglob_poroelastic))
 
     ! extra array if adjoint and kernels calculation
     if(SIMULATION_TYPE == 2 .and. any_poroelastic) then
-      allocate(b_displs_poroelastic(NDIM,npoin))
-      allocate(b_velocs_poroelastic(NDIM,npoin))
-      allocate(b_accels_poroelastic(NDIM,npoin))
-      allocate(b_displw_poroelastic(NDIM,npoin))
-      allocate(b_velocw_poroelastic(NDIM,npoin))
-      allocate(b_accelw_poroelastic(NDIM,npoin))
+      allocate(b_displs_poroelastic(NDIM,nglob))
+      allocate(b_velocs_poroelastic(NDIM,nglob))
+      allocate(b_accels_poroelastic(NDIM,nglob))
+      allocate(b_displw_poroelastic(NDIM,nglob))
+      allocate(b_velocw_poroelastic(NDIM,nglob))
+      allocate(b_accelw_poroelastic(NDIM,nglob))
       allocate(rhot_kl(NGLLX,NGLLZ,nspec))
-      allocate(rhot_k(npoin))
+      allocate(rhot_k(nglob))
       allocate(rhof_kl(NGLLX,NGLLZ,nspec))
-      allocate(rhof_k(npoin))
+      allocate(rhof_k(nglob))
       allocate(sm_kl(NGLLX,NGLLZ,nspec))
-      allocate(sm_k(npoin))
+      allocate(sm_k(nglob))
       allocate(eta_kl(NGLLX,NGLLZ,nspec))
-      allocate(eta_k(npoin))
+      allocate(eta_k(nglob))
       allocate(mufr_kl(NGLLX,NGLLZ,nspec))
-      allocate(mufr_k(npoin))
+      allocate(mufr_k(nglob))
       allocate(B_kl(NGLLX,NGLLZ,nspec))
-      allocate(B_k(npoin))
+      allocate(B_k(nglob))
       allocate(C_kl(NGLLX,NGLLZ,nspec))
-      allocate(C_k(npoin))
+      allocate(C_k(nglob))
       allocate(M_kl(NGLLX,NGLLZ,nspec))
-      allocate(M_k(npoin))
+      allocate(M_k(nglob))
       allocate(rhob_kl(NGLLX,NGLLZ,nspec))
       allocate(rhofb_kl(NGLLX,NGLLZ,nspec))
       allocate(phi_kl(NGLLX,NGLLZ,nspec))
@@ -2273,16 +2149,16 @@
       allocate(cpII_kl(NGLLX,NGLLZ,nspec))
       allocate(cs_kl(NGLLX,NGLLZ,nspec))
       allocate(ratio_kl(NGLLX,NGLLZ,nspec))
-      allocate(phil_global(npoin))
-      allocate(mulfr_global(npoin))
-      allocate(etal_f_global(npoin))
-      allocate(rhol_s_global(npoin))
-      allocate(rhol_f_global(npoin))
-      allocate(rhol_bar_global(npoin))
-      allocate(tortl_global(npoin))
-      allocate(permlxx_global(npoin))
-      allocate(permlxz_global(npoin))
-      allocate(permlzz_global(npoin))
+      allocate(phil_global(nglob))
+      allocate(mulfr_global(nglob))
+      allocate(etal_f_global(nglob))
+      allocate(rhol_s_global(nglob))
+      allocate(rhol_f_global(nglob))
+      allocate(rhol_bar_global(nglob))
+      allocate(tortl_global(nglob))
+      allocate(permlxx_global(nglob))
+      allocate(permlxz_global(nglob))
+      allocate(permlzz_global(nglob))
     else
       allocate(b_displs_poroelastic(1,1))
       allocate(b_velocs_poroelastic(1,1))
@@ -2333,34 +2209,34 @@
     endif
 
     if(any_poroelastic .and. any_elastic) then
-      allocate(icount(npoin))
+      allocate(icount(nglob))
     else
       allocate(icount(1))
     endif
 
     ! potential, its first and second derivative, and inverse of the mass matrix for acoustic elements
     if(any_acoustic) then
-      npoin_acoustic = npoin
+      nglob_acoustic = nglob
     else
       ! allocate unused arrays with fictitious size
-      npoin_acoustic = 1
+      nglob_acoustic = 1
     endif
-    allocate(potential_acoustic(npoin_acoustic))
-    allocate(potential_dot_acoustic(npoin_acoustic))
-    allocate(potential_dot_dot_acoustic(npoin_acoustic))
-    allocate(rmass_inverse_acoustic(npoin_acoustic))
+    allocate(potential_acoustic(nglob_acoustic))
+    allocate(potential_dot_acoustic(nglob_acoustic))
+    allocate(potential_dot_dot_acoustic(nglob_acoustic))
+    allocate(rmass_inverse_acoustic(nglob_acoustic))
 
     if(SIMULATION_TYPE == 2 .and. any_acoustic) then
-      allocate(b_potential_acoustic(npoin))
-      allocate(b_potential_dot_acoustic(npoin))
-      allocate(b_potential_dot_dot_acoustic(npoin))
-      allocate(b_displ_ac(2,npoin))
-      allocate(b_accel_ac(2,npoin))
-      allocate(accel_ac(2,npoin))
+      allocate(b_potential_acoustic(nglob))
+      allocate(b_potential_dot_acoustic(nglob))
+      allocate(b_potential_dot_dot_acoustic(nglob))
+      allocate(b_displ_ac(2,nglob))
+      allocate(b_accel_ac(2,nglob))
+      allocate(accel_ac(2,nglob))
       allocate(rho_ac_kl(NGLLX,NGLLZ,nspec))
-      allocate(rhol_ac_global(npoin))
+      allocate(rhol_ac_global(nglob))
       allocate(kappa_ac_kl(NGLLX,NGLLZ,nspec))
-      allocate(kappal_ac_global(npoin))
+      allocate(kappal_ac_global(nglob))
       allocate(rhop_ac_kl(NGLLX,NGLLZ,nspec))
       allocate(alpha_ac_kl(NGLLX,NGLLZ,nspec))
       allocate(rhorho_ac_hessian_final2(NGLLX,NGLLZ,nspec))
@@ -2389,10 +2265,10 @@
   !---- build the global mass matrix
   !
   call invert_mass_matrix_init(any_elastic,any_acoustic,any_poroelastic, &
-                                rmass_inverse_elastic,npoin_elastic, &
-                                rmass_inverse_acoustic,npoin_acoustic, &
+                                rmass_inverse_elastic,nglob_elastic, &
+                                rmass_inverse_acoustic,nglob_acoustic, &
                                 rmass_s_inverse_poroelastic, &
-                                rmass_w_inverse_poroelastic,npoin_poroelastic, &
+                                rmass_w_inverse_poroelastic,nglob_poroelastic, &
                                 nspec,ibool,kmato,wxgll,wzgll,jacobian, &
                                 elastic,poroelastic, &
                                 assign_external_model,numat, &
@@ -2408,7 +2284,7 @@
     if(ipass == 1) allocate(mask_ispec_inner_outer(nspec))
     mask_ispec_inner_outer(:) = .false.
 
-    call get_MPI(nspec,ibool,knods,ngnod,npoin,elastic,poroelastic, &
+    call get_MPI(nspec,ibool,knods,ngnod,nglob,elastic,poroelastic, &
                     ninterface, max_interface_size, &
                     my_nelmnts_neighbours,my_interfaces,my_neighbours, &
                     ibool_interfaces_acoustic, ibool_interfaces_elastic, &
@@ -2464,9 +2340,9 @@
     endif
 
 ! assembling the mass matrix
-    call assemble_MPI_scalar(rmass_inverse_acoustic,npoin_acoustic, &
-                            rmass_inverse_elastic,npoin_elastic, &
-                            rmass_s_inverse_poroelastic,rmass_w_inverse_poroelastic,npoin_poroelastic, &
+    call assemble_MPI_scalar(rmass_inverse_acoustic,nglob_acoustic, &
+                            rmass_inverse_elastic,nglob_elastic, &
+                            rmass_s_inverse_poroelastic,rmass_w_inverse_poroelastic,nglob_poroelastic, &
                             ninterface, max_interface_size, max_ibool_interfaces_size_ac, &
                             max_ibool_interfaces_size_el, &
                             max_ibool_interfaces_size_po, &
@@ -2547,65 +2423,18 @@
       ibool_inner(:,:,ispec_inner) = ibool(:,:,ispec)
     enddo
 
-    allocate(copy_ibool_ori(NGLLX,NGLLZ,nspec_outer))
-    allocate(mask_ibool(npoin))
+    ! reduces cache misses for outer elements
+    call get_global_indirect_addressing(nspec_outer,nglob,ibool_outer)
 
-    mask_ibool(:) = -1
-    copy_ibool_ori(:,:,:) = ibool_outer(:,:,:)
-
-    inumber = 0
-
-    do ispec = 1,nspec_outer
-      do j=1,NGLLZ
-        do i=1,NGLLX
-          if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
-    ! create a new point
-            inumber = inumber + 1
-            ibool_outer(i,j,ispec) = inumber
-            mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
-          else
-    ! use an existing point created previously
-            ibool_outer(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
-          endif
-        enddo
-      enddo
-    enddo
-
-    deallocate(copy_ibool_ori)
-    deallocate(mask_ibool)
-
     ! the total number of points without multiples in this region is now known
-    npoin_outer = maxval(ibool_outer)
+    nglob_outer = maxval(ibool_outer)
 
-    allocate(copy_ibool_ori(NGLLX,NGLLZ,nspec_inner))
-    allocate(mask_ibool(npoin))
+    ! reduces cache misses for inner elements
+    call get_global_indirect_addressing(nspec_inner,nglob,ibool_inner)
 
-    mask_ibool(:) = -1
-    copy_ibool_ori(:,:,:) = ibool_inner(:,:,:)
 
-    inumber = 0
-
-    do ispec = 1,nspec_inner
-      do j=1,NGLLZ
-        do i=1,NGLLX
-          if(mask_ibool(copy_ibool_ori(i,j,ispec)) == -1) then
-    ! create a new point
-            inumber = inumber + 1
-            ibool_inner(i,j,ispec) = inumber
-            mask_ibool(copy_ibool_ori(i,j,ispec)) = inumber
-          else
-    ! use an existing point created previously
-            ibool_inner(i,j,ispec) = mask_ibool(copy_ibool_ori(i,j,ispec))
-          endif
-        enddo
-      enddo
-    enddo
-
-    deallocate(copy_ibool_ori)
-    deallocate(mask_ibool)
-
     ! the total number of points without multiples in this region is now known
-    npoin_inner = maxval(ibool_inner)
+    nglob_inner = maxval(ibool_inner)
 
     !allocate(perm(nspec))
 
@@ -2617,7 +2446,7 @@
     if(ACTUALLY_IMPLEMENT_PERM_WHOLE) then
 
       allocate(check_perm(nspec))
-      call get_perm(ibool,perm,LIMIT_MULTI_CUTHILL,nspec,npoin)
+      call get_perm(ibool,perm,LIMIT_MULTI_CUTHILL,nspec,nglob)
     ! check that the permutation obtained is bijective
       check_perm(:) = -1
       do ispec = 1,nspec
@@ -2630,7 +2459,7 @@
 
     if(ACTUALLY_IMPLEMENT_PERM_OUT) then
       allocate(check_perm(nspec_outer))
-      call get_perm(ibool_outer,perm(1:nspec_outer),LIMIT_MULTI_CUTHILL,nspec_outer,npoin_outer)
+      call get_perm(ibool_outer,perm(1:nspec_outer),LIMIT_MULTI_CUTHILL,nspec_outer,nglob_outer)
     ! check that the permutation obtained is bijective
       check_perm(:) = -1
       do ispec = 1,nspec_outer
@@ -2644,7 +2473,7 @@
 
     if(ACTUALLY_IMPLEMENT_PERM_INN) then
       allocate(check_perm(nspec_inner))
-      call get_perm(ibool_inner,perm(nspec_outer+1:nspec),LIMIT_MULTI_CUTHILL,nspec_inner,npoin_inner)
+      call get_perm(ibool_inner,perm(nspec_outer+1:nspec),LIMIT_MULTI_CUTHILL,nspec_inner,nglob_inner)
     ! check that the permutation obtained is bijective
       check_perm(:) = -1
       do ispec = 1,nspec_inner
@@ -2675,10 +2504,10 @@
 !---
 
   call invert_mass_matrix(any_elastic,any_acoustic,any_poroelastic,&
-              rmass_inverse_elastic,npoin_elastic, &
-              rmass_inverse_acoustic,npoin_acoustic, &
+              rmass_inverse_elastic,nglob_elastic, &
+              rmass_inverse_acoustic,nglob_acoustic, &
               rmass_s_inverse_poroelastic, &
-              rmass_w_inverse_poroelastic,npoin_poroelastic)
+              rmass_w_inverse_poroelastic,nglob_poroelastic)
 
 ! check the mesh, stability and number of points per wavelength
   if(DISPLAY_SUBSET_OPTION == 1) then
@@ -2694,7 +2523,7 @@
   endif
   call checkgrid(vpext,vsext,rhoext,density,poroelastcoef, &
                  porosity,tortuosity,permeability,ibool,kmato, &
-                 coord,npoin,vpImin,vpImax,vpIImin,vpIImax, &
+                 coord,nglob,vpImin,vpImax,vpIImin,vpIImax, &
                  assign_external_model,nspec,UPPER_LIMIT_DISPLAY,numat,deltat, &
                  f0,initialfield,time_function_type, &
                  coorg,xinterp,zinterp,shape2D_display,knods,simulation_title, &
@@ -2714,7 +2543,7 @@
     call prepare_color_image_init(NX_IMAGE_color,NZ_IMAGE_color, &
                             xmin_color_image,xmax_color_image, &
                             zmin_color_image,zmax_color_image, &
-                            coord,npoin,npgeo)
+                            coord,nglob,npgeo)
 
     ! allocate an array for image data
     allocate(image_color_data(NX_IMAGE_color,NZ_IMAGE_color))
@@ -2728,7 +2557,7 @@
     call prepare_color_image_pixels(myrank,NX_IMAGE_color,NZ_IMAGE_color, &
                             xmin_color_image,xmax_color_image, &
                             zmin_color_image,zmax_color_image, &
-                            coord,npoin,coorg,npgeo,nspec,ngnod,knods,ibool, &
+                            coord,nglob,coorg,npgeo,nspec,ngnod,knods,ibool, &
                             nb_pixel_loc,iglob_image_color)
 
 
@@ -2810,12 +2639,12 @@
 !----- Files where viscous damping are saved during forward wavefield calculation
 !
   if(any_poroelastic .and. (SAVE_FORWARD .or. SIMULATION_TYPE .eq. 2)) then
-    allocate(b_viscodampx(npoin))
-    allocate(b_viscodampz(npoin))
+    allocate(b_viscodampx(nglob))
+    allocate(b_viscodampz(nglob))
     write(outputname,'(a,i6.6,a)') 'viscodampingx',myrank,'.bin'
     write(outputname2,'(a,i6.6,a)') 'viscodampingz',myrank,'.bin'
     if(SIMULATION_TYPE == 2) then
-      reclen = CUSTOM_REAL * npoin
+      reclen = CUSTOM_REAL * nglob
       open(unit=23,file='OUTPUT_FILES/'//outputname,status='old',&
             action='read',form='unformatted',access='direct',&
             recl=reclen)
@@ -2823,7 +2652,7 @@
             action='read',form='unformatted',access='direct',&
             recl=reclen)
     else
-      reclen = CUSTOM_REAL * npoin
+      reclen = CUSTOM_REAL * nglob
       open(unit=23,file='OUTPUT_FILES/'//outputname,status='unknown',&
             form='unformatted',access='direct',&
             recl=reclen)
@@ -2994,7 +2823,7 @@
     if( any_elastic ) then
       call prepare_initialfield(myrank,any_acoustic,any_poroelastic,over_critical_angle, &
                         NSOURCES,source_type,angleforce,x_source,z_source,f0, &
-                        npoin,numat,poroelastcoef,density,coord, &
+                        nglob,numat,poroelastcoef,density,coord, &
                         angleforce_refl,c_inc,c_refl,cploc,csloc,time_offset, &
                         A_plane, B_plane, C_plane, &
                         accel_elastic,veloc_elastic,displ_elastic)
@@ -3026,12 +2855,12 @@
       allocate(t0x_bot(count_bottom,NSTEP))
       allocate(t0z_bot(count_bottom,NSTEP))
 
-      allocate(displ_paco(NDIM,npoin))
-      allocate(veloc_paco(NDIM,npoin))
-      allocate(accel_paco(NDIM,npoin))
+      allocate(displ_paco(NDIM,nglob))
+      allocate(veloc_paco(NDIM,nglob))
+      allocate(accel_paco(NDIM,nglob))
 
       ! call Paco's routine to compute in frequency and convert to time by Fourier transform
-      call paco_beyond_critical(coord,npoin,deltat,NSTEP,angleforce(1),&
+      call paco_beyond_critical(coord,nglob,deltat,NSTEP,angleforce(1),&
               f0(1),cploc,csloc,TURN_ATTENUATION_ON,Qp_attenuation,source_type(1),v0x_left,v0z_left,&
               v0x_right,v0z_right,v0x_bot,v0z_bot,t0x_left,t0z_left,t0x_right,t0z_right,&
               t0x_bot,t0z_bot,left_bound(1:count_left),right_bound(1:count_right),bot_bound(1:count_bottom)&
@@ -3689,7 +3518,7 @@
 
   ! prepares image background
   if(output_color_image) then
-    call prepare_color_image_vp(npoin,image_color_vp_display,iglob_image_color, &
+    call prepare_color_image_vp(nglob,image_color_vp_display,iglob_image_color, &
                             NX_IMAGE_color,NZ_IMAGE_color,nb_pixel_loc, &
                             num_pixel_loc,nspec,poroelastic,ibool,kmato, &
                             numat,density,poroelastcoef,porosity,tortuosity, &
@@ -3816,7 +3645,7 @@
       d2_coorg_send_ps_vector_field=nspec*pointsdisp*pointsdisp
     endif
   else
-    d2_coorg_send_ps_vector_field=npoin
+    d2_coorg_send_ps_vector_field=nglob
   endif
   call mpi_allreduce(d1_coorg_send_ps_vector_field,d1_coorg_recv_ps_vector_field,1,MPI_INTEGER,MPI_MAX,MPI_COMM_WORLD,ier)
   call mpi_allreduce(d2_coorg_send_ps_vector_field,d2_coorg_recv_ps_vector_field,1,MPI_INTEGER,MPI_MAX,MPI_COMM_WORLD,ier)
@@ -4027,12 +3856,12 @@
       if ( nelem_acoustic_surface > 0 ) then
         call enforce_acoustic_free_surface(potential_dot_dot_acoustic,potential_dot_acoustic, &
                                           potential_acoustic,acoustic_surface, &
-                                          ibool,nelem_acoustic_surface,npoin,nspec)
+                                          ibool,nelem_acoustic_surface,nglob,nspec)
 
         if(SIMULATION_TYPE == 2) then ! Adjoint calculation
           call enforce_acoustic_free_surface(b_potential_dot_dot_acoustic,b_potential_dot_acoustic, &
                                             b_potential_acoustic,acoustic_surface, &
-                                            ibool,nelem_acoustic_surface,npoin,nspec)
+                                            ibool,nelem_acoustic_surface,nglob,nspec)
         endif
       endif
 
@@ -4040,7 +3869,7 @@
 ! ************* compute forces for the acoustic elements
 ! *********************************************************
 
-!      call compute_forces_acoustic(npoin,nspec,nelemabs,numat,it,NSTEP, &
+!      call compute_forces_acoustic(nglob,nspec,nelemabs,numat,it,NSTEP, &
 !               anyabs,assign_external_model,ibool,kmato,numabs, &
 !               elastic,poroelastic,codeabs,potential_dot_dot_acoustic,potential_dot_acoustic, &
 !               potential_acoustic,b_potential_dot_dot_acoustic,b_potential_acoustic, &
@@ -4055,7 +3884,7 @@
 !               nspec_bottom,nspec_top,ib_left,ib_right,ib_bottom,ib_top)
 
 
-      call compute_forces_acoustic_2(npoin,nspec,nelemabs,numat,it,NSTEP, &
+      call compute_forces_acoustic_2(nglob,nspec,nelemabs,numat,it,NSTEP, &
                anyabs,assign_external_model,ibool,kmato,numabs, &
                elastic,poroelastic,codeabs,potential_dot_dot_acoustic,potential_dot_acoustic, &
                potential_acoustic, &
@@ -4069,7 +3898,7 @@
                b_absorb_acoustic_left,b_absorb_acoustic_right, &
                b_absorb_acoustic_bottom,b_absorb_acoustic_top)
       if( SIMULATION_TYPE == 2 ) then
-        call compute_forces_acoustic_2(npoin,nspec,nelemabs,numat,it,NSTEP, &
+        call compute_forces_acoustic_2(nglob,nspec,nelemabs,numat,it,NSTEP, &
                anyabs,assign_external_model,ibool,kmato,numabs, &
                elastic,poroelastic,codeabs,b_potential_dot_dot_acoustic,b_potential_dot_acoustic, &
                b_potential_acoustic, &
@@ -4391,7 +4220,7 @@
 ! assembling potential_dot_dot for acoustic elements
 #ifdef USE_MPI
   if ( nproc > 1 .and. any_acoustic .and. ninterface_acoustic > 0) then
-    call assemble_MPI_vector_ac(potential_dot_dot_acoustic,npoin, &
+    call assemble_MPI_vector_ac(potential_dot_dot_acoustic,nglob, &
                     ninterface, ninterface_acoustic,inum_interfaces_acoustic, &
                     max_interface_size, max_ibool_interfaces_size_ac,&
                     ibool_interfaces_acoustic, nibool_interfaces_acoustic, &
@@ -4399,7 +4228,7 @@
                     buffer_recv_faces_vector_ac, my_neighbours)
 
     if ( SIMULATION_TYPE == 2) then
-      call assemble_MPI_vector_ac(b_potential_dot_dot_acoustic,npoin, &
+      call assemble_MPI_vector_ac(b_potential_dot_dot_acoustic,nglob, &
                      ninterface, ninterface_acoustic,inum_interfaces_acoustic, &
                      max_interface_size, max_ibool_interfaces_size_ac,&
                      ibool_interfaces_acoustic, nibool_interfaces_acoustic, &
@@ -4411,7 +4240,7 @@
   endif
 
 !  if ( nproc > 1 .and. any_acoustic .and. ninterface_acoustic > 0 .and. SIMULATION_TYPE == 2) then
-!    call assemble_MPI_vector_ac(b_potential_dot_dot_acoustic,npoin, &
+!    call assemble_MPI_vector_ac(b_potential_dot_dot_acoustic,nglob, &
 !           ninterface, ninterface_acoustic,inum_interfaces_acoustic, &
 !           max_interface_size, max_ibool_interfaces_size_ac,&
 !           ibool_interfaces_acoustic, nibool_interfaces_acoustic, &
@@ -4439,12 +4268,12 @@
     if ( nelem_acoustic_surface > 0 ) then
       call enforce_acoustic_free_surface(potential_dot_dot_acoustic,potential_dot_acoustic, &
                                         potential_acoustic,acoustic_surface, &
-                                        ibool,nelem_acoustic_surface,npoin,nspec)
+                                        ibool,nelem_acoustic_surface,nglob,nspec)
 
       if(SIMULATION_TYPE == 2) then
         call enforce_acoustic_free_surface(b_potential_dot_dot_acoustic,b_potential_dot_acoustic, &
                                           b_potential_acoustic,acoustic_surface, &
-                                          ibool,nelem_acoustic_surface,npoin,nspec)
+                                          ibool,nelem_acoustic_surface,nglob,nspec)
       endif
 
     endif
@@ -4457,7 +4286,7 @@
 ! *********************************************************
 
  if(any_elastic) then
-    call compute_forces_viscoelastic(p_sv,npoin,nspec,myrank,nelemabs,numat, &
+    call compute_forces_viscoelastic(p_sv,nglob,nspec,myrank,nelemabs,numat, &
                ispec_selected_source,ispec_selected_rec,is_proc_source,which_proc_receiver, &
                source_type,it,NSTEP,anyabs,assign_external_model, &
                initialfield,TURN_ATTENUATION_ON,angleforce,deltatcube, &
@@ -5022,7 +4851,7 @@
 ! assembling accel_elastic for elastic elements
 #ifdef USE_MPI
   if (nproc > 1 .and. any_elastic .and. ninterface_elastic > 0) then
-    call assemble_MPI_vector_el(accel_elastic,npoin, &
+    call assemble_MPI_vector_el(accel_elastic,nglob, &
       ninterface, ninterface_elastic,inum_interfaces_elastic, &
       max_interface_size, max_ibool_interfaces_size_el,&
       ibool_interfaces_elastic, nibool_interfaces_elastic, &
@@ -5031,7 +4860,7 @@
   endif
 
   if (nproc > 1 .and. any_elastic .and. ninterface_elastic > 0 .and. SIMULATION_TYPE == 2) then
-    call assemble_MPI_vector_el(b_accel_elastic,npoin, &
+    call assemble_MPI_vector_el(b_accel_elastic,nglob, &
       ninterface, ninterface_elastic,inum_interfaces_elastic, &
       max_interface_size, max_ibool_interfaces_size_el,&
       ibool_interfaces_elastic, nibool_interfaces_elastic, &
@@ -5077,7 +4906,7 @@
      b_viscodampz(:) = ZERO
     endif
 
-    call compute_forces_poro_solid(npoin,nspec,myrank,nelemabs,numat, &
+    call compute_forces_poro_solid(nglob,nspec,myrank,nelemabs,numat, &
                ispec_selected_source,ispec_selected_rec,is_proc_source,which_proc_receiver,&
                source_type,it,NSTEP,anyabs, &
                initialfield,TURN_ATTENUATION_ON,TURN_VISCATTENUATION_ON,deltatcube, &
@@ -5100,7 +4929,7 @@
 
 
 
-    call compute_forces_poro_fluid(npoin,nspec,myrank,nelemabs,numat, &
+    call compute_forces_poro_fluid(nglob,nspec,myrank,nelemabs,numat, &
                ispec_selected_source,ispec_selected_rec,is_proc_source,which_proc_receiver,&
                source_type,it,NSTEP,anyabs, &
                initialfield,TURN_ATTENUATION_ON,TURN_VISCATTENUATION_ON,deltatcube, &
@@ -5659,7 +5488,7 @@
 ! assembling accels_proelastic & accelw_poroelastic for poroelastic elements
 #ifdef USE_MPI
   if (nproc > 1 .and. any_poroelastic .and. ninterface_poroelastic > 0) then
-    call assemble_MPI_vector_po(accels_poroelastic,accelw_poroelastic,npoin, &
+    call assemble_MPI_vector_po(accels_poroelastic,accelw_poroelastic,nglob, &
       ninterface, ninterface_poroelastic,inum_interfaces_poroelastic, &
       max_interface_size, max_ibool_interfaces_size_po,&
       ibool_interfaces_poroelastic, nibool_interfaces_poroelastic, &
@@ -5669,7 +5498,7 @@
   endif
 
   if (nproc > 1 .and. any_poroelastic .and. ninterface_poroelastic > 0 .and. SIMULATION_TYPE == 2) then
-    call assemble_MPI_vector_po(b_accels_poroelastic,b_accelw_poroelastic,npoin, &
+    call assemble_MPI_vector_po(b_accels_poroelastic,b_accelw_poroelastic,nglob, &
       ninterface, ninterface_poroelastic,inum_interfaces_poroelastic, &
       max_interface_size, max_ibool_interfaces_size_po,&
       ibool_interfaces_poroelastic, nibool_interfaces_poroelastic, &
@@ -5800,7 +5629,7 @@
     if(any_acoustic) then
       write(outputname,'(a,i6.6,a)') 'lastframe_acoustic',myrank,'.bin'
       open(unit=55,file='OUTPUT_FILES/'//outputname,status='old',action='read',form='unformatted')
-      do j=1,npoin
+      do j=1,nglob
         read(55) b_potential_acoustic(j),&
                 b_potential_dot_acoustic(j),&
                 b_potential_dot_dot_acoustic(j)
@@ -5811,7 +5640,7 @@
       if ( nelem_acoustic_surface > 0 ) then
         call enforce_acoustic_free_surface(b_potential_dot_dot_acoustic,b_potential_dot_acoustic, &
                                           b_potential_acoustic,acoustic_surface, &
-                                          ibool,nelem_acoustic_surface,npoin,nspec)
+                                          ibool,nelem_acoustic_surface,nglob,nspec)
       endif
     endif
 
@@ -5820,7 +5649,7 @@
       write(outputname,'(a,i6.6,a)') 'lastframe_elastic',myrank,'.bin'
       open(unit=55,file='OUTPUT_FILES/'//outputname,status='old',action='read',form='unformatted')
       if(p_sv)then !P-SV waves
-        do j=1,npoin
+        do j=1,nglob
           read(55) (b_displ_elastic(i,j), i=1,NDIM), &
                     (b_veloc_elastic(i,j), i=1,NDIM), &
                     (b_accel_elastic(i,j), i=1,NDIM)
@@ -5832,7 +5661,7 @@
         b_accel_elastic(3,:) = b_accel_elastic(2,:)
         b_accel_elastic(2,:) = 0._CUSTOM_REAL
       else !SH (membrane) waves
-        do j=1,npoin
+        do j=1,nglob
           read(55) b_displ_elastic(2,j), &
                     b_veloc_elastic(2,j), &
                     b_accel_elastic(2,j)
@@ -5853,7 +5682,7 @@
     open(unit=55,file='OUTPUT_FILES/'//outputname,status='old',action='read',form='unformatted')
     write(outputname,'(a,i6.6,a)') 'lastframe_poroelastic_w',myrank,'.bin'
     open(unit=56,file='OUTPUT_FILES/'//outputname,status='old',action='read',form='unformatted')
-       do j=1,npoin
+       do j=1,nglob
       read(55) (b_displs_poroelastic(i,j), i=1,NDIM), &
                   (b_velocs_poroelastic(i,j), i=1,NDIM), &
                   (b_accels_poroelastic(i,j), i=1,NDIM)
@@ -5871,7 +5700,7 @@
 !                                      kernels calculation
 ! ********************************************************************************************
   if(any_elastic .and. SIMULATION_TYPE == 2) then ! kernels calculation
-      do iglob = 1,npoin
+      do iglob = 1,nglob
             rho_k(iglob) =  accel_elastic(1,iglob)*b_displ_elastic(1,iglob) +&
                             accel_elastic(2,iglob)*b_displ_elastic(2,iglob) +&
                             accel_elastic(3,iglob)*b_displ_elastic(3,iglob)
@@ -5885,7 +5714,7 @@
   endif
 
   if(any_poroelastic .and. SIMULATION_TYPE ==2) then
-   do iglob =1,npoin
+   do iglob =1,nglob
             rhot_k(iglob) = accels_poroelastic(1,iglob) * b_displs_poroelastic(1,iglob) + &
                   accels_poroelastic(2,iglob) * b_displs_poroelastic(2,iglob)
             rhof_k(iglob) = accelw_poroelastic(1,iglob) * b_displs_poroelastic(1,iglob) + &
@@ -5905,7 +5734,7 @@
                         displs_poroelastic,velocs_poroelastic, &
                         displw_poroelastic,velocw_poroelastic, &
                         xix,xiz,gammax,gammaz,jacobian,ibool,elastic,poroelastic,hprime_xx,hprime_zz, &
-                        nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         assign_external_model,it,deltat,t0,kmato,poroelastcoef,density, &
                         porosity,tortuosity, &
                         vpext,vsext,rhoext,c11ext,c13ext,c15ext,c33ext,c35ext,c55ext, &
@@ -5917,7 +5746,7 @@
 !----  display time step and max of norm of displacement
   if(mod(it,NTSTEP_BETWEEN_OUTPUT_INFO) == 0 .or. it == 5 .or. it == NSTEP) then
     call check_stability(myrank,time,it,NSTEP, &
-                        npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         any_elastic_glob,any_elastic,displ_elastic, &
                         any_poroelastic_glob,any_poroelastic, &
                         displs_poroelastic,displw_poroelastic, &
@@ -5938,7 +5767,7 @@
        call compute_pressure_one_element(pressure_element,potential_dot_dot_acoustic,displ_elastic,&
             displs_poroelastic,displw_poroelastic,elastic,poroelastic,&
             xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz,nspec, &
-            npoin_acoustic,npoin_elastic,npoin_poroelastic,assign_external_model, &
+            nglob_acoustic,nglob_elastic,nglob_poroelastic,assign_external_model, &
             numat,kmato,density,porosity,tortuosity,poroelastcoef,vpext,vsext,rhoext, &
             c11ext,c13ext,c15ext,c33ext,c35ext,c55ext,anisotropic,anisotropy,ispec,e1,e11, &
             TURN_ATTENUATION_ON,Mu_nu1,Mu_nu2,N_SLS)
@@ -5951,21 +5780,21 @@
                               displ_elastic,displs_poroelastic,&
                               elastic,poroelastic,xix,xiz,gammax,gammaz, &
                               ibool,hprime_xx,hprime_zz, &
-                              nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                              nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                               ispec,numat,kmato,density,rhoext,assign_external_model)
        else if(seismotype == 2) then
           call compute_vector_one_element(vector_field_element,potential_dot_acoustic, &
                               veloc_elastic,velocs_poroelastic, &
                               elastic,poroelastic,xix,xiz,gammax,gammaz, &
                               ibool,hprime_xx,hprime_zz, &
-                              nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                              nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                               ispec,numat,kmato,density,rhoext,assign_external_model)
        else if(seismotype == 3) then
           call compute_vector_one_element(vector_field_element,potential_dot_dot_acoustic, &
                               accel_elastic,accels_poroelastic, &
                               elastic,poroelastic,xix,xiz,gammax,gammaz, &
                               ibool,hprime_xx,hprime_zz, &
-                              nspec,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                              nspec,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                               ispec,numat,kmato,density,rhoext,assign_external_model)
        endif
 
@@ -5973,7 +5802,7 @@
        call compute_curl_one_element(curl_element,displ_elastic, &
                             displs_poroelastic,elastic,poroelastic, &
                             xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                            nspec,npoin_elastic,npoin_poroelastic,ispec)
+                            nspec,nglob_elastic,nglob_poroelastic,ispec)
     endif
 
 ! perform the general interpolation using Lagrange polynomials
@@ -6427,7 +6256,7 @@
     call compute_vector_whole_medium(potential_acoustic,displ_elastic,displs_poroelastic,&
                         elastic,poroelastic,vector_field_display, &
                         xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                        nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         numat,kmato,density,rhoext,assign_external_model)
 
     call plotpost(vector_field_display,coord,vpext,x_source,z_source,x_final_receiver,z_final_receiver, &
@@ -6435,7 +6264,7 @@
           Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
           poroelastcoef,knods,kmato,ibool, &
           numabs,codeabs,anyabs,nelem_acoustic_surface,acoustic_edges, &
-          simulation_title,npoin,npgeo,vpImin,vpImax,nrec,NSOURCES, &
+          simulation_title,nglob,npgeo,vpImin,vpImax,nrec,NSOURCES, &
           colors,numbers,subsamp,imagetype,interpol,meshvect,modelvect, &
           boundvect,assign_external_model,cutsnaps,sizemax_arrows,nelemabs,numat,pointsdisp, &
           nspec,ngnod,coupled_acoustic_elastic,coupled_acoustic_poro,coupled_elastic_poro, &
@@ -6471,7 +6300,7 @@
     call compute_vector_whole_medium(potential_dot_acoustic,veloc_elastic,velocs_poroelastic,&
                         elastic,poroelastic,vector_field_display, &
                         xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                        nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         numat,kmato,density,rhoext,assign_external_model)
 
     call plotpost(vector_field_display,coord,vpext,x_source,z_source,x_final_receiver,z_final_receiver, &
@@ -6479,7 +6308,7 @@
           Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
           poroelastcoef,knods,kmato,ibool, &
           numabs,codeabs,anyabs,nelem_acoustic_surface,acoustic_edges, &
-          simulation_title,npoin,npgeo,vpImin,vpImax,nrec,NSOURCES, &
+          simulation_title,nglob,npgeo,vpImin,vpImax,nrec,NSOURCES, &
           colors,numbers,subsamp,imagetype,interpol,meshvect,modelvect, &
           boundvect,assign_external_model,cutsnaps,sizemax_arrows,nelemabs,numat,pointsdisp, &
           nspec,ngnod,coupled_acoustic_elastic,coupled_acoustic_poro,coupled_elastic_poro, &
@@ -6515,7 +6344,7 @@
     call compute_vector_whole_medium(potential_dot_dot_acoustic,accel_elastic,accels_poroelastic,&
                         elastic,poroelastic,vector_field_display, &
                         xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                        nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         numat,kmato,density,rhoext,assign_external_model)
 
     call plotpost(vector_field_display,coord,vpext,x_source,z_source,x_final_receiver,z_final_receiver, &
@@ -6523,7 +6352,7 @@
           Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
           poroelastcoef,knods,kmato,ibool, &
           numabs,codeabs,anyabs,nelem_acoustic_surface,acoustic_edges, &
-          simulation_title,npoin,npgeo,vpImin,vpImax,nrec,NSOURCES, &
+          simulation_title,nglob,npgeo,vpImin,vpImax,nrec,NSOURCES, &
           colors,numbers,subsamp,imagetype,interpol,meshvect,modelvect, &
           boundvect,assign_external_model,cutsnaps,sizemax_arrows,nelemabs,numat,pointsdisp, &
           nspec,ngnod,coupled_acoustic_elastic,coupled_acoustic_poro,coupled_elastic_poro, &
@@ -6578,7 +6407,7 @@
     call compute_vector_whole_medium(potential_acoustic,displ_elastic,displs_poroelastic,&
                         elastic,poroelastic,vector_field_display, &
                         xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                        nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         numat,kmato,density,rhoext,assign_external_model)
 
   else if(imagetype == 2) then
@@ -6588,7 +6417,7 @@
     call compute_vector_whole_medium(potential_dot_acoustic,veloc_elastic,velocs_poroelastic,&
                         elastic,poroelastic,vector_field_display, &
                         xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                        nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         numat,kmato,density,rhoext,assign_external_model)
 
   else if(imagetype == 3) then
@@ -6598,7 +6427,7 @@
     call compute_vector_whole_medium(potential_dot_dot_acoustic,accel_elastic,accels_poroelastic,&
                         elastic,poroelastic,vector_field_display, &
                         xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz, &
-                        nspec,npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic, &
+                        nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
                         numat,kmato,density,rhoext,assign_external_model)
 
   else if(imagetype == 4 .and. p_sv) then
@@ -6608,7 +6437,7 @@
     call compute_pressure_whole_medium(potential_dot_dot_acoustic,displ_elastic,&
          displs_poroelastic,displw_poroelastic,elastic,poroelastic,vector_field_display, &
          xix,xiz,gammax,gammaz,ibool,hprime_xx,hprime_zz,nspec, &
-         npoin,npoin_acoustic,npoin_elastic,npoin_poroelastic,assign_external_model, &
+         nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic,assign_external_model, &
          numat,kmato,density,porosity,tortuosity,poroelastcoef,vpext,vsext,rhoext, &
          c11ext,c13ext,c15ext,c33ext,c35ext,c55ext,anisotropic,anisotropy,e1,e11, &
          TURN_ATTENUATION_ON,Mu_nu1,Mu_nu2,N_SLS)
@@ -6751,13 +6580,13 @@
     write(outputname,'(a,i6.6,a)') 'lastframe_elastic',myrank,'.bin'
     open(unit=55,file='OUTPUT_FILES/'//outputname,status='unknown',form='unformatted')
     if(p_sv)then !P-SV waves
-      do j=1,npoin
+      do j=1,nglob
         write(55) displ_elastic(1,j), displ_elastic(3,j), &
                   veloc_elastic(1,j), veloc_elastic(3,j), &
                   accel_elastic(1,j), accel_elastic(3,j)
       enddo
     else !SH (membrane) waves
-      do j=1,npoin
+      do j=1,nglob
         write(55) displ_elastic(2,j), &
                   veloc_elastic(2,j), &
                   accel_elastic(2,j)
@@ -6776,7 +6605,7 @@
     open(unit=55,file='OUTPUT_FILES/'//outputname,status='unknown',form='unformatted')
     write(outputname,'(a,i6.6,a)') 'lastframe_poroelastic_w',myrank,'.bin'
     open(unit=56,file='OUTPUT_FILES/'//outputname,status='unknown',form='unformatted')
-       do j=1,npoin
+       do j=1,nglob
       write(55) (displs_poroelastic(i,j), i=1,NDIM), &
                   (velocs_poroelastic(i,j), i=1,NDIM), &
                   (accels_poroelastic(i,j), i=1,NDIM)
@@ -6796,7 +6625,7 @@
   endif
     write(outputname,'(a,i6.6,a)') 'lastframe_acoustic',myrank,'.bin'
     open(unit=55,file='OUTPUT_FILES/'//outputname,status='unknown',form='unformatted')
-       do j=1,npoin
+       do j=1,nglob
       write(55) potential_acoustic(j),&
                potential_dot_acoustic(j),&
                potential_dot_dot_acoustic(j)
@@ -6838,8 +6667,8 @@
       allocate(rho_local(ngllx,ngllz,nspec)); rho_local=0.
       allocate(vp_local(ngllx,ngllz,nspec)); vp_local=0.
       allocate(vs_local(ngllx,ngllz,nspec)); vs_local=0.
-!!      write(1001,*) npoin
-!!      do iglob = 1,npoin
+!!      write(1001,*) nglob
+!!      do iglob = 1,nglob
 !!         write(1001,*) coord(1,iglob),coord(2,iglob),rho_global(iglob),vp_global(iglob),vs_global(iglob)
 !!      end do
       do ispec = 1,nspec
@@ -6855,8 +6684,8 @@
         end do
       end do
     else
-!!     write(1001,*) npoin
-!!  do iglob = 1,npoin
+!!     write(1001,*) nglob
+!!  do iglob = 1,nglob
 !!     write(1001,*) coord(1,iglob),coord(2,iglob),rhoext_global(iglob),vpext_global(iglob),vsext_global(iglob)
 !!  end do
       do ispec = 1,nspec



More information about the CIG-COMMITS mailing list