/[MITgcm]/MITgcm/model/src/ini_spherical_polar_grid.F
ViewVC logotype

Diff of /MITgcm/model/src/ini_spherical_polar_grid.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.25 by mlosch, Fri Feb 8 13:01:25 2008 UTC revision 1.26 by jmc, Tue Jan 27 15:35:27 2009 UTC
# Line 43  C     == Local variables == Line 43  C     == Local variables ==
43  C     xG, yG - Global coordinate location.  C     xG, yG - Global coordinate location.
44  C     xBase  - South-west corner location for process.  C     xBase  - South-west corner location for process.
45  C     yBase  C     yBase
46  C     zUpper - Work arrays for upper and lower  C     zUpper - Work arrays for upper and lower
47  C     zLower   cell-face heights.  C     zLower   cell-face heights.
48  C     phi    - Temporary scalar  C     phi    - Temporary scalar
49  C     iG, jG - Global coordinate index. Usually used to hold  C     iG, jG - Global coordinate index. Usually used to hold
# Line 74  C     >    I dont understand why we woul Line 74  C     >    I dont understand why we woul
74  C     >    overlap by the total domain size e.g  C     >    overlap by the total domain size e.g
75  C     >    OLx*Nx, OLy*Ny.  C     >    OLx*Nx, OLy*Ny.
76  C     >    Can anybody explain? Lines are in ini_spherical_polar_grid.F.  C     >    Can anybody explain? Lines are in ini_spherical_polar_grid.F.
77  C     >    Surprised the code works if its wrong, so I am puzzled.          C     >    Surprised the code works if its wrong, so I am puzzled.
78  C     jmc replied:  C     jmc replied:
79  C     Yes, I can explain this since I put this modification to work  C     Yes, I can explain this since I put this modification to work
80  C     with small domain (where Oly > Ny, as for instance, zonal-average  C     with small domain (where Oly > Ny, as for instance, zonal-average
# Line 84  C     and jGl(J,bj) since we take mod(a+ Line 84  C     and jGl(J,bj) since we take mod(a+
84  C     But in case a or b is negative, then the FORTRAN function "mod"  C     But in case a or b is negative, then the FORTRAN function "mod"
85  C     does not return the matematical value of the "modulus" function,  C     does not return the matematical value of the "modulus" function,
86  C     and this is not good for your purpose.  C     and this is not good for your purpose.
87  C     This is why I add +OLx*Nx and +OLy*Ny to be sure that the 1rst  C     This is why I add +OLx*Nx and +OLy*Ny to be sure that the 1rst
88  C     argument of the mod function is positive.  C     argument of the mod function is positive.
89        INTEGER iGl,jGl        INTEGER iGl,jGl
90        iGl(I,bi) = 1+mod(myXGlobalLo-1+(bi-1)*sNx+I+Olx*Nx-1,Nx)        iGl(I,bi) = 1+mod(myXGlobalLo-1+(bi-1)*sNx+I+Olx*Nx-1,Nx)
# Line 101  C--     "Global" index (place holder) Line 101  C--     "Global" index (place holder)
101          iG = myXGlobalLo + (bi-1)*sNx          iG = myXGlobalLo + (bi-1)*sNx
102    
103  C--   First find coordinate of tile corner (meaning outer corner of halo)  C--   First find coordinate of tile corner (meaning outer corner of halo)
104          xG0 = thetaMin          xG0 = xgOrigin
105  C       Find the X-coordinate of the outer grid-line of the "real" tile  C       Find the X-coordinate of the outer grid-line of the "real" tile
106          DO i=1, iG-1          DO i=1, iG-1
107           xG0 = xG0 + delX(i)           xG0 = xG0 + delX(i)
# Line 111  C       Back-step to the outer grid-line Line 111  C       Back-step to the outer grid-line
111           xG0 = xG0 - delX( 1+mod(Olx*Nx-1+iG-i,Nx) )           xG0 = xG0 - delX( 1+mod(Olx*Nx-1+iG-i,Nx) )
112          ENDDO          ENDDO
113  C       Find the Y-coordinate of the outer grid-line of the "real" tile  C       Find the Y-coordinate of the outer grid-line of the "real" tile
114          yG0 = phiMin          yG0 = ygOrigin
115          DO j=1, jG-1          DO j=1, jG-1
116           yG0 = yG0 + delY(j)           yG0 = yG0 + delY(j)
117          ENDDO          ENDDO
# Line 148  C--     Calculate [xC,yC], coordinates o Line 148  C--     Calculate [xC,yC], coordinates o
148          DO J=1-Oly,sNy+Oly          DO J=1-Oly,sNy+Oly
149           DO I=1-Olx,sNx+Olx           DO I=1-Olx,sNx+Olx
150  C         by averaging  C         by averaging
151            xC(I,J,bi,bj) = 0.25*(            xC(I,J,bi,bj) = 0.25*(
152       &     xGloc(I,J)+xGloc(I+1,J)+xGloc(I,J+1)+xGloc(I+1,J+1) )       &     xGloc(I,J)+xGloc(I+1,J)+xGloc(I,J+1)+xGloc(I+1,J+1) )
153            yC(I,J,bi,bj) = 0.25*(            yC(I,J,bi,bj) = 0.25*(
154       &     yGloc(I,J)+yGloc(I+1,J)+yGloc(I,J+1)+yGloc(I+1,J+1) )       &     yGloc(I,J)+yGloc(I+1,J)+yGloc(I,J+1)+yGloc(I+1,J+1) )
155           ENDDO           ENDDO
156          ENDDO          ENDDO

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.22