[cig-commits] [commit] devel: added USE_CONSTANT_MAX_AMPLITUDE and CONSTANT_MAX_AMPLITUDE_TO_USE for movies (f2250b8)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue May 20 16:06:29 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem2d/compare/83c3f8b8d715991bea655b40a9834e6259246db6...43d601599a217df4052ee31d48670a4bbe69415a

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

commit f2250b80dc14a0d6eb17d18fc5788a02e6d5d5aa
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Wed May 21 01:04:45 2014 +0200

    added USE_CONSTANT_MAX_AMPLITUDE and CONSTANT_MAX_AMPLITUDE_TO_USE for movies


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

f2250b80dc14a0d6eb17d18fc5788a02e6d5d5aa
 DATA/Par_file                         |  2 ++
 EXAMPLES                              |  2 +-
 src/meshfem2D/read_parameter_file.F90 | 14 ++++++++++++++
 src/meshfem2D/save_databases.f90      |  6 ++++++
 src/specfem2D/create_color_image.f90  | 22 ++++++++++++++++------
 src/specfem2D/read_databases.F90      | 15 ++++++++++++++-
 src/specfem2D/specfem2D.F90           | 12 ++++++++++--
 7 files changed, 63 insertions(+), 10 deletions(-)

diff --git a/DATA/Par_file b/DATA/Par_file
index e6cdc76..5da10f1 100644
--- a/DATA/Par_file
+++ b/DATA/Par_file
@@ -72,6 +72,8 @@ cutsnaps                        = 1.             # minimum amplitude kept in % f
 output_color_image              = .true.         # output JPEG color image of the results every NSTEP_BETWEEN_OUTPUT_IMAGES time steps or not
 imagetype_JPEG                  = 2              # display 1=displ_Ux 2=displ_Uz 3=displ_norm 4=veloc_Vx 5=veloc_Vz 6=veloc_norm 7=accel_Ax 8=accel_Az 9=accel_norm 10=pressure
 factor_subsample_image          = 1.0            # (double precision) factor to subsample color images output by the code (useful for very large models)
+USE_CONSTANT_MAX_AMPLITUDE      = .false.        # by default the code normalizes each image independently to its maximum; use this option to use the global maximum below instead
+CONSTANT_MAX_AMPLITUDE_TO_USE   = 1.17d4         # constant maximum amplitude to use for all color images if the above USE_CONSTANT_MAX_AMPLITUDE option is true
 POWER_DISPLAY_COLOR             = 0.30d0         # non linear display to enhance small amplitudes in JPEG color images
 DRAW_SOURCES_AND_RECEIVERS      = .true.         # display sources as orange crosses and receivers as green squares in JPEG images or not
 DRAW_WATER_IN_BLUE              = .true.         # display acoustic layers as constant blue in JPEG images, because they likely correspond to water in the case of ocean acoustics or in the case of offshore oil industry experiments (if off, display them as greyscale, as for elastic or poroelastic elements, for instance for acoustic-only oil industry models of solid media)
diff --git a/EXAMPLES b/EXAMPLES
index bf38c5d..599ea1a 160000
--- a/EXAMPLES
+++ b/EXAMPLES
@@ -1 +1 @@
-Subproject commit bf38c5d4415ed828f173d493adafc1f07c31e7c2
+Subproject commit 599ea1a4656dc2499687591f676dad14cf843f63
diff --git a/src/meshfem2D/read_parameter_file.F90 b/src/meshfem2D/read_parameter_file.F90
index 1fb91b2..87994a9 100644
--- a/src/meshfem2D/read_parameter_file.F90
+++ b/src/meshfem2D/read_parameter_file.F90
@@ -124,6 +124,12 @@ module parameter_file
 ! factor to subsample color images output by the code (useful for very large models)
   double precision :: factor_subsample_image
 
+! by default the code normalizes each image independently to its maximum; use this option to use the global maximum below instead
+  logical :: USE_CONSTANT_MAX_AMPLITUDE
+
+! constant maximum amplitude to use for all color images if the USE_CONSTANT_MAX_AMPLITUDE option is true
+  double precision :: CONSTANT_MAX_AMPLITUDE_TO_USE
+
 ! use snapshot number in the file name of JPG color snapshots instead of the time step
   logical :: USE_SNAPSHOT_NUMBER_IN_FILENAME
 
@@ -362,6 +368,14 @@ contains
   call read_value_double_precision_p(factor_subsample_image, 'solver.factor_subsample_image')
   if(err_occurred() /= 0) stop 'error reading parameter 43b in Par_file'
 
