File indexing completed on 2024-08-30 05:10:51 UTC
view on githubraw file Latest commit ae2be615 on 2024-08-29 19:00:27 UTC
7f407c2fb7 Davi*0001 #include "DIC_OPTIONS.h"
0002
51e381e9c9 Jean*0003
0004
0005
7f407c2fb7 Davi*0006
51e381e9c9 Jean*0007
0008 SUBROUTINE DIC_READ_PICKUP( myIter, myThid )
0009
0010
0011
0012
0013
7f407c2fb7 Davi*0014 IMPLICIT NONE
51e381e9c9 Jean*0015
7f407c2fb7 Davi*0016 #include "SIZE.h"
0017 #include "EEPARAMS.h"
0018 #include "PARAMS.h"
2ef8966791 Davi*0019 #include "DIC_VARS.h"
7f407c2fb7 Davi*0020
51e381e9c9 Jean*0021
0022
0023
7f407c2fb7 Davi*0024 INTEGER myIter
0025 INTEGER myThid
0026
0027 #ifdef ALLOW_DIC
0028 #ifdef DIC_BIOTIC
51e381e9c9 Jean*0029
0030 INTEGER ILNBLNK
0031 EXTERNAL ILNBLNK
d800a455f8 Jean*0032
7f407c2fb7 Davi*0033
51e381e9c9 Jean*0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 INTEGER fp
0046 INTEGER filePrec, nbFields
0047 INTEGER missFldDim, nMissing
0048 INTEGER j, nj, ioUnit
0049 PARAMETER( missFldDim = 12 )
df5a9764ba Jean*0050 CHARACTER*(10) suff
51e381e9c9 Jean*0051 CHARACTER*(MAX_LEN_FNAM) fn
0052 CHARACTER*(8) missFldList(missFldDim)
d800a455f8 Jean*0053 CHARACTER*(MAX_LEN_MBUF) msgBuf
51e381e9c9 Jean*0054 CHARACTER*(MAX_LEN_FNAM) tmpNam
0055
0056
0057 LOGICAL useCurrentDir, fileExist, StopFlag
0058 INTEGER iL
7f407c2fb7 Davi*0059
0060
51e381e9c9 Jean*0061
d800a455f8 Jean*0062
51e381e9c9 Jean*0063 IF ( pickupSuff.EQ.' ' ) THEN
df5a9764ba Jean*0064 IF ( rwSuffixType.EQ.0 ) THEN
0065 WRITE(fn,'(A,I10.10)') 'pickup_dic.', myIter
0066 ELSE
0067 CALL RW_GET_SUFFIX( suff, startTime, myIter, myThid )
0068 WRITE(fn,'(A,A)') 'pickup_dic.', suff
0069 ENDIF
51e381e9c9 Jean*0070 ELSE
d800a455f8 Jean*0071 WRITE(fn,'(A,A10)') 'pickup_dic.', pickupSuff
51e381e9c9 Jean*0072 ENDIF
0073 fp = precFloat64
7f407c2fb7 Davi*0074
51e381e9c9 Jean*0075 CALL READ_MFLDS_SET(
0076 I fn,
0077 O nbFields, filePrec,
0078 I Nr, myIter, myThid )
0079 _BEGIN_MASTER( myThid )
0080
0081 IF ( nbFields.GE.0 .AND. filePrec.NE.fp ) THEN
0082 WRITE(msgBuf,'(2A,I4)') 'DIC_READ_PICKUP: ',
0083 & 'pickup-file binary precision do not match !'
0084 CALL PRINT_ERROR( msgBuf, myThid )
0085 WRITE(msgBuf,'(A,2(A,I4))') 'DIC_READ_PICKUP: ',
0086 & 'file prec.=', filePrec, ' but expecting prec.=', fp
0087 CALL PRINT_ERROR( msgBuf, myThid )
0088 CALL ALL_PROC_DIE( 0 )
0089 STOP 'ABNORMAL END: S/R DIC_READ_PICKUP (data-prec Pb)'
0090 ENDIF
0091 _END_MASTER( myThid )
0092
0093 ioUnit = errorMessageUnit
0094 StopFlag = .FALSE.
0095 IF ( nbFields.LE.0 ) THEN
0096
0097 IF ( pickupStrictlyMatch ) THEN
0098 WRITE(msgBuf,'(4A)') 'DIC_READ_PICKUP: ',
0099 & 'no field-list found in meta-file',
0100 & ' => cannot check for strick-matching'
0101 CALL PRINT_ERROR( msgBuf, myThid )
0102 WRITE(msgBuf,'(4A)') 'DIC_READ_PICKUP: ',
0103 & 'try with " pickupStrictlyMatch=.FALSE.,"',
0104 & ' in file: "data", NameList: "PARM03"'
0105 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0106 StopFlag = .TRUE.
0107 ELSE
0108 WRITE(msgBuf,'(4A)') 'WARNING >> DIC_READ_PICKUP: ',
0109 & ' no field-list found'
0110 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0111 IF ( nbFields.EQ.-1 ) THEN
0112
c8b148d42e Jean*0113 #ifdef ALLOW_MDSIO
51e381e9c9 Jean*0114 useCurrentDir = .FALSE.
0115 CALL MDS_CHECK4FILE(
4aace458cd Jean*0116 I fn, '.data', 'DIC_READ_PICKUP',
51e381e9c9 Jean*0117 O tmpNam, fileExist,
c8b148d42e Jean*0118 I useCurrentDir, myThid )
0119 #else
51e381e9c9 Jean*0120 STOP 'ABNORMAL END: S/R DIC_READ_PICKUP: Needs MDSIO pkg'
c8b148d42e Jean*0121 #endif
51e381e9c9 Jean*0122 IF ( fileExist ) THEN
0123 WRITE(msgBuf,'(4A)') 'WARNING >> ',
0124 & ' try to read pickup as currently written'
0125 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0126 ELSE
0127 iL = ILNBLNK(fn)
0128 WRITE(msgBuf,'(4A)') 'DIC_READ_PICKUP: ',
0129 & 'missing both "meta" & "data" files for "', fn(1:iL), '"'
0130 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0131 nbFields = -2
0132 ENDIF
0133 ELSE
0134
0135
0136
0137
0138
0139
0140
0141 WRITE(msgBuf,'(4A)') 'DIC_READ_PICKUP: ',
0142 & 'no field-list found in meta-file'
0143 CALL PRINT_ERROR( msgBuf, myThid )
0144 StopFlag = .TRUE.
0145 ENDIF
0146 ENDIF
0147 ENDIF
0148 IF ( StopFlag ) THEN
0149 CALL ALL_PROC_DIE( myThid )
0150 STOP 'ABNORMAL END: S/R DIC_READ_PICKUP'
0151 ENDIF
d800a455f8 Jean*0152
51e381e9c9 Jean*0153
d800a455f8 Jean*0154
51e381e9c9 Jean*0155 IF ( nbFields.EQ.0 ) THEN
0156
0157
0158 ELSEIF ( nbFields.NE.-2 ) THEN
0159
0160 nj = 0
0161
0162 #ifdef DIC_CALCITE_SAT
0163 IF ( useCalciteSaturation ) THEN
ae2be6150b Jona*0164 CALL READ_MFLDS_3D_RL( 'DIC_pH3d', pH3D,
0165 & nj, fp, Nr, myIter, myThid )
0166 _BEGIN_MASTER( myThid )
0167 pH_isLoaded(2) = .TRUE.
0168 _END_MASTER( myThid )
51e381e9c9 Jean*0169 ENDIF
0170 #endif
0171
0172
0173 nj = nj*Nr
0174
0175 CALL READ_MFLDS_3D_RL( 'DIC_pH2d', pH,
0176 & nj, fp, 1 , myIter, myThid )
0177 _BEGIN_MASTER( myThid )
0178 pH_isLoaded(1) = .TRUE.
0179 _END_MASTER( myThid )
0180
0181
0182 ENDIF
0183
0184
0185 nMissing = missFldDim
0186 CALL READ_MFLDS_CHECK(
0187 O missFldList,
0188 U nMissing,
0189 I myIter, myThid )
0190 IF ( nMissing.GT.missFldDim ) THEN
0191 WRITE(msgBuf,'(2A,I4)') 'DIC_READ_PICKUP: ',
0192 & 'missing fields list has been truncated to', missFldDim
0193 CALL PRINT_ERROR( msgBuf, myThid )
0194 CALL ALL_PROC_DIE( myThid )
0195 STOP 'ABNORMAL END: S/R DIC_READ_PICKUP (list-size Pb)'
0196 ENDIF
0197 IF ( nMissing.GE.1 ) THEN
0198 DO j=1,nMissing
0199 IF ( missFldList(nj) .EQ. 'DIC_pH2d' ) THEN
0200 _BEGIN_MASTER( myThid )
0201 pH_isLoaded(1) = .FALSE.
0202 _END_MASTER( myThid )
0203 ELSEIF ( missFldList(nj) .EQ. 'DIC_pH3d' ) THEN
0204 _BEGIN_MASTER( myThid )
0205 pH_isLoaded(2) = .FALSE.
0206 _END_MASTER( myThid )
0207 ELSE
0208 StopFlag = .TRUE.
0209 WRITE(msgBuf,'(4A)') 'DIC_READ_PICKUP: ',
0210 & 'cannot restart without field "',missFldList(nj),'"'
0211 CALL PRINT_ERROR( msgBuf, myThid )
0212 ENDIF
0213 ENDDO
0214 IF ( pickupStrictlyMatch .AND. .NOT.StopFlag ) THEN
0215 StopFlag = .TRUE.
d800a455f8 Jean*0216 WRITE(msgBuf,'(4A)') 'DIC_READ_PICKUP: ',
0217 & 'try with " pickupStrictlyMatch=.FALSE.,"',
0218 & ' in file: "data", NameList: "PARM03"'
51e381e9c9 Jean*0219 CALL PRINT_ERROR( msgBuf, myThid )
d800a455f8 Jean*0220 ENDIF
51e381e9c9 Jean*0221 ENDIF
0222 IF ( StopFlag ) THEN
0223 CALL ALL_PROC_DIE( myThid )
0224 STOP 'ABNORMAL END: S/R DIC_READ_PICKUP'
0225 ENDIF
0226
0227 _BEGIN_MASTER( myThid )
0228 IF ( .NOT.pH_isLoaded(1) ) THEN
0229 WRITE(msgBuf,'(2A)') 'WARNING >> DIC_READ_PICKUP: ',
0230 & 'will restart from approximated 2-D pH'
0231 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0232 ENDIF
0233 IF ( useCalciteSaturation .AND. .NOT.pH_isLoaded(2) ) THEN
0234 WRITE(msgBuf,'(2A)') 'WARNING >> DIC_READ_PICKUP: ',
0235 & 'will restart from approximated 3-D pH'
0236
0237 ENDIF
0238 _END_MASTER( myThid )
0239
0240
0241 CALL EXCH_XY_RL( pH, myThid )
0242 #ifdef DIC_CALCITE_SAT
0243 IF ( useCalciteSaturation ) THEN
0244
0245 ENDIF
0246 #endif
7f407c2fb7 Davi*0247
51e381e9c9 Jean*0248 #endif /* DIC_BIOTIC */
0249 #endif /* ALLOW_DIC */
7f407c2fb7 Davi*0250
0251 RETURN
0252 END