Back to home page

MITgcm

 
 

    


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

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