[cig-commits] [commit] devel, master: Fix calculation of regular grid point order. (c4704bc)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 6 08:12:29 PST 2014


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

On branches: devel,master
Link       : https://github.com/geodynamics/specfem3d_globe/compare/bc58e579b3b0838a0968725a076f5904845437ca...be63f20cbb6f462104e949894dbe205d2398cd7f

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

commit c4704bc03e806b44e42ead66924e12ec5aa9e1e6
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Mon Aug 19 01:09:19 2013 -0400

    Fix calculation of regular grid point order.
    
    The original may have touched all points, but I don't think they would
    be in any real order.


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

c4704bc03e806b44e42ead66924e12ec5aa9e1e6
 src/specfem3D/locate_regular_points.f90 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/specfem3D/locate_regular_points.f90 b/src/specfem3D/locate_regular_points.f90
index de7fc82..1353f67 100644
--- a/src/specfem3D/locate_regular_points.f90
+++ b/src/specfem3D/locate_regular_points.f90
@@ -130,13 +130,13 @@
 
   do isp = 1,GRID%npts_total
     if (isp == GRID%npts_before_layer(ilayer+1)+1) ilayer=ilayer+1
-    ilat = (isp - GRID%npts_before_layer(ilayer) - 1) / GRID%nlat(ilayer)
-    ilon = (isp - GRID%npts_before_layer(ilayer) - 1) - ilat * GRID%nlat(ilayer)
+    ilat = (isp - GRID%npts_before_layer(ilayer) - 1) / GRID%nlon(ilayer)
+    ilon = (isp - GRID%npts_before_layer(ilayer)) - ilat * GRID%nlon(ilayer)
 
     ! (lat,lon,radius) for isp point
     lat = KL_REG_MIN_LAT + ilat * GRID%dlat * GRID%ndoubling(ilayer)
     th = (90 - lat) * DEGREES_TO_RADIANS
-    lon = KL_REG_MIN_LON + ilon * GRID%dlon * GRID%ndoubling(ilayer)
+    lon = KL_REG_MIN_LON + (ilon - 1) * GRID%dlon * GRID%ndoubling(ilayer)
     ph = lon * DEGREES_TO_RADIANS
     x = sin(th) * cos(ph); y = sin(th) * sin(ph); z = cos(th)
 
@@ -244,12 +244,12 @@
       if (isp <= GRID%npts_before_layer(ilayer+1)) exit
     enddo
 
-    ilat = (isp - GRID%npts_before_layer(ilayer) - 1) / GRID%nlat(ilayer)
-    ilon = (isp - GRID%npts_before_layer(ilayer) - 1) - ilat * GRID%nlat(ilayer)
+    ilat = (isp - GRID%npts_before_layer(ilayer) - 1) / GRID%nlon(ilayer)
+    ilon = (isp - GRID%npts_before_layer(ilayer)) - ilat * GRID%nlon(ilayer)
 
     ! (lat,lon,radius) for isp point
     lat = KL_REG_MIN_LAT + ilat * GRID%dlat * GRID%ndoubling(ilayer)
-    lon = KL_REG_MIN_LON + ilon * GRID%dlon * GRID%ndoubling(ilayer)
+    lon = KL_REG_MIN_LON + (ilon - 1) * GRID%dlon * GRID%ndoubling(ilayer)
     ! convert radius to meters and then scale
     radius = GRID%rlayer(ilayer) * 1000.0 / R_EARTH
     ! (x,y,z) for isp point



More information about the CIG-COMMITS mailing list