Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:36:45 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
1dbaea09ee Chri*0001 #include "CPP_OPTIONS.h"
924557e60a Chri*0002 
9366854e02 Chri*0003 CBOP
                0004 C     !ROUTINE: INI_CARTESIAN_GRID
                0005 C     !INTERFACE:
924557e60a Chri*0006       SUBROUTINE INI_CARTESIAN_GRID( myThid )
758c85d317 Jean*0007 
9366854e02 Chri*0008 C     !DESCRIPTION: \bv
                0009 C     *==========================================================*
9780090eaa Jean*0010 C     | SUBROUTINE INI_CARTESIAN_GRID
                0011 C     | o Initialise model coordinate system
9366854e02 Chri*0012 C     *==========================================================*
9780090eaa Jean*0013 C     | The grid arrays, initialised here, are used throughout
                0014 C     | the code in evaluating gradients, integrals and spatial
06399abf63 Jean*0015 C     | avarages. This routine is called separately by each
                0016 C     | thread and initialises only the region of the domain
                0017 C     | it is "responsible" for.
                0018 C     | Under the cartesian grid mode primitive distances
                0019 C     | in X and Y are in metres. Distance in Z are in m or Pa
9780090eaa Jean*0020 C     | depending on the vertical gridding mode.
9366854e02 Chri*0021 C     *==========================================================*
                0022 C     \ev
924557e60a Chri*0023 
9366854e02 Chri*0024 C     !USES:
                0025       IMPLICIT NONE
924557e60a Chri*0026 C     === Global variables ===
                0027 #include "SIZE.h"
                0028 #include "EEPARAMS.h"
                0029 #include "PARAMS.h"
                0030 #include "GRID.h"
                0031 
9366854e02 Chri*0032 C     !INPUT/OUTPUT PARAMETERS:
924557e60a Chri*0033 C     == Routine arguments ==
06399abf63 Jean*0034 C     myThid  :: my Thread Id Number
924557e60a Chri*0035       INTEGER myThid
                0036 
9366854e02 Chri*0037 C     !LOCAL VARIABLES:
924557e60a Chri*0038 C     == Local variables ==
06399abf63 Jean*0039 C     bi,bj   :: tile indices
                0040 C     i, j    :: loop counters
                0041 C     delXloc :: mesh spacing in X direction
                0042 C     delYloc :: mesh spacing in Y direction
                0043 C     xGloc   :: mesh corner-point location (local "Long" real array type)
                0044 C     yGloc   :: mesh corner-point location (local "Long" real array type)
                0045       INTEGER bi, bj
                0046       INTEGER i,  j
                0047       INTEGER gridNx, gridNy
                0048 C NOTICE the extended range of indices!!
                0049       _RL delXloc(0-OLx:sNx+OLx)
                0050       _RL delYloc(0-OLy:sNy+OLy)
                0051 C NOTICE the extended range of indices!!
                0052       _RL xGloc(1-OLx:sNx+OLx+1,1-OLy:sNy+OLy+1)
                0053       _RL yGloc(1-OLx:sNx+OLx+1,1-OLy:sNy+OLy+1)
9366854e02 Chri*0054 CEOP
aea29c8517 Alis*0055 
06399abf63 Jean*0056 C--   For each tile ...
924557e60a Chri*0057       DO bj = myByLo(myThid), myByHi(myThid)
                0058        DO bi = myBxLo(myThid), myBxHi(myThid)
aea29c8517 Alis*0059 
06399abf63 Jean*0060 C--     set tile local mesh (same units as delX,deY)
                0061 C       corresponding to coordinates of cell corners for N+1 grid-lines
aea29c8517 Alis*0062 
06399abf63 Jean*0063         CALL INI_LOCAL_GRID(
                0064      O                       xGloc, yGloc,
                0065      O                       delXloc, delYloc,
                0066      O                       gridNx, gridNy,
                0067      I                       bi, bj, myThid )
aea29c8517 Alis*0068 
                0069 C--     Make a permanent copy of [xGloc,yGloc] in [xG,yG]
06399abf63 Jean*0070         DO j=1-OLy,sNy+OLy
                0071          DO i=1-OLx,sNx+OLx
758c85d317 Jean*0072           xG(i,j,bi,bj) = xGloc(i,j)
                0073           yG(i,j,bi,bj) = yGloc(i,j)
924557e60a Chri*0074          ENDDO
                0075         ENDDO
aea29c8517 Alis*0076 
                0077 C--     Calculate [xC,yC], coordinates of cell centers
06399abf63 Jean*0078         DO j=1-OLy,sNy+OLy
                0079          DO i=1-OLx,sNx+OLx
aea29c8517 Alis*0080 C         by averaging
758c85d317 Jean*0081           xC(i,j,bi,bj) = 0.25 _d 0*(
                0082      &     xGloc(i,j)+xGloc(i+1,j)+xGloc(i,j+1)+xGloc(i+1,j+1) )
                0083           yC(i,j,bi,bj) = 0.25 _d 0*(
                0084      &     yGloc(i,j)+yGloc(i+1,j)+yGloc(i,j+1)+yGloc(i+1,j+1) )
aea29c8517 Alis*0085          ENDDO
                0086         ENDDO
                0087 
                0088 C--     Calculate [dxF,dyF], lengths between cell faces (through center)
06399abf63 Jean*0089         DO j=1-OLy,sNy+OLy
                0090          DO i=1-OLx,sNx+OLx
                0091           dxF(i,j,bi,bj) = delXloc(i)
                0092           dyF(i,j,bi,bj) = delYloc(j)
924557e60a Chri*0093          ENDDO
                0094         ENDDO
aea29c8517 Alis*0095 
                0096 C--     Calculate [dxG,dyG], lengths along cell boundaries
06399abf63 Jean*0097         DO j=1-OLy,sNy+OLy
                0098          DO i=1-OLx,sNx+OLx
                0099           dxG(i,j,bi,bj) = delXloc(i)
                0100           dyG(i,j,bi,bj) = delYloc(j)
aea29c8517 Alis*0101          ENDDO
                0102         ENDDO
                0103 
                0104 C--     The following arrays are not defined in some parts of the halo
71b5d4795f Jean*0105 C       region. We set them to zero here for safety.
                0106 C       Note: this is now done earlier in main S/R INI_GRID
aea29c8517 Alis*0107 
                0108 C--     Calculate [dxC], zonal length between cell centers
06399abf63 Jean*0109         DO j=1-OLy,sNy+OLy
                0110          DO i=1-OLx+1,sNx+OLx ! NOTE range
758c85d317 Jean*0111           dxC(i,j,bi,bj) = 0.5 _d 0*(dxF(i,j,bi,bj)+dxF(i-1,j,bi,bj))
aea29c8517 Alis*0112          ENDDO
                0113         ENDDO
                0114 
                0115 C--     Calculate [dyC], meridional length between cell centers
06399abf63 Jean*0116         DO j=1-OLy+1,sNy+OLy ! NOTE range
                0117          DO i=1-OLx,sNx+OLx
758c85d317 Jean*0118           dyC(i,j,bi,bj) = 0.5 _d 0*(dyF(i,j,bi,bj)+dyF(i,j-1,bi,bj))
aea29c8517 Alis*0119          ENDDO
                0120         ENDDO
                0121 
                0122 C--     Calculate [dxV,dyU], length between velocity points (through corners)
06399abf63 Jean*0123         DO j=1-OLy+1,sNy+OLy ! NOTE range
                0124          DO i=1-OLx+1,sNx+OLx ! NOTE range
aea29c8517 Alis*0125 C         by averaging (method I)
758c85d317 Jean*0126           dxV(i,j,bi,bj) = 0.5 _d 0*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
                0127           dyU(i,j,bi,bj) = 0.5 _d 0*(dyG(i,j,bi,bj)+dyG(i,j-1,bi,bj))
aea29c8517 Alis*0128 C         by averaging (method II)
758c85d317 Jean*0129 c         dxV(i,j,bi,bj) = 0.5*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
                0130 c         dyU(i,j,bi,bj) = 0.5*(dyC(i,j,bi,bj)+dyC(i-1,j,bi,bj))
aea29c8517 Alis*0131          ENDDO
                0132         ENDDO
                0133 
9780090eaa Jean*0134 C--     Calculate vertical face area
06399abf63 Jean*0135         DO j=1-OLy,sNy+OLy
                0136          DO i=1-OLx,sNx+OLx
758c85d317 Jean*0137           rA (i,j,bi,bj) = dxF(i,j,bi,bj)*dyF(i,j,bi,bj)
                0138           rAw(i,j,bi,bj) = dxC(i,j,bi,bj)*dyG(i,j,bi,bj)
                0139           rAs(i,j,bi,bj) = dxG(i,j,bi,bj)*dyC(i,j,bi,bj)
                0140           rAz(i,j,bi,bj) = dxV(i,j,bi,bj)*dyU(i,j,bi,bj)
51910c84f4 Jean*0141 C--     Set trigonometric terms & grid orientation:
71b5d4795f Jean*0142 C       Note: this is now done earlier in main S/R INI_GRID
                0143 c         tanPhiAtU(i,j,bi,bj) = 0.
                0144 c         tanPhiAtV(i,j,bi,bj) = 0.
                0145 c         angleCosC(i,j,bi,bj) = 1.
                0146 c         angleSinC(i,j,bi,bj) = 0.
e7217683b5 Chri*0147          ENDDO
                0148         ENDDO
b05b067368 Chri*0149 
9780090eaa Jean*0150 C--   end bi,bj loops
                0151        ENDDO
                0152       ENDDO
aea29c8517 Alis*0153 
924557e60a Chri*0154       RETURN
                0155       END