File indexing completed on 2018-03-02 18:43:52 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
aea29c8517 Alis*0001 #include "SHAP_FILT_OPTIONS.h"
ae409e69d3 Jean*0002
15c70d7cd1 Jean*0003
0004
0005
0006 SUBROUTINE SHAP_FILT_TRACER_S2(
0007 U field, tmpFld,
e93c2e7dac Jean*0008 I nShapTr, exchInOut, kSize,
0009 I myTime, myIter, myThid )
15c70d7cd1 Jean*0010
0011
0012
0013
0014
0015
0016
0017
0018
ae409e69d3 Jean*0019
15c70d7cd1 Jean*0020
aea29c8517 Alis*0021 IMPLICIT NONE
ae409e69d3 Jean*0022
aea29c8517 Alis*0023
0024 #include "SIZE.h"
0025 #include "EEPARAMS.h"
0026 #include "PARAMS.h"
0027 #include "GRID.h"
0028 #include "SHAP_FILT.h"
0029
15c70d7cd1 Jean*0030
aea29c8517 Alis*0031
e93c2e7dac Jean*0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
8a5457c6b4 Jean*0045 INTEGER kSize
15c70d7cd1 Jean*0046 _RL field(1-OLx:sNx+OLx,1-OLy:sNy+OLy,kSize,nSx,nSy)
0047 _RL tmpFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,kSize,nSx,nSy)
8a5457c6b4 Jean*0048 INTEGER nShapTr, exchInOut
aea29c8517 Alis*0049 _RL myTime
e93c2e7dac Jean*0050 INTEGER myIter
aea29c8517 Alis*0051 INTEGER myThid
ae409e69d3 Jean*0052
aea29c8517 Alis*0053 #ifdef ALLOW_SHAP_FILT
0054
15c70d7cd1 Jean*0055
aea29c8517 Alis*0056
8edc6fec00 Jean*0057 INTEGER nShapComput
0058 INTEGER bi,bj,k,i,j,n
aea29c8517 Alis*0059 _RL tmpGrd(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
8edc6fec00 Jean*0060 _RL tmpFdx(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0061 _RL tmpFdy(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
15c70d7cd1 Jean*0062
aea29c8517 Alis*0063
e93c2e7dac Jean*0064 IF ( exchInOut.LT.0 .OR. exchInOut.GT.3 ) THEN
0065 STOP 'S/R SHAP_FILT_TRACER_S2: exchInOut is wrong'
0066 ENDIF
0067
ae409e69d3 Jean*0068 IF (nShapTr.GT.0) THEN
e64f43ca56 Jean*0069
0070
8edc6fec00 Jean*0071
e64f43ca56 Jean*0072
8edc6fec00 Jean*0073 nShapComput = nShapTr - nShapTrPhys
aea29c8517 Alis*0074
0075 DO bj=myByLo(myThid),myByHi(myThid)
0076 DO bi=myBxLo(myThid),myBxHi(myThid)
8edc6fec00 Jean*0077 DO k=1,kSize
41b8eb6e45 Jean*0078 DO j=1-OLy,sNy+OLy
0079 DO i=1-OLx,sNx+OLx
aea29c8517 Alis*0080 tmpFld(i,j,k,bi,bj)=field(i,j,k,bi,bj)
0081 ENDDO
0082 ENDDO
0083 ENDDO
0084 ENDDO
0085 ENDDO
0086
8edc6fec00 Jean*0087
aea29c8517 Alis*0088
8edc6fec00 Jean*0089 DO n=1,nShapTr
aea29c8517 Alis*0090
e93c2e7dac Jean*0091 IF ( ( MOD(n,2).EQ.1 .OR. Shap_alwaysExchTr ) .AND.
0092 & ( n.GE.2 .OR. MOD(exchInOut,2).EQ.1 ) ) THEN
8edc6fec00 Jean*0093 IF (kSize.EQ.Nr) THEN
7163a40534 Jean*0094 _EXCH_XYZ_RL( tmpFld, myThid )
8edc6fec00 Jean*0095 ELSEIF (kSize.EQ.1) THEN
7163a40534 Jean*0096 _EXCH_XY_RL( tmpFld, myThid )
8edc6fec00 Jean*0097 ELSE
0098 STOP 'S/R SHAP_FILT_TRACER_S2: kSize is wrong'
0099 ENDIF
15c70d7cd1 Jean*0100 ENDIF
ae409e69d3 Jean*0101
aea29c8517 Alis*0102 DO bj=myByLo(myThid),myByHi(myThid)
0103 DO bi=myBxLo(myThid),myBxHi(myThid)
8edc6fec00 Jean*0104 DO k=1,kSize
aea29c8517 Alis*0105
8edc6fec00 Jean*0106
aea29c8517 Alis*0107
8edc6fec00 Jean*0108
41b8eb6e45 Jean*0109 #ifndef ALLOW_AUTODIFF
8edc6fec00 Jean*0110 IF ( .NOT.Shap_alwaysExchTr
0111 & .AND. useCubedSphereExchange ) THEN
0112
93e3461d85 Jean*0113 CALL FILL_CS_CORNER_TR_RL( 1, .FALSE.,
41b8eb6e45 Jean*0114 & tmpFld(1-OLx,1-OLy,k,bi,bj),
8edc6fec00 Jean*0115 & bi,bj, myThid )
0116 ENDIF
e13cb171e9 Jean*0117 #endif
8edc6fec00 Jean*0118 IF ( n.LE.nShapComput ) THEN
0119
0120 DO j=0,sNy+1
0121 DO i=0,sNx+2
e93c2e7dac Jean*0122 tmpFdx(i,j) =
8edc6fec00 Jean*0123 & ( tmpFld(i,j,k,bi,bj)-tmpFld(i-1,j,k,bi,bj) )
0124 & *_maskW(i,j,k,bi,bj)
0125 ENDDO
0126 ENDDO
0127 ELSE
0128
0129 DO j=0,sNy+1
0130 DO i=0,sNx+2
e93c2e7dac Jean*0131 tmpFdx(i,j) =
8edc6fec00 Jean*0132 & ( tmpFld(i,j,k,bi,bj)-tmpFld(i-1,j,k,bi,bj) )
0133 & *_hFacW(i,j,k,bi,bj)
0134 & *dyG(i,j,bi,bj)*recip_dxC(i,j,bi,bj)
0135 ENDDO
0136 ENDDO
0137 ENDIF
e64f43ca56 Jean*0138
8edc6fec00 Jean*0139
41b8eb6e45 Jean*0140 #ifndef ALLOW_AUTODIFF
8edc6fec00 Jean*0141 IF ( .NOT.Shap_alwaysExchTr
0142 & .AND. useCubedSphereExchange ) THEN
0143
93e3461d85 Jean*0144 CALL FILL_CS_CORNER_TR_RL( 2, .FALSE.,
41b8eb6e45 Jean*0145 & tmpFld(1-OLx,1-OLy,k,bi,bj),
8edc6fec00 Jean*0146 & bi,bj, myThid )
0147 ENDIF
e13cb171e9 Jean*0148 #endif
8edc6fec00 Jean*0149 IF ( n.LE.nShapComput ) THEN
0150
0151 DO j=0,sNy+2
0152 DO i=0,sNx+1
e93c2e7dac Jean*0153 tmpFdy(i,j) =
8edc6fec00 Jean*0154 & ( tmpFld(i,j,k,bi,bj)-tmpFld(i,j-1,k,bi,bj) )
0155 & *_maskS(i,j,k,bi,bj)
0156 ENDDO
0157 ENDDO
0158 ELSE
0159
0160 DO j=0,sNy+2
0161 DO i=0,sNx+1
e93c2e7dac Jean*0162 tmpFdy(i,j) =
8edc6fec00 Jean*0163 & ( tmpFld(i,j,k,bi,bj)-tmpFld(i,j-1,k,bi,bj) )
0164 & *_hFacS(i,j,k,bi,bj)
0165 & *dxG(i,j,bi,bj)*recip_dyC(i,j,bi,bj)
0166 ENDDO
0167 ENDDO
0168 ENDIF
aea29c8517 Alis*0169
8edc6fec00 Jean*0170
0171 DO j=0,sNy+1
0172 DO i=0,sNx+1
0173 tmpGrd(i,j) = ( tmpFdx(i+1,j) - tmpFdx(i,j) )
0174 & + ( tmpFdy(i,j+1) - tmpFdy(i,j) )
0175 ENDDO
e64f43ca56 Jean*0176 ENDDO
0177
e93c2e7dac Jean*0178
8edc6fec00 Jean*0179 IF ( n.LE.nShapComput ) THEN
0180 DO j=0,sNy+1
0181 DO i=0,sNx+1
0182 tmpFld(i,j,k,bi,bj) = -0.125*tmpGrd(i,j)
0183 ENDDO
0184 ENDDO
e93c2e7dac Jean*0185
8edc6fec00 Jean*0186 ELSEIF (Shap_TrLength.LE.0.) THEN
0187 DO j=0,sNy+1
0188 DO i=0,sNx+1
0189 tmpFld(i,j,k,bi,bj) = -0.125*tmpGrd(i,j)
0190 & *recip_hFacC(i,j,k,bi,bj)
0191 ENDDO
e64f43ca56 Jean*0192 ENDDO
0193 ELSE
8edc6fec00 Jean*0194 DO j=0,sNy+1
0195 DO i=0,sNx+1
0196 tmpFld(i,j,k,bi,bj) = -0.125*tmpGrd(i,j)
0197 & *recip_hFacC(i,j,k,bi,bj)*recip_rA(i,j,bi,bj)
0198 & *Shap_TrLength*Shap_TrLength
0199 ENDDO
e64f43ca56 Jean*0200 ENDDO
0201 ENDIF
8edc6fec00 Jean*0202
e64f43ca56 Jean*0203
8edc6fec00 Jean*0204
e64f43ca56 Jean*0205 ENDDO
0206 ENDDO
0207 ENDDO
8edc6fec00 Jean*0208
aea29c8517 Alis*0209 ENDDO
0210
15c70d7cd1 Jean*0211
aea29c8517 Alis*0212 DO bj=myByLo(myThid),myByHi(myThid)
0213 DO bi=myBxLo(myThid),myBxHi(myThid)
8edc6fec00 Jean*0214 DO k=1,kSize
0215 DO j=1,sNy
0216 DO i=1,sNx
e64f43ca56 Jean*0217 field(i,j,k,bi,bj)=field(i,j,k,bi,bj)
6824f48020 Jean*0218 & -tmpFld(i,j,k,bi,bj)*dTtracerLev(1)/Shap_Trtau
0219 tmpFld(i,j,k,bi,bj)= -tmpFld(i,j,k,bi,bj)/Shap_Trtau
aea29c8517 Alis*0220 ENDDO
0221 ENDDO
0222 ENDDO
0223 ENDDO
0224 ENDDO
0225
e93c2e7dac Jean*0226 IF ( exchInOut.GE.2 ) THEN
0227 IF (kSize.EQ.Nr) THEN
7163a40534 Jean*0228 _EXCH_XYZ_RL( field, myThid )
e93c2e7dac Jean*0229 ELSEIF (kSize.EQ.1) THEN
7163a40534 Jean*0230 _EXCH_XY_RL( field, myThid )
e93c2e7dac Jean*0231 ELSE
0232 STOP 'S/R SHAP_FILT_TRACER_S2: kSize is wrong'
0233 ENDIF
0234 ENDIF
aea29c8517 Alis*0235
0236 ENDIF
0237 #endif /* ALLOW_SHAP_FILT */
0238
0239 RETURN
0240 END