File indexing completed on 2018-03-02 18:36:54 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
fd5464a82d Jean*0003 #undef USE_BACKWARD_COMPATIBLE_GRID
fb481a83c2 Alis*0004
9366854e02 Chri*0005
0006
0007
924557e60a Chri*0008 SUBROUTINE INI_SPHERICAL_POLAR_GRID( myThid )
758c85d317 Jean*0009
9366854e02 Chri*0010
758c85d317 Jean*0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
9366854e02 Chri*0023
924557e60a Chri*0024
9366854e02 Chri*0025
0026 IMPLICIT NONE
924557e60a Chri*0027
0028 #include "SIZE.h"
0029 #include "EEPARAMS.h"
0030 #include "PARAMS.h"
0031 #include "GRID.h"
0032
9366854e02 Chri*0033
924557e60a Chri*0034
758c85d317 Jean*0035
924557e60a Chri*0036 INTEGER myThid
0037
9366854e02 Chri*0038
924557e60a Chri*0039
758c85d317 Jean*0040
0041
06399abf63 Jean*0042
0043
0044
0045
0046
0047
0048
1f3a025cae Jean*0049 LOGICAL skipCalcAngleC
924557e60a Chri*0050 INTEGER bi, bj
758c85d317 Jean*0051 INTEGER i, j
06399abf63 Jean*0052 INTEGER gridNx, gridNy
0053 _RL lat, dlat, dlon
0054
0055 _RL delXloc(0-OLx:sNx+OLx)
0056 _RL delYloc(0-OLy:sNy+OLy)
0057
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)
9366854e02 Chri*0060
fb481a83c2 Alis*0061
06399abf63 Jean*0062
924557e60a Chri*0063 DO bj = myByLo(myThid), myByHi(myThid)
0064 DO bi = myBxLo(myThid), myBxHi(myThid)
fb481a83c2 Alis*0065
06399abf63 Jean*0066
0067
0068 CALL INI_LOCAL_GRID(
0069 O xGloc, yGloc,
0070 O delXloc, delYloc,
0071 O gridNx, gridNy,
0072 I bi, bj, myThid )
fb481a83c2 Alis*0073
0074
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)
924557e60a Chri*0079 ENDDO
0080 ENDDO
fb481a83c2 Alis*0081
0082
06399abf63 Jean*0083 DO j=1-OLy,sNy+OLy
0084 DO i=1-OLx,sNx+OLx
fb481a83c2 Alis*0085
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) )
924557e60a Chri*0090 ENDDO
0091 ENDDO
fb481a83c2 Alis*0092
0093
06399abf63 Jean*0094 DO j=1-OLy,sNy+OLy
0095 DO i=1-OLx,sNx+OLx
fb481a83c2 Alis*0096
758c85d317 Jean*0097
0098
fb481a83c2 Alis*0099
758c85d317 Jean*0100 lat = yC(i,j,bi,bj)
06399abf63 Jean*0101 dlon = delXloc(i)
0102 dlat = delYloc(j)
fd5464a82d Jean*0103 dxF(i,j,bi,bj) = rSphere*COS(lat*deg2rad)*dlon*deg2rad
758c85d317 Jean*0104 dyF(i,j,bi,bj) = rSphere*dlat*deg2rad
fb481a83c2 Alis*0105 ENDDO
0106 ENDDO
0107
0108
06399abf63 Jean*0109 DO j=1-OLy,sNy+OLy
0110 DO i=1-OLx,sNx+OLx
fb481a83c2 Alis*0111
758c85d317 Jean*0112
0113
fb481a83c2 Alis*0114
758c85d317 Jean*0115 lat = 0.5 _d 0*(yGloc(i,j)+yGloc(i+1,j))
06399abf63 Jean*0116 dlon = delXloc(i)
0117 dlat = delYloc(j)
758c85d317 Jean*0118 dxG(i,j,bi,bj) = rSphere*COS(deg2rad*lat)*dlon*deg2rad
fd5464a82d Jean*0119 IF (dxG(i,j,bi,bj).LT.1.) dxG(i,j,bi,bj)=0.
758c85d317 Jean*0120 dyG(i,j,bi,bj) = rSphere*dlat*deg2rad
fb481a83c2 Alis*0121 ENDDO
0122 ENDDO
0123
0124
0125
0126
1f3a025cae Jean*0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
fb481a83c2 Alis*0138
0139
06399abf63 Jean*0140 DO j=1-OLy,sNy+OLy
0141 DO i=1-OLx+1,sNx+OLx
fb481a83c2 Alis*0142
758c85d317 Jean*0143 dxC(i,j,bi,bj) = 0.5 _d 0*(dxF(i,j,bi,bj)+dxF(i-1,j,bi,bj))
fb481a83c2 Alis*0144
758c85d317 Jean*0145
06399abf63 Jean*0146
758c85d317 Jean*0147
fb481a83c2 Alis*0148
758c85d317 Jean*0149
06399abf63 Jean*0150
758c85d317 Jean*0151
fb481a83c2 Alis*0152 ENDDO
0153 ENDDO
0154
0155
06399abf63 Jean*0156 DO j=1-OLy+1,sNy+OLy
0157 DO i=1-OLx,sNx+OLx
fb481a83c2 Alis*0158
758c85d317 Jean*0159 dyC(i,j,bi,bj) = 0.5 _d 0*(dyF(i,j,bi,bj)+dyF(i,j-1,bi,bj))
fb481a83c2 Alis*0160
06399abf63 Jean*0161
758c85d317 Jean*0162
fb481a83c2 Alis*0163
06399abf63 Jean*0164
758c85d317 Jean*0165
fb481a83c2 Alis*0166 ENDDO
0167 ENDDO
0168
0169
06399abf63 Jean*0170 DO j=1-OLy+1,sNy+OLy
0171 DO i=1-OLx+1,sNx+OLx
fb481a83c2 Alis*0172
758c85d317 Jean*0173 dxV(i,j,bi,bj) = 0.5 _d 0*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
0174 dyU(i,j,bi,bj) = 0.5 _d 0*(dyG(i,j,bi,bj)+dyG(i,j-1,bi,bj))
fb481a83c2 Alis*0175
758c85d317 Jean*0176
0177
fb481a83c2 Alis*0178 ENDDO
0179 ENDDO
0180
0181
06399abf63 Jean*0182 DO j=1-OLy,sNy+OLy
0183 DO i=1-OLx,sNx+OLx
758c85d317 Jean*0184 lat=0.5 _d 0*(yGloc(i,j)+yGloc(i+1,j))
06399abf63 Jean*0185 dlon = delXloc(i)
0186 dlat = delYloc(j)
758c85d317 Jean*0187 rA(i,j,bi,bj) = rSphere*rSphere*dlon*deg2rad
0188 & *ABS( SIN((lat+dlat)*deg2rad)-SIN(lat*deg2rad) )
fd5464a82d Jean*0189 #ifdef USE_BACKWARD_COMPATIBLE_GRID
06399abf63 Jean*0190 lat = yC(i,j,bi,bj) - delYloc(j)*0.5 _d 0
0191 dlat= yC(i,j,bi,bj) + delYloc(j)*0.5 _d 0
758c85d317 Jean*0192 rA(i,j,bi,bj) = dyF(i,j,bi,bj)
fd5464a82d Jean*0193 & *rSphere*(SIN(dlat*deg2rad)-SIN(lat*deg2rad))
0194 #endif /* USE_BACKWARD_COMPATIBLE_GRID */
924557e60a Chri*0195 ENDDO
0196 ENDDO
fb481a83c2 Alis*0197
0198
06399abf63 Jean*0199 DO j=1-OLy,sNy+OLy
0200 DO i=1-OLx+1,sNx+OLx
fb481a83c2 Alis*0201
758c85d317 Jean*0202 rAw(i,j,bi,bj) = 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj))
fb481a83c2 Alis*0203
758c85d317 Jean*0204
06399abf63 Jean*0205
0206
758c85d317 Jean*0207
fb481a83c2 Alis*0208
0209 ENDDO
0210 ENDDO
0211
0212
06399abf63 Jean*0213 DO j=1-OLy,sNy+OLy
0214 DO i=1-OLx,sNx+OLx
fb481a83c2 Alis*0215
758c85d317 Jean*0216 lat=yC(i,j,bi,bj)
06399abf63 Jean*0217 dlon = delXloc(i)
0218 dlat = 0.5 _d 0*( delYloc(j) + delYloc(j-1) )
fd5464a82d Jean*0219 #ifdef USE_BACKWARD_COMPATIBLE_GRID
06399abf63 Jean*0220 dlat= delYloc(j)
fd5464a82d Jean*0221 #endif /* USE_BACKWARD_COMPATIBLE_GRID */
758c85d317 Jean*0222 rAs(i,j,bi,bj) = rSphere*rSphere*dlon*deg2rad
0223 & *ABS( SIN(lat*deg2rad)-SIN((lat-dlat)*deg2rad) )
0224 IF (ABS(lat).GT.90..OR.ABS(lat-dlat).GT.90.) rAs(i,j,bi,bj)=0.
fb481a83c2 Alis*0225 ENDDO
0226 ENDDO
0227
0228
06399abf63 Jean*0229 DO j=1-OLy,sNy+OLy
0230 DO i=1-OLx,sNx+OLx
fb481a83c2 Alis*0231
06399abf63 Jean*0232 lat = 0.5 _d 0*(yGloc(i,j)+yGloc(i,j+1))
0233 dlon = 0.5 _d 0*( delXloc(i) + delXloc(i-1) )
0234 dlat = 0.5 _d 0*( delYloc(j) + delYloc(j-1) )
758c85d317 Jean*0235 rAz(i,j,bi,bj) = rSphere*rSphere*dlon*deg2rad
0236 & *ABS( SIN(lat*deg2rad)-SIN((lat-dlat)*deg2rad) )
0237 IF (ABS(lat).GT.90..OR.ABS(lat-dlat).GT.90.) rAz(i,j,bi,bj)=0.
fb481a83c2 Alis*0238 ENDDO
0239 ENDDO
0240
51910c84f4 Jean*0241
06399abf63 Jean*0242 DO j=1-OLy,sNy+OLy
0243 DO i=1-OLx,sNx+OLx
758c85d317 Jean*0244 lat=0.5 _d 0*(yGloc(i,j)+yGloc(i,j+1))
0245 tanPhiAtU(i,j,bi,bj)=TAN(lat*deg2rad)
0246 lat=0.5 _d 0*(yGloc(i,j)+yGloc(i+1,j))
0247 tanPhiAtV(i,j,bi,bj)=TAN(lat*deg2rad)
1f3a025cae Jean*0248
0249
0250
c1701ff971 Alis*0251 ENDDO
0252 ENDDO
fb481a83c2 Alis*0253
aea29c8517 Alis*0254
758c85d317 Jean*0255 DO j=1-OLy,sNy+OLy
fd5464a82d Jean*0256 i = 1
aea29c8517 Alis*0257 IF (cosPower.NE.0.) THEN
fd5464a82d Jean*0258 lat = 0.5 _d 0*(yGloc(i,j)+yGloc(i,j+1))
0259 cosFacU(j,bi,bj) = ABS( COS(lat*deg2rad) )**cosPower
0260 lat = 0.5 _d 0*(yGloc(i,j)+yGloc(i+1,j))
0261 cosFacV(j,bi,bj) = ABS( COS(lat*deg2rad) )**cosPower
0262 sqcosFacU(j,bi,bj) = SQRT(cosFacU(j,bi,bj))
0263 sqcosFacV(j,bi,bj) = SQRT(cosFacV(j,bi,bj))
aea29c8517 Alis*0264 ELSE
fd5464a82d Jean*0265 cosFacU(j,bi,bj) = 1.
0266 cosFacV(j,bi,bj) = 1.
758c85d317 Jean*0267 sqcosFacU(j,bi,bj)=1.
0268 sqcosFacV(j,bi,bj)=1.
aea29c8517 Alis*0269 ENDIF
0270 ENDDO
0271
fd5464a82d Jean*0272
0273 ENDDO
0274 ENDDO
fb481a83c2 Alis*0275
7514c1bd55 Mart*0276 IF ( rotateGrid ) THEN
0277 CALL ROTATE_SPHERICAL_POLAR_GRID( xC, yC, myThid )
0278 CALL ROTATE_SPHERICAL_POLAR_GRID( xG, yG, myThid )
1f3a025cae Jean*0279 skipCalcAngleC = .FALSE.
0280 CALL CALC_GRID_ANGLES( skipCalcAngleC, myThid )
7514c1bd55 Mart*0281 ENDIF
0282
924557e60a Chri*0283 RETURN
0284 END