Back to home page

MITgcm

 
 

    


File indexing completed on 2023-12-14 06:10:52 UTC

view on githubraw file Latest commit 9af873c5 on 2023-12-13 16:30:10 UTC
89474f9a5c Mart*0001 #include "GGL90_OPTIONS.h"
                0002 
                0003       SUBROUTINE GGL90_CHECK( myThid )
477997464d Jean*0004 C     *==========================================================*
89474f9a5c Mart*0005 C     | SUBROUTINE GGL90_CHECK                                   |
                0006 C     | o Validate basic package setup and inter-package         |
                0007 C     | dependencies.                                            |
477997464d Jean*0008 C     *==========================================================*
89474f9a5c Mart*0009       IMPLICIT NONE
                0010 
                0011 C     === Global variables ===
                0012 #include "SIZE.h"
                0013 #include "EEPARAMS.h"
                0014 #include "PARAMS.h"
37a95f6b42 Davi*0015 #include "GGL90.h"
b038e3cc4f Mart*0016 #ifdef ALLOW_AUTODIFF
                0017 # include "AUTODIFF_PARAMS.h"
                0018 #endif
89474f9a5c Mart*0019 
                0020 C     === Routine arguments ===
9293d3c672 Hajo*0021 C     myThid   :: Number of this instance of GGL90_CHECK
89474f9a5c Mart*0022       INTEGER myThid
                0023 
                0024 #ifdef ALLOW_GGL90
                0025 
                0026 C     === Local variables ===
9293d3c672 Hajo*0027 C     errCount :: error counter
                0028 C     msgBuf   :: Informational/error message buffer
                0029       INTEGER errCount
89474f9a5c Mart*0030       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0031 
9293d3c672 Hajo*0032       _BEGIN_MASTER(myThid)
                0033       errCount = 0
                0034 
89474f9a5c Mart*0035       WRITE(msgBuf,'(A)') 'GGL90_CHECK: #define ALLOW_GGL90'
                0036       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
477997464d Jean*0037      &                    SQUEEZE_RIGHT, myThid )
89474f9a5c Mart*0038 
9293d3c672 Hajo*0039 C     Convective adjustment might be needed even with ggl90
477997464d Jean*0040       IF ( cAdjFreq.NE.0. .OR. ivdc_kappa.NE.0. ) THEN
b4ce400958 Davi*0041          WRITE(msgBuf,'(A)')
37a95f6b42 Davi*0042      &  'GGL90_CHECK: Some form of convection has been enabled'
fdcf8e8616 Gael*0043          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
477997464d Jean*0044      &                       SQUEEZE_RIGHT, myThid )
89474f9a5c Mart*0045       ENDIF
                0046 
37a95f6b42 Davi*0047 #ifdef ALLOW_GGL90_HORIZDIFF
                0048 #ifdef ALLOW_GGL90_SMOOTH
                0049       IF ( GGL90diffTKEh .NE. 0. _d 0 ) THEN
                0050          WRITE(msgBuf,'(A)')
                0051      &      'Horizontal diffusion of TKE and smoothing are both on'
477997464d Jean*0052          CALL PRINT_ERROR( msgBuf, myThid )
9293d3c672 Hajo*0053          errCount = errCount + 1
37a95f6b42 Davi*0054       ENDIF
                0055 #endif
                0056 #else
                0057       IF ( GGL90diffTKEh .NE. 0. _d 0 ) THEN
477997464d Jean*0058          WRITE(msgBuf,'(2A)')
                0059      &      'Define ALLOW_GGL90_HORIZDIFF in GGL90_OPTIONS.h',
                0060      &      ' to get diffusion of TKE'
                0061          CALL PRINT_ERROR( msgBuf, myThid )
9293d3c672 Hajo*0062          errCount = errCount + 1
                0063       ENDIF
                0064 #endif
                0065 #ifndef ALLOW_GGL90_LANGMUIR
                0066       IF (useLANGMUIR ) THEN
                0067          WRITE(msgBuf,'(2A)')
                0068      &      'Define ALLOW_GGL90_LANGMUIR in GGL90_OPTIONS.h',
                0069      &      ' to use Langmuir Parameterization'
                0070          CALL PRINT_ERROR( msgBuf, myThid )
                0071          errCount = errCount + 1
37a95f6b42 Davi*0072       ENDIF
                0073 #endif
                0074 
9293d3c672 Hajo*0075 C     GGL90 needs implicit vertical diffusion and viscosity
                0076       IF (.NOT.implicitDiffusion ) THEN
                0077          WRITE(msgBuf,'(A)')
                0078      &      'GGL90 needs implicitDiffusion to be enabled'
                0079          CALL PRINT_ERROR( msgBuf, myThid )
                0080          errCount = errCount + 1
                0081       ENDIF
                0082       IF (.NOT.implicitViscosity) THEN
                0083          WRITE(msgBuf,'(A)')
                0084      &      'GGL90 needs implicitViscosity to be enabled'
                0085          CALL PRINT_ERROR( msgBuf, myThid )
                0086          errCount = errCount + 1
                0087       ENDIF
                0088 
                0089 C     Limitation of Langmuir Parameterization implementation:
                0090       IF ( useLANGMUIR .AND. useAbsVorticity ) THEN
                0091          WRITE(msgBuf,'(2A)') 'GGL90_CHECK: ',
                0092      &      'with useAbsVorticity, missing Coriolis'
                0093          CALL PRINT_ERROR( msgBuf, myThid )
                0094          WRITE(msgBuf,'(2A)') 'GGL90_CHECK: ',
                0095      &      ' contrib from Langmuir Parameterization'
                0096          CALL PRINT_ERROR( msgBuf, myThid )
