File indexing completed on 2019-12-05 06:10:41 UTC
view on githubraw file Latest commit 58426deb on 2019-05-29 16:25:44 UTC
cf5b5345a0 Jean*0001 #include "GAD_OPTIONS.h"
0002
0003
2b5bd8961b Jean*0004
cf5b5345a0 Jean*0005
0006
2b5bd8961b Jean*0007 SUBROUTINE CHEAPAML_CALC_RHS(
58426debb4 Jean*0008 I bi,bj, iMin,iMax,jMin,jMax,
0009 I uTrans, vTrans,
364bacbe7c Jean*0010 I uVel, vVel,
76b059cef2 Jean*0011 I diffKh, Tracer,
0012 I deltaTtracer, zu,
0013 I useFluxLimit, cheapamlXperiodic, cheapamlYperiodic,
0014 O wVel,
0015 U gTracer,
cf5b5345a0 Jean*0016 I myTime, myIter, myThid )
0017
0018
ced0783fba Jean*0019
0020
0021
364bacbe7c Jean*0022
ced0783fba Jean*0023
364bacbe7c Jean*0024
ced0783fba Jean*0025
364bacbe7c Jean*0026
ced0783fba Jean*0027
0028
0029
0030
cf5b5345a0 Jean*0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 IMPLICIT NONE
0041 #include "SIZE.h"
0042 #include "EEPARAMS.h"
0043 #include "PARAMS.h"
0044 #include "GRID.h"
0045 #include "GAD.h"
0046
0047
0048
0049
0050
0051
0052
0053
0054
364bacbe7c Jean*0055
76b059cef2 Jean*0056
0057
0058
0059
cf5b5345a0 Jean*0060
0061
0062
0063 INTEGER bi,bj,iMin,iMax,jMin,jMax
0064 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0065 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0066 _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0067 _RL vVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
76b059cef2 Jean*0068 _RL diffKh
cf5b5345a0 Jean*0069 _RL Tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
76b059cef2 Jean*0070 _RL deltaTtracer, zu
364bacbe7c Jean*0071 LOGICAL useFluxLimit
76b059cef2 Jean*0072 LOGICAL cheapamlXperiodic, cheapamlYperiodic
cf5b5345a0 Jean*0073 _RL myTime
0074 INTEGER myIter, myThid
0075
0076
76b059cef2 Jean*0077
ced0783fba Jean*0078
76b059cef2 Jean*0079 _RL wVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
cf5b5345a0 Jean*0080 _RL gTracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0081
0082
0083
ced0783fba Jean*0084
0085
364bacbe7c Jean*0086
ced0783fba Jean*0087
cf5b5345a0 Jean*0088
0089
58426debb4 Jean*0090
364bacbe7c Jean*0091
0092
0093
58426debb4 Jean*0094 INTEGER i,j, iG,jG, ii, jj
cf5b5345a0 Jean*0095 _RL fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0096 _RL fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0097 _RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0098 _RL localT(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
58426debb4 Jean*0099 _RL horizDiv(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
364bacbe7c Jean*0100 _RS maskLocW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0101 _RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
cf5b5345a0 Jean*0102
0103
58426debb4 Jean*0104
cf5b5345a0 Jean*0105 DO j=1-OLy,sNy+OLy
ced0783fba Jean*0106 DO i=1-OLx,sNx+OLx
58426debb4 Jean*0107 df(i,j) = 0. _d 0
0108 fZon(i,j) = 0. _d 0
0109 fMer(i,j) = 0. _d 0
ced0783fba Jean*0110 ENDDO
cf5b5345a0 Jean*0111 ENDDO
364bacbe7c Jean*0112
cf5b5345a0 Jean*0113
364bacbe7c Jean*0114
cf5b5345a0 Jean*0115 DO j=1-OLy,sNy+OLy
ced0783fba Jean*0116 DO i=1-OLx,sNx+OLx
0117 localT(i,j)=tracer(i,j,bi,bj)
4fa4901be6 Nico*0118 ENDDO
0119 ENDDO
0120 DO j=1-OLy,sNy+OLy-1
0121 DO i=1-OLx,sNx+OLx-1
58426debb4 Jean*0122 horizDiv(i,j) = (
0123 & ( uTrans(i+1,j) - uTrans(i,j) )
0124 & + ( vTrans(i,j+1) - vTrans(i,j) )
0125 & )*recip_rA(i,j,bi,bj)
0126 wVel(i,j,bi,bj) = -horizDiv(i,j)
ced0783fba Jean*0127 ENDDO
cf5b5345a0 Jean*0128 ENDDO
0129
364bacbe7c Jean*0130
76b059cef2 Jean*0131 IF(.NOT.cheapamlXperiodic)THEN
0132 DO j=1,sNy
0133 DO i=1,sNx
364bacbe7c Jean*0134 iG=myXGlobalLo-1+(bi-1)*sNx+i
0135 IF (iG.EQ.2) THEN
0136 IF (uVel(i,j,bi,bj).LT.0. _d 0) THEN
0137 DO ii=1-OLx,1
0138 localT(ii,j)=localT(i,j)
0139 ENDDO
0140 ENDIF
0141 ELSEIF (iG.EQ.Nx-1) THEN
0142 IF (uVel(i+1,j,bi,bj).GT.0. _d 0) THEN
0143 DO ii=sNx,sNx+OLx
0144 localT(ii,j)=localT(i,j)
0145 ENDDO
0146 ENDIF
0147 ENDIF
76b059cef2 Jean*0148 ENDDO
364bacbe7c Jean*0149 ENDDO
76b059cef2 Jean*0150 ENDIF
ced0783fba Jean*0151
364bacbe7c Jean*0152 IF (useFluxLimit) THEN
0153
ced0783fba Jean*0154 DO j=1-OLy,sNy+OLy
0155 DO i=1-OLx,sNx+OLx
364bacbe7c Jean*0156
0157
0158 maskLocW(i,j)=1. _d 0
ced0783fba Jean*0159 ENDDO
0160 ENDDO
364bacbe7c Jean*0161 CALL GAD_DST3FL_ADV_X(
ced0783fba Jean*0162 I bi,bj,1,.TRUE., deltaTtracer,
58426debb4 Jean*0163 I uTrans, uVel(1-OLx,1-OLy,bi,bj),
ced0783fba Jean*0164 I maskLocW, localT,
58426debb4 Jean*0165 O fZon,
ced0783fba Jean*0166 I myThid )
364bacbe7c Jean*0167 ELSE
58426debb4 Jean*0168 CALL GAD_C2_ADV_X( bi,bj,1,uTrans,localT,fZon,myThid )
364bacbe7c Jean*0169 ENDIF
cf5b5345a0 Jean*0170
ced0783fba Jean*0171
58426debb4 Jean*0172 IF ( diffKh.NE.zeroRL ) THEN
0173 CALL GAD_DIFF_X( bi,bj,1, dyG(1-OLx,1-OLy,bi,bj),
0174 I diffKh, localT,
0175 O df, myThid )
364bacbe7c Jean*0176 DO j=1-OLy,sNy+OLy
0177 DO i=1-OLx,sNx+OLx
58426debb4 Jean*0178 fZon(i,j) = fZon(i,j) + df(i,j)
ced0783fba Jean*0179 ENDDO
cf5b5345a0 Jean*0180 ENDDO
0181 ENDIF
364bacbe7c Jean*0182
0183
76b059cef2 Jean*0184 IF(.NOT.cheapamlXperiodic)THEN
0185 DO j=1,sNy
0186 DO i=1,sNx
364bacbe7c Jean*0187 iG=myXGlobalLo-1+(bi-1)*sNx+i
0188 IF (iG.EQ.2) THEN
0189 IF (uVel(i,j,bi,bj).LT.0. _d 0) THEN
0190 DO ii=1-OLx,1
0191 localT(ii,j)=tracer(ii,j,bi,bj)
0192 ENDDO
0193 ENDIF
0194 ELSEIF (iG.EQ.Nx-1) THEN
0195 IF (uVel(i+1,j,bi,bj).GT.0. _d 0) THEN
0196 DO ii=sNx,sNx+OLx
0197 localT(ii,j)=tracer(ii,j,bi,bj)
0198 ENDDO
0199 ENDIF
0200 ENDIF
76b059cef2 Jean*0201 ENDDO
364bacbe7c Jean*0202 ENDDO
76b059cef2 Jean*0203 ENDIF
ced0783fba Jean*0204
0205
364bacbe7c Jean*0206
0207
76b059cef2 Jean*0208 IF(.NOT.cheapamlYperiodic)THEN
0209 DO j=1,sNy
0210 jG = myYGlobalLo-1+(bj-1)*sNy+j
0211 DO i=1,sNx
364bacbe7c Jean*0212 IF (jG.EQ.2) THEN
0213 IF (vVel(i,j,bi,bj).LT.0. _d 0) THEN
0214 DO jj=1-OLy,1
0215 localT(i,jj)=localT(i,j)
0216 ENDDO
0217 ENDIF
0218 ELSEIF (jG.EQ.Ny-1) THEN
0219 IF (vVel(i,j+1,bi,bj).GT.0. _d 0) THEN
0220 DO jj=sNy,sNy+OLy
0221 localT(i,jj)=localT(i,j)
0222 ENDDO
0223 ENDIF
0224 ENDIF
76b059cef2 Jean*0225 ENDDO
364bacbe7c Jean*0226 ENDDO
76b059cef2 Jean*0227 ENDIF
364bacbe7c Jean*0228
0229 IF (useFluxLimit) THEN
0230
ced0783fba Jean*0231 DO j=1-OLy,sNy+OLy
0232 DO i=1-OLx,sNx+OLx
364bacbe7c Jean*0233
0234
0235 maskLocS(i,j)= 1. _d 0
ced0783fba Jean*0236 ENDDO
0237 ENDDO
364bacbe7c Jean*0238 CALL GAD_DST3FL_ADV_Y(
ced0783fba Jean*0239 I bi,bj,1,.TRUE., deltaTtracer,
58426debb4 Jean*0240 I vTrans, vVel(1-OLx,1-OLy,bi,bj),
ced0783fba Jean*0241 I maskLocS, localT,
58426debb4 Jean*0242 O fMer,
ced0783fba Jean*0243 I myThid )
364bacbe7c Jean*0244 ELSE
58426debb4 Jean*0245 CALL GAD_C2_ADV_Y( bi,bj,1,vTrans,localT,fMer,myThid )
364bacbe7c Jean*0246 ENDIF
0247
ced0783fba Jean*0248
58426debb4 Jean*0249 IF ( diffKh.NE.zeroRL ) THEN
0250 CALL GAD_DIFF_Y( bi,bj,1, dxG(1-OLx,1-OLy,bi,bj),
0251 I diffKh, localT,
0252 O df, myThid )
0253 IF ( .NOT.cheapamlYperiodic ) THEN
0254 DO j=1,sNy+1
0255 jG = myYGlobalLo-1+(bj-1)*sNy+j
0256 IF ( jG.EQ.1 .OR. jG.EQ.Ny ) THEN
0257
0258
0259 DO i=1-OLx,sNx+OLx
0260 df(i,j) = 0. _d 0
0261 ENDDO
0262 ENDIF
0263 ENDDO
0264 ENDIF
364bacbe7c Jean*0265 DO j=1-OLy,sNy+OLy
0266 DO i=1-OLx,sNx+OLx
58426debb4 Jean*0267 fMer(i,j) = fMer(i,j) + df(i,j)
ced0783fba Jean*0268 ENDDO
cf5b5345a0 Jean*0269 ENDDO
ced0783fba Jean*0270 ENDIF
364bacbe7c Jean*0271
cf5b5345a0 Jean*0272
364bacbe7c Jean*0273 DO j=1-OLy,sNy+OLy-1
0274 DO i=1-OLx,sNx+OLx-1
58426debb4 Jean*0275 gTracer(i,j,bi,bj) =
0276 & -( ( fZon(i+1,j) - fZon(i,j) )
0277 & + ( fMer(i,j+1) - fMer(i,j) )
0278 & )*recip_rA(i,j,bi,bj)
0279 & + horizDiv(i,j)*localT(i,j)
ced0783fba Jean*0280 ENDDO
cf5b5345a0 Jean*0281 ENDDO
364bacbe7c Jean*0282
cf5b5345a0 Jean*0283 RETURN
0284 END