[cig-commits] r20519 - seismo/2D/SPECFEM2D/trunk/src/specfem2D

xie.zhinan at geodynamics.org xie.zhinan at geodynamics.org
Wed Jul 11 04:32:48 PDT 2012


Author: xie.zhinan
Date: 2012-07-11 04:32:47 -0700 (Wed, 11 Jul 2012)
New Revision: 20519

Modified:
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.F90
Log:
rm unneeded code when using PML in compute_forces_viscoelastic.F90


Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.F90	2012-07-11 11:22:58 UTC (rev 20518)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/compute_forces_viscoelastic.F90	2012-07-11 11:32:47 UTC (rev 20519)
@@ -406,8 +406,7 @@
               endif
 
 
-              if(PML_BOUNDARY_CONDITIONS) then
-                if(is_PML(ispec)) then
+                if(is_PML(ispec) .and. PML_BOUNDARY_CONDITIONS) then
                   ispec_PML=spec_to_PML(ispec)
                   iPML=ibool_PML(i,j,ispec)
 !------------------------------------------------------------------------------
@@ -476,8 +475,6 @@
 !------------------------------------------------------------------------------
                    elseif ( (which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                         (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec)) ) then
-                      ispec_PML=spec_to_PML(ispec)
-                      iPML=ibool_PML(i,j,ispec)
 
                       !----------------------- A7 ------------------------------
                       if ( abs( alpha_z_store(iPML) ) < 1.d-3 .AND. &
@@ -705,7 +702,6 @@
                     duz_dzl = duz_dzl  + rmemory_duz_dz(1,i,j,ispec_PML) + rmemory_duz_dz(2,i,j,ispec_PML)
 
                   endif
-                endif
               endif ! PML_BOUNDARY_CONDITIONS
 
               if(SIMULATION_TYPE == 2) then ! Adjoint calculation, backward wavefield
@@ -882,9 +878,8 @@
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         ! PML
-        if( PML_BOUNDARY_CONDITIONS ) then
-          if(is_PML(ispec)) then
-            ! first double loop over GLL points to compute and store gradients
+        if( is_PML(ispec) .and. PML_BOUNDARY_CONDITIONS ) then
+            ispec_PML=spec_to_PML(ispec)
             do j = 1,NGLLZ
               do i = 1,NGLLX
                 if ( assign_external_model) then
@@ -892,21 +887,15 @@
                 else
                  rhol = density(1,kmato(ispec))
                 endif
+                    iPML=ibool_PML(i,j,ispec)
+                    iglob=ibool(i,j,ispec)
 
-                if ( is_PML( ispec ) ) then
-                  iPML=ibool_PML(i,j,ispec)
-                  iglob=ibool(i,j,ispec)
-
 !------------------------------------------------------------------------------
 !---------------------------- LEFT & RIGHT ------------------------------------
 !------------------------------------------------------------------------------
                   if ( (which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                        .not. (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec)) ) then
 
-                    ispec_PML=spec_to_PML(ispec)
-                    iPML=ibool_PML(i,j,ispec)
-                    iglob=ibool(i,j,ispec)
-
                     !---------------------- A3 and A4 --------------------------
                     A3 = d_x_store(iPML ) * alpha_x_store(iPML) ** 2
                     A4 = 0.d0
@@ -935,8 +924,6 @@
 !------------------------------------------------------------------------------
                    elseif ( (which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                        (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec)) ) then
-                       ispec_PML=spec_to_PML(ispec)
-                       iPML=ibool_PML(i,j,ispec)
 
                        !---------------------------- A3 ----------------------------
                        if ( abs( alpha_z_store(iPML) ) < 1.d-3 .AND. &
@@ -1012,9 +999,6 @@
 !------------------------------------------------------------------------------
 !-------------------------------- TOP & BOTTOM --------------------------------
 !------------------------------------------------------------------------------
-                    ispec_PML=spec_to_PML(ispec)
-                    iPML=ibool_PML(i,j,ispec)
-                    iglob=ibool(i,j,ispec)
 
                     !---------------------- A3 and A4 ----------------------------
                     A4 = d_z_store(iPML ) * alpha_z_store(iPML) ** 2
@@ -1039,14 +1023,11 @@
                     rmemory_displ_elastic(2,3,i,j,ispec_PML)=coef0_x * rmemory_displ_elastic(2,3,i,j,ispec_PML) &
                     + displ_elastic_new(3,iglob) * coef1_x + displ_elastic(3,iglob) * coef2_x
 
-                  endif
+                endif
 
 
                 if ( (which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                        .not. (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec))) then
-                  ispec_PML=spec_to_PML(ispec)
-                  iPML=ibool_PML(i,j,ispec)
-                  iglob=ibool(i,j,ispec)
 
                   A0 = - alpha_x_store( iPML ) * d_x_store(iPML)
                   A1 = d_x_store(iPML) 
@@ -1065,9 +1046,6 @@
                elseif ( (which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                        (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec))) then
 
-                     ispec_PML=spec_to_PML(ispec)
-                     iPML=ibool_PML(i,j,ispec)
-
                      A0 = d_x_store(iPML) * d_z_store(iPML) &
                         - alpha_x_store( iPML ) * d_x_store(iPML) * k_z_store(iPML) &
                         - alpha_z_store( iPML ) * d_z_store(iPML) * k_x_store(iPML)
@@ -1088,10 +1066,6 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!corner
                else
 
-                  ispec_PML=spec_to_PML(ispec)
-                  iPML=ibool_PML(i,j,ispec)
-                  iglob=ibool(i,j,ispec)
-
                   A0 = - alpha_z_store( iPML ) * d_z_store(iPML)
                   A1 = d_z_store(iPML) 
                   A2 = k_z_store(iPML)
@@ -1105,12 +1079,10 @@
                       rmemory_displ_elastic(1,3,i,j,ispec_PML)+rmemory_displ_elastic(2,3,i,j,ispec_PML)&
                       + A0 * displ_elastic(3,iglob) )
                endif
-             endif
 
            enddo
         enddo
 
-      endif ! end of test if elastic element
      endif ! PML_BOUNDARY_CONDITIONS
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -1119,7 +1091,6 @@
         !
         do j = 1,NGLLZ
            do i = 1,NGLLX
-
               iglob = ibool(i,j,ispec)
 
               ! along x direction and z direction
@@ -1144,32 +1115,26 @@
               enddo
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-          if( PML_BOUNDARY_CONDITIONS ) then
-            if(is_PML(ispec))then
+            if(is_PML(ispec) .and. PML_BOUNDARY_CONDITIONS)then
+                ispec_PML=spec_to_PML(ispec)
+                iPML=ibool_PML(i,j,ispec)
                 if ((which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                        .not. (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec))) then
-                        ispec_PML=spec_to_PML(ispec)
-                        iPML=ibool_PML(i,j,ispec)
                       accel_elastic(1,iglob) = accel_elastic(1,iglob) - accel_elastic_PML(1,i,j,ispec_PML)
                       accel_elastic(2,iglob) = accel_elastic(2,iglob)
                       accel_elastic(3,iglob) = accel_elastic(3,iglob) - accel_elastic_PML(3,i,j,ispec_PML)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!corner
                elseif ((which_PML_elem(ILEFT,ispec) .OR. which_PML_elem(IRIGHT,ispec)) .and. &
                         (which_PML_elem(ITOP,ispec) .OR. which_PML_elem(IBOTTOM,ispec))) then
-                        ispec_PML=spec_to_PML(ispec)
-                        iPML=ibool_PML(i,j,ispec)
                       accel_elastic(1,iglob) = accel_elastic(1,iglob) - accel_elastic_PML(1,i,j,ispec_PML)
                       accel_elastic(2,iglob) = accel_elastic(2,iglob)
                       accel_elastic(3,iglob) = accel_elastic(3,iglob) - accel_elastic_PML(3,i,j,ispec_PML)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!corner
                else
-                      ispec_PML=spec_to_PML(ispec)
-                      iPML=ibool_PML(i,j,ispec)
                       accel_elastic(1,iglob) = accel_elastic(1,iglob) - accel_elastic_PML(1,i,j,ispec_PML)
                       accel_elastic(2,iglob) = accel_elastic(2,iglob)
                       accel_elastic(3,iglob) = accel_elastic(3,iglob) - accel_elastic_PML(3,i,j,ispec_PML)
                endif
-             endif
           endif ! PML_BOUNDARY_CONDITIONS
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 



More information about the CIG-COMMITS mailing list