[cig-commits] [commit] devel, master: added Paul Cristini's new version of process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py (cfda3d6)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Jun 18 15:24:26 PDT 2014


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

On branches: devel,master
Link       : https://github.com/geodynamics/specfem2d/compare/fc67e6fd7ad890705b2b72b4b3c509accb22249e...e9ca46c40131588d89d7b0883250bc6584ce6b4c

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

commit cfda3d63ddc0af7f8d30e39d7fd14c18de4942f9
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Thu May 22 15:39:18 2014 +0200

    added Paul Cristini's new version of process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py


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

cfda3d63ddc0af7f8d30e39d7fd14c18de4942f9
 ...e_their_format_when_new_parameters_are_added.py | 85 +++++++++++++++++-----
 1 file changed, 67 insertions(+), 18 deletions(-)

diff --git a/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py b/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
index 5a5ab24..fe80a50 100644
--- a/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
+++ b/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
@@ -619,9 +619,9 @@ def ProcessParfile_axisym_file(fic):
     print 'xxxxx------> '+fic+' processed to '+release_number
     return
 #------------------------------------------------------------------------------
-def ProcessParfile_acoustic_forcing(fic):
+def ProcessParfile_force_acoustic(fic):
     # define the release number
-    release_number='forcing'
+    release_number='force_acoustic'
     # Open the file and get all lines from Par_file
     ligs= LoadLig(fic)
 
@@ -632,13 +632,17 @@ def ProcessParfile_acoustic_forcing(fic):
             return
     #
     a1='\n# acoustic forcing\n'+ \
-    'ACOUSTIC_FORCING                = .false.   \n'
+    'ACOUSTIC_FORCING                  = .false.   \n'
+    a2='acoustic_forcing_surface_file   = ./DATA/MSH/Surface_forcing_'+\
+    'Bottom_enforcing_mesh   # file containing the acoustic forcing surface\n'
     #--------------------------------------------------------------------------
     # Add new parameters
     # 
     for ilg, lig in enumerate(ligs):
         if lig.startswith('time_stepping_scheme'):
             ligs.insert(ilg+1,a1)
+        if lig.startswith('absorbing_surface_file'):
+            ligs.insert(ilg+1,a2)
     #
     move(fic,fic+'.before_update_to_'+release_number)
     #
@@ -649,25 +653,59 @@ def ProcessParfile_acoustic_forcing(fic):
     print 'xxxxx------> '+fic+' processed to '+release_number
     return
 #------------------------------------------------------------------------------
-def ProcessParfile_acoustic_forcing_file(fic):
+def ProcessParfile_correction_periodic(fic):
     # define the release number
-    release_number='forcing_file'
+    release_number='periodic_horiz_correction'
     # Open the file and get all lines from Par_file
     ligs= LoadLig(fic)
 
     # Test if already processed
     for lig in ligs:
-        if lig.startswith('acoustic_forcing_surface_file'):
+        if lig.startswith('PERIODIC_HORIZ_DIST'):
             print '----> '+fic+' already processed to '+release_number          
             return
+
+    #--------------------------------------------------------------------------
+    # Add new parameters
     # 
-    a1='acoustic_forcing_surface_file   = Surf_acforcing   '+ \
-    '# file containing the axial element numbers for axisymmetric simulations\n'
+    for ilg, lig in enumerate(ligs):
+        if lig.startswith('PERIODIC_horiz_dist'):
+            ligs[ilg]=ligs[ilg].replace('PERIODIC_horiz_dist', \
+                            'PERIODIC_HORIZ_DIST')
+    #
+    move(fic,fic+'.before_update_to_'+release_number)
+    #
+    fm = open(fic,'w')
+    fm.writelines(ligs)
+    fm.close()
+    #
+    print 'xxxxx------> '+fic+' processed to '+release_number
+    return
+#------------------------------------------------------------------------------
+def ProcessParfile_max_amplitude(fic):
+    # define the release number
+    release_number='max_amplitude'
+    # Open the file and get all lines from Par_file
+    ligs= LoadLig(fic)
+
+    # Test if already processed
+    for lig in ligs:
+        if lig.startswith('USE_CONSTANT_MAX_AMPLITUDE'):
+            print '----> '+fic+' already processed to '+release_number          
+            return
+    #
+    a1='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\nCONSTANT_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\n'
+
     #--------------------------------------------------------------------------
     # Add new parameters
     # 
     for ilg, lig in enumerate(ligs):
-        if lig.startswith('absorbing_surface_file'):
+        if lig.startswith('factor_subsample_image'):
             ligs.insert(ilg+1,a1)
     #
     move(fic,fic+'.before_update_to_'+release_number)
@@ -679,25 +717,34 @@ def ProcessParfile_acoustic_forcing_file(fic):
     print 'xxxxx------> '+fic+' processed to '+release_number
     return
 #------------------------------------------------------------------------------
-def ProcessParfile_correction_periodic(fic):
+def ProcessParfile_read_velocities_at_f0(fic):
     # define the release number
-    release_number='periodic_horiz_correction'
+    release_number='read_velocities_at_f'
     # Open the file and get all lines from Par_file
     ligs= LoadLig(fic)
 
     # Test if already processed
     for lig in ligs:
-        if lig.startswith('PERIODIC_HORIZ_DIST'):
+        if lig.startswith('READ_VELOCITIES_AT_f0'):
             print '----> '+fic+' already processed to '+release_number          
             return
-
+    #
+    a1='# shift (i.e. change) velocities read from the input file to take '+\
+    'average physical dispersion into account,\n# i.e. if needed change the '+\
+    'reference frequency at which these velocities are defined internally in'+\
+    ' the code:\n# by default, the seismic velocity values that are read at '+\
+    'the end of this Par_file of the code are supposed to be the unrelaxed '+\
+    'values,\n# i.e. the velocities at infinite frequency. We may want to '+\
+    'change this and impose that the values read are those for a given '+\
+    'frequency (here f0_attenuation).\n# (when we do this, velocities will '+\
+    'then slightly decrease and waves will thus slightly slow '+\
+    'down)\nREAD_VELOCITIES_AT_f0           = .false.\n'
     #--------------------------------------------------------------------------
     # Add new parameters
     # 
     for ilg, lig in enumerate(ligs):
-        if lig.startswith('PERIODIC_horiz_dist'):
-            ligs[ilg]=ligs[ilg].replace('PERIODIC_horiz_dist', \
-                            'PERIODIC_HORIZ_DIST')
+        if lig.startswith('f0_attenuation'):
+            ligs.insert(ilg+1,a1)
     #
     move(fic,fic+'.before_update_to_'+release_number)
     #
@@ -707,6 +754,7 @@ def ProcessParfile_correction_periodic(fic):
     #
     print 'xxxxx------> '+fic+' processed to '+release_number
     return
+
 #------------------------------------------------------------------------------
 if __name__=='__main__':
     ## List of all files of current directory
@@ -738,9 +786,10 @@ if __name__=='__main__':
                     ProcessParfile_r21820(fic)
                     ProcessParfile_axisym(fic)
                     ProcessParfile_axisym_file(fic)                    
-                    ProcessParfile_acoustic_forcing(fic)
-                    ProcessParfile_acoustic_forcing_file(fic)
                     ProcessParfile_correction_periodic(fic)
+                    ProcessParfile_force_acoustic(fic)
+                    ProcessParfile_max_amplitude(fic)
+                    ProcessParfile_read_velocities_at_f0(fic)
                     print '~'*80
     #                
     print 'Number of Par_file analysed : ', Ct_Par_file



More information about the CIG-COMMITS mailing list