Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:44:35 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
30e883b651 Jean*0001 #include "CPP_EEOPTIONS.h"
37c5e7e634 Jean*0002 
                0003 CStartofinterface
                0004       SUBROUTINE TIMEAVE_CUMUL_2VFC( 
                0005      O   fldtave,
873fffa31d Patr*0006      I   fld1, fld2, fld3, Ksize, dir, deltaTloc,
37c5e7e634 Jean*0007      I   bi, bj, myThid )
                0008 C     /==========================================================\
                0009 C     | SUBROUTINE TIMEAVE_CUMUL_2VFC                            |
                0010 C     | o Sum over time a product of 2 fields and 1 factor array |
                0011 C     |   depending on the relative position on the grid of the  |
                0012 C     |    2nd field & factor (tracer_grid, u_grid, v_grid).     |
                0013 C     |   The first array is on tracer_grid or at same position  |
                0014 C     |    as the 2 others ; 2nd and 3rd always at same position |
                0015 C     \==========================================================/
                0016       IMPLICIT NONE
                0017 
                0018 C     == Global variables ===
                0019 #include "SIZE.h"
                0020 #include "EEPARAMS.h"
                0021 
                0022 C     == Routine arguments ==
                0023 C     myThid - Thread number for this instance of the routine.
                0024 C     fldtave - time averaged Field
                0025 C     fld1,fld2 - Input fields
                0026 C     fld3  - Input factor
                0027 C     dir - type of grid for 2nd field and factor, relatively to the 1rst :
                0028 C         0: same location ; 1: zonal,West ;  2: merid, South 
                0029 C     Ksize - 3rd dimension of local arrays (Input and Output fields)
                0030       INTEGER Ksize, dir
                0031       _RL fld1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Ksize,nSx,nSy)
                0032       _RL fld2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Ksize,nSx,nSy)
                0033       _RS fld3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Ksize,nSx,nSy)
                0034       _RL fldtave(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Ksize,nSx,nSy)
873fffa31d Patr*0035       _RL deltaTloc
37c5e7e634 Jean*0036       INTEGER bi, bj, myThid
                0037 
                0038 CEndofinterface
                0039 
                0040 C     == Local variables ==
                0041 C     i,j,k,bi,bj  - Loop counters
                0042       INTEGER i, j, k
                0043  
                0044       IF ( dir.eq.0 ) THEN 
                0045 
                0046 C     DO bj = myByLo(myThid), myByHi(myThid)
                0047 C      DO bi = myBxLo(myThid), myBxHi(myThid)
                0048         DO k=1,Ksize
                0049          DO j=1,sNy
                0050           DO i=1,sNx
873fffa31d Patr*0051             fldtave(i,j,k,bi,bj) = fldtave(i,j,k,bi,bj) + deltaTloc*
37c5e7e634 Jean*0052      &         fld1(i,j,k,bi,bj)*fld2(i,j,k,bi,bj)*fld3(i,j,k,bi,bj)
                0053            ENDDO
                0054           ENDDO
                0055          ENDDO
                0056 C       ENDDO
                0057 C      ENDDO
                0058 
                0059       ELSEIF ( dir.eq.1 )  THEN
                0060  
                0061 C     DO bj = myByLo(myThid), myByHi(myThid)
                0062 C      DO bi = myBxLo(myThid), myBxHi(myThid)
                0063         DO k=1,Ksize
                0064          DO j=1,sNy
                0065           DO i=1,sNx
873fffa31d Patr*0066             fldtave(i,j,k,bi,bj) = fldtave(i,j,k,bi,bj) + deltaTloc*
37c5e7e634 Jean*0067      &         0.5*( fld1(i-1,j,k,bi,bj) + fld1(i,j,k,bi,bj) )
                0068      &            *fld2(i,j,k,bi,bj)*fld3(i,j,k,bi,bj)
                0069            ENDDO
                0070           ENDDO
                0071          ENDDO
                0072 C       ENDDO
                0073 C      ENDDO
                0074 
                0075       ELSEIF ( dir.eq.2 ) THEN
                0076  
                0077 C     DO bj = myByLo(myThid), myByHi(myThid)
                0078 C      DO bi = myBxLo(myThid), myBxHi(myThid)
                0079         DO k=1,Ksize
                0080          DO j=1,sNy
                0081           DO i=1,sNx
873fffa31d Patr*0082             fldtave(i,j,k,bi,bj) = fldtave(i,j,k,bi,bj) + deltaTloc*
37c5e7e634 Jean*0083      &         0.5*( fld1(i,j-1,k,bi,bj) + fld1(i,j,k,bi,bj) )
                0084      &            *fld2(i,j,k,bi,bj)*fld3(i,j,k,bi,bj)
                0085            ENDDO
                0086           ENDDO
                0087          ENDDO
                0088 C       ENDDO
                0089 C      ENDDO
                0090 
                0091       ENDIF
                0092 
                0093       RETURN
                0094       END