+  call read_value_double_precision_p(USE_CONSTANT_MAX_AMPLITUDE, 'solver.USE_CONSTANT_MAX_AMPLITUDE')
+  if(err_occurred() /= 0) stop 'error reading parameter 43bb in Par_file'
+
+  call read_value_double_precision_p(CONSTANT_MAX_AMPLITUDE_TO_USE, 'solver.CONSTANT_MAX_AMPLITUDE_TO_USE')
+  if(err_occurred() /= 0) stop 'error reading parameter 43bbb in Par_file'
+  if(output_color_image .and. USE_CONSTANT_MAX_AMPLITUDE .and. CONSTANT_MAX_AMPLITUDE_TO_USE < 0.d0) &
+      stop 'CONSTANT_MAX_AMPLITUDE_TO_USE must be strictly positive'
+
   call read_value_double_precision_p(POWER_DISPLAY_COLOR, 'solver.POWER_DISPLAY_COLOR')
   if(err_occurred() /= 0) stop 'error reading parameter 43c in Par_file'
 
diff --git a/src/meshfem2D/save_databases.f90 b/src/meshfem2D/save_databases.f90
index b39b83d..e9c9d64 100644
--- a/src/meshfem2D/save_databases.f90
+++ b/src/meshfem2D/save_databases.f90
@@ -187,6 +187,12 @@
     write(15,*) 'factor_subsample_image'
     write(15,*) factor_subsample_image
 
+    write(15,*) 'USE_CONSTANT_MAX_AMPLITUDE'
+    write(15,*) USE_CONSTANT_MAX_AMPLITUDE
+
+    write(15,*) 'CONSTANT_MAX_AMPLITUDE_TO_USE'
+    write(15,*) CONSTANT_MAX_AMPLITUDE_TO_USE
+
     write(15,*) 'USE_SNAPSHOT_NUMBER_IN_FILENAME'
     write(15,*) USE_SNAPSHOT_NUMBER_IN_FILENAME
 
diff --git a/src/specfem2D/create_color_image.f90 b/src/specfem2D/create_color_image.f90
index 77426cc..ecc1515 100644
--- a/src/specfem2D/create_color_image.f90
+++ b/src/specfem2D/create_color_image.f90
@@ -45,7 +45,8 @@
                                   NX,NY,it,isnapshot_number,cutsnaps,image_color_vp_display, &
                                   USE_SNAPSHOT_NUMBER_IN_FILENAME,POWER_DISPLAY_COLOR, &
                                   DRAW_SOURCES_AND_RECEIVERS,NSOURCES,nrec, &
-                                  ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver)
+                                  ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver, &
+                                  USE_CONSTANT_MAX_AMPLITUDE,CONSTANT_MAX_AMPLITUDE_TO_USE)
 
 ! display a given field as a red and blue color JPEG image
 
@@ -57,7 +58,8 @@
 
   integer :: NX,NY,it,isnapshot_number
 
-  double precision :: cutsnaps
+  double precision :: cutsnaps,CONSTANT_MAX_AMPLITUDE_TO_USE
+  logical :: USE_CONSTANT_MAX_AMPLITUDE
 
   integer, dimension(NX,NY) :: iglob_image_color_2D
 
@@ -116,7 +118,15 @@
   endif
 
 ! compute maximum amplitude
-  amplitude_max = maxval(abs(color_image_2D_data))
+  if(.not. USE_CONSTANT_MAX_AMPLITUDE) then
+    amplitude_max = maxval(abs(color_image_2D_data))
+  else
+    amplitude_max = CONSTANT_MAX_AMPLITUDE_TO_USE
+!   in case of a pre-defined and constant maximum, truncate all values that are outside that constant range
+    where(color_image_2D_data > +CONSTANT_MAX_AMPLITUDE_TO_USE) color_image_2D_data = +CONSTANT_MAX_AMPLITUDE_TO_USE
+    where(color_image_2D_data < -CONSTANT_MAX_AMPLITUDE_TO_USE) color_image_2D_data = -CONSTANT_MAX_AMPLITUDE_TO_USE
+  endif
+
   vpmin = HUGEVAL
   vpmax = TINYVAL
   do iy=1,NY
@@ -171,9 +181,9 @@
 ! negative values in image_color_vp_display are a flag indicating a water layer to color in light blue
         if (image_color_vp_display(ix,iy) < 0) then
 ! use light blue to display water
-!!!!!!          R = 204
-!!!!!!          G = 255
-!!!!!!          B = 255
+!!!!!!    R = 204
+!!!!!!    G = 255
+!!!!!!    B = 255
           R = 135 !!! LightSkyBlue
           G = 206
           B = 250
diff --git a/src/specfem2D/read_databases.F90 b/src/specfem2D/read_databases.F90
index a694ee8..1323506 100644
--- a/src/specfem2D/read_databases.F90
+++ b/src/specfem2D/read_databases.F90
@@ -55,7 +55,8 @@
                   ATTENUATION_VISCOELASTIC_SOLID,ATTENUATION_PORO_FLUID_PART,save_ASCII_seismograms, &
                   save_binary_seismograms_single,save_binary_seismograms_double, &
                   DRAW_SOURCES_AND_RECEIVERS,Q0,freq0,p_sv,NSTEP,deltat,NSOURCES, &
