| 1 |
dimitri |
1.1 |
C $Header: /u/gcmpack/MITgcm/model/src/calc_oce_mxlayer.F,v 1.2 2007/06/20 23:06:51 jmc Exp $ |
| 2 |
|
|
C $Name: $ |
| 3 |
|
|
|
| 4 |
|
|
#include "PACKAGES_CONFIG.h" |
| 5 |
|
|
#include "CPP_OPTIONS.h" |
| 6 |
|
|
|
| 7 |
|
|
CBOP |
| 8 |
|
|
C !ROUTINE: CALC_OCE_MXLAYER |
| 9 |
|
|
C !INTERFACE: |
| 10 |
|
|
SUBROUTINE CALC_OCE_MXLAYER( |
| 11 |
|
|
I rhoSurf, sigmaR, |
| 12 |
|
|
I bi, bj, myTime, myIter, myThid ) |
| 13 |
|
|
C !DESCRIPTION: \bv |
| 14 |
|
|
C *==========================================================* |
| 15 |
|
|
C | S/R CALC_OCE_MXLAYER |
| 16 |
|
|
C | o Diagnose the Oceanic surface Mixed-Layer |
| 17 |
|
|
C *==========================================================* |
| 18 |
|
|
C \ev |
| 19 |
|
|
|
| 20 |
|
|
C !USES: |
| 21 |
|
|
IMPLICIT NONE |
| 22 |
|
|
C == Global variables == |
| 23 |
|
|
#include "SIZE.h" |
| 24 |
|
|
#include "EEPARAMS.h" |
| 25 |
|
|
#include "PARAMS.h" |
| 26 |
|
|
#include "GRID.h" |
| 27 |
|
|
#include "SURFACE.h" |
| 28 |
|
|
#include "DYNVARS.h" |
| 29 |
|
|
#ifdef ALLOW_GMREDI |
| 30 |
|
|
# include "GMREDI.h" |
| 31 |
|
|
#endif |
| 32 |
|
|
|
| 33 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
| 34 |
|
|
C == Routine Arguments == |
| 35 |
|
|
C rhoSurf :: Surface density anomaly |
| 36 |
|
|
C sigmaR :: Vertical gradient of potential density |
| 37 |
|
|
C bi,bj :: tile indices |
| 38 |
|
|
C myTime :: Current time in simulation |
| 39 |
|
|
C myIter :: Current iteration number in simulation |
| 40 |
|
|
C myThid :: my Thread Id number |
| 41 |
|
|
_RL rhoSurf(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 42 |
|
|
_RL sigmaR (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
| 43 |
|
|
INTEGER bi, bj |
| 44 |
|
|
_RL myTime |
| 45 |
|
|
INTEGER myIter |
| 46 |
|
|
INTEGER myThid |
| 47 |
|
|
|
| 48 |
|
|
C === Functions ==== |
| 49 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
| 50 |
|
|
LOGICAL DIAGNOSTICS_IS_ON |
| 51 |
|
|
EXTERNAL DIAGNOSTICS_IS_ON |
| 52 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
| 53 |
|
|
|
| 54 |
|
|
C !LOCAL VARIABLES: |
| 55 |
|
|
C == Local variables == |
| 56 |
|
|
C i,j :: Loop counters |
| 57 |
|
|
INTEGER i,j,k |
| 58 |
|
|
LOGICAL calcMixLayerDepth |
| 59 |
|
|
INTEGER method |
| 60 |
|
|
_RL dRhoSmall, rhoBigNb |
| 61 |
|
|
_RL rhoMxL(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 62 |
|
|
_RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 63 |
|
|
_RL rhoLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 64 |
|
|
_RL tmpFac, sigmAv |
| 65 |
|
|
CEOP |
| 66 |
|
|
|
| 67 |
|
|
calcMixLayerDepth = .FALSE. |
| 68 |
|
|
#ifdef ALLOW_GMREDI |
| 69 |
|
|
IF ( useGMRedi ) calcMixLayerDepth = GM_taper_scheme.EQ.'fm07' |
| 70 |
|
|
#endif |
| 71 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
| 72 |
|
|
IF ( useDiagnostics.AND. .NOT.calcMixLayerDepth ) THEN |
| 73 |
|
|
calcMixLayerDepth = DIAGNOSTICS_IS_ON('MXLDEPTH',myThid) |
| 74 |
|
|
ENDIF |
| 75 |
|
|
#endif |
| 76 |
|
|
IF ( calcMixLayerDepth ) THEN |
| 77 |
|
|
|
| 78 |
|
|
C-- Select which "method" to use: |
| 79 |
|
|
method = 0 |
| 80 |
|
|
IF ( hMixCriteria.LT.0. ) method = 1 |
| 81 |
|
|
IF ( hMixCriteria.GT.1. ) method = 2 |
| 82 |
|
|
|
| 83 |
|
|
IF ( method.EQ.1 ) THEN |
| 84 |
|
|
|
| 85 |
|
|
C-- First method : |
| 86 |
|
|
C where the potential density (ref.lev=surface) is larger than |
| 87 |
|
|
C surface density plus Delta_Rho = hMixCriteria * Alpha(surf) |
| 88 |
|
|
C = density of water which is -hMixCriteria colder than surface water |
| 89 |
|
|
|
| 90 |
|
|
c hMixCriteria = -0.8 _d 0 |
| 91 |
|
|
dRhoSmall = 1. _d -6 |
| 92 |
|
|
rhoBigNb = rhoConst*1. _d 10 |
| 93 |
|
|
CALL FIND_ALPHA( |
| 94 |
|
|
I bi, bj, 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1, 1, |
| 95 |
|
|
O rhoMxL, myThid ) |
| 96 |
|
|
|
| 97 |
|
|
DO j=1-Oly,sNy+Oly |
| 98 |
|
|
DO i=1-Olx,sNx+Olx |
| 99 |
|
|
rhoKm1(i,j) = rhoSurf(i,j) |
| 100 |
|
|
rhoMxL(i,j) = rhoSurf(i,j) |
| 101 |
|
|
& + MAX( rhoMxL(i,j)*hMixCriteria, dRhoSmall ) |
| 102 |
|
|
hMixLayer(i,j,bi,bj) = rF(1)-R_low(I,J,bi,bj) |
| 103 |
|
|
ENDDO |
| 104 |
|
|
ENDDO |
| 105 |
|
|
DO k = 2,Nr |
| 106 |
|
|
C- potential density (reference level = surface level) |
| 107 |
|
|
CALL FIND_RHO( |
| 108 |
|
|
I bi, bj, 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, K, 1, |
| 109 |
|
|
I theta, salt, |
| 110 |
|
|
O rhoLoc, myThid ) |
| 111 |
|
|
|
| 112 |
|
|
DO j=1-Oly,sNy+Oly |
| 113 |
|
|
DO i=1-Olx,sNx+Olx |
| 114 |
|
|
IF ( k.LE.klowC(i,j,bi,bj) .AND. |
| 115 |
|
|
& rhoLoc(i,j).GE.rhoMxL(i,j) ) THEN |
| 116 |
|
|
IF ( rhoLoc(i,j).GT.rhoKm1(i,j) ) THEN |
| 117 |
|
|
tmpFac = ( rhoMxL(i,j) - rhoKm1(i,j) ) |
| 118 |
|
|
& / ( rhoLoc(i,j) - rhoKm1(i,j) ) |
| 119 |
|
|
ELSE |
| 120 |
|
|
tmpFac = 0. |
| 121 |
|
|
ENDIF |
| 122 |
|
|
hMixLayer(i,j,bi,bj) = rF(1)-rC(k-1)+tmpFac*drC(k) |
| 123 |
|
|
rhoMxL(i,j) = rhoBigNb |
| 124 |
|
|
ELSE |
| 125 |
|
|
rhoKm1(i,j) = rhoLoc(i,j) |
| 126 |
|
|
ENDIF |
| 127 |
|
|
ENDDO |
| 128 |
|
|
ENDDO |
| 129 |
|
|
ENDDO |
| 130 |
|
|
|
| 131 |
|
|
ELSEIF ( method.EQ.2 ) THEN |
| 132 |
|
|
|
| 133 |
|
|
C-- Second method : |
| 134 |
|
|
C where the local stratification exceed the mean stratification above |
| 135 |
|
|
C (from surface down to here) by factor hMixCriteria |
| 136 |
|
|
|
| 137 |
|
|
c hMixCriteria = 2. _d 0 |
| 138 |
|
|
C-Note: dRhoSmall is hard coded for now but should become run-time parameter |
| 139 |
|
|
dRhoSmall = 1. _d -2 |
| 140 |
|
|
DO j=1-Oly,sNy+Oly |
| 141 |
|
|
DO i=1-Olx,sNx+Olx |
| 142 |
|
|
IF ( klowC(i,j,bi,bj) .GT. 0 ) THEN |
| 143 |
|
|
hMixLayer(i,j,bi,bj) = drF(1) |
| 144 |
|
|
rhoMxL(i,j) = 1. |
| 145 |
|
|
ELSE |
| 146 |
|
|
hMixLayer(i,j,bi,bj) = rF(1) |
| 147 |
|
|
rhoMxL(i,j) = -1. |
| 148 |
|
|
ENDIF |
| 149 |
|
|
ENDDO |
| 150 |
|
|
ENDDO |
| 151 |
|
|
DO k = 2,Nr-1 |
| 152 |
|
|
C- potential density (reference level = surface level) |
| 153 |
|
|
CALL FIND_RHO( |
| 154 |
|
|
I bi, bj, 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, K, 1, |
| 155 |
|
|
I theta, salt, |
| 156 |
|
|
O rhoLoc, myThid ) |
| 157 |
|
|
|
| 158 |
|
|
DO j=1-Oly,sNy+Oly |
| 159 |
|
|
DO i=1-Olx,sNx+Olx |
| 160 |
|
|
IF ( k.LT.klowC(i,j,bi,bj) |
| 161 |
|
|
& .AND. rhoMxL(i,j).GE.0. ) THEN |
| 162 |
|
|
sigmAv = ( rhoLoc(i,j)-rhoSurf(i,j)+dRhoSmall ) |
| 163 |
|
|
& / ( rC(1)-rC(k) ) |
| 164 |
|
|
IF ( -sigmaR(i,j,k+1).GT.sigmAv*hMixCriteria ) THEN |
| 165 |
|
|
tmpFac = 0. _d 0 |
| 166 |
|
|
IF ( sigmAv.GT.0. _d 0 ) THEN |
| 167 |
|
|
tmpFac = hMixCriteria*sigmaR(i,j,k)/sigmaR(i,j,k+1) |
| 168 |
|
|
IF ( tmpFac .GT. 1. _d 0 ) THEN |
| 169 |
|
|
tmpFac = 1. _d 0 |
| 170 |
|
|
& + ( tmpFac - 1. _d 0 )/( hMixCriteria - 1. _d 0 ) |
| 171 |
|
|
ENDIF |
| 172 |
|
|
tmpFac = MAX( 0. _d 0, MIN( tmpFac, 2. _d 0 ) ) |
| 173 |
|
|
ENDIF |
| 174 |
|
|
hMixLayer(i,j,bi,bj) = rF(1)-rF(k+1) |
| 175 |
|
|
& - drF(k)*tmpFac*0.5 _d 0 |
| 176 |
|
|
rhoMxL(i,j) = -1. |
| 177 |
|
|
ENDIF |
| 178 |
|
|
ENDIF |
| 179 |
|
|
ENDDO |
| 180 |
|
|
ENDDO |
| 181 |
|
|
ENDDO |
| 182 |
|
|
|
| 183 |
|
|
ELSE |
| 184 |
|
|
STOP 'S/R CALC_OCE_MXLAYER: invalid method' |
| 185 |
|
|
ENDIF |
| 186 |
|
|
|
| 187 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
| 188 |
|
|
IF ( useDiagnostics ) THEN |
| 189 |
|
|
CALL DIAGNOSTICS_FILL( hMixLayer, 'MXLDEPTH', |
| 190 |
|
|
& 0, 1, 1, bi, bj, myThid ) |
| 191 |
|
|
ENDIF |
| 192 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
| 193 |
|
|
|
| 194 |
|
|
C-- end if calcMixLayerDepth |
| 195 |
|
|
ENDIF |
| 196 |
|
|
|
| 197 |
|
|
RETURN |
| 198 |
|
|
END |