Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:41:11 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
12838c4aff Andr*0001 #include "GAD_OPTIONS.h"
                0002 
                0003 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0004 CBOP
                0005 C !ROUTINE: SALT_FILL
                0006 C !INTERFACE: ==========================================================
                0007       SUBROUTINE SALT_FILL(
ce898dc2d4 Jean*0008      I     uVel, vVel,
                0009      U     salt,
                0010      I     flag,myTime,myIter,myThid)
                0011 
12838c4aff Andr*0012 C !DESCRIPTION:
                0013 C Fills in negatives for the salt (specific humidity) field
                0014 C
                0015 C The algorithm is as follows:
ce898dc2d4 Jean*0016 C
12838c4aff Andr*0017 C Simplest scheme (flag = 1) -> borrow from below and create
                0018 C                               salt if needed at bottom level
ce898dc2d4 Jean*0019 C 'Get it back'   (flag = 2) -> Fill negative of salt by getting it
12838c4aff Andr*0020 C                               back from where it went
ce898dc2d4 Jean*0021 C     If no immediate surrounding value is large enough to fill negative,
                0022 C     the sum of immediate surrounding positive values is tried.
12838c4aff Andr*0023 C     If sum is not large enough, salt is simply set to zero.
                0024 C  NOTE AS OF 6/2/06 -- DO NOT USE FLAG=2 OPTION - NOT WORKING
ce898dc2d4 Jean*0025 
                0026 C     !USES:
                0027       IMPLICIT NONE
                0028 #include "SIZE.h"
                0029 #include "EEPARAMS.h"
                0030 #include "PARAMS.h"
                0031 #include "GRID.h"
                0032 
12838c4aff Andr*0033 C !INPUT PARAMETERS: ===================================================
                0034 C  uVel              :: zonal velocity component
                0035 C  vVel              :: meridional velocity component
                0036 C  salt              :: salt field
                0037 C  flag              :: integer flag telling scheme how to fill
                0038 C  myTime            :: current time
                0039 C  myIter            :: iteration number
                0040 C  myThid            :: thread number
                0041 C !OUTPUT PARAMETERS: ==================================================
ce898dc2d4 Jean*0042 C  salt             :: salt array is replaced
                0043       _RL uVel (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
                0044       _RL vVel (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
                0045       _RL salt (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
12838c4aff Andr*0046       INTEGER flag
                0047       _RL myTime
                0048       INTEGER myIter
                0049       INTEGER myThid
ce898dc2d4 Jean*0050 CEOP
12838c4aff Andr*0051 
ce898dc2d4 Jean*0052 C     !FUNCTIONS:
                0053 c#ifdef ALLOW_DIAGNOSTICS
                0054 c     LOGICAL  DIAGNOSTICS_IS_ON
                0055 c     EXTERNAL DIAGNOSTICS_IS_ON
                0056 c#endif
                0057 
                0058 C     !LOCAL VARIABLES:
                0059       INTEGER bi,bj,i,j,L,LM1
                0060       _RL dpratio
ff44768087 Dimi*0061 #ifdef ALLOW_DIAGNOSTICS
ce898dc2d4 Jean*0062       _RL tmpFac
ff44768087 Dimi*0063 #endif
12838c4aff Andr*0064 
ce898dc2d4 Jean*0065 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
12838c4aff Andr*0066 
                0067       DO bj=myByLo(myThid),myByHi(myThid)
                0068        DO bi=myBxLo(myThid),myBxHi(myThid)
                0069 #ifdef ALLOW_DIAGNOSTICS
ce898dc2d4 Jean*0070 C Fill diagnostic for filling with negative of salt
12838c4aff Andr*0071         IF (useDiagnostics)THEN
ce898dc2d4 Jean*0072           tmpFac = -1. _d 0
                0073           CALL DIAGNOSTICS_SCALE_FILL(salt,tmpFac,1,'SALTFILL',
                0074      &                                   0,Nr,-1,bi,bj,myThid)
12838c4aff Andr*0075         ENDIF
                0076 #endif
                0077 
ce898dc2d4 Jean*0078 c Flag = 1:
12838c4aff Andr*0079 c ---------------------------------
                0080         if(flag.eq.1) then
                0081 
                0082         do L=Nr,2,-1
                0083          LM1 = L-1
                0084          dpratio= rC(L)/rC(LM1)
aa45708003 Andr*0085          do j=1,sNy
                0086          do i=1,sNx
12838c4aff Andr*0087           if( salt(i,j,L,bi,bj).lt.0.0  _d 0) then
                0088            salt(i,j,LM1,bi,bj) = salt(i,j,LM1,bi,bj) +
                0089      .          salt(i,j,L,bi,bj)*dpratio
                0090            salt(i,j,L,bi,bj) = 0.0 _d 0
                0091           endif
                0092          enddo
                0093          enddo
                0094         enddo
                0095 
aa45708003 Andr*0096         do j=1,sNy
                0097         do i=1,sNx
12838c4aff Andr*0098          if(salt(i,j,1,bi,bj).lt.0.0 _d 0)
                0099      .                  salt(i,j,1,bi,bj) = 0.0 _d 0
                0100         enddo
                0101         enddo
                0102 
                0103         else
                0104          print *,'Invalid Flag in salt_fill - nothing done '
                0105         endif
                0106 
                0107 #ifdef ALLOW_DIAGNOSTICS
ce898dc2d4 Jean*0108 C Fill diagnostic for filling with salt - get tendency
                0109         IF ( useDiagnostics ) THEN
                0110           CALL DIAGNOSTICS_FILL(salt,'SALTFILL',0,Nr,1,bi,bj,myThid)
12838c4aff Andr*0111         ENDIF
                0112 #endif
                0113        ENDDO
                0114       ENDDO
                0115 
                0116       RETURN
                0117       END