-                  factor_subsample_image,USE_SNAPSHOT_NUMBER_IN_FILENAME,DRAW_WATER_IN_BLUE,US_LETTER, &
+                  factor_subsample_image,USE_CONSTANT_MAX_AMPLITUDE,CONSTANT_MAX_AMPLITUDE_TO_USE, &
+                  USE_SNAPSHOT_NUMBER_IN_FILENAME,DRAW_WATER_IN_BLUE,US_LETTER, &
                   POWER_DISPLAY_COLOR,SU_FORMAT,USER_T0,time_stepping_scheme, &
                   ADD_SPRING_TO_STACEY,ADD_PERIODIC_CONDITIONS,PERIODIC_HORIZ_DIST, &
                   read_external_mesh,ACOUSTIC_FORCING,save_ASCII_kernels)
@@ -90,6 +91,12 @@
 ! factor to subsample color images output by the code (useful for very large models)
   double precision :: factor_subsample_image
 
+! by default the code normalizes each image independently to its maximum; use this option to use the global maximum below instead
+  logical :: USE_CONSTANT_MAX_AMPLITUDE
+
+! constant maximum amplitude to use for all color images if the USE_CONSTANT_MAX_AMPLITUDE option is true
+  double precision :: CONSTANT_MAX_AMPLITUDE_TO_USE
+
 ! use snapshot number in the file name of JPG color snapshots instead of the time step
   logical :: USE_SNAPSHOT_NUMBER_IN_FILENAME
 
@@ -273,6 +280,12 @@
   read(IIN,*) factor_subsample_image
 
   read(IIN,"(a80)") datlin
+  read(IIN,*) USE_CONSTANT_MAX_AMPLITUDE
+
+  read(IIN,"(a80)") datlin
+  read(IIN,*) CONSTANT_MAX_AMPLITUDE_TO_USE
+
+  read(IIN,"(a80)") datlin
   read(IIN,*) USE_SNAPSHOT_NUMBER_IN_FILENAME
 
   read(IIN,"(a80)") datlin
diff --git a/src/specfem2D/specfem2D.F90 b/src/specfem2D/specfem2D.F90
index 66cf259..95d5524 100644
--- a/src/specfem2D/specfem2D.F90
+++ b/src/specfem2D/specfem2D.F90
@@ -387,6 +387,12 @@
 ! factor to subsample color images output by the code (useful for very large models)
   double precision :: factor_subsample_image
 
+! by default the code normalizes each image independently to its maximum; use this option to use the global maximum below instead
+  logical :: USE_CONSTANT_MAX_AMPLITUDE
+
+! constant maximum amplitude to use for all color images if the USE_CONSTANT_MAX_AMPLITUDE option is true
+  double precision :: CONSTANT_MAX_AMPLITUDE_TO_USE
+
 ! use snapshot number in the file name of JPG color snapshots instead of the time step
   logical :: USE_SNAPSHOT_NUMBER_IN_FILENAME
 
@@ -1112,7 +1118,8 @@
                   ATTENUATION_VISCOELASTIC_SOLID,ATTENUATION_PORO_FLUID_PART,save_ASCII_seismograms, &
                   save_binary_seismograms_single,save_binary_seismograms_double,DRAW_SOURCES_AND_RECEIVERS, &
                   Q0,freq0,p_sv,NSTEP,deltat,NSOURCES, &
-                  factor_subsample_image,USE_SNAPSHOT_NUMBER_IN_FILENAME,DRAW_WATER_IN_BLUE,US_LETTER, &
+                  factor_subsample_image,USE_CONSTANT_MAX_AMPLITUDE,CONSTANT_MAX_AMPLITUDE_TO_USE, &
+                  USE_SNAPSHOT_NUMBER_IN_FILENAME,DRAW_WATER_IN_BLUE,US_LETTER, &
                   POWER_DISPLAY_COLOR,SU_FORMAT,USER_T0, time_stepping_scheme, &
                   ADD_SPRING_TO_STACEY,ADD_PERIODIC_CONDITIONS,PERIODIC_HORIZ_DIST, &
                   read_external_mesh,ACOUSTIC_FORCING,save_ASCII_kernels)
@@ -9606,7 +9613,8 @@ if(coupled_elastic_poro) then
                   NX_IMAGE_color,NZ_IMAGE_color,it,isnapshot_number,cutsnaps,image_color_vp_display, &
                   USE_SNAPSHOT_NUMBER_IN_FILENAME,POWER_DISPLAY_COLOR, &
                   DRAW_SOURCES_AND_RECEIVERS,NSOURCES,nrec, &
-                  ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver)
+                  ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver, &
+                  USE_CONSTANT_MAX_AMPLITUDE,CONSTANT_MAX_AMPLITUDE_TO_USE)
           write(IOUT,*) 'Color image created'
         endif
 



More information about the CIG-COMMITS mailing list