[cig-commits] [commit] devel: Cleans SEP model reader and adds a couple of comments (c9c7951)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Oct 2 14:07:38 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/858a86e5e8e4c076696d24c8c9942e93d3d663cb...7ef78c5b45b052afca446255945d0c62788f8e93

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

commit c9c7951fcd9e639809789b04e7620b3b28ee2ba7
Author: Matthieu Lefebvre <ml15 at princeton.edu>
Date:   Thu Oct 2 16:17:32 2014 -0400

    Cleans SEP model reader and adds a couple of comments


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

c9c7951fcd9e639809789b04e7620b3b28ee2ba7
 m4                                   |  2 +-
 src/generate_databases/model_sep.f90 | 13 ++++++++-----
 src/generate_databases/parse_sep.c   | 16 ++++++++++++++++
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/m4 b/m4
index ba14abf..09ca47b 160000
--- a/m4
+++ b/m4
@@ -1 +1 @@
-Subproject commit ba14abf73197b78e13d1a155a8f84ceb1d7be3e4
+Subproject commit 09ca47be4e87a6133563b7e8e32974a6da7c5d58
diff --git a/src/generate_databases/model_sep.f90 b/src/generate_databases/model_sep.f90
index 3822aa1..5d91413 100644
--- a/src/generate_databases/model_sep.f90
+++ b/src/generate_databases/model_sep.f90
@@ -1,9 +1,14 @@
+!> Module dealing with SEP model files.
+!! Constraints:
+!! * Only acoustic and elastic elements
+!! * Requires VP, VS and RHO models
 module model_sep_mod
   implicit none
 
 contains
 
 !==============================================================================
+!> Reads a SEP elastic model, with vp, vs and rho files.
 subroutine model_sep()
   use generate_databases_par, only: NGLLX, NGLLY, NGLLZ, NSPEC=>NSPEC_AB, &
                                     SEP_MODEL_DIRECTORY, FOUR_THIRDS
@@ -28,9 +33,6 @@ subroutine model_sep()
   sep_header_name_vp = trim(SEP_MODEL_DIRECTORY) // "/vp.H" 
   sep_header_name_vs = trim(SEP_MODEL_DIRECTORY) // "/vs.H" 
   sep_header_name_rho = trim(SEP_MODEL_DIRECTORY) // "/rho.H" 
-  !write(sep_header_name_vp, '(a)') trim(SEP_MODEL_DIRECTORY) // "/vp.H" 
-  !write(sep_header_name_vs, *) trim(SEP_MODEL_DIRECTORY) // "/vs.H" 
-  !write(sep_header_name_rho, *) trim(SEP_MODEL_DIRECTORY) // "/rho.H" 
 
   inquire(file=trim(sep_header_name_vp), exist=vp_exists) 
   if (.not. vp_exists) stop "SEP vp model should exist"
@@ -234,7 +236,8 @@ subroutine interpolate_sep_on_mesh(sep_var, xmin, ymin, ni, nj, NZ, &
 end subroutine interpolate_sep_on_mesh
 
 !==============================================================================
-!>
+!> Find offsets and number of elements to read from the SEP file according
+!! to the slice topology.
 subroutine find_slice_bounds_sep(NX, NY, NZ, OX, OY, OZ, DX, DY, DZ, &
                                  xmin, ymin, imin, jmin, kmin, ni, nj, nk)
   use generate_databases_par, only: xstore, ystore, zstore
@@ -273,7 +276,7 @@ end subroutine find_slice_bounds_sep
 
 
 !==============================================================================
-!>
+!> Make sure that each element is fully acoustic or fully elastic.
 subroutine correct_sep_interface()
   use generate_databases_par, only: NGLLX, NGLLY, NGLLZ, NSPEC=>NSPEC_AB
   use create_regions_mesh_ext_par, only: rhostore, rho_vp, rho_vs, &
diff --git a/src/generate_databases/parse_sep.c b/src/generate_databases/parse_sep.c
index a789c70..682b46d 100644
--- a/src/generate_databases/parse_sep.c
+++ b/src/generate_databases/parse_sep.c
@@ -26,6 +26,21 @@
 
 
 /*****************************************************************************/
+/**
+ * Parse a sep header file and get information of interest
+ *
+ * \param header_name Name of the sep header to parse
+ * \param n1 Number of sample in X direction
+ * \param n2 Number of sample in Y direction
+ * \param n3 Number of sample in Z direction
+ * \param o1 Offset (m) in X direction
+ * \param o2 Offset (m) in Y direction
+ * \param o3 Offset (m) in Z direction
+ * \param d1 Spatial increment (m) in X direction
+ * \param d2 Spatial increment (m) in Y direction
+ * \param d3 Spatial increment (m) in Z direction
+ * \param in Name and location of the SEP binary file
+ */
 void parse_sep_header(char *header_name, 
                       int *n1, int *n2, int *n3, 
                       float *o1, float *o2, float *o3, 
@@ -79,6 +94,7 @@ void parse_sep_header(char *header_name,
         *d2 = atof(value);
       } else if (!strcmp(name, "d3")) {
         *d3 = atof(value);
+        /* We do not have use for other fields. */
       /*} else if (!strcmp(name, "label1")) {
         strncpy(*label1, value, value_len+1);
       } else if (!strcmp(name, "label2")) {



More information about the CIG-COMMITS mailing list