/[MITgcm]/MITgcm_contrib/bbl/code/mypackage_calc_rhs.F
ViewVC logotype

Diff of /MITgcm_contrib/bbl/code/mypackage_calc_rhs.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by dimitri, Tue Nov 23 07:06:25 2010 UTC revision 1.3 by dimitri, Sun Mar 6 02:11:05 2011 UTC
# Line 37  C     !OUTPUT PARAMETERS: Line 37  C     !OUTPUT PARAMETERS:
37  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
38  C     i,j       :: Loop indices  C     i,j       :: Loop indices
39  C     kBot      :: k index of bottommost wet grid box  C     kBot      :: k index of bottommost wet grid box
40    C     kLowC1    :: k index of bottommost (i,j) cell
41    C     kLowC2    :: k index of bottommost (i+1,j) or (i,j+1) cell
42    C     kl        :: k index at which to compare 2 cells
43  C     resThk    :: thickness of bottommost wet grid box minus bbl_eta  C     resThk    :: thickness of bottommost wet grid box minus bbl_eta
44  C     resTheta  :: temperature of this residual volume  C     resTheta  :: temperature of this residual volume
45  C     resSalt   :: salinity of this residual volume  C     resSalt   :: salinity of this residual volume
# Line 45  C     deltaDpt  :: depth change Line 48  C     deltaDpt  :: depth change
48  C     bbl_tend  :: temporary variable for tendency terms  C     bbl_tend  :: temporary variable for tendency terms
49  C     sloc      :: salinity of bottommost wet grid box  C     sloc      :: salinity of bottommost wet grid box
50  C     tloc      :: temperature of bottommost wet grid box  C     tloc      :: temperature of bottommost wet grid box
51  C     rholoc    :: Potential density of bottommost wet grid box  C     rholoc    :: in situ density of bottommost wet grid box
52  C     bbl_rho   :: Potential density of bottom boundary layer  C     rhoBBL    :: in situ density of bottom boundary layer
53  C     fZon      :: Zonal flux  C     fZon      :: Zonal flux
54  C     fMer      :: Meridional flux  C     fMer      :: Meridional flux
55        INTEGER i, j, kBot  C     bbl_rho1  :: local (i,j) density
56    C     bbl_rho2  :: local (i+1, j) or (i,j+1) density
57          INTEGER i, j, kBot, kLowC1, kLowC2, kl
58        _RL     resThk, resTheta, resSalt        _RL     resThk, resTheta, resSalt
59        _RL     deltaRho, deltaDpt, bbl_tend        _RL     deltaRho, deltaDpt, bbl_tend
60          _RL     bbl_rho1, bbl_rho2
61        _RL     sloc    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )        _RL     sloc    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )
62        _RL     tloc    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )        _RL     tloc    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )
63        _RL     rholoc  ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )        _RL     rholoc  ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )
64        _RL     bbl_rho ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )        _RL     rhoBBL  ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )
65        _RL     fZon    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )        _RL     fZon    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )
66        _RL     fMer    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )        _RL     fMer    ( 1-Olx:sNx+Olx, 1-Oly:sNy+Oly )
67        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
68  CEOP  CEOP
69    
70  C     Initialize tendency terms and  C     Initialize tendency terms and make local copy of
71  C     make local copy of bottomost temperature and salinity  C     bottomost temperature, salinity, and in-situ desnity
72    C     and of in-situ BBL density
73        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
74         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
75          bbl_TendTheta(i,j,bi,bj) = 0. _d 0          bbl_TendTheta(i,j,bi,bj) = 0. _d 0
76          bbl_TendSalt (i,j,bi,bj) = 0. _d 0          bbl_TendSalt (i,j,bi,bj) = 0. _d 0
77          kBot = max(1,kLowC(i,j,bi,bj))          kBot = max(1,kLowC(i,j,bi,bj))
78          tLoc(i,j) = theta(i,j,kBot,bi,bj)          tLoc(i,j)   = theta(i,j,kBot,bi,bj)
79          sLoc(i,j) = salt (i,j,kBot,bi,bj)          sLoc(i,j)   = salt (i,j,kBot,bi,bj)
80            rholoc(i,j) = rhoInSitu(i,j,kBot,bi,bj)
81            rhoBBL(i,j) = rhoInSitu(i,j,kBot+1, bi,bj)
82         ENDDO         ENDDO
83        ENDDO        ENDDO
84    
 C     Calculate potential density of bottommost wet grid box  
       CALL FIND_RHO_2D(  
      I     1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1,  
      I     tLoc, sLoc,  
      O     rhoLoc,  
      I     1, bi, bj, myThid )  
   
 C     Calculate potential density of bbl  
       CALL FIND_RHO_2D(  
      I     1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1,  
      I     bbl_theta(1-OLx,1-OLy,bi,bj), bbl_salt(1-OLx,1-OLy,bi,bj),  
      O     bbl_rho,  
      I     1, bi, bj, myThid )  
   
