[cig-commits] [commit] devel: Change in specfem for DSM (1c030e2)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Aug 1 10:07:54 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/8a3f14d7d473f70feb7f073639045daa35c587bc...d759e09dd946c593868753fbb4253d77378fb276

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

commit 1c030e220047fdf58b829eca23121d63db8c49eb
Author: Clément Durochat <c.durochat at gmail.com>
Date:   Fri Aug 1 18:29:48 2014 +0200

    Change in specfem for DSM


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

1c030e220047fdf58b829eca23121d63db8c49eb
 src/generate_databases/get_model.f90          | 30 ++++++++---
 src/generate_databases/model_tomography.f90   | 15 +++++-
 src/generate_databases/save_arrays_solver.f90 | 71 ++++++++++++++-------------
 3 files changed, 75 insertions(+), 41 deletions(-)

diff --git a/src/generate_databases/get_model.f90 b/src/generate_databases/get_model.f90
index 8ec8c71..6a3a215 100644
--- a/src/generate_databases/get_model.f90
+++ b/src/generate_databases/get_model.f90
@@ -66,9 +66,19 @@
   ispec_is_elastic(:) = .false.
   ispec_is_poroelastic(:) = .false.
 
-  ! prepares tomographic models if needed for elements with undefined material definitions
-  if( nundefMat_ext_mesh > 0 .or. IMODEL == IMODEL_TOMO ) then
-    call model_tomography_broadcast(myrank)
+
+  !! WANGYI test for the benchmark of hybrid DSM-SPECFEM3D coupling 
+  if (COUPLE_WITH_DSM) then 
+    if( nundefMat_ext_mesh > 6 .or. IMODEL == IMODEL_TOMO ) then ! changed by WANGYI
+      write(*,*)  'nundefMat_ext_mesh, IMODEL, IMODEL_TOMO', nundefMat_ext_mesh, IMODEL, IMODEL_TOMO ! add by WANGYI
+      call model_tomography_broadcast(myrank)
+    endif
+
+  else
+    ! prepares tomographic models if needed for elements with undefined material definitions
+    if( nundefMat_ext_mesh > 0 .or. IMODEL == IMODEL_TOMO ) then
+      call model_tomography_broadcast(myrank)
+    endif
   endif
 
   ! prepares external model values if needed
@@ -333,9 +343,17 @@
   call any_all_l( ANY(ispec_is_elastic), ELASTIC_SIMULATION )
   call any_all_l( ANY(ispec_is_poroelastic), POROELASTIC_SIMULATION )
 
-  ! deallocates tomographic arrays
-  if( nundefMat_ext_mesh > 0 .or. IMODEL == IMODEL_TOMO ) then
-     call deallocate_tomography_files()
+  !! WANGYI test for the benchmark of hybrid DSM-SPECFEM3D coupling 
+  if (COUPLE_WITH_DSM) then 
+    if( nundefMat_ext_mesh > 6 .or. IMODEL == IMODEL_TOMO ) then  ! changed by wangyi for test
+      call deallocate_tomography_files()
+    endif
+
+  else
+    ! deallocates tomographic arrays
+    if( nundefMat_ext_mesh > 0 .or. IMODEL == IMODEL_TOMO ) then
+      call deallocate_tomography_files()
+    endif
   endif
 
   end subroutine get_model
diff --git a/src/generate_databases/model_tomography.f90 b/src/generate_databases/model_tomography.f90
index 2c147dd..5b6ec81 100644
--- a/src/generate_databases/model_tomography.f90
+++ b/src/generate_databases/model_tomography.f90
@@ -104,7 +104,20 @@
 
         read(undef_mat_prop(4,iundef),*) filename
 
-        tomo_filename = TOMOGRAPHY_PATH(1:len_trim(TOMOGRAPHY_PATH))//trim(filename)
+        !! WANGYI test for the benchmark of hybrid DSM-SPECFEM3D coupling 
+        if (COUPLE_WITH_DSM) then 
+           if ( TOMOGRAPHY_PATH(len_trim(TOMOGRAPHY_PATH):len_trim(TOMOGRAPHY_PATH)) == "/"  )then
+             tomo_filename = TOMOGRAPHY_PATH(1:len_trim(TOMOGRAPHY_PATH))//trim(filename)
+           else
+             tomo_filename = TOMOGRAPHY_PATH(1:len_trim(TOMOGRAPHY_PATH))//'/'//trim(filename)
+           endif  !add by wangyi,correct the path and filename of tomography model
+           write(*,*) 'iundef',iundef  ! add by WANGYI for test 
+           write(*,*) 'tomo_filename',tomo_filename ! add by WANGYI for test   
+
+        else
+          tomo_filename = TOMOGRAPHY_PATH(1:len_trim(TOMOGRAPHY_PATH))//trim(filename)
+
+        endif 
 
         ! opens file for reading
         open(unit=27,file=trim(tomo_filename),status='old',action='read',iostat=ier)
diff --git a/src/generate_databases/save_arrays_solver.f90 b/src/generate_databases/save_arrays_solver.f90
index 07ed7f7..46637f1 100644
--- a/src/generate_databases/save_arrays_solver.f90
+++ b/src/generate_databases/save_arrays_solver.f90
@@ -568,42 +568,45 @@
                         v_tmp_i,filename)
 
       deallocate(iglob_tmp,v_tmp_i)
-    endif
+    endif !if( ACOUSTIC_SIMULATION .and. ELASTIC_SIMULATION ) 
+  endif  !if( DEBUG )
+
+  !! CD CD !! For coupling with DSM
+  if (COUPLE_WITH_DSM) then
+    !if (num_abs_boundary_faces > 0) then
+    filename = prname(1:len_trim(prname))//'absorb_dsm'
+    open(27,file=filename(1:len_trim(filename)),status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file absorb_dsm'
+    write(27) num_abs_boundary_faces
+    write(27) abs_boundary_ispec
+    write(27) abs_boundary_ijk
+    write(27) abs_boundary_jacobian2Dw
+    write(27) abs_boundary_normal
+    close(27)
+
+    filename = prname(1:len_trim(prname))//'inner'
+    open(27,file=filename(1:len_trim(filename)),status='unknown',form='unformatted',iostat=ier)
+    write(27) ispec_is_inner
+    write(27) ispec_is_elastic
+    close(27)
 
-    !! CD CD !! For coupling with DSM
-    if (COUPLE_WITH_DSM) then
-      !if (num_abs_boundary_faces > 0) then
-      filename = prname(1:len_trim(prname))//'absorb_dsm'
-      open(27,file=filename(1:len_trim(filename)),status='unknown',form='unformatted',iostat=ier)
-      if( ier /= 0 ) stop 'error opening file absorb_dsm'
-      write(27) num_abs_boundary_faces
-      write(27) abs_boundary_ispec
-      write(27) abs_boundary_ijk
-      write(27) abs_boundary_jacobian2Dw
-      write(27) abs_boundary_normal
-      close(27)
-
-      filename = prname(1:len_trim(prname))//'inner'
-      open(27,file=filename(1:len_trim(filename)),status='unknown',form='unformatted',iostat=ier)
-      write(27) ispec_is_inner
-      write(27) ispec_is_elastic
-      close(27)
-
-      !endif
-
-      !! Don't delete this comment for the moment
-      !!
-      !! saves 1. MPI interface
-      !!
-      !!if( num_interfaces_ext_mesh >= 1 ) then
-      !!  filename = prname(1:len_trim(prname))//'MPI_1_points'
-      !!  call write_VTK_data_points(nglob, xstore_dummy,ystore_dummy,zstore_dummy, &
-      !!                             ibool_interfaces_ext_mesh_dummy(1:nibool_interfaces_ext_mesh(1),1), &
-      !!                             nibool_interfaces_ext_mesh(1), filename)
-      !!endif
+    !endif
 
-    endif
-    !! CD CD
+    !! Don't delete this comment for the moment
+    !!
+    !! saves 1. MPI interface
+    !!
+    !!if( num_interfaces_ext_mesh >= 1 ) then
+    !!  filename = prname(1:len_trim(prname))//'MPI_1_points'
+    !!  call write_VTK_data_points(nglob, xstore_dummy,ystore_dummy,zstore_dummy, &
+    !!                             ibool_interfaces_ext_mesh_dummy(1:nibool_interfaces_ext_mesh(1),1), &
+    !!                             nibool_interfaces_ext_mesh(1), filename)
+    !!endif
+
+  endif !  if (COUPLE_WITH_DSM)
+  !! CD CD
+
+  if( DEBUG ) then  !! CD CD
 
     ! acoustic-poroelastic domains
     if( ACOUSTIC_SIMULATION .and. POROELASTIC_SIMULATION ) then



More information about the CIG-COMMITS mailing list