[cig-commits] r21643 - in seismo/3D/SPECFEM3D/trunk/src: generate_databases specfem3D

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Tue Mar 26 15:30:39 PDT 2013


Author: dkomati1
Date: 2013-03-26 15:30:39 -0700 (Tue, 26 Mar 2013)
New Revision: 21643

Modified:
   seismo/3D/SPECFEM3D/trunk/src/generate_databases/save_arrays_solver.f90
   seismo/3D/SPECFEM3D/trunk/src/specfem3D/read_mesh_databases.f90
Log:
fixed memory allocation and database writing and reading, following my modification for rhostore() for CPML


Modified: seismo/3D/SPECFEM3D/trunk/src/generate_databases/save_arrays_solver.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/src/generate_databases/save_arrays_solver.f90	2013-03-26 22:08:33 UTC (rev 21642)
+++ seismo/3D/SPECFEM3D/trunk/src/generate_databases/save_arrays_solver.f90	2013-03-26 22:30:39 UTC (rev 21643)
@@ -97,9 +97,12 @@
 ! acoustic
   if( ACOUSTIC_SIMULATION ) then
     write(IOUT) rmass_acoustic
-    write(IOUT) rhostore
   endif
 
+! this array is needed for acoustic simulations but also for elastic simulations with CPML,
+! thus we allocate it and read it in all cases (whether the simulation is acoustic, elastic, or acoustic/elastic)
+  write(IOUT) rhostore
+
 ! elastic
   if( ELASTIC_SIMULATION ) then
     write(IOUT) rmass

Modified: seismo/3D/SPECFEM3D/trunk/src/specfem3D/read_mesh_databases.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/src/specfem3D/read_mesh_databases.f90	2013-03-26 22:08:33 UTC (rev 21642)
+++ seismo/3D/SPECFEM3D/trunk/src/specfem3D/read_mesh_databases.f90	2013-03-26 22:30:39 UTC (rev 21643)
@@ -99,19 +99,20 @@
     ! mass matrix, density
     allocate(rmass_acoustic(NGLOB_AB),stat=ier)
     if( ier /= 0 ) stop 'error allocating array rmass_acoustic'
+    read(27) rmass_acoustic
 
     ! initializes mass matrix contribution
     allocate(rmassz_acoustic(NGLOB_AB),stat=ier)
     if( ier /= 0 ) stop 'error allocating array rmassz_acoustic'
     rmassz_acoustic(:) = 0._CUSTOM_REAL
+  endif
 
-    allocate(rhostore(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier)
-    if( ier /= 0 ) stop 'error allocating array rhostore'
+! this array is needed for acoustic simulations but also for elastic simulations with CPML,
+! thus we now allocate it and read it in all cases (whether the simulation is acoustic, elastic, or acoustic/elastic)
+  allocate(rhostore(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier)
+  if( ier /= 0 ) stop 'error allocating array rhostore'
+  read(27) rhostore
 
-    read(27) rmass_acoustic
-    read(27) rhostore
-  endif
-
   ! elastic
   ! number of elastic elements in this partition
   nspec_elastic = count(ispec_is_elastic(:))
@@ -226,29 +227,30 @@
     read(27,iostat=ier) rho_vs
     if( ier /= 0 ) stop 'error reading in array rho_vs'
 
-    ! checks if rhostore is available for gravity
-    if( GRAVITY ) then
-
-      if( .not. ACOUSTIC_SIMULATION ) then
-        ! rho array needed for gravity
-        allocate(rhostore(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier)
-        if( ier /= 0 ) stop 'error allocating array rhostore'
-
-        ! extract rho information from mu = rho * vs * vs and rho_vs = rho * vs
-        rhostore = 0.0_CUSTOM_REAL
-        where( mustore > TINYVAL )
-          rhostore = (rho_vs*rho_vs) / mustore
-        endwhere
-
-        ! note: the construct below leads to a segmentation fault (ifort v11.1). not sure why...
-        !          (where statement - standard fortran 95)
-        !where( mustore > TINYVAL )
-        !  rhostore = (rho_vs*rho_vs) / mustore
-        !elsewhere
-        !  rhostore = 0.0_CUSTOM_REAL
-        !endwhere
-      endif
-    endif
+!! DK DK rhostore is now allocated and read in all cases (see above)
+!   ! checks if rhostore is available for gravity
+!   if( GRAVITY ) then
+!
+!     if( .not. ACOUSTIC_SIMULATION ) then
+!       ! rho array needed for gravity
+!       allocate(rhostore(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier)
+!       if( ier /= 0 ) stop 'error allocating array rhostore'
+!
+!       ! extract rho information from mu = rho * vs * vs and rho_vs = rho * vs
+!       rhostore = 0.0_CUSTOM_REAL
+!       where( mustore > TINYVAL )
+!         rhostore = (rho_vs*rho_vs) / mustore
+!       endwhere
+!
+!       ! note: the construct below leads to a segmentation fault (ifort v11.1). not sure why...
+!       !          (where statement - standard fortran 95)
+!       !where( mustore > TINYVAL )
+!       !  rhostore = (rho_vs*rho_vs) / mustore
+!       !elsewhere
+!       !  rhostore = 0.0_CUSTOM_REAL
+!       !endwhere
+!     endif
+!   endif
   else
     ! no elastic attenuation & anisotropy
     ATTENUATION = .false.



More information about the CIG-COMMITS mailing list