/[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.17 by cnh, Sun Feb 4 16:46:44 2001 UTC revision 1.18 by adcroft, Tue May 29 14:01:37 2001 UTC
# Line 77  C  NOTICE the extended range of indices! Line 77  C  NOTICE the extended range of indices!
77        _RL xGloc(1-Olx:sNx+Olx+1,1-Oly:sNy+Oly+1)        _RL xGloc(1-Olx:sNx+Olx+1,1-Oly:sNy+Oly+1)
78        _RL yGloc(1-Olx:sNx+Olx+1,1-Oly:sNy+Oly+1)        _RL yGloc(1-Olx:sNx+Olx+1,1-Oly:sNy+Oly+1)
79    
80  C These functions return the "global" index with valid values beyond  C The functions iGl, jGl return the "global" index with valid values beyond
81  C halo regions  C halo regions
82    C cnh wrote:
83    C >    I don't understand why we would ever have to multiply the
84    C >    overlap by the total domain size e.g
85    C >    OLx*Nx, OLy*Ny.
86    C >    Can anybody explain? Lines are in ini_spherical_polar_grid.F.
87    C >    Surprised the code works if its wrong, so I am puzzled.        
88    C jmc relied:
89    C Yes, I can explain this since I put this modification to work
90    C with small domain (where Oly > Ny, as for instance, zonal-average
91    C case):
92    C This has no effect on the acuracy of the evaluation of iGl(I,bi)
93    C and jGl(J,bj) since we take mod(a+OLx*Nx,Nx) and mod(b+OLy*Ny,Ny).
94    C But in case a or b is negative, then the FORTRAN function "mod"
95    C does not return the matematical value of the "modulus" function,
96    C and this is not good for your purpose.
97    C This is why I add +OLx*Nx and +OLy*Ny to be sure that the 1rst
98    C argument of the mod function is positive.
99        INTEGER iGl,jGl        INTEGER iGl,jGl
100        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)
101        jGl(J,bj) = 1+mod(myYGlobalLo-1+(bj-1)*sNy+J+Oly*Ny-1,Ny)        jGl(J,bj) = 1+mod(myYGlobalLo-1+(bj-1)*sNy+J+Oly*Ny-1,Ny)
102    
103    
104  C     For each tile ...  C     For each tile ...
105        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
106         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
# Line 176  C         by formula Line 194  C         by formula
194            dlon = delX( iGl(I,bi) )            dlon = delX( iGl(I,bi) )
195            dlat = delY( jGl(J,bj) )            dlat = delY( jGl(J,bj) )
196            dXG(I,J,bi,bj) = rSphere*COS(deg2rad*lat)*dlon*deg2rad            dXG(I,J,bi,bj) = rSphere*COS(deg2rad*lat)*dlon*deg2rad
197              if (dXG(I,J,bi,bj).LT.1.) dXG(I,J,bi,bj)=0.
198            dYG(I,J,bi,bj) = rSphere*dlat*deg2rad            dYG(I,J,bi,bj) = rSphere*dlat*deg2rad
199           ENDDO           ENDDO
200          ENDDO          ENDDO
# Line 309  C--     Calculate trigonometric terms Line 328  C--     Calculate trigonometric terms
328           ENDDO           ENDDO
329          ENDDO          ENDDO
330    
331    C--     Cosine(lat) scaling
332            DO J=1-OLy,sNy+OLy
333             jG = myYGlobalLo + (bj-1)*sNy + J-1
334             jG = min(max(1,jG),Ny)
335             IF (cosPower.NE.0.) THEN
336              cosFacU(J,bi,bj)=COS(yC(1,J,bi,bj)*deg2rad)
337         &                    **cosPower
338              cosFacV(J,bi,bj)=COS((yC(1,J,bi,bj)-0.5*delY(jG))*deg2rad)
339         &                    **cosPower
340              sqcosFacU(J,bi,bj)=sqrt(cosFacU(J,bi,bj))
341              sqcosFacV(J,bi,bj)=sqrt(cosFacV(J,bi,bj))
342             ELSE
343              cosFacU(J,bi,bj)=1.
344              cosFacV(J,bi,bj)=1.
345              sqcosFacU(J,bi,bj)=1.
346              sqcosFacV(J,bi,bj)=1.
347             ENDIF
348            ENDDO
349    
350         ENDDO ! bi         ENDDO ! bi
351        ENDDO ! bj        ENDDO ! bj
352    

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.22