Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:42:48 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
31ebb84b18 Jean*0001 #include "OCN_CPL_OPTIONS.h"
                0002 
                0003 CBOP 0
                0004 C !ROUTINE: OCN_CHECK_CPLCONFIG
                0005 
                0006 C !INTERFACE:
                0007       SUBROUTINE OCN_CHECK_CPLCONFIG(
                0008      U                        errFlag, errMsg,
                0009      I                        myThid )
                0010 
                0011 C !DESCRIPTION:
                0012 C     *==========================================================*
                0013 C     | SUBROUTINE OCN_CHECK_CPLCONFIG
                0014 C     | o Check for inconsistency in coupling set-up config
                0015 C     *==========================================================*
                0016 C     | The routine checks on consistent coupler-exchange config
                0017 C     |  and performs some basic checking on consistency between
                0018 C     |  components (e.g., land-sea mask);
                0019 C     | Also summarises coupling set-up config and output fields
                0020 C     |  that were imported
                0021 C     *==========================================================*
                0022 
                0023 C !USES:
                0024       IMPLICIT NONE
                0025 C     == Global variables ==
                0026 #include "SIZE.h"
                0027 #include "EEPARAMS.h"
                0028 #include "PARAMS.h"
                0029 #include "GRID.h"
                0030 #include "CPL_PARAMS.h"
                0031 #include "OCNCPL.h"
                0032 
                0033 C !INPUT/OUTPUT PARAMETERS:
                0034 C     errFlag  :: logical flag to report an error
                0035 C     errMsg   :: error message to print to clog file
                0036 C     myThid   :: Thread number for this instance of the routine
                0037       LOGICAL errFlag
                0038       CHARACTER*(*) errMsg
                0039       INTEGER myThid
                0040 
                0041 C !LOCAL VARIABLES:
                0042       INTEGER i, j, bi, bj
                0043       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0044       _RL atm_waterOnly, atm_landOnly, depth_noWater
                0045 CEOP
                0046 
                0047 C--   Summarise fields that were imported.
                0048 C     o Plot atmosphere land-mask
                0049       IF ( debugLevel.GE.debLevB ) THEN
                0050         CALL WRITE_FLD_XY_RL( 'Atm_Land', ' ', landMask, 0, myThid )
                0051       ENDIF
a24915ab1a Jean*0052       IF ( plotLevel.GE.debLevC ) THEN
31ebb84b18 Jean*0053         CALL PLOT_FIELD_XYRL( landMask,
                0054      &                  'Atmosphere land/sea mask on ocean grid',
                0055      &                  1, myThid )
                0056       ENDIF
                0057 
                0058 C--   Report previously found errors
                0059       _BEGIN_MASTER( myThid )
                0060 
                0061       IF ( cplErrorCount.NE.0 ) THEN
                0062         errFlag = .TRUE.
                0063         WRITE(msgBuf,'(2A,I4,A)') 'OCN_CHECK_CPLCONFIG: ',
                0064      &    ' cplErrorCount=', cplErrorCount, ' (from previous error)'
                0065         CALL PRINT_ERROR( msgBuf, myThid )
                0066       ENDIF
                0067 
                0068 C--   Do consistency checks on imported fields.
                0069 C     o Check that:
                0070 C      a) where land/sea mask is "water-only", this should be a wet ocean pts
                0071 C      b) where land/sea mask has "no water",  this should be a dry ocean pts
                0072       atm_waterOnly = 0. _d 0
                0073       atm_landOnly  = 1. _d 0
                0074       depth_noWater = 0. _d 0
                0075       DO bj=1,nSy
                0076        DO bi=1,nSx
                0077         DO j=1,sNy
                0078          DO i=1,sNx
                0079           IF ( ( landMask(i,j,bi,bj) .EQ. atm_waterOnly
                0080      &        .AND. R_low(i,j,bi,bj) .EQ. depth_noWater )
                0081      &    .OR. ( landMask(i,j,bi,bj) .EQ. atm_landOnly
                0082      &        .AND. R_low(i,j,bi,bj) .NE. depth_noWater ) ) THEN
                0083            errFlag = .TRUE.
                0084            WRITE(msgBuf,'(2(A,I6),2(A,I4),A)')
                0085      &     'Inconsistent land/sea mask @ (i=', i, ',j=', j,
                0086      &                              ',bi=', bi, ',bj=', bj, ')'
                0087            CALL PRINT_ERROR( msgBuf, myThid )
                0088            WRITE(msgBuf,'(A,E30.15)')
                0089      &     'Land (atmosphere) ==', landMask(i,j,bi,bj)
                0090            CALL PRINT_ERROR( msgBuf, myThid )
                0091            WRITE(msgBuf,'(A,E30.15)')
                0092      &     'Depth (ocean)     ==', R_low(i,j,bi,bj)
                0093            CALL PRINT_ERROR( msgBuf, myThid )
                0094           ENDIF
                0095          ENDDO
                0096         ENDDO
                0097        ENDDO
                0098       ENDDO
                0099 
                0100       IF ( errFlag ) WRITE(errMsg,'(A)')
                0101      &   'OCN_CHECK_CPLCONFIG: inconsistent OCN/CPL/ATM config'
                0102 
                0103       _END_MASTER( myThid )
                0104 
                0105       RETURN
                0106       END