Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:37:34 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
3fd4b811ee Jean*0001 #include "ATM_CPL_OPTIONS.h"
7d490dd46a Jean*0002 
                0003 CBOP
                0004 C     !ROUTINE: ATM_EXPORT_FLD
                0005 C     !INTERFACE:
                0006       SUBROUTINE ATM_EXPORT_FLD(
                0007      I               atmFldName,
                0008      U               atmFld, countTime,
                0009      I               myThid )
                0010 
                0011 C     !DESCRIPTION: \bv
                0012 C     *==========================================================*
                0013 C     | SUBROUTINE ATM_EXPORT_FLD
                0014 C     | o Routine for exporting 1 atmos. field to coupling layer:
                0015 C     |   - compute the time-average (if needed)
                0016 C     |   - send the field to the coupler
                0017 C     |   - reset time and field to zero
                0018 C     *==========================================================*
                0019 C     | This version talks to the MIT Coupler. It uses the MIT
                0020 C     | Coupler "checkpoint1" library calls.
49715ba709 Jean*0021 C     | Note: requires arg. array "atmFld" to be shared
                0022 C     |       (in common block) to work in multi-threaded.
7d490dd46a Jean*0023 C     *==========================================================*
                0024 C     \ev
                0025 
                0026 C     !USES:
                0027       IMPLICIT NONE
                0028 C     == Global variables ==
                0029 #include "SIZE.h"
                0030 #include "EEPARAMS.h"
                0031 
                0032 C     !INPUT/OUTPUT PARAMETERS:
                0033 C     === Routine arguments ===
                0034 C     atmFldName :: atmos. Field identificator name
                0035 C     atmFld     :: array containing the atmospheric Field to export
                0036 C     countTime  :: fractional integrated time
                0037 C     myThid     :: my Thread Id number
                0038       CHARACTER*(*) atmFldName
                0039       _RL     atmFld   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0040       _RL     countTime(nSx,nSy)
                0041       INTEGER myThid
                0042 CEOP
                0043 
49715ba709 Jean*0044 #ifdef COMPONENT_MODULE
                0045 C     !LOCAL VARIABLES:
7d490dd46a Jean*0046 C     == Local variables ==
                0047 C     recipAvT  :: Temp. for holding reciprocal of averaging period.
                0048 C     i,j,bi,bj :: Loop counters
                0049       _RL recipAvT
                0050       INTEGER i,j,bi,bj
                0051 
                0052 C     Convert time integrated heatflux to mean value ready for export.
                0053       DO bj=myByLo(myThid),myByHi(myThid)
                0054        DO bi=myBxLo(myThid),myBxHi(myThid)
                0055         IF ( ABS(countTime(bi,bj) -1. _d 0).GT. 1. _d -12
                0056      &     .AND. countTime(bi,bj) .NE. 0. ) THEN
                0057          recipAvT = 1. _d 0/countTime(bi,bj)
                0058          DO j=1,sNy
                0059           DO i=1,sNx
                0060            atmFld(i,j,bi,bj) = atmFld(i,j,bi,bj)*recipAvT
                0061           ENDDO
                0062          ENDDO
                0063          WRITE(errorMessageUnit,'(3A,2I4,1PE15.8)')
                0064      &     'ATM_EXPORT_FLD: ',atmFldName,' : 1-CountTime=',
                0065      &                             bi,bj,1.-countTime(bi,bj)
                0066         ENDIF
                0067        ENDDO
                0068       ENDDO
                0069 
                0070 C     Send atmos. field to coupling layer.
49715ba709 Jean*0071       _BARRIER
                0072       _BEGIN_MASTER( myThid )
                0073       CALL COMPSEND_R8TILES(
                0074      I              atmFldName, sNx, OLx, sNy, OLy, 1, nSx, nSy,
                0075      I              atmFld )
                0076       _END_MASTER( myThid )
                0077       _BARRIER
7d490dd46a Jean*0078 
                0079 C     Reset atmos. field & integrated time before accumulating again.
                0080       DO bj=myByLo(myThid),myByHi(myThid)
                0081        DO bi=myBxLo(myThid),myBxHi(myThid)
                0082         countTime(bi,bj) = 0.
                0083         DO j=1,sNy
                0084          DO i=1,sNx
                0085           atmFld(i,j,bi,bj) = 0.
                0086          ENDDO
                0087         ENDDO
                0088        ENDDO
                0089       ENDDO
                0090 
49715ba709 Jean*0091 #endif /* COMPONENT_MODULE */
                0092 
7d490dd46a Jean*0093       RETURN
                0094       END