Back to home page

MITgcm

 
 

    


File indexing completed on 2021-11-06 05:17:51 UTC

view on githubraw file Latest commit 75c5b64b on 2021-11-03 02:00:03 UTC
508ee73e24 Mart*0001 #include "GCHEM_OPTIONS.h"
                0002 
e46e994325 Jean*0003 CBOP
                0004 C     !ROUTINE: GCHEM_CHECK
                0005 C     !INTERFACE:
508ee73e24 Mart*0006       SUBROUTINE GCHEM_CHECK( myThid )
e46e994325 Jean*0007 C     !DESCRIPTION: \bv
5c5997ced8 Jean*0008 C     *==========================================================*
                0009 C     | SUBROUTINE GCHEM_CHECK
                0010 C     | o Validate basic package setup and inter-package
a6c1c05757 Jean*0011 C     |   dependencies.
5c5997ced8 Jean*0012 C     *==========================================================*
e46e994325 Jean*0013 C     \ev
508ee73e24 Mart*0014 
e46e994325 Jean*0015 C     !USES:
                0016       IMPLICIT NONE
508ee73e24 Mart*0017 C     === Global variables ===
                0018 #include "SIZE.h"
                0019 #include "EEPARAMS.h"
                0020 #include "PARAMS.h"
96e2a5a610 Davi*0021 #include "GCHEM.h"
e46e994325 Jean*0022 #ifdef ALLOW_CFC
                0023 # include "CFC_SIZE.h"
                0024 #endif
                0025 #ifdef ALLOW_SPOIL
                0026 # include "SPOIL_SIZE.h"
                0027 #endif
                0028 #include "GCHEM_SIZE.h"
                0029 #ifdef ALLOW_PTRACERS
                0030 # include "PTRACERS_SIZE.h"
                0031 # include "PTRACERS_PARAMS.h"
                0032 #endif
508ee73e24 Mart*0033 
e46e994325 Jean*0034 C     !INPUT/OUTPUT PARAMETERS:
                0035 C     myThid   :: My Thread Id number
508ee73e24 Mart*0036       INTEGER myThid
                0037 
                0038 #ifdef ALLOW_GCHEM
e46e994325 Jean*0039 C     !LOCAL VARIABLES:
5c5997ced8 Jean*0040 C     msgBuf   :: Informational/error message buffer
508ee73e24 Mart*0041       CHARACTER*(MAX_LEN_MBUF) msgBuf
e46e994325 Jean*0042       INTEGER errCount
                0043       INTEGER nb_tendTr
                0044 CEOP
                0045 
                0046 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
508ee73e24 Mart*0047 
6b9e7a8805 Jean*0048       _BEGIN_MASTER(myThid)
e46e994325 Jean*0049       errCount = 0
6b9e7a8805 Jean*0050 
e46e994325 Jean*0051       WRITE(msgBuf,'(2A)') 'GCHEM_CHECK ',
                0052      &                     ' --> Starts to check GCHEM set-up'
508ee73e24 Mart*0053       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
e46e994325 Jean*0054      &                    SQUEEZE_RIGHT, myThid )
508ee73e24 Mart*0055 
e46e994325 Jean*0056 C--   Check GCHEM Options and Parameters:
                0057 
                0058 #ifndef GCHEM_ADD2TR_TENDENCY
5c5997ced8 Jean*0059       IF ( useCFC ) THEN
e46e994325 Jean*0060         WRITE(msgBuf,'(A)') 'GCHEM_ADD2TR_TENDENCY needed to use CFC'
                0061         CALL PRINT_ERROR( msgBuf, myThid )
                0062         errCount = errCount + 1
5c5997ced8 Jean*0063       ENDIF
e46e994325 Jean*0064 #endif /* ndef GCHEM_ADD2TR_TENDENCY */
                0065 
                0066 #ifndef GCHEM_SEPARATE_FORCING
8d459f0cbe Jean*0067       IF ( useDIC ) THEN
                0068         WRITE(msgBuf,'(A)') 'GCHEM_SEPARATE_FORCING needed to use DIC'
e46e994325 Jean*0069         CALL PRINT_ERROR( msgBuf, myThid )
                0070         errCount = errCount + 1
                0071       ENDIF
                0072       IF ( useBLING ) THEN
                0073         WRITE(msgBuf,'(A)')
                0074      &       'GCHEM_SEPARATE_FORCING needed to use BLING'
                0075         CALL PRINT_ERROR( msgBuf, myThid )
                0076         errCount = errCount + 1
8d459f0cbe Jean*0077       ENDIF
                0078       IF ( useDARWIN ) THEN
e46e994325 Jean*0079         WRITE(msgBuf,'(A)')
                0080      &       'GCHEM_SEPARATE_FORCING needed to use DARWIN'
                0081         CALL PRINT_ERROR( msgBuf, myThid )
                0082         errCount = errCount + 1
8d459f0cbe Jean*0083       ENDIF
e46e994325 Jean*0084 #endif /* ndef GCHEM_SEPARATE_FORCING */
5c5997ced8 Jean*0085 
508ee73e24 Mart*0086 C     GCHEM needs passive tracer package
                0087       IF ( .NOT.usePTRACERS) THEN