9af873c532 Hajo*0097          errCount = errCount + 1
9293d3c672 Hajo*0098       ENDIF
                0099       IF ( useLANGMUIR .AND. useCDscheme ) THEN
                0100          WRITE(msgBuf,'(2A)') 'GGL90_CHECK: ',
                0101      &      'with useCDscheme, missing Coriolis'
                0102          CALL PRINT_ERROR( msgBuf, myThid )
                0103          WRITE(msgBuf,'(2A)') 'GGL90_CHECK: ',
                0104      &      ' contrib from Langmuir Parameterization'
                0105          CALL PRINT_ERROR( msgBuf, myThid )
9af873c532 Hajo*0106          errCount = errCount + 1
9293d3c672 Hajo*0107       ENDIF
                0108 
                0109 C     Compatibility with the use of other pkgs:
89474f9a5c Mart*0110       IF ( useKPP ) THEN
                0111          WRITE(msgBuf,'(A)')
                0112      &      'GGL90 and KPP cannot be turned on at the same time'
477997464d Jean*0113          CALL PRINT_ERROR( msgBuf, myThid )
9293d3c672 Hajo*0114          errCount = errCount + 1
89474f9a5c Mart*0115       ENDIF
                0116 
                0117       IF ( usePP81 ) THEN
477997464d Jean*0118          WRITE(msgBuf,'(A)')
89474f9a5c Mart*0119      &      'GGL90 and PP81 cannot be turned on at the same time'
477997464d Jean*0120          CALL PRINT_ERROR( msgBuf, myThid )
9293d3c672 Hajo*0121          errCount = errCount + 1
89474f9a5c Mart*0122       ENDIF
                0123 
                0124       IF ( useMY82 ) THEN
477997464d Jean*0125          WRITE(msgBuf,'(A)')
89474f9a5c Mart*0126      &      'GGL90 and MY82 cannot be turned on at the same time'
477997464d Jean*0127          CALL PRINT_ERROR( msgBuf, myThid )
9293d3c672 Hajo*0128          errCount = errCount + 1
89474f9a5c Mart*0129       ENDIF
                0130 
b038e3cc4f Mart*0131 #ifdef ALLOW_AUTODIFF
                0132 C     Not everything works stably with AD code
                0133       IF ( useGGL90inAdMode .AND. adMxlMaxFlag .GT. 1 ) THEN
                0134        WRITE(msgBuf,'(2A,L1,A,I2,A)') '** WARNING ** GGL90_CHECK: ',
                0135      &      'useGGL90inAdMode = ', useGGL90inAdMode,
                0136      &      ' with adMxlMaxFlag =', adMxlMaxFlag, ' (> 1)'
                0137        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0138      &                     SQUEEZE_RIGHT, myThid )
                0139        WRITE(msgBuf,'(2A)') '** WARNING ** GGL90_CHECK: ',
                0140      &      'tends to be unstable, use (ad)mxlMaxFlag = 0 or 1.'
                0141        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0142      &                     SQUEEZE_RIGHT, myThid )
                0143       ENDIF
                0144       IF ( useGGL90inAdMode .AND. adMxlMaxFlag .NE. mxlMaxFlag ) THEN
                0145        WRITE(msgBuf,'(2A,I2,A)') '** WARNING ** GGL90_CHECK: ',
                0146      &      'In AD-mode only, using adMxlMaxFlag =', adMxlMaxFlag,
                0147      &      ' (instead of mxlMaxFlag).'
                0148        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0149      &                     SQUEEZE_RIGHT, myThid )
                0150       ENDIF
                0151 #endif
                0152 
9293d3c672 Hajo*0153 C-    Stop cleanly when error was detected
                0154       IF ( errCount.GE.1 ) THEN
                0155          WRITE(msgBuf,'(A,I3,A)')
                0156      &       'GGL90_CHECK: detected', errCount,' fatal error(s)'
477997464d Jean*0157          CALL PRINT_ERROR( msgBuf, myThid )
9293d3c672 Hajo*0158          CALL ALL_PROC_DIE( 0 )
89474f9a5c Mart*0159          STOP 'ABNORMAL END: S/R GGL90_CHECK'
                0160       ENDIF
9293d3c672 Hajo*0161       _END_MASTER(myThid)
89474f9a5c Mart*0162 
                0163 #endif /* ALLOW_GGL90 */
                0164 
477997464d Jean*0165       RETURN
                0166       END