File indexing completed on 2018-03-02 18:41:25 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
050b4366e6 Jean*0001 #include "GMREDI_OPTIONS.h"
0002
0003
0004
0005
0006 SUBROUTINE SUBMESO_CALC_PSI(
0007 I bi, bj, iMin, iMax, jMin, jMax,
0008 I sigmaX, sigmaY, sigmaR,
0009 I locMixLayer,
0010 I myIter, myThid )
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 IMPLICIT NONE
0024
0025
0026 #include "SIZE.h"
0027 #include "GRID.h"
0028 #include "EEPARAMS.h"
0029 #include "PARAMS.h"
0030 #include "GMREDI.h"
0031
0032
0033
37c4687543 Jean*0034 _RL sigmaX(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0035 _RL sigmaY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0036 _RL sigmaR(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0037 _RL locMixLayer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
050b4366e6 Jean*0038 INTEGER bi,bj,iMin,iMax,jMin,jMax
0039 INTEGER myIter
0040 INTEGER myThid
0041
0042
0043 #ifndef GM_EXCLUDE_SUBMESO
0044
0045
0046
0047 INTEGER i,j,k
37c4687543 Jean*0048 _RL mixLayerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0049 _RL mixLayerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0050 _RL dBuoyX_Hu (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0051 _RL dBuoyY_Hv (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0052 _RL NHmixLay (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0053 _RL MsquareH (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0054 _RL lengthScaleF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0055 _RL fcorLoc (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0056 _RL PsiLoc (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0057 _RL dzLoc
0058 #ifdef GM_BOLUS_ADVEC
0059 _RL z2H, mu_z
0060 #endif
050b4366e6 Jean*0061 _RL five_ov21
0062 PARAMETER( five_ov21 = 5. _d 0 / 21. _d 0 )
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
37c4687543 Jean*0076 DO j=1-OLy,sNy+OLy
0077 DO i=1-OLx+1,sNx+OLx
050b4366e6 Jean*0078 mixLayerU(i,j) = op5*( locMixLayer(i-1,j)+locMixLayer(i,j) )
0079 mixLayerU(i,j) = MIN( mixLayerU(i,j), -rLowW(i,j,bi,bj) )
0080 ENDDO
0081 ENDDO
37c4687543 Jean*0082 DO j=1-OLy+1,sNy+OLy
0083 DO i=1-OLx,sNx+OLx
050b4366e6 Jean*0084 mixLayerV(i,j)=op5*( locMixLayer(i,j-1)+locMixLayer(i,j) )
0085 mixLayerV(i,j) = MIN( mixLayerV(i,j), -rLowS(i,j,bi,bj) )
0086 ENDDO
0087 ENDDO
0088
0089
37c4687543 Jean*0090 DO j=1-OLy,sNy+OLy
0091 DO i=1-OLx,sNx+OLx
050b4366e6 Jean*0092 dBuoyX_Hu(i,j)= 0.
0093 dBuoyY_Hv(i,j)= 0.
0094 NHmixLay(i,j) = 0.
0095 fcorLoc(i,j) = SQRT( fCori(i,j,bi,bj)*fCori(i,j,bi,bj)
0096 & + subMeso_invTau*subMeso_invTau )
0097 ENDDO
0098 ENDDO
0099 DO k=1,Nr
37c4687543 Jean*0100 DO j=1-OLy,sNy+OLy
0101 DO i=1-OLx+1,sNx+OLx
050b4366e6 Jean*0102 dzLoc = MAX( 0. _d 0, MIN( drF(k), mixLayerU(i,j)+rF(k) ) )
0103 dBuoyX_Hu(i,j) = dBuoyX_Hu(i,j) + sigmaX(i,j,k)*dzLoc
0104 ENDDO
0105 ENDDO
37c4687543 Jean*0106 DO j=1-OLy+1,sNy+OLy
0107 DO i=1-OLx,sNx+OLx
050b4366e6 Jean*0108 dzLoc = MAX( 0. _d 0, MIN( drF(k), mixLayerV(i,j)+rF(k) ) )
0109 dBuoyY_Hv(i,j) = dBuoyY_Hv(i,j) + sigmaY(i,j,k)*dzLoc
0110 ENDDO
0111 ENDDO
0112 ENDDO
0113 DO k=2,Nr
37c4687543 Jean*0114 DO j=1-OLy,sNy+OLy
0115 DO i=1-OLx,sNx+OLx
050b4366e6 Jean*0116 dzLoc = 0.
0117 IF ( locMixLayer(i,j)+rC(k-1).GE.0. ) dzLoc = drC(k)
0118 NHmixLay(i,j) = NHmixLay(i,j)
0119 & + dzLoc*MAX( -sigmaR(i,j,k), 0. _d 0 )
0120 ENDDO
0121 ENDDO
0122 ENDDO
37c4687543 Jean*0123 DO j=1-OLy,sNy+OLy
0124 DO i=1-OLx,sNx+OLx
050b4366e6 Jean*0125 dBuoyX_Hu(i,j)= -dBuoyX_Hu(i,j)*gravity*recip_rhoConst
0126 dBuoyY_Hv(i,j)= -dBuoyY_Hv(i,j)*gravity*recip_rhoConst
0127 NHmixLay(i,j) = SQRT( NHmixLay(i,j)*gravity*recip_rhoConst
0128 & *locMixLayer(i,j) )
0129 ENDDO
0130 ENDDO
37c4687543 Jean*0131 DO j=2-OLy,sNy+OLy-1
0132 DO i=2-OLx,sNx+OLx-1
050b4366e6 Jean*0133 MsquareH(i,j)= SQRT( op25*(
0134 & (dBuoyX_Hu(i,j) + dBuoyX_Hu(i+1,j))**2
0135 & + (dBuoyY_Hv(i,j) + dBuoyY_Hv(i,j+1))**2
0136 & ) )
0137 ENDDO
0138 ENDDO
0139
37c4687543 Jean*0140 DO j=2-OLy,sNy+OLy-1
0141 DO i=2-OLx,sNx+OLx-1
050b4366e6 Jean*0142 lengthScaleF(i,j)= MAX(
0143 & MsquareH(i,j)/(fcorLoc(i,j)*fcorLoc(i,j)) ,
0144 & NHmixLay(i,j)/fcorLoc(i,j) ,
0145 & subMeso_LfMin )
0146 ENDDO
0147 ENDDO
0148
0149
37c4687543 Jean*0150 DO j=2-OLy,sNy+OLy-1
0151 DO i=3-OLx,sNx+OLx-1
050b4366e6 Jean*0152 PsiLoc(i,j) = -subMeso_Ceff*dBuoyX_Hu(i,j)
0153 & *mixLayerU(i,j)
0154 & *MIN( dxC(i,j,bi,bj), subMeso_Lmax )
0155 & *2. _d 0/(lengthScaleF(i-1,j)+lengthScaleF(i,j))
0156 & *2. _d 0/(fcorLoc(i-1,j)+fcorLoc(i,j))
0157 ENDDO
0158 ENDDO
0159 #ifdef GM_BOLUS_ADVEC
0160 DO k=2,Nr
37c4687543 Jean*0161 DO j=2-OLy,sNy+OLy-1
0162 DO i=3-OLx,sNx+OLx-1
050b4366e6 Jean*0163 IF ( mixLayerU(i,j).GT.0. _d 0 ) THEN
0164 z2H = 2. _d 0*rF(k)/mixLayerU(i,j)
0165 ELSE
0166 z2H = 0. _d 0
0167 ENDIF
0168 mu_z = ( z2H + 1. _d 0 )*( z2H + 1. _d 0 )
0169 mu_z = ( 1. _d 0 - mu_z )*(1. _d 0 + mu_z*five_ov21 )
0170 mu_z = MAX( 0. _d 0, mu_z )
0171 GM_PsiX(i,j,k,bi,bj) = GM_PsiX(i,j,k,bi,bj)
0172 & + mu_z*PsiLoc(i,j)
0173 ENDDO
0174 ENDDO
0175 ENDDO
0176 #endif /* GM_BOLUS_ADVEC */
0177 #ifdef ALLOW_DIAGNOSTICS
0178 IF ( useDiagnostics ) THEN
0179 CALL DIAGNOSTICS_FILL( lengthScaleF, 'SubMesLf',
0180 & 0, 1, 2, bi, bj, myThid )
0181 CALL DIAGNOSTICS_FILL( PsiLoc, 'SubMpsiX',
0182 & 0, 1, 2, bi, bj, myThid )
0183 ENDIF
0184 #endif
0185 IF ( debugLevel.GE.debLevD ) THEN
0186 CALL WRITE_LOCAL_RL( 'subMeso_Lf','I10',1,lengthScaleF,
0187 & bi,bj,1,myIter,myThid )
0188 CALL WRITE_LOCAL_RL( 'subMeso_psiX','I10',1,PsiLoc,
0189 & bi,bj,1,myIter,myThid )
0190 ENDIF
0191
0192
37c4687543 Jean*0193 DO j=3-OLy,sNy+OLy-1
0194 DO i=2-OLx,sNx+OLx-1
050b4366e6 Jean*0195 PsiLoc(i,j) = -subMeso_Ceff*dBuoyY_Hv(i,j)
0196 & *mixLayerV(i,j)
0197 & *MIN( dyC(i,j,bi,bj), subMeso_Lmax )
0198 & *2. _d 0/(lengthScaleF(i,j-1)+lengthScaleF(i,j))
0199 & *2. _d 0/(fcorLoc(i,j-1)+fcorLoc(i,j))
0200 ENDDO
0201 ENDDO
0202 #ifdef GM_BOLUS_ADVEC
0203 DO k=2,Nr
37c4687543 Jean*0204 DO j=3-OLy,sNy+OLy-1
0205 DO i=2-OLx,sNx+OLx-1
050b4366e6 Jean*0206 IF ( mixLayerV(i,j).GT.0. _d 0 ) THEN
0207 z2H = 2. _d 0*rF(k)/mixLayerV(i,j)
0208 ELSE
0209 z2H = 0. _d 0
0210 ENDIF
0211 mu_z = ( z2H + 1. _d 0 )*( z2H + 1. _d 0 )
0212 mu_z = ( 1. _d 0 - mu_z )*(1. _d 0 + mu_z*five_ov21 )
0213 mu_z = MAX( 0. _d 0, mu_z )
0214 GM_PsiY(i,j,k,bi,bj) = GM_PsiY(i,j,k,bi,bj)
0215 & + mu_z*PsiLoc(i,j)
0216 ENDDO
0217 ENDDO
0218 ENDDO
0219 #endif /* GM_BOLUS_ADVEC */
0220 #ifdef ALLOW_DIAGNOSTICS
0221 IF ( useDiagnostics ) THEN
0222 CALL DIAGNOSTICS_FILL( PsiLoc, 'SubMpsiY',
0223 & 0, 1, 2, bi, bj, myThid )
0224 ENDIF
0225 #endif
0226 IF ( debugLevel.GE.debLevD ) THEN
0227 CALL WRITE_LOCAL_RL( 'subMeso_psiY','I10',1,PsiLoc,
0228 & bi,bj,1,myIter,myThid )
0229 ENDIF
0230
0231
0232 #endif /* ndef GM_EXCLUDE_SUBMESO */
0233
0234 RETURN
0235 END