File indexing completed on 2023-09-03 05:10:41 UTC
view on githubraw file Latest commit 74487008 on 2023-09-03 01:50:18 UTC
b862faca7c Jean*0001 #include "PTRACERS_OPTIONS.h"
46918f1b26 Jean*0002 #include "GAD_OPTIONS.h"
b862faca7c Jean*0003
0004
0005
0006
0007
0008
0009 SUBROUTINE PTRACERS_CHECK( myThid )
0010
0011
0012
0013
0014
0015
0016 IMPLICIT NONE
0017 #include "SIZE.h"
0018 #include "EEPARAMS.h"
0019 #include "PARAMS.h"
0020 #include "PTRACERS_SIZE.h"
0021 #include "PTRACERS_PARAMS.h"
0022 #include "GAD.h"
0023
0024
0025 INTEGER myThid
0026
0027
0028 #ifdef ALLOW_PTRACERS
0029
0030
0031
0032
0033 INTEGER iTracer
46918f1b26 Jean*0034 INTEGER iUnit, errCount
b862faca7c Jean*0035 CHARACTER*(MAX_LEN_MBUF) msgBuf
0036
0037
0038
0039 _BEGIN_MASTER(myThid)
46918f1b26 Jean*0040 errCount = 0
b862faca7c Jean*0041
0042 WRITE(msgBuf,'(A)') 'PTRACERS_CHECK: #define ALLOW_PTRACERS'
0043 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0044 & SQUEEZE_RIGHT, myThid )
0045
0046
0047 iUnit = standardMessageUnit
0048 WRITE(msgBuf,'(A)') '// ==================================='
0049 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
0050 WRITE(msgBuf,'(A)') '// PTRACERS parameters '
0051 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
0052 WRITE(msgBuf,'(A)') '// ==================================='
0053 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
0054 CALL WRITE_0D_I( PTRACERS_numInUse, INDEX_NONE,
0055 & 'PTRACERS_numInUse =',
0056 & ' /* number of tracers */')
0057 CALL WRITE_0D_I( PTRACERS_Iter0, INDEX_NONE,
0058 & 'PTRACERS_Iter0 =',
0059 & ' /* timestep number when tracers are initialized */')
0060 CALL WRITE_0D_L( PTRACERS_startAllTrc, INDEX_NONE,
0061 & 'PTRACERS_startAllTrc =','/* all tracers start @ startTime */')
fc10d43a89 Jean*0062 CALL WRITE_0D_L( PTRACERS_doAB_onGpTr, INDEX_NONE,
0063 & 'PTRACERS_doAB_onGpTr =',
0064 & '/* apply AB on Tendencies (rather than on Tracers) */')
b862faca7c Jean*0065 CALL WRITE_0D_L( PTRACERS_addSrelax2EmP, INDEX_NONE,
0066 & 'PTRACERS_addSrelax2EmP =','/* add Salt relaxation to EmP */')
0067 CALL WRITE_1D_RL( PTRACERS_dTLev, Nr, INDEX_K,
0068 & 'PTRACERS_dTLev =',
0069 &' /* Ptracer timestep ( s ) */')
51ed6fbf34 Jean*0070 CALL WRITE_0D_RL(PTRACERS_monitorFreq, INDEX_NONE,
0071 & 'PTRACERS_monitorFreq =',
0072 & ' /* Frequency^-1 for monitor output (s) */')
b862faca7c Jean*0073 CALL WRITE_0D_RL(PTRACERS_dumpFreq, INDEX_NONE,
0074 & 'PTRACERS_dumpFreq =',
0075 & ' /* Frequency^-1 for snapshot output (s) */')
0076 CALL WRITE_0D_RL(PTRACERS_taveFreq, INDEX_NONE,
0077 & 'PTRACERS_taveFreq =',
0078 & ' /* Frequency^-1 for time-Aver. output (s) */')
0079 CALL WRITE_0D_L( PTRACERS_useRecords, INDEX_NONE,
0080 & 'PTRACERS_useRecords =', ' /* all tracers in 1 file */')
0081
0082 CALL WRITE_0D_L( PTRACERS_timeave_mnc, INDEX_NONE,
0083 & 'PTRACERS_timeave_mnc =',
0084 & ' /* use MNC for Tave output */')
0085 CALL WRITE_0D_L( PTRACERS_snapshot_mnc, INDEX_NONE,
0086 & 'PTRACERS_snapshot_mnc =',
0087 & ' /* use MNC for snapshot output */')
0088 CALL WRITE_0D_L( PTRACERS_pickup_write_mnc, INDEX_NONE,
0089 & 'PTRACERS_pickup_write_mnc =',
0090 & ' /* use MNC for writing pickups */')
0091 CALL WRITE_0D_L( PTRACERS_pickup_read_mnc, INDEX_NONE,
0092 & 'PTRACERS_pickup_read_mnc =',
0093 & ' /* use MNC for reading pickups */')
0094
0095 DO iTracer=1,PTRACERS_numInUse
0096 WRITE(msgBuf,'(A)') ' -----------------------------------'
0097 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
0098 WRITE(msgBuf,'(A,I4)') ' tracer number : ',iTracer
0099 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
0100 CALL WRITE_0D_C( PTRACERS_names(iTracer), -1, INDEX_NONE,
0101 & 'PTRACERS_names =', ' /* Tracer short name */')
0102 CALL WRITE_0D_C( PTRACERS_long_names(iTracer), -1, INDEX_NONE,
0103 & 'PTRACERS_long_names =', ' /* Tracer long name */')
0104 CALL WRITE_0D_C( PTRACERS_ioLabel(iTracer), 0, INDEX_NONE,
0105 & 'PTRACERS_ioLabel =', ' /* tracer IO Label */')
0106 IF ( .NOT.PTRACERS_startAllTrc )
0107 & CALL WRITE_0D_RL( PTRACERS_startStepFwd(iTracer), INDEX_NONE,
0108 & 'PTRACERS_startStepFwd =', ' /* tracer starting time */')
0109 CALL WRITE_0D_I( PTRACERS_advScheme(iTracer), INDEX_NONE,
0110 & 'PTRACERS_advScheme =', ' /* Advection Scheme */')
0111 CALL WRITE_0D_L( PTRACERS_SOM_Advection(iTracer), INDEX_NONE,
0112 & 'PTRACERS_SOM_Advection =',
0113 & ' /* tracer uses SOM advection scheme */')
0114 CALL WRITE_0D_L( PTRACERS_ImplVertAdv(iTracer), INDEX_NONE,
0115 & 'PTRACERS_ImplVertAdv =',
0116 & ' /* implicit vert. advection flag */')
fc10d43a89 Jean*0117 CALL WRITE_0D_L( PTRACERS_MultiDimAdv(iTracer), INDEX_NONE,
0118 & 'PTRACERS_MultiDimAdv =',
0119 & ' /* tracer uses Multi-Dim advection */')
0120 CALL WRITE_0D_L( PTRACERS_AdamsBashGtr(iTracer), INDEX_NONE,
0121 & 'PTRACERS_AdamsBashGtr =',
0122 & ' /* apply AB on tracer tendency */')
0123 CALL WRITE_0D_L( PTRACERS_AdamsBash_Tr(iTracer), INDEX_NONE,
0124 & 'PTRACERS_AdamsBash_Tr =',
0125 & ' /* apply AB on passive tracer */')
b862faca7c Jean*0126 CALL WRITE_0D_RL( PTRACERS_diffKh(iTracer), INDEX_NONE,
0127 & 'PTRACERS_diffKh =', ' /* Laplacian Diffusivity */')
0128 CALL WRITE_0D_RL( PTRACERS_diffK4(iTracer), INDEX_NONE,
0129 & 'PTRACERS_diffK4 =', ' /* Biharmonic Diffusivity */')
0130 CALL WRITE_1D_RL( PTRACERS_diffKrNr(1,iTracer), Nr, INDEX_K,
0131 & 'PTRACERS_diffKrNr =', ' /* Vertical Diffusivity */')
0132 CALL WRITE_0D_L( PTRACERS_useGMRedi(iTracer), INDEX_NONE,
0133 & 'PTRACERS_useGMRedi =', ' /* apply GM-Redi */')
0134 CALL WRITE_0D_L( PTRACERS_useDWNSLP(iTracer), INDEX_NONE,
0135 & 'PTRACERS_useDWNSLP =', ' /* apply DOWN-SLOPE Flow */')
0136 CALL WRITE_0D_L( PTRACERS_useKPP(iTracer), INDEX_NONE,
0137 & 'PTRACERS_useKPP =', ' /* apply KPP scheme */')
46918f1b26 Jean*0138 #ifdef GAD_SMOLARKIEWICZ_HACK
0139 CALL WRITE_0D_L( PTRACERS_stayPositive(iTracer), INDEX_NONE,
0140 & 'PTRACERS_stayPositive =',
0141 & ' /* use Smolarkiewicz Hack for this tracer */')
0142 #endif
b862faca7c Jean*0143 CALL WRITE_1D_RL( PTRACERS_ref(1,iTracer), Nr, INDEX_K,
0144 & 'PTRACERS_ref =', ' /* Reference vertical profile */')
0145 CALL WRITE_0D_RL( PTRACERS_EvPrRn(iTracer), INDEX_NONE,
0146 & 'PTRACERS_EvPrRn =', '/* tracer conc. in Evap. & Rain */')
0147
0148 ENDDO
0149 WRITE(msgBuf,'(A)') ' -----------------------------------'
0150 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
0151
0152
0153
0154 IF ( PTRACERS_Iter0.GE.nEndIter ) THEN
0155 WRITE(msgBuf,'(2A)') '** WARNING ** PTRACERS_CHECK:',
0156 & ' PTRACERS_Iter0 beyond run-end (=nEndIter)'
0157 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
0158 & SQUEEZE_RIGHT, myThid )
0159 WRITE(msgBuf,'(2A)') '** WARNING ** PTRACERS_CHECK:',
0160 & ' ==> do not load initial conditions nor pickup file'
0161 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
0162 & SQUEEZE_RIGHT, myThid )
0163 ELSEIF ( PTRACERS_Iter0.GT.nIter0 ) THEN
46918f1b26 Jean*0164 WRITE(msgBuf,'(2A)') 'PTRACERS_CHECK:',
b862faca7c Jean*0165 & ' wrong setting of PTRACERS_Iter0 :'
0166 CALL PRINT_ERROR( msgBuf, myThid )
46918f1b26 Jean*0167 WRITE(msgBuf,'(2A)') 'PTRACERS_CHECK:',
b862faca7c Jean*0168 & ' nIter0 < PTRACERS_Iter0 < nEndIter not supported'
0169 CALL PRINT_ERROR( msgBuf, myThid )
46918f1b26 Jean*0170 errCount = errCount + 1
b862faca7c Jean*0171 ENDIF
0172
0173 #ifndef INCLUDE_IMPLVERTADV_CODE
0174 DO iTracer=1,PTRACERS_numInUse
0175 IF ( PTRACERS_ImplVertAdv(iTracer) ) THEN
0176 WRITE(msgBuf,'(A)')
0177 & 'PTRACERS_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
0178 CALL PRINT_ERROR( msgBuf, myThid )
46918f1b26 Jean*0179 WRITE(msgBuf,'(2A,I4,A)') 'PTRACERS_CHECK:',
b862faca7c Jean*0180 & ' but pTracers_ImplVertAdv(',iTracer,' ) is TRUE'
0181 CALL PRINT_ERROR( msgBuf, myThid )
46918f1b26 Jean*0182 errCount = errCount + 1
b862faca7c Jean*0183 ENDIF
0184 ENDDO
0185 IF ( PTRACERS_dTLev(1).NE.PTRACERS_dTLev(Nr)
0186 & .AND. implicitDiffusion ) THEN
0187 WRITE(msgBuf,'(A)')
0188 & 'PTRACERS_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
0189 CALL PRINT_ERROR( msgBuf , myThid)
0190 WRITE(msgBuf,'(2A)') 'PTRACERS_CHECK: ',
0191 & 'but implicitDiffusion=T with non-uniform PTRACERS_dTLev'
0192 CALL PRINT_ERROR( msgBuf , myThid)
46918f1b26 Jean*0193 errCount = errCount + 1
b862faca7c Jean*0194 ENDIF
0195 #endif
0196 DO iTracer=1,PTRACERS_numInUse
46918f1b26 Jean*0197 IF ( PTRACERS_useGMRedi(iTracer) .AND. .NOT.useGMRedi ) THEN
0198 WRITE(msgBuf,'(2A,I4,A)') 'PTRACERS_CHECK:',
0199 & ' pTracers_useGMRedi(',iTracer,' ) is TRUE'
0200 CALL PRINT_ERROR( msgBuf, myThid )
0201 WRITE(msgBuf,'(A,L5,A)')
0202 & 'PTRACERS_CHECK: But not useGMRedi (=',useGMRedi,')'
0203 CALL PRINT_ERROR( msgBuf, myThid )
0204 errCount = errCount + 1
0205 ENDIF
0206 IF ( PTRACERS_useDWNSLP(iTracer) .AND. .NOT.useDOWN_SLOPE ) THEN
0207 WRITE(msgBuf,'(2A,I4,A)') 'PTRACERS_CHECK:',
0208 & ' pTracers_useDWNSLP(',iTracer,' ) is TRUE'
0209 CALL PRINT_ERROR( msgBuf, myThid )
0210 WRITE(msgBuf,'(2A,L5,A)') 'PTRACERS_CHECK:',
0211 & ' But not useDOWN_SLOPE (=', useDOWN_SLOPE, ')'
0212 CALL PRINT_ERROR( msgBuf, myThid )
0213 errCount = errCount + 1
0214 ENDIF
0215 IF ( PTRACERS_useKPP(iTracer) .AND. .NOT.useKPP ) THEN
0216 WRITE(msgBuf,'(2A,I4,A)') 'PTRACERS_CHECK:',
0217 & ' pTracers_useKPP(',iTracer,' ) is TRUE'
0218 CALL PRINT_ERROR( msgBuf, myThid )
0219 WRITE(msgBuf,'(A,L5,A)')
0220 & 'PTRACERS_CHECK: But not useKPP (=',useKPP,')'
0221 CALL PRINT_ERROR( msgBuf, myThid )
0222 errCount = errCount + 1
0223 ENDIF
0224 #ifndef GAD_SMOLARKIEWICZ_HACK
0225 IF ( PTRACERS_stayPositive(iTracer) ) THEN
0226 WRITE(msgBuf,'(2A)') 'PTRACERS_CHECK:',
0227 & ' Smolarkiewicz Hack code is not compiled'
0228 CALL PRINT_ERROR( msgBuf, myThid )
0229 WRITE(msgBuf,'(2A,I4,A)') 'PTRACERS_CHECK:',
0230 & ' but needed to keep pTracer(', iTracer, ' ) positive.'
0231 CALL PRINT_ERROR( msgBuf, myThid )
0232 WRITE(msgBuf,'(2A)') 'PTRACERS_CHECK: Re-compile with: ',
0233 & ' #define GAD_SMOLARKIEWICZ_HACK in GAD_OPTIONS.h'
0234 CALL PRINT_ERROR( msgBuf , myThid)
0235 errCount = errCount + 1
0236 ENDIF
0237 #endif /* ndef GAD_SMOLARKIEWICZ_HACK */
7448700841 Mart*0238 #ifndef PTRACERS_ALLOW_DYN_STATE
0239 IF ( PTRACERS_SOM_Advection(iTracer) ) THEN
0240 WRITE(msgBuf,'(2A,I4,A)') 'PTRACERS_CHECK:',
0241 & ' PTRACERS_SOM_Advection(', iTracer, ') = T, but'
0242 CALL PRINT_ERROR( msgBuf, myThid )
0243 WRITE(msgBuf,'(3A)') 'PTRACERS_CHECK:',
0244 & ' PTRACERS_ALLOW_DYN_STATE is not defined',
0245 & ' in PTRACERS_OPTIONS.h.'
0246 CALL PRINT_ERROR( msgBuf, myThid )
0247 errCount = errCount + 1
0248 ENDIF
0249 #endif
b862faca7c Jean*0250 ENDDO
0251
46918f1b26 Jean*0252 IF ( errCount.GE.1 ) THEN
0253 WRITE(msgBuf,'(A,I5,A)')
0254 & 'PTRACERS_CHECK: detected', errCount,' fatal error(s)'
0255 CALL PRINT_ERROR( msgBuf, myThid )
0256 CALL ALL_PROC_DIE( 0 )
0257 STOP 'ABNORMAL END: S/R PTRACERS_CHECK'
0258 ENDIF
0259
b862faca7c Jean*0260 _END_MASTER(myThid)
0261
0262 _BARRIER
0263
0264 #endif /* ALLOW_PTRACERS */
0265
0266 RETURN
0267 END