[cig-commits] [commit] devel: uses local arrays for PML_dpotential_dxl, .. for slightly faster acoustic PML computations (8409ff4)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon Dec 22 05:55:59 PST 2014


Repository : https://github.com/geodynamics/specfem3d

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/5482435a44c766976b16ef4139e5b545834a7300...8409ff46e1df08c2033322539a2dbb07ba86390c

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

commit 8409ff46e1df08c2033322539a2dbb07ba86390c
Author: daniel peter <peterda at ethz.ch>
Date:   Mon Dec 22 14:32:22 2014 +0100

    uses local arrays for PML_dpotential_dxl,.. for slightly faster acoustic PML computations


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

8409ff46e1df08c2033322539a2dbb07ba86390c
 src/generate_databases/memory_eval.f90           |  4 --
 src/specfem3D/compute_forces_acoustic_Dev.F90    | 18 +++++++--
 src/specfem3D/compute_forces_acoustic_noDev.f90  | 25 +++++++-----
 src/specfem3D/pml_allocate_arrays.f90            | 51 ------------------------
 src/specfem3D/pml_compute_accel_contribution.f90 | 19 ++++++---
 src/specfem3D/pml_compute_memory_variables.f90   | 26 +++++++++---
 src/specfem3D/pml_par.f90                        | 12 ------
 7 files changed, 64 insertions(+), 91 deletions(-)

diff --git a/src/generate_databases/memory_eval.f90 b/src/generate_databases/memory_eval.f90
index ff33cfe..aa76093 100644
--- a/src/generate_databases/memory_eval.f90
+++ b/src/generate_databases/memory_eval.f90
@@ -105,10 +105,6 @@
      ! PML_duz_dxl_old,PML_duz_dyl_old,PML_duz_dzl_old
      memory_size = memory_size + 18.d0*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*nspec_cpml*dble(CUSTOM_REAL)
 
-     ! PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl
-     ! PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
-     memory_size = memory_size + 6.d0*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*nspec_cpml*dble(CUSTOM_REAL)
-
      ! rmemory_dux_dxl_x,rmemory_dux_dyl_x,rmemory_dux_dzl_x,rmemory_duy_dxl_x,
      ! rmemory_duy_dyl_x,rmemory_duz_dxl_x,rmemory_duz_dzl_x,
      ! rmemory_dux_dxl_y,rmemory_dux_dyl_y,rmemory_duy_dxl_y,rmemory_duy_dyl_y,
diff --git a/src/specfem3D/compute_forces_acoustic_Dev.F90 b/src/specfem3D/compute_forces_acoustic_Dev.F90
index 7da1062..65330e1 100644
--- a/src/specfem3D/compute_forces_acoustic_Dev.F90
+++ b/src/specfem3D/compute_forces_acoustic_Dev.F90
@@ -50,9 +50,6 @@
                         m1,m2,NGLLCUBE,PML_CONDITIONS
 
   use pml_par, only: is_CPML, spec_to_CPML, NSPEC_CPML, &
-                     PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl,&
-                     PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old,&
-                     PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new,&
                      potential_dot_dot_acoustic_CPML,rmemory_dpotential_dxl,rmemory_dpotential_dyl,&
                      rmemory_dpotential_dzl,rmemory_potential_acoustic, &
                      potential_acoustic_old,potential_acoustic_new
@@ -101,6 +98,16 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: chi_elem_old,chi_elem_new
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: tempx1_old,tempx2_old,tempx3_old
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: tempx1_new,tempx2_new,tempx3_new
+  ! derivatives of potential with respect to x, y and z
+  ! in computation potential_acoustic at "n" time step is used
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl
+  ! in computation of PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
+  ! we replace potential_acoustic with potential_acoustic_old
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
+  ! we replace potential_acoustic at "n" time step with
+  ! we replace potential_acoustic with potential_acoustic_old with potential_acoustic_new
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new
+
 
 #ifdef FORCE_VECTORIZATION
 ! this will (purposely) give out-of-bound array accesses if run through range checking,