85  C==== Compute and apply vertical exchange between BBL and  C==== Compute and apply vertical exchange between BBL and
86  C     residual volume of botommost wet grid box.  C     residual volume of botommost wet grid box.
87  C     This operation does not change total tracer quantity  C     This operation does not change total tracer quantity
# Line 100  C     in botommost wet grid box. Line 95  C     in botommost wet grid box.
95    
96  C     If bbl occupies the complete bottom model grid box or  C     If bbl occupies the complete bottom model grid box or
97  C     if model density is higher than BBL then mix instantly.  C     if model density is higher than BBL then mix instantly.
98           IF ( (resThk.LE.0) .OR. (rhoLoc(i,j).GE.bbl_rho(i,j)) ) THEN           IF ( (resThk.LE.0) .OR. (rhoLoc(i,j).GE.rhoBBL(i,j)) ) THEN
99            bbl_theta(i,j,bi,bj) = tLoc(i,j)            bbl_theta(i,j,bi,bj) = tLoc(i,j)
100            bbl_salt (i,j,bi,bj) = sLoc(i,j)            bbl_salt (i,j,bi,bj) = sLoc(i,j)
101    
# Line 122  C     If model density is lower than BBL Line 117  C     If model density is lower than BBL
117  C==== Compute zonal bbl exchange.  C==== Compute zonal bbl exchange.
118        DO j=1-Oly,sNy+Oly        DO j=1-Oly,sNy+Oly
119         DO i=1-Olx,sNx+Olx-1         DO i=1-Olx,sNx+Olx-1
120          IF ((kLowC(i,j,bi,bj).GT.0).AND.(kLowC(i+1,j,bi,bj).GT.0)) THEN          kLowC1 = kLowC(i,j,bi,bj)
121           deltaRho = bbl_rho(i+1,j) - bbl_rho(i,j)          kLowC2 = kLowC(i+1,j,bi,bj)
122            IF ((kLowC1.GT.0).AND.(kLowC2.GT.0)) THEN
123    C compare the bbl densities at the higher pressure (highest possible density of given t,s)
124    C bbl in situ density is stored in kLowC + 1 index  
125             kl = MAX(kLowC1, kLowC2) + 1
126             bbl_rho1 = rhoInSitu(i,j,kl,bi,bj)
127             bbl_rho2 = rhoInSitu(i+1,j,kl,bi,bj)        
128             deltaRho = bbl_rho2 - bbl_rho1
129           deltaDpt = R_low(i  ,j,bi,bj) + bbl_eta(i  ,j,bi,bj) -           deltaDpt = R_low(i  ,j,bi,bj) + bbl_eta(i  ,j,bi,bj) -
130       &              R_low(i+1,j,bi,bj) - bbl_eta(i+1,j,bi,bj)       &              R_low(i+1,j,bi,bj) - bbl_eta(i+1,j,bi,bj)
131    
# Line 152  C     exchange properties laterally. Line 154  C     exchange properties laterally.
154  C==== Compute meridional bbl exchange.  C==== Compute meridional bbl exchange.
155        DO j=1-Oly,sNy+Oly-1        DO j=1-Oly,sNy+Oly-1
156         DO i=1-Olx,sNx+Olx         DO i=1-Olx,sNx+Olx
157          IF ((kLowC(i,j,bi,bj).GT.0).AND.(kLowC(i,j+1,bi,bj).GT.0)) THEN          kLowC1 = kLowC(i,j,bi,bj)
158           deltaRho = bbl_rho(i,j+1) - bbl_rho(i,j)          kLowC2 = kLowC(i,j+1, bi,bj)
159            IF ((kLowC1.GT.0).AND.(kLowC2.GT.0)) THEN
160    C compare the bbl densities at the higher pressure (highest possible density of given t,s)
161    C bbl in situ density is stored in kLowC + 1 index  
162             kl = MAX(kLowC1, kLowC2) + 1
163             bbl_rho1 = rhoInSitu(i,j,kl,bi,bj)
164             bbl_rho2 = rhoInSitu(i,j+1,kl,bi,bj)        
165             deltaRho = bbl_rho2 - bbl_rho1
166           deltaDpt = R_low(i,j  ,bi,bj) + bbl_eta(i,j  ,bi,bj) -           deltaDpt = R_low(i,j  ,bi,bj) + bbl_eta(i,j  ,bi,bj) -
167       &              R_low(i,j+1,bi,bj) - bbl_eta(i,j+1,bi,bj)       &              R_low(i,j+1,bi,bj) - bbl_eta(i,j+1,bi,bj)
168    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22