8d459f0cbe Jean*0088         WRITE(msgBuf,'(A)') 'usePTRACERS has to be .TRUE. for GCHEM'
e46e994325 Jean*0089         CALL PRINT_ERROR( msgBuf, myThid )
                0090         errCount = errCount + 1
508ee73e24 Mart*0091       ENDIF
                0092 
e46e994325 Jean*0093 C     GCHEM cannot run BLING and DIC together
                0094       IF ( useBLING .AND. useDIC ) THEN
                0095         WRITE(msgBuf,'(A)')
                0096      &       'useBLING and useDIC cannot both be .TRUE.'
                0097         CALL PRINT_ERROR( msgBuf, myThid )
                0098         errCount = errCount + 1
96e2a5a610 Davi*0099       ENDIF
                0100 
e46e994325 Jean*0101 C     GCHEM cannot run BLING and DARWIN together
                0102       IF ( useBLING .AND. useDARWIN ) THEN
                0103         WRITE(msgBuf,'(A)')
                0104      &       'useBLING and useDARWIN cannot both be .TRUE.'
                0105         CALL PRINT_ERROR( msgBuf, myThid )
                0106         errCount = errCount + 1
                0107       ENDIF
                0108 
                0109 C     GCHEM cannot run DARWIN and DIC together
5dae554984 Oliv*0110       IF ( useDARWIN .AND. useDIC ) THEN
e46e994325 Jean*0111         WRITE(msgBuf,'(A)')
                0112      &       'useDARWIN and useDIC cannot both be .TRUE.'
                0113         CALL PRINT_ERROR( msgBuf, myThid )
                0114         errCount = errCount + 1
5dae554984 Oliv*0115       ENDIF
                0116 
e46e994325 Jean*0117       nb_tendTr = gchem_Tracer_num - gchem_sepFTr_num
                0118       IF ( nb_tendTr.GT.GCHEM_tendTr_num ) THEN
                0119         WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ',
                0120      &    'Number of tendency-tracers: nb_tendTr=', nb_tendTr
5dae554984 Oliv*0121         CALL PRINT_ERROR( msgBuf , myThid )
e46e994325 Jean*0122         WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ',
                0123      &    'Exceeds GCHEM_tendTr_num=', GCHEM_tendTr_num,
                0124      &    ' (from GCHEM_SIZE.h)'
                0125         CALL PRINT_ERROR( msgBuf, myThid )
                0126         errCount = errCount + 1
                0127       ENDIF
                0128       IF ( gchem_Tracer_num.GT.PTRACERS_numInUse ) THEN
                0129         WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ',
                0130      &  'Number of GCHEM tracers: gchem_Tracer_num =', gchem_Tracer_num
                0131         CALL PRINT_ERROR( msgBuf, myThid )
                0132         WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ',
                0133      &  ' exceeds number of pTr: PTRACERS_numInUse =',PTRACERS_numInUse
                0134 c    &  ' exceeds number of PTRACERS(_numInUse)=', PTRACERS_numInUse
                0135         CALL PRINT_ERROR( msgBuf, myThid )
                0136         errCount = errCount + 1
5dae554984 Oliv*0137       ENDIF
                0138 
e46e994325 Jean*0139       IF ( errCount.GE.1 ) THEN
                0140         WRITE(msgBuf,'(A,I3,A)')
75c5b64bda Jean*0141      &       'GCHEM_CHECK: detected', errCount,' fatal error(s)'
e46e994325 Jean*0142         CALL PRINT_ERROR( msgBuf, myThid )
                0143         CALL ALL_PROC_DIE( 0 )
                0144         STOP 'ABNORMAL END: S/R GCHEM_CHECK'
                0145       ENDIF
8d459f0cbe Jean*0146       _END_MASTER(myThid)
                0147 
e46e994325 Jean*0148 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0149 
                0150 C--   Check other GCHEM pkgs:
                0151 
a6c1c05757 Jean*0152 #ifdef ALLOW_CFC
e46e994325 Jean*0153 C-    run checks specific to CFC
a6c1c05757 Jean*0154       IF ( useCFC ) THEN
                0155         CALL CFC_CHECK( myThid )
                0156       ENDIF
                0157 #endif
                0158 
5dae554984 Oliv*0159 #ifdef ALLOW_DARWIN
e46e994325 Jean*0160 C-    run checks specific to darwin
5dae554984 Oliv*0161       IF ( useDARWIN ) THEN
                0162         CALL DARWIN_CHECK( myThid )
                0163       ENDIF
                0164 #endif
                0165 
e46e994325 Jean*0166       _BEGIN_MASTER(myThid)
                0167       WRITE(msgBuf,'(2A)') 'GCHEM_CHECK ',
                0168      &                     ' <-- Ends Normally'
                0169       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0170      &                    SQUEEZE_RIGHT, myThid )
                0171       WRITE(msgBuf,'(2A)') ' '
                0172       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0173      &                    SQUEEZE_RIGHT, myThid )
                0174 
                0175       _END_MASTER(myThid)
                0176 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0177 
508ee73e24 Mart*0178 #endif /* ALLOW_GCHEM */
                0179 
6b9e7a8805 Jean*0180       RETURN
                0181       END