@@ -230,7 +237,10 @@
         ! sets C-PML elastic memory variables to compute stress sigma and form dot product with test vector
         call pml_compute_memory_variables_acoustic(ispec,ispec_CPML, &
                                                    tempx1,tempx2,tempx3,&
-                                                   rmemory_dpotential_dxl,rmemory_dpotential_dyl,rmemory_dpotential_dzl)
+                                                   rmemory_dpotential_dxl,rmemory_dpotential_dyl,rmemory_dpotential_dzl, &
+                                                   PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl,&
+                                                   PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old,&
+                                                   PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new)
 
         ! calculates contribution from each C-PML element to update acceleration
         call pml_compute_accel_contribution_acoustic(ispec,ispec_CPML,potential_acoustic,&
diff --git a/src/specfem3D/compute_forces_acoustic_noDev.f90 b/src/specfem3D/compute_forces_acoustic_noDev.f90
index 751a123..406d322 100644
--- a/src/specfem3D/compute_forces_acoustic_noDev.f90
+++ b/src/specfem3D/compute_forces_acoustic_noDev.f90
@@ -45,9 +45,6 @@
   use specfem_par,only: CUSTOM_REAL,NGLLX,NGLLY,NGLLZ,PML_CONDITIONS
 
   use pml_par, only: is_CPML, spec_to_CPML, NSPEC_CPML, &
-                     PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl,&
-                     PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old,&
-                     PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new,&
                      potential_dot_dot_acoustic_CPML,rmemory_dpotential_dxl,rmemory_dpotential_dyl,&
                      rmemory_dpotential_dzl,rmemory_potential_acoustic, &
                      potential_acoustic_old,potential_acoustic_new
@@ -90,18 +87,25 @@
   real(kind=CUSTOM_REAL) :: hp1,hp2,hp3
   real(kind=CUSTOM_REAL) :: fac1,fac2,fac3
 
+  integer :: ispec,iglob,i,j,k,l,ispec_p,num_elements
+
   ! CPML
+  integer :: ispec_CPML
   real(kind=CUSTOM_REAL) :: temp1l_old,temp2l_old,temp3l_old
   real(kind=CUSTOM_REAL) :: temp1l_new,temp2l_new,temp3l_new
 
   real(kind=CUSTOM_REAL) :: xixl,xiyl,xizl,etaxl,etayl,etazl,gammaxl,gammayl,gammazl,jacobianl
   real(kind=CUSTOM_REAL) :: dpotentialdxl,dpotentialdyl,dpotentialdzl
   real(kind=CUSTOM_REAL) :: rho_invl
-
-  integer :: ispec,iglob,i,j,k,l,ispec_p,num_elements
-
-  ! local C-PML absorbing boundary conditions parameters
-  integer :: ispec_CPML
+  ! derivatives of potential with respect to x, y and z
+  ! in computation potential_acoustic at "n" time step is used
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl
+  ! in computation of PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
+  ! we replace potential_acoustic with potential_acoustic_old
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
+  ! we replace potential_acoustic at "n" time step with
+  ! we replace potential_acoustic with potential_acoustic_old with potential_acoustic_new
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new
 
   if (iphase == 1) then
     num_elements = nspec_outer_acoustic
@@ -229,7 +233,10 @@
 
         ! sets C-PML elastic memory variables to compute stress sigma and form dot product with test vector
         call pml_compute_memory_variables_acoustic(ispec,ispec_CPML,temp1,temp2,temp3,&
-                                                   rmemory_dpotential_dxl,rmemory_dpotential_dyl,rmemory_dpotential_dzl)
+                                                   rmemory_dpotential_dxl,rmemory_dpotential_dyl,rmemory_dpotential_dzl, &
+                                                   PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl,&
+                                                   PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old,&
+                                                   PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new)
 
         ! calculates contribution from each C-PML element to update acceleration
         call pml_compute_accel_contribution_acoustic(ispec,ispec_CPML,potential_acoustic,&
diff --git a/src/specfem3D/pml_allocate_arrays.f90 b/src/specfem3D/pml_allocate_arrays.f90
index 3afbe7f..0dc31fc 100644
--- a/src/specfem3D/pml_allocate_arrays.f90
+++ b/src/specfem3D/pml_allocate_arrays.f90
@@ -190,28 +190,6 @@
 !    allocate(potential_dot_dot_acoustic_old(NGLOB_AB),stat=ier)
 !    if (ier /= 0) stop 'error allocating potential_dot_dot_acoustic_old array'
 
-    ! stores derivatives of potential with respect to x, y and z
-    allocate(PML_dpotential_dxl(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl array'
-    allocate(PML_dpotential_dyl(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl array'
-    allocate(PML_dpotential_dzl(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl array'
-
-    allocate(PML_dpotential_dxl_old(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl_old array'
-    allocate(PML_dpotential_dyl_old(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl_old array'
-    allocate(PML_dpotential_dzl_old(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl_old array'
-
-    allocate(PML_dpotential_dxl_new(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl_new array'
-    allocate(PML_dpotential_dyl_new(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl_new array'
-    allocate(PML_dpotential_dzl_new(NGLLX,NGLLY,NGLLZ),stat=ier)
-    if (ier /= 0) stop 'error allocating PML_dpotential_dxl_new array'
-
     ! stores C-PML memory variables
     allocate(rmemory_dpotential_dxl(NGLLX,NGLLY,NGLLZ,NSPEC_CPML,3),stat=ier)
     if (ier /= 0) stop 'error allocating rmemory_dpotential_dxl array'
@@ -311,17 +289,6 @@
     potential_acoustic_old(:) = 0._CUSTOM_REAL
     potential_acoustic_new(:) = 0._CUSTOM_REAL
 !    potential_dot_dot_acoustic_old(:) = 0._CUSTOM_REAL
-    PML_dpotential_dxl(:,:,:) = 0._CUSTOM_REAL
-    PML_dpotential_dyl(:,:,:) = 0._CUSTOM_REAL
-    PML_dpotential_dzl(:,:,:) = 0._CUSTOM_REAL
-
-    PML_dpotential_dxl_old(:,:,:) = 0._CUSTOM_REAL
-    PML_dpotential_dyl_old(:,:,:) = 0._CUSTOM_REAL
-    PML_dpotential_dzl_old(:,:,:) = 0._CUSTOM_REAL
-
-    PML_dpotential_dxl_new(:,:,:) = 0._CUSTOM_REAL
-    PML_dpotential_dyl_new(:,:,:) = 0._CUSTOM_REAL
-    PML_dpotential_dzl_new(:,:,:) = 0._CUSTOM_REAL
 
     rmemory_dpotential_dxl(:,:,:,:,:) = 0._CUSTOM_REAL
     rmemory_dpotential_dyl(:,:,:,:,:) = 0._CUSTOM_REAL
@@ -517,15 +484,6 @@
     if (.not. allocated(potential_acoustic_new)) allocate(potential_acoustic_new(1))
     !if (.not. allocated(potential_dot_dot_acoustic_old)) allocate(potential_dot_dot_acoustic_old(1))
 
-    if (.not. allocated(PML_dpotential_dxl)) allocate(PML_dpotential_dxl(1,1,1))
-    if (.not. allocated(PML_dpotential_dyl)) allocate(PML_dpotential_dyl(1,1,1))
-    if (.not. allocated(PML_dpotential_dzl)) allocate(PML_dpotential_dzl(1,1,1))
-    if (.not. allocated(PML_dpotential_dxl_old)) allocate(PML_dpotential_dxl_old(1,1,1))
-    if (.not. allocated(PML_dpotential_dyl_old)) allocate(PML_dpotential_dyl_old(1,1,1))
-    if (.not. allocated(PML_dpotential_dzl_old)) allocate(PML_dpotential_dzl_old(1,1,1))
-    if (.not. allocated(PML_dpotential_dxl_new)) allocate(PML_dpotential_dxl_new(1,1,1))
-    if (.not. allocated(PML_dpotential_dyl_new)) allocate(PML_dpotential_dyl_new(1,1,1))
-    if (.not. allocated(PML_dpotential_dzl_new)) allocate(PML_dpotential_dzl_new(1,1,1))
     if (.not. allocated(rmemory_dpotential_dxl)) allocate(rmemory_dpotential_dxl(1,1,1,1,3))
     if (.not. allocated(rmemory_dpotential_dyl)) allocate(rmemory_dpotential_dyl(1,1,1,1,3))
     if (.not. allocated(rmemory_dpotential_dzl)) allocate(rmemory_dpotential_dzl(1,1,1,1,3))
@@ -638,15 +596,6 @@
   if (ACOUSTIC_SIMULATION) then
     deallocate(potential_acoustic_old)
     deallocate(potential_acoustic_new)
-    deallocate(PML_dpotential_dxl)
-    deallocate(PML_dpotential_dyl)
-    deallocate(PML_dpotential_dzl)
-    deallocate(PML_dpotential_dxl_old)
-    deallocate(PML_dpotential_dyl_old)
-    deallocate(PML_dpotential_dzl_old)
-    deallocate(PML_dpotential_dxl_new)
-    deallocate(PML_dpotential_dyl_new)
-    deallocate(PML_dpotential_dzl_new)
     deallocate(rmemory_dpotential_dxl)
     deallocate(rmemory_dpotential_dyl)
     deallocate(rmemory_dpotential_dzl)
diff --git a/src/specfem3D/pml_compute_accel_contribution.f90 b/src/specfem3D/pml_compute_accel_contribution.f90
index d4ca547..696316b 100644
--- a/src/specfem3D/pml_compute_accel_contribution.f90
+++ b/src/specfem3D/pml_compute_accel_contribution.f90
@@ -61,11 +61,13 @@ subroutine pml_compute_accel_contribution_elastic(ispec,ispec_CPML,displ,veloc,r
   do k=1,NGLLZ
     do j=1,NGLLY
       do i=1,NGLLX
+        iglob = ibool(i,j,k,ispec)
+
         rhol = rhostore(i,j,k,ispec)
         jacobianl = jacobian(i,j,k,ispec)
-        iglob = ibool(i,j,k,ispec)
         wgllcube = wgll_cube(i,j,k)
 
+        ! pml coefficient values
         CPML_region_local = CPML_regions(ispec_CPML)
 
         kappa_x = k_store_x(i,j,k,ispec_CPML)
@@ -80,7 +82,7 @@ subroutine pml_compute_accel_contribution_elastic(ispec,ispec_CPML,displ,veloc,r
         alpha_y = alpha_store_y(i,j,k,ispec_CPML)
         alpha_z = alpha_store_z(i,j,k,ispec_CPML)
 
-        time_nplus1 = (it - 1._CUSTOM_REAL) * deltat
+        time_nplus1 = (it - 1) * deltat
 
         call l_parameter_computation( &
                time_nplus1, deltat, &
@@ -94,6 +96,7 @@ subroutine pml_compute_accel_contribution_elastic(ispec,ispec_CPML,displ,veloc,r
                coef0_z, coef1_z, coef2_z, &
                singularity_type_4, singularity_type_5)
 
+        ! updates memory variables
         rmemory_displ_elastic(1,i,j,k,ispec_CPML,1) = coef0_x * rmemory_displ_elastic(1,i,j,k,ispec_CPML,1) &
                 + displ_new(1,iglob) * coef1_x + displ_old(1,iglob) * coef2_x
         rmemory_displ_elastic(2,i,j,k,ispec_CPML,1) = coef0_x * rmemory_displ_elastic(2,i,j,k,ispec_CPML,1) &
@@ -115,6 +118,7 @@ subroutine pml_compute_accel_contribution_elastic(ispec,ispec_CPML,displ,veloc,r
         rmemory_displ_elastic(3,i,j,k,ispec_CPML,3) = coef0_z * rmemory_displ_elastic(3,i,j,k,ispec_CPML,3) &
                 + displ_new(3,iglob) * coef1_z + displ_old(3,iglob) * coef2_z
 
+        ! updates pml acceleration
         accel_elastic_CPML(1,i,j,k) =  wgllcube * rhol * jacobianl * &
              ( A_1 * veloc(1,iglob) + A_2 * displ(1,iglob) + &
                A_3 * rmemory_displ_elastic(1,i,j,k,ispec_CPML,1) + &
@@ -180,11 +184,13 @@ subroutine pml_compute_accel_contribution_acoustic(ispec,ispec_CPML,potential_ac
   do k=1,NGLLZ
     do j=1,NGLLY
       do i=1,NGLLX
-        kappal_inv = 1._CUSTOM_REAL / kappastore(i,j,k,ispec)
-        jacobianl = jacobian(i,j,k,ispec)
         iglob = ibool(i,j,k,ispec)
+
         wgllcube = wgll_cube(i,j,k)
+        jacobianl = jacobian(i,j,k,ispec)
+        kappal_inv = 1._CUSTOM_REAL / kappastore(i,j,k,ispec)
 
+        ! pml coefficient values
         CPML_region_local = CPML_regions(ispec_CPML)
 
         kappa_x = k_store_x(i,j,k,ispec_CPML)
@@ -199,7 +205,7 @@ subroutine pml_compute_accel_contribution_acoustic(ispec,ispec_CPML,potential_ac
         alpha_y = alpha_store_y(i,j,k,ispec_CPML)
         alpha_z = alpha_store_z(i,j,k,ispec_CPML)
 
-        time_nplus1 = (it - 1._CUSTOM_REAL) * deltat
+        time_nplus1 = (it - 1) * deltat
 
         call l_parameter_computation( &
                time_nplus1, deltat, &
@@ -213,6 +219,7 @@ subroutine pml_compute_accel_contribution_acoustic(ispec,ispec_CPML,potential_ac
                coef0_z, coef1_z, coef2_z, &
                singularity_type_4, singularity_type_5)
 
+        ! updates memory variables
         rmemory_potential_acoustic(i,j,k,ispec_CPML,1) = coef0_x * rmemory_potential_acoustic(i,j,k,ispec_CPML,1) &
                 + coef1_x * potential_acoustic_new(iglob) + coef2_x * potential_acoustic_old(iglob)
 
@@ -222,7 +229,7 @@ subroutine pml_compute_accel_contribution_acoustic(ispec,ispec_CPML,potential_ac
         rmemory_potential_acoustic(i,j,k,ispec_CPML,3) = coef0_z * rmemory_potential_acoustic(i,j,k,ispec_CPML,3) &
                 + coef1_z * potential_acoustic_new(iglob) + coef2_z * potential_acoustic_old(iglob)
 
-
+        ! updates pml potential
         potential_dot_dot_acoustic_CPML(i,j,k) =  wgllcube * kappal_inv * jacobianl * &
                   ( A_1 * potential_dot_acoustic(iglob) + A_2 * potential_acoustic(iglob) &
                   + A_3 * rmemory_potential_acoustic(i,j,k,ispec_CPML,1) &
diff --git a/src/specfem3D/pml_compute_memory_variables.f90 b/src/specfem3D/pml_compute_memory_variables.f90
index 047fece..e33c8d1 100644
--- a/src/specfem3D/pml_compute_memory_variables.f90
+++ b/src/specfem3D/pml_compute_memory_variables.f90
@@ -353,7 +353,10 @@ end subroutine pml_compute_memory_variables_elastic
 !=====================================================================
 !
 subroutine pml_compute_memory_variables_acoustic(ispec,ispec_CPML,temp1,temp2,temp3,&
-                                                 rmemory_dpotential_dxl,rmemory_dpotential_dyl,rmemory_dpotential_dzl)
+                                                 rmemory_dpotential_dxl,rmemory_dpotential_dyl,rmemory_dpotential_dzl, &
+                                                 PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl,&
+                                                 PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old,&
+                                                 PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new)
   ! calculates C-PML elastic memory variables and computes stress sigma
 
   ! second-order accurate convolution term calculation from equation (21) of
@@ -366,10 +369,7 @@ subroutine pml_compute_memory_variables_acoustic(ispec,ispec_CPML,temp1,temp2,te
 
   use pml_par, only: NSPEC_CPML,CPML_regions,k_store_x,k_store_y,k_store_z,&
                      d_store_x,d_store_y,d_store_z,&
-                     alpha_store_x,alpha_store_y,alpha_store_z,&
-                     PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl,&
-                     PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old,&
-                     PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new
+                     alpha_store_x,alpha_store_y,alpha_store_z !,&
 
   use constants, only: CUSTOM_REAL,NGLLX,NGLLY,NGLLZ,FOUR_THIRDS, &
                        CPML_X_ONLY,CPML_Y_ONLY,CPML_Z_ONLY,CPML_XY_ONLY,CPML_XZ_ONLY,CPML_YZ_ONLY,CPML_XYZ
@@ -378,9 +378,25 @@ subroutine pml_compute_memory_variables_acoustic(ispec,ispec_CPML,temp1,temp2,te
 
   integer, intent(in) :: ispec,ispec_CPML
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ), intent(out) :: temp1,temp2,temp3
+
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_CPML,3),intent(inout) :: &
     rmemory_dpotential_dxl, rmemory_dpotential_dyl, rmemory_dpotential_dzl
 
+  ! derivatives of potential with respect to x, y and z
+  ! in computation potential_acoustic at "n" time step is used
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ),intent(in) :: &
+    PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl
+
+  ! in computation of PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
+  ! we replace potential_acoustic with potential_acoustic_old
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ),intent(in) :: &
+    PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
+
+  ! we replace potential_acoustic at "n" time step with
+  ! we replace potential_acoustic with potential_acoustic_old with potential_acoustic_new
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ),intent(in) :: &
+    PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new
+
   ! local parameters
   integer :: i,j,k
   real(kind=CUSTOM_REAL) :: xixl,xiyl,xizl,etaxl,etayl,etazl,gammaxl,gammayl,gammazl,jacobianl
diff --git a/src/specfem3D/pml_par.f90 b/src/specfem3D/pml_par.f90
index e6e7b96..41faba5 100644
--- a/src/specfem3D/pml_par.f90
+++ b/src/specfem3D/pml_par.f90
@@ -100,18 +100,6 @@ module pml_par
   !and potential_dot_acoustic is predicted potential_dot_acoustic at "n" time step
   real(kind=CUSTOM_REAL), dimension(:), allocatable :: potential_acoustic_new
 
-  ! derivatives of potential with respect to x, y and z
-  ! in computation potential_acoustic at "n" time step is used
-  real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: PML_dpotential_dxl,PML_dpotential_dyl,PML_dpotential_dzl
-
-  ! in computation of PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
-  ! we replace potential_acoustic with potential_acoustic_old
-  real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: PML_dpotential_dxl_old,PML_dpotential_dyl_old,PML_dpotential_dzl_old
-
-  ! we replace potential_acoustic at "n" time step with
-  ! we replace potential_acoustic with potential_acoustic_old with potential_acoustic_new
-  real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: PML_dpotential_dxl_new,PML_dpotential_dyl_new,PML_dpotential_dzl_new
-
   ! C-PML memory variables
   real(kind=CUSTOM_REAL), dimension(:,:,:,:,:), allocatable :: rmemory_dux_dxl_x,rmemory_dux_dyl_x,rmemory_dux_dzl_x
   real(kind=CUSTOM_REAL), dimension(:,:,:,:), allocatable :: rmemory_duy_dxl_x,rmemory_duy_dyl_x



More information about the CIG-COMMITS mailing list