File indexing completed on 2023-09-03 05:10:44 UTC
view on githubraw file Latest commit 74487008 on 2023-09-03 01:50:18 UTC
e4775240e5 Dimi*0001 #include "SALT_PLUME_OPTIONS.h"
1c8bd9fb65 Gael*0002 #ifdef ALLOW_AUTODIFF
0003 # include "AUTODIFF_OPTIONS.h"
0004 #endif
8c3259a14c Dimi*0005
0006
e4775240e5 Dimi*0007
8c3259a14c Dimi*0008
e4775240e5 Dimi*0009 SUBROUTINE SALT_PLUME_CALC_DEPTH(
8c3259a14c Dimi*0010 I rhoSurf, sigmaR,
0011 I bi, bj, myTime, myIter, myThid )
762bde3a3e Dimi*0012
8c3259a14c Dimi*0013
0014
e4775240e5 Dimi*0015
8c3259a14c Dimi*0016
0017
0018
0019
0020
0021
0022 IMPLICIT NONE
0023
0024 #include "SIZE.h"
0025 #include "EEPARAMS.h"
0026 #include "PARAMS.h"
0027 #include "GRID.h"
0028 #include "SURFACE.h"
0029 #include "DYNVARS.h"
e4775240e5 Dimi*0030 #include "SALT_PLUME.h"
1cd6baa812 Patr*0031 #ifdef ALLOW_AUTODIFF_TAMC
0032 # include "tamc.h"
0033 #endif /* ALLOW_AUTODIFF_TAMC */
8c3259a14c Dimi*0034
0035
0036
0037
0038
0039
0040
0041
0042 _RL rhoSurf(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0043 _RL sigmaR (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0044 INTEGER bi, bj
0045 _RL myTime
0046 INTEGER myIter
0047 INTEGER myThid
7c50f07931 Mart*0048 #ifdef ALLOW_AUTODIFF_TAMC
0049 INTEGER ikey, kkey
0050 #endif
762bde3a3e Dimi*0051
0052
0053 #ifdef ALLOW_SALT_PLUME
8c3259a14c Dimi*0054
0055
0056
0057 INTEGER i,j,k
b5aa60a554 Dimi*0058 _RL rhoBigNb, tmpFac
8c3259a14c Dimi*0059 _RL rhoMxL(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0060 _RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0061 _RL rhoLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
824966555a Dimi*0062 _RL GG, GGm1
0063 _RL SPIND (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
8c3259a14c Dimi*0064
1cd6baa812 Patr*0065 #ifdef ALLOW_AUTODIFF_TAMC
20dee61641 Mart*0066 ikey = bi + (bj-1)*nSx + (ikey_dynamics-1)*nSx*nSy
1cd6baa812 Patr*0067 #endif /* ALLOW_AUTODIFF_TAMC */
0068
552196e76f Gael*0069
8c3259a14c Dimi*0070 DO j=1-Oly,sNy+Oly
0071 DO i=1-Olx,sNx+Olx
0072 SaltPlumeDepth(i,j,bi,bj) = rF(1)-R_low(I,J,bi,bj)
1cd6baa812 Patr*0073 SPIND(i,j) = 0. _d 0
0074 rhoKm1(i,j) = 0. _d 0
0075 rhoMxL(i,j) = 0. _d 0
8c3259a14c Dimi*0076 ENDDO
0077 ENDDO
824966555a Dimi*0078
7448700841 Mart*0079 #ifdef ALLOW_AUTODIFF_TAMC
0080
0081
0082 #endif
552196e76f Gael*0083
824966555a Dimi*0084 IF (CriterionType.EQ.1) THEN
0085
0086 rhoBigNb = rhoConst*1. _d 10
8c3259a14c Dimi*0087 DO j=1-Oly,sNy+Oly
0088 DO i=1-Olx,sNx+Olx
1cd6baa812 Patr*0089 SaltPlumeDepth(i,j,bi,bj) = rF(1)-R_low(I,J,bi,bj)
824966555a Dimi*0090 rhoKm1(i,j) = rhoSurf(i,j)
0091 rhoMxL(i,j) = rhoSurf(i,j) + SaltPlumeCriterion
0092 ENDDO
0093 ENDDO
1cd6baa812 Patr*0094
824966555a Dimi*0095 DO k = 2,Nr
1cd6baa812 Patr*0096 #ifdef ALLOW_AUTODIFF_TAMC
0097 kkey = (ikey-1)*Nr + k
7c50f07931 Mart*0098
1cd6baa812 Patr*0099
7c50f07931 Mart*0100
1cd6baa812 Patr*0101
7c50f07931 Mart*0102
1cd6baa812 Patr*0103
7c50f07931 Mart*0104
1cd6baa812 Patr*0105
0106 #endif
824966555a Dimi*0107
94c8eb5701 Jean*0108 CALL FIND_RHO_2D(
0109 I 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1,
0110 I theta(1-OLx,1-OLy,K,bi,bj), salt(1-OLx,1-OLy,K,bi,bj),
0111 O rhoLoc,
0112 I K, bi, bj, myThid )
824966555a Dimi*0113
0114 DO j=1-Oly,sNy+Oly
0115 DO i=1-Olx,sNx+Olx
0116 IF ( k.LE.klowC(i,j,bi,bj) .AND.
0117 & rhoLoc(i,j).GE.rhoMxL(i,j) ) THEN
0118 IF ( rhoLoc(i,j).GT.rhoKm1(i,j) ) THEN
0119 tmpFac = ( rhoMxL(i,j) - rhoKm1(i,j) )
0120 & / ( rhoLoc(i,j) - rhoKm1(i,j) )
0121 ELSE
0122 tmpFac = 0.
0123 ENDIF
0124 SaltPlumeDepth(i,j,bi,bj) = rF(1)-rC(k-1)+tmpFac*drC(k)
0125 rhoMxL(i,j) = rhoBigNb
8c3259a14c Dimi*0126 ELSE
824966555a Dimi*0127 rhoKm1(i,j) = rhoLoc(i,j)
8c3259a14c Dimi*0128 ENDIF
824966555a Dimi*0129 ENDDO
8c3259a14c Dimi*0130 ENDDO
0131 ENDDO
824966555a Dimi*0132
94c8eb5701 Jean*0133 ELSEIF ( CriterionType.EQ.2 ) THEN
824966555a Dimi*0134
1cd6baa812 Patr*0135 DO j=1-Oly,sNy+Oly
0136 DO i=1-Olx,sNx+Olx
0137 SaltPlumeDepth(i,j,bi,bj) = rF(1)-R_low(I,J,bi,bj)
0138 SPIND(i,j) = 0. _d 0
0139 ENDDO
0140 ENDDO
0141
824966555a Dimi*0142 DO k=2,Nr
1cd6baa812 Patr*0143 #ifdef ALLOW_AUTODIFF_TAMC
0144 kkey = (ikey-1)*Nr + k
7c50f07931 Mart*0145
1cd6baa812 Patr*0146
0147 #endif
824966555a Dimi*0148 DO j=1-Oly,sNy+Oly
0149 DO i=1-Olx,sNx+Olx
0150 GG =-1.0*sigmaR(i,j,k)
0151 GGm1=-1.0*sigmaR(i,j,k-1)
0152 IF ( k.LE.klowC(i,j,bi,bj) .AND.
0153 & GG.GE.SaltPlumeCriterion ) THEN
0154 IF (GGm1.LE.SaltPlumeCriterion) THEN
0155 tmpFac = (SaltPlumeCriterion - GGm1)
0156 & / (GG - GGm1)
0157 IF(SPIND(i,j) .LT. 0.5) THEN
0158 SaltPlumeDepth(i,j,bi,bj) = rF(1)-rC(k-1)+tmpFac*drC(k)
0159 SPIND(i,j)=1.
0160 ENDIF
0161 ELSE
0162 tmpFac = 0.
0163 ENDIF
0164 ENDIF
0165 ENDDO
0166 ENDDO
0167 ENDDO
0168
0169 DO j=1-Oly,sNy+Oly
0170 DO i=1-Olx,sNx+Olx
0171 SaltPlumeDepth(i,j,bi,bj) =
0172 & min( SaltPlumeDepth(i,j,bi,bj)*SPovershoot,
0173 & rF(1)-R_low(i,j,bi,bj) )
0174 ENDDO
0175 ENDDO
552196e76f Gael*0176 ENDIF
0177
0178
0179 DO j=1-Oly,sNy+Oly
0180 DO i=1-Olx,sNx+Olx
0181 SaltPlumeDepth(i,j,bi,bj) =
0182 & min( SaltPlumeDepth(i,j,bi,bj),
0183 & rF(1)-R_low(i,j,bi,bj) )
0184 ENDDO
0185 ENDDO
8c3259a14c Dimi*0186
1f89baba18 Patr*0187
0188
0189
0190
b5aa60a554 Dimi*0191
762bde3a3e Dimi*0192 #endif /* ALLOW_SALT_PLUME */
0193
8c3259a14c Dimi*0194 RETURN
0195 END