File indexing completed on 2018-03-02 18:43:05 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
c3afacc940 Jean*0001 #include "RBCS_OPTIONS.h"
5a13c92ce6 Step*0002
0003
0004
0005
0006
0007 SUBROUTINE RBCS_READPARMS( myThid )
0008
0009
0010
0011
0012
0013 IMPLICIT NONE
0014 #include "SIZE.h"
0015 #include "EEPARAMS.h"
0016 #include "PARAMS.h"
0017 #ifdef ALLOW_PTRACERS
0018 #include "PTRACERS_SIZE.h"
0019 #endif
a16c4403c6 Jean*0020 #include "RBCS_SIZE.h"
0021 #include "RBCS_PARAMS.h"
5a13c92ce6 Step*0022
0023
a16c4403c6 Jean*0024
5a13c92ce6 Step*0025 INTEGER myThid
0026
0027
0028
0029
0030 #ifdef ALLOW_RBCS
0031
0032
c3afacc940 Jean*0033
0034
5e2b20d683 Jean*0035
0036
5a13c92ce6 Step*0037 CHARACTER*(MAX_LEN_MBUF) msgBuf
0038 INTEGER iUnit
5e2b20d683 Jean*0039 INTEGER irbc, errCount
0040 INTEGER locSize
c3afacc940 Jean*0041 #ifdef ALLOW_PTRACERS
0042 INTEGER iTracer
5e2b20d683 Jean*0043 PARAMETER( locSize = 10+PTRACERS_num )
0044 #else
0045 PARAMETER( locSize = 4 )
c3afacc940 Jean*0046 #endif
5e2b20d683 Jean*0047 CHARACTER*(MAX_LEN_FNAM) relaxMaskFile(locSize)
c3afacc940 Jean*0048
0049 LOGICAL useRBCptracers
27afb9cdd5 Jean*0050 INTEGER rbcsIniter
5a13c92ce6 Step*0051
0052
a16c4403c6 Jean*0053
5a13c92ce6 Step*0054 NAMELIST /RBCS_PARM01/
a16c4403c6 Jean*0055 & tauRelaxU,
0056 & tauRelaxV,
1830fa7b80 Step*0057 & tauRelaxT,
0058 & tauRelaxS,
a16c4403c6 Jean*0059 & relaxMaskUFile,
0060 & relaxMaskVFile,
1830fa7b80 Step*0061 & relaxMaskFile,
5d32982e3e Jean*0062 & relaxUFile,
0063 & relaxVFile,
5a13c92ce6 Step*0064 & relaxTFile,
0065 & relaxSFile,
a16c4403c6 Jean*0066 & useRBCuVel,
0067 & useRBCvVel,
5a13c92ce6 Step*0068 & useRBCtemp,
0069 & useRBCsalt,
0070 & useRBCptracers,
0071 & rbcsIniter,
0072 & rbcsForcingPeriod,
fb7cd45a1a Oliv*0073 & rbcsForcingCycle,
0074 & rbcsForcingOffset,
880a0c1fb9 Gael*0075 & rbcsVanishingTime,
fb7cd45a1a Oliv*0076 & rbcsSingleTimeFiles,
0077 & deltaTrbcs,
0078 & rbcsIter0
5a13c92ce6 Step*0079
0080 #ifdef ALLOW_PTRACERS
0081 NAMELIST /RBCS_PARM02/
27afb9cdd5 Jean*0082 & useRBCpTrNum, tauRelaxPTR,
5a13c92ce6 Step*0083 & relaxPtracerFile
0084 #endif
0085
c3afacc940 Jean*0086
0087
ae4c29e0db Jean*0088 IF ( .NOT.useRBCS ) THEN
0089
0090 _BEGIN_MASTER(myThid)
0091
0092
0093 CALL PACKAGES_UNUSED_MSG( 'useRBCS', ' ', ' ' )
0094 _END_MASTER(myThid)
0095 RETURN
0096 ENDIF
0097
c3afacc940 Jean*0098 _BEGIN_MASTER(myThid)
0099
5a13c92ce6 Step*0100
a16c4403c6 Jean*0101 useRBCuVel =.FALSE.
0102 useRBCvVel =.FALSE.
c3afacc940 Jean*0103 useRBCtemp =.FALSE.
0104 useRBCsalt =.FALSE.
a16c4403c6 Jean*0105 tauRelaxU = 0.
0106 tauRelaxV = 0.
c3afacc940 Jean*0107 tauRelaxT = 0.
0108 tauRelaxS = 0.
a16c4403c6 Jean*0109 relaxMaskUFile = ' '
0110 relaxMaskVFile = ' '
5e2b20d683 Jean*0111 DO irbc=1,locSize
1830fa7b80 Step*0112 relaxMaskFile(irbc) = ' '
c3afacc940 Jean*0113 ENDDO
a16c4403c6 Jean*0114 relaxUFile = ' '
0115 relaxVFile = ' '
5a13c92ce6 Step*0116 relaxTFile = ' '
0117 relaxSFile = ' '
fb7cd45a1a Oliv*0118 rbcsIniter = 0
c3afacc940 Jean*0119 rbcsForcingPeriod = 0. _d 0
0120 rbcsForcingCycle = 0. _d 0
fb7cd45a1a Oliv*0121 rbcsForcingOffset = 0. _d 0
880a0c1fb9 Gael*0122 rbcsVanishingTime = 0. _d 0
fb7cd45a1a Oliv*0123 rbcsSingleTimeFiles = .FALSE.
0124 deltaTrbcs = deltaTclock
0125 rbcsIter0 = 0
5a13c92ce6 Step*0126 #ifdef ALLOW_PTRACERS
0127 DO iTracer=1,PTRACERS_num
27afb9cdd5 Jean*0128 useRBCpTrNum(iTracer)=.FALSE.
c3afacc940 Jean*0129 tauRelaxPTR(iTracer) = 0.
0130 relaxPtracerFile(iTracer) = ' '
5a13c92ce6 Step*0131 ENDDO
0132 #endif
c3afacc940 Jean*0133 useRBCptracers=.FALSE.
5a13c92ce6 Step*0134
a16c4403c6 Jean*0135
c3afacc940 Jean*0136
5a13c92ce6 Step*0137 WRITE(msgBuf,'(A)') ' RBCS_READPARMS: opening data.rbcs'
0138 CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
0139 & SQUEEZE_RIGHT , 1)
0140 CALL OPEN_COPY_DATA_FILE(
a70bcb5316 Dimi*0141 I 'data.rbcs', 'RBCS_READPARMS',
5a13c92ce6 Step*0142 O iUnit,
0143 I myThid )
0144 READ(UNIT=iUnit,NML=RBCS_PARM01)
0145 #ifdef ALLOW_PTRACERS
0146 READ(UNIT=iUnit,NML=RBCS_PARM02)
0147 #endif
0148 WRITE(msgBuf,'(A)')
0149 & ' RBCS_READPARMS: finished reading data.rbcs'
0150 CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
0151 & SQUEEZE_RIGHT , 1)
0152
a16c4403c6 Jean*0153
7a77863887 Mart*0154 #ifdef SINGLE_DISK_IO
5a13c92ce6 Step*0155 CLOSE(iUnit)
7a77863887 Mart*0156 #else
0157 CLOSE(iUnit,STATUS='DELETE')
0158 #endif /* SINGLE_DISK_IO */
5a13c92ce6 Step*0159
5e2b20d683 Jean*0160
0161 DO irbc=1,maskLEN
0162 relaxMaskTrFile(irbc) = ' '
0163 ENDDO
0164 errCount = 0
0165 DO irbc=1,locSize
0166 IF ( irbc.LE.maskLEN ) THEN
0167 relaxMaskTrFile(irbc) = relaxMaskFile(irbc)
0168 ELSEIF ( relaxMaskFile(irbc).NE.' ' ) THEN
0169 errCount = errCount + 1
0170 ENDIF
0171 ENDDO
0172 IF ( errCount.GT.0 ) THEN
0173 WRITE(msgBuf,'(2A,I6)')' RBCS_READPARAMS: ',
0174 & 'Too many "relaxMaskFile" are set ! exceeds maskLEN=', maskLEN
0175 CALL PRINT_ERROR( msgBuf, myThid )
0176 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0177 & '==> Increase maskLEN (in RBCS_SIZE.h) and recompile'
0178 CALL PRINT_ERROR( msgBuf, myThid )
0179 ENDIF
0180
a16c4403c6 Jean*0181
0182 #ifdef DISABLE_RBCS_MOM
0183 IF ( useRBCuVel .OR. useRBCvVel ) THEN
0184 WRITE(msgBuf,'(2A,2(L2,A))') 'RBCS_READPARMS: ',
0185 & 'cannot use RBC for U,V (useRBCuVel=',useRBCuVel,
0186 & ', useRBCvVel=',useRBCvVel,')'
0187 CALL PRINT_ERROR( msgBuf, myThid )
0188 WRITE(msgBuf,'(2A)') 'RBCS_READPARMS: ',
0189 & 'when DISABLE_RBCS_MOM is defined (in RBCS_OPTIONS.h)'
0190 CALL PRINT_ERROR( msgBuf, myThid )
0191 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0192 ENDIF
0193 #endif /* DISABLE_RBCS_MOM */
fb7cd45a1a Oliv*0194 IF (rbcsIniter.NE.0) THEN
0195 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0196 & 'rbcsIniter has been replaced by rbcsForcingOffset '
0197 CALL PRINT_ERROR( msgBuf, myThid )
0198 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0199 & 'which is in seconds. Please change your data.rbcs'
0200 CALL PRINT_ERROR( msgBuf, myThid )
0201 STOP 'ABNORMAL END: S/R RBCS_READPARAMS'
0202 ENDIF
0203 IF (startTime.LT.rbcsForcingOffset+0.5*rbcsForcingPeriod .AND.
0204 & .NOT. rbcsSingleTimeFiles) THEN
0205 IF (rbcsForcingCycle.GT.0) THEN
0206 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0207 & 'startTime before rbcsForcingOffset+0.5*rbcsForcingPeriod '
0208 CALL PRINT_ERROR( msgBuf, myThid )
0209 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0210 & 'will use last record'
0211 CALL PRINT_ERROR( msgBuf, myThid )
0212 ELSE
0213 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0214 & 'startTime before rbcsForcingOffset+0.5*rbcsForcingPeriod '
0215 CALL PRINT_ERROR( msgBuf, myThid )
0216 WRITE(msgBuf,'(2A)')' RBCS_READPARAMS: ',
0217 & 'not allowed with rbcsForcingCycle=0 unless rbcsSingleTimeFiles'
0218 CALL PRINT_ERROR( msgBuf, myThid )
0219 STOP 'ABNORMAL END: S/R RBCS_READPARAMS'
0220 ENDIF
0221 ENDIF
a16c4403c6 Jean*0222 IF ( useRBCuVel .AND. tauRelaxU.LE.0. ) THEN
0223 WRITE(msgBuf,'(2A)') 'RBCS_READPARMS: ',
0224 & 'tauRelaxU cannot be zero with useRBCuVel'
0225 CALL PRINT_ERROR( msgBuf, myThid )
0226 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0227 ENDIF
0228 IF ( useRBCvVel .AND. tauRelaxV.LE.0. ) THEN
0229 WRITE(msgBuf,'(2A)') 'RBCS_READPARMS: ',
0230 & 'tauRelaxV cannot be zero with useRBCvVel'
0231 CALL PRINT_ERROR( msgBuf, myThid )
0232 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0233 ENDIF
c3afacc940 Jean*0234 IF ( useRBCtemp .AND. tauRelaxT.LE.0. ) THEN
0235 WRITE(msgBuf,'(2A)') 'RBCS_READPARMS: ',
0236 & 'tauRelaxT cannot be zero with useRBCtemp'
0237 CALL PRINT_ERROR( msgBuf, myThid )
0238 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0239 ENDIF
0240 IF ( useRBCsalt .AND. tauRelaxS.LE.0. ) THEN
0241 WRITE(msgBuf,'(2A)') 'RBCS_READPARMS: ',
0242 & 'tauRelaxS cannot be zero with useRBCsalt'
0243 CALL PRINT_ERROR( msgBuf, myThid )
0244 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0245 ENDIF
0246 #ifdef ALLOW_PTRACERS
0247 DO iTracer=1,PTRACERS_num
27afb9cdd5 Jean*0248 IF ( useRBCpTrNum(iTracer) ) THEN
c3afacc940 Jean*0249 IF ( .NOT.usePTRACERS ) THEN
0250 WRITE(msgBuf,'(2A,I6,A)') 'RBCS_READPARMS: ',
0251 & 'usePTRACERS=F => cannot use RBCS for tracer:', iTracer
0252 CALL PRINT_ERROR( msgBuf, myThid )
0253 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0254 ENDIF
0255
0256
0257
0258 IF ( tauRelaxPTR(iTracer).LE.0. ) THEN
0259 WRITE(msgBuf,'(2A,I6,A)') 'RBCS_READPARMS: ',
0260 & 'tauRelaxPTR(itr=', iTracer, ' ) = 0. is'
0261 CALL PRINT_ERROR( msgBuf, myThid )
0262 WRITE(msgBuf,'(2A,I6,A)') 'RBCS_READPARMS: ',
0263 & 'not allowed with useRBCptr(itr)=T'
0264 CALL PRINT_ERROR( msgBuf, myThid )
0265 STOP 'ABNORMAL END: S/R RBCS_READPARMS'
0266 ENDIF
0267 ENDIF
0268 ENDDO
0269 #endif
5a13c92ce6 Step*0270 _END_MASTER(myThid)
0271
0272
0273 _BARRIER
0274
0275 #endif /* ALLOW_RBCS */
0276
0277 RETURN
0278 END