Back to home page

MITgcm

 
 

    


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

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