Back to home page

MITgcm

 
 

    


File indexing completed on 2022-04-10 05:09:16 UTC

view on githubraw file Latest commit 51575f66 on 2022-04-09 20:43:48 UTC
dfe2344b20 Alis*0001 #include "CPP_OPTIONS.h"
                0002 
                0003 CBOP
                0004 C !ROUTINE: CONVECTIVE_WEIGHTS
                0005 C !INTERFACE:
                0006       SUBROUTINE CONVECTIVE_WEIGHTS(
73d49f19f9 Jean*0007      I                              bi, bj, k, rhoKm1, rhoK,
                0008      O                              weightA, weightB, convectCount,
                0009      I                              myThid )
                0010 
dfe2344b20 Alis*0011 C !DESCRIPTION:
                0012 C Calculates the weights used to represent convective mixing
                0013 C between two layers.
73d49f19f9 Jean*0014 C
dfe2344b20 Alis*0015 C Mixing is represented by:
73d49f19f9 Jean*0016 C                       T(k-1) = T(k-1) + A * ( T(k) - T(k-1) )
                0017 C                       T(k)   = T(k)   + B * ( T(k-1) - T(k) )
dfe2344b20 Alis*0018 C
                0019 C In the stable case, A = B = 0
                0020 C In the unstable case, A and B are non-zero and are chosen so as to
                0021 C conserve total volume of T.
                0022 
4dba04e5f3 Alis*0023 C !USES:
dfe2344b20 Alis*0024       IMPLICIT NONE
                0025 #include "SIZE.h"
                0026 #include "EEPARAMS.h"
                0027 #include "PARAMS.h"
                0028 #include "GRID.h"
                0029 
4dba04e5f3 Alis*0030 C !INPUT/OUTPUT PARAMETERS:
73d49f19f9 Jean*0031 C     bi,bj,k :: indices
                0032 C     rhoKm1  :: rho in level k-1
                0033 C     rhoK    :: rho in level  k
                0034 C     weightA :: weight for tracer @ level k-1
                0035 C     weightB :: weight for tracer @ level  k
                0036 C     convectCount :: counter to diagnose where convection occurs
                0037 C     myThid  :: my Thread Id number
dfe2344b20 Alis*0038       INTEGER bi,bj,k
73d49f19f9 Jean*0039       _RL rhoKm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0040       _RL rhoK   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
dfe2344b20 Alis*0041       _RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0042       _RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73d49f19f9 Jean*0043       _RL convectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
dfe2344b20 Alis*0044       INTEGER myThid
                0045 
51575f66de Mart*0046 #if (defined INCLUDE_CONVECT_CALL || defined INCLUDE_CONVECT_INI_CALL)
dfe2344b20 Alis*0047 
4dba04e5f3 Alis*0048 C !LOCAL VARIABLES:
dfe2344b20 Alis*0049 C     i,j      :: Loop counter
                0050 C     dS,d1,d2 :: Layer thicknesses
                0051       INTEGER i,j
                0052       _RL dS,d1,d2
                0053 CEOP
                0054 
73d49f19f9 Jean*0055       DO j=1-OLy,sNy+OLy
                0056        DO i=1-OLx,sNx+OLx
                0057          IF ( _hFacC(i,j,k-1,bi,bj)* _hFacC(i,j,k,bi,bj) .GT. 0. .AND.
                0058      &        (rhok(i,j)-rhokm1(i,j))*rkSign*gravitySign .LT. 0.
9e5f2093d3 Alis*0059      &      ) THEN
dfe2344b20 Alis*0060 
                0061 C      Where statically unstable, mix the tracers conserving volume
                0062           d1 = _hFacC(i,j,k-1,bi,bj)*drF(k-1)
                0063           d2 = _hFacC(i,j, k ,bi,bj)*drF( k )
                0064           dS = d1+d2
                0065           weightA(i,j) = d2/dS
                0066           weightB(i,j) = d1/dS
73d49f19f9 Jean*0067           convectCount(i,j,k) = 1.
dfe2344b20 Alis*0068          ELSE
                0069 C      Where statically stable, do nothing
                0070           weightA(i,j) = 0.
                0071           weightB(i,j) = 0.
73d49f19f9 Jean*0072           convectCount(i,j,k) = 0.
dfe2344b20 Alis*0073          ENDIF
                0074        ENDDO
                0075       ENDDO
                0076 
51575f66de Mart*0077 #endif /* INCLUDE_CONVECT_CALL or INCLUDE_CONVECT_INI_CALL */
dfe2344b20 Alis*0078 
                0079       RETURN
                0080       END