[cig-commits] [commit] devel: redirects file output of mesh resolutions checks in xmodel_update (fdc626e)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Sat Oct 18 04:27:13 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/15e76931c9ff7422f3594346aecc63381ba69c42...fdc626e9da99e7f24f070e328aecaf9aad758f8d

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

commit fdc626e9da99e7f24f070e328aecaf9aad758f8d
Author: daniel peter <peterda at ethz.ch>
Date:   Sat Oct 18 12:17:14 2014 +0200

    redirects file output of mesh resolutions checks in xmodel_update


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

fdc626e9da99e7f24f070e328aecaf9aad758f8d
 src/tomography/model_update.f90 | 48 ++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/src/tomography/model_update.f90 b/src/tomography/model_update.f90
index e04766b..1fb57e6 100644
--- a/src/tomography/model_update.f90
+++ b/src/tomography/model_update.f90
@@ -652,7 +652,7 @@ end subroutine initialize
 subroutine get_external_mesh()
 
   use specfem_par,only: CUSTOM_REAL,NSPEC_AB,NGLOB_AB,NGLLX,NGLLY,NGLLZ, &
-    LOCAL_PATH,SAVE_MESH_FILES,model_speed_max,DT,myrank
+    LOCAL_PATH,SAVE_MESH_FILES,model_speed_max,DT,myrank,IMAIN,ISTANDARD_OUTPUT
 
   use specfem_par,only: ibool,xstore,ystore,zstore,xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz,jacobian, &
     kappastore,mustore,rhostore
@@ -662,6 +662,8 @@ subroutine get_external_mesh()
   use specfem_par_poroelastic,only: POROELASTIC_SIMULATION,ispec_is_poroelastic,rho_vpI,rho_vpII,rho_vsI, &
     phistore,tortstore,rhoarraystore
 
+  use tomography_par,only: OUTPUT_MODEL_DIR
+
   implicit none
   integer :: ier
   real(kind=CUSTOM_REAL) :: distance_min_glob,distance_max_glob
@@ -729,8 +731,14 @@ subroutine get_external_mesh()
     print*,'  Max/min ratio = ',elemsize_max_glob/elemsize_min_glob
     print*
   endif
+  call synchronize_all()
+
+  ! resolution check
+  ! open main output file, only written to by process 0
+  if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) &
+    open(unit=IMAIN,file=trim(OUTPUT_MODEL_DIR)//'/output_mesh_resolution_initial.txt',status='unknown')
 
-  if( ELASTIC_SIMULATION ) then
+  if (ELASTIC_SIMULATION) then
     call check_mesh_resolution(myrank,NSPEC_AB,NGLOB_AB, &
                                ibool,xstore,ystore,zstore, &
                                kappastore,mustore,rho_vp,rho_vs, &
@@ -761,7 +769,8 @@ subroutine get_external_mesh()
                                LOCAL_PATH,SAVE_MESH_FILES)
     deallocate(rho_vp,rho_vs)
   endif
-  call synchronize_all()
+
+  if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) close(IMAIN)
 
 end subroutine get_external_mesh
 
@@ -773,8 +782,8 @@ subroutine save_new_databases()
 
   use specfem_par
   use specfem_par_elastic
-  use specfem_par_acoustic
-  use specfem_par_poroelastic
+  use specfem_par_acoustic,only:ACOUSTIC_SIMULATION,ispec_is_acoustic
+  use specfem_par_poroelastic,only:POROELASTIC_SIMULATION,ispec_is_poroelastic
 
   use tomography_model_iso,only: model_vs_new,model_vp_new,model_rho_new,OUTPUT_MODEL_DIR
 
@@ -910,6 +919,28 @@ subroutine save_new_databases()
   rmass_solid_poroelastic_new = 0._CUSTOM_REAL
   rmass_fluid_poroelastic_new = 0._CUSTOM_REAL
 
+
+  ! new resolution check
+  ! open main output file, only written to by process 0
+  if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) &
+    open(unit=IMAIN,file=trim(OUTPUT_MODEL_DIR)//'/output_mesh_resolution_final.txt',status='unknown')
+
+  ! calculate min_resolved_period (needed for attenuation model)
+  if (ELASTIC_SIMULATION) then
+    call check_mesh_resolution(myrank,NSPEC_AB,NGLOB_AB, &
+                               ibool,xstore,ystore,zstore, &
+                               kappastore_new,mustore_new,rho_vp_new,rho_vs_new, &
+                               -1.0d0,model_speed_max,min_resolved_period, &
+                               LOCAL_PATH,SAVE_MESH_FILES)
+
+  else if( POROELASTIC_SIMULATION ) then
+    stop 'Error saving new databases for POROELASTIC models not implemented yet'
+  else if( ACOUSTIC_SIMULATION ) then
+    stop 'Error saving new databases for ACOUSTIC models not implemented yet'
+  endif
+
+  if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) close(IMAIN)
+
   !-------- attenuation -------
   ! store the attenuation flag in qmu_attenuation_store
   allocate(qmu_attenuation_store(NGLLX,NGLLY,NGLLZ,NSPEC_AB), &
@@ -990,13 +1021,6 @@ subroutine save_new_databases()
     enddo
     call synchronize_all()
 
-    ! calculate min_resolved_period needed for attenuation model
-    call check_mesh_resolution(myrank,NSPEC_AB,NGLOB_AB,ibool,&
-                               xstore,ystore,zstore, &
-                               kappastore_new,mustore_new,rho_vp_new,rho_vs_new, &
-                               -1.0d0, model_speed_max,min_resolved_period, &
-                               LOCAL_PATH,SAVE_MESH_FILES )
-
     ! calculates and stores attenuation arrays
     call get_attenuation_model(myrank,NSPEC_AB,USE_OLSEN_ATTENUATION,OLSEN_ATTENUATION_RATIO, &
                                mustore_new,rho_vs_new,kappastore_new,rho_vp_new, &



More information about the CIG-COMMITS